Skip to content

Commit

Permalink
daemon: Install dring to libexec and edit templates at install time.
Browse files Browse the repository at this point in the history
Executables are typically installed under bin/, sbin/ or libexec,
rather than lib/.  The problem was noticed when trying to use Jami
with a Guix relocatable pack, which only wraps executables found under
the above locations.  Since dring is a daemon and should not be run
directly by users under normal circumstances, the convention is to use
the libexec directory, according to the File Hierchy Standard 3.0.

Also tackled in this change is the substitution of the Autoconf
variables at installation time rather than configuration time, as per
the GNU Coding Standards.  The following solution is taken from
https://github.com/gentoo/eudev/pull/183/commits, which in turn is
adapted from the Autoconf manual (c.f.: info "(autoconf)Installation
Directory Variables").

* bin/Makefile.am (ringlibdir): Delete variable.
* bin/dbus/Makefile.am (do_subst): New variable.
(cx.ring.Ring.service): Derive from the cx.ring.Ring.service.in
template.
[HAVE_WIN32]: (ringlib_PROGRAMS): Rename to ...
(bin_PROGRAMS): ... this.
[HAVE_OSX, RING_DBUS]: Likewise.
* bin/dbus/cx.ring.Ring.service.in (Exec): Adust.
* globals.mk (ringlibdir): Delete variable.
* configure.ac [with_dbus] <AC_CONFIG_FILES>: Remove
bin/dbus/cx.ring.Ring.service.  Also remove the LIBDIR variable, no
longer used.  Fix indentation.

Thanks to Vladimir Stoiakin for providing feedback on this change.

Change-Id: I845bf2bd590a9457e70ca173027217b8f164d713
  • Loading branch information
Maxim Cournoyer committed Jun 22, 2021
1 parent 4bb6741 commit 2afa99f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
8 changes: 3 additions & 5 deletions bin/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
ringlibdir = $(libdir)/ring

if HAVE_WIN32
ringlib_PROGRAMS = ringcli
libexec_PROGRAMS = ringcli
ringcli_SOURCES = winmain.cpp
ringcli_CXXFLAGS = -I$(top_srcdir)/src \
-I$(top_srcdir)/src/dring \
Expand All @@ -11,7 +9,7 @@ ringcli_LDADD = $(top_builddir)/src/libring.la
endif

if HAVE_OSX
ringlib_PROGRAMS = ringcli
libexec_PROGRAMS = ringcli
ringcli_SOURCES = osxmain.cpp
ringcli_CXXFLAGS = -I$(top_srcdir)/src \
-I$(top_srcdir)/src/dring \
Expand All @@ -25,7 +23,7 @@ SUBDIRS=
if RING_DBUS
SUBDIRS+=dbus

ringlib_PROGRAMS = dring
libexec_PROGRAMS = dring

dring_SOURCES = main.cpp

Expand Down
6 changes: 6 additions & 0 deletions bin/dbus/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ libclient_dbus_la_CXXFLAGS = -I../ \
-DPROGSHAREDIR=\"${datadir}/ring\" \
$(DBUSCPP_CFLAGS)

do_subst = $(SED) \
-e 's,[@]bindir[@],$(bindir),g'

cx.ring.Ring.service: cx.ring.Ring.service.in Makefile
$(do_subst) < $< > $@

# Dbus service file
servicedir = $(datadir)/dbus-1/services
service_DATA = cx.ring.Ring.service
Expand Down
2 changes: 1 addition & 1 deletion bin/dbus/cx.ring.Ring.service.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=cx.ring.Ring
Exec=@LIBDIR@/ring/dring
Exec=@libexec@/dring
27 changes: 12 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -381,24 +381,21 @@ AC_ARG_WITH([dbus],
[AS_HELP_STRING([--without-dbus], [disable support for dbus])],
[],
[with_dbus=yes])
AS_IF([test "x$with_dbus" = "xyes"], [
PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,,
AC_MSG_WARN([Missing dbus development files]))
AS_IF([test "x$with_dbus" = "xyes"],
[PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,,
AC_MSG_WARN([Missing dbus development files]))
AS_AC_EXPAND(LIBDIR, $libdir)
AC_SUBST(LIBDIR)
AC_CONFIG_FILES([bin/dbus/Makefile])
AC_CONFIG_FILES([bin/dbus/Makefile
bin/dbus/cx.ring.Ring.service])
AC_PATH_PROG([DBUSXX_XML2CPP], dbusxx-xml2cpp,
[AC_MSG_ERROR([dbusxx-xml2cpp not found])])
AC_PATH_PROG([DBUSXX_XML2CPP], dbusxx-xml2cpp,
[AC_MSG_ERROR([dbusxx-xml2cpp not found])])
AS_IF([test "x$CLANG" = "xyes"],
[AC_MSG_ERROR([dbus does not compile when clang is used,
rerun with --without-dbus])]);
AM_CONDITIONAL(RING_DBUS, true)],TESTS= $(check_PROGRAMS)
AM_CONDITIONAL(RING_DBUS, false));
AS_IF([test "x$CLANG" = "xyes"],
[AC_MSG_ERROR([dbus does not compile when clang is used,
rerun with --without-dbus])]);
AM_CONDITIONAL(RING_DBUS, true)],
[TESTS= $(check_PROGRAMS)
AM_CONDITIONAL(RING_DBUS, false)]);

dnl name service is default-enabled
AC_ARG_ENABLE([ringns], AS_HELP_STRING([--disable-ringns],
Expand Down
1 change: 0 additions & 1 deletion globals.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Global variables

src=$(abs_top_srcdir)
ringlibdir=$(DESTDIR)$(libdir)/ring

ASTYLERC="$(top_srcdir)/../astylerc"
indent="/usr/bin/astyle"
Expand Down

0 comments on commit 2afa99f

Please sign in to comment.