From 4ef8c8a39392c25ae3fc5ac59583fb3361cf5663 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 19 Aug 2015 22:27:38 +0200 Subject: [PATCH 1/1] Play better with non-FHS distros * Makefile.am: Remove rootprefix, rootbindir, and rootlibexecdir. udevrulesdir is substed from configure.ac. Adapt distcheck. * autogen.sh: Make more normal. * configure.ac: Add --with-udevrulesdir. Remove --with-rootprefix. Detect bin dir for udev. --- Makefile.am | 59 +++++++------------------------------- autogen.sh | 51 -------------------------------- configure.ac | 13 +++++---- src/login/71-seat.rules.in | 4 +-- 4 files changed, 19 insertions(+), 108 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1f830c032..8012620fd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -55,18 +55,15 @@ zshcompletiondir=@zshcompletiondir@ varlogdir=$(localstatedir)/log elogindstatedir=$(localstatedir)/lib/elogind +udevrulesdir=@udevrulesdir@ +udevbindir=@udevbindir@ + # Our own, non-special dirs pkgsysconfdir=$(sysconfdir)/elogind pkgincludedir=$(includedir)/elogind -udevrulesdir=$(rootprefix)/lib/udev/rules.d factory_etcdir = $(prefix)/share/factory/etc factory_pamdir = $(prefix)/share/factory/etc/pam.d -# And these are the special ones for / -rootprefix=@rootprefix@ -rootbindir=$(rootprefix)/bin -rootlibexecdir=$(rootprefix)/lib/elogind - EXTRA_DIST = BUILT_SOURCES = INSTALL_EXEC_HOOKS = @@ -130,8 +127,6 @@ AM_CPPFLAGS = \ -DPOLKIT_AGENT_BINARY_PATH=\"$(bindir)/pkttyagent\" \ -DKEXEC=\"$(KEXEC)\" \ -DLIBDIR=\"$(libdir)\" \ - -DROOTLIBDIR=\"$(rootlibdir)\" \ - -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \ -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ -I $(top_srcdir)/src \ -I $(top_builddir)/src/shared \ @@ -148,18 +143,6 @@ AM_CFLAGS = $(OUR_CFLAGS) AM_LDFLAGS = $(OUR_LDFLAGS) # ------------------------------------------------------------------------------ -define move-to-rootlibdir - if test "$(libdir)" != "$(rootlibdir)"; then \ - $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \ - so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \ - rm -f $(DESTDIR)$(libdir)/$$libname && \ - $(LN_S) --relative -f $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \ - mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \ - fi -endef - -INSTALL_DIRS = - SHUTDOWN_TARGET_WANTS = LOCAL_FS_TARGET_WANTS = MULTI_USER_TARGET_WANTS = @@ -203,9 +186,6 @@ define add-wants for i in $$what; do $(LN_S) ../$$i . || exit $$? ; done ) endef -install-directories-hook: - $(MKDIR_P) $(addprefix $(DESTDIR),$(INSTALL_DIRS)) - install-aliases-hook: set -- $(GENERAL_ALIASES) && \ dir= && $(install-relative-aliases) @@ -233,7 +213,6 @@ install-touch-usr-hook: INSTALL_EXEC_HOOKS += \ install-target-wants-hook \ - install-directories-hook \ install-aliases-hook \ install-touch-usr-hook @@ -264,9 +243,8 @@ AM_V_RM_ = $(AM_V_RM_$(AM_DEFAULT_VERBOSITY)) AM_V_RM_0 = @echo " RM " $@; # ------------------------------------------------------------------------------ -rootbin_PROGRAMS = bin_PROGRAMS = -rootlibexec_PROGRAMS = +pkglibexec_PROGRAMS = dist_bashcompletion_DATA = dist_zshcompletion_DATA = @@ -733,15 +711,6 @@ libelogind_la_LDFLAGS = \ libelogind_la_LIBADD = \ libelogind-internal.la -libelogind-install-hook: - libname=libelogind.so && $(move-to-rootlibdir) - -libelogind-uninstall-hook: - rm -f $(DESTDIR)$(rootlibdir)/libelogind.so* - -INSTALL_EXEC_HOOKS += libelogind-install-hook -UNINSTALL_EXEC_HOOKS += libelogind-uninstall-hook - pkgconfiglib_DATA += \ src/libelogind/libelogind.pc @@ -814,8 +783,7 @@ endif noinst_LTLIBRARIES += \ libelogind-core.la -rootlibexec_PROGRAMS += \ - elogind +pkglibexec_PROGRAMS += elogind loginctl_SOURCES = \ src/login/loginctl.c \ @@ -827,7 +795,7 @@ loginctl_LDADD = \ libelogind-internal.la \ libelogind-shared.la -rootbin_PROGRAMS += \ +bin_PROGRAMS += \ loginctl dist_bashcompletion_DATA += \ @@ -843,7 +811,7 @@ systemd_inhibit_LDADD = \ libelogind-internal.la \ libelogind-shared.la -rootbin_PROGRAMS += \ +bin_PROGRAMS += \ systemd-inhibit test_login_SOURCES = \ @@ -924,9 +892,6 @@ dist_pkgsysconf_DATA += \ polkitpolicy_files += \ src/login/org.freedesktop.login1.policy -INSTALL_DIRS += \ - $(elogindstatedir) - SYSTEM_UNIT_ALIASES += \ elogind.service dbus-org.freedesktop.login1.service @@ -950,12 +915,10 @@ EXTRA_DIST += \ # ------------------------------------------------------------------------------ substitutions = \ - '|rootlibexecdir=$(rootlibexecdir)|' \ - '|rootbindir=$(rootbindir)|' \ '|bindir=$(bindir)|' \ + '|udevbindir=$(udevbindir)|' \ '|pkgsysconfdir=$(pkgsysconfdir)|' \ '|pkgdatadir=$(pkgdatadir)|' \ - '|udevrulesdir=$(udevrulesdir)|' \ '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \ '|PACKAGE_NAME=$(PACKAGE_NAME)|' \ '|PACKAGE_URL=$(PACKAGE_URL)|' \ @@ -966,7 +929,6 @@ substitutions = \ '|VERSION=$(VERSION)|' \ '|rootprefix=$(rootprefix)|' \ '|MKDIR_P=$(MKDIR_P)|' \ - '|VARLOGDIR=$(varlogdir)|' \ '|systemuidmax=$(SYSTEM_UID_MAX)|' \ '|systemgidmax=$(SYSTEM_GID_MAX)|' @@ -1115,9 +1077,8 @@ DISTCHECK_CONFIGURE_FLAGS = \ --with-zshcompletiondir=$$dc_install_base/$(zshcompletiondir) \ --with-pamlibdir=$$dc_install_base/$(pamlibdir) \ --with-pamconfdir=$$dc_install_base/$(pamconfdir) \ - --with-rootprefix=$$dc_install_base \ - --disable-split-usr \ - --enable-kdbus + --enable-kdbus \ + --with-udevrulesdir=$$dc_install_base/$(udevrulesdir) if ENABLE_GTK_DOC DISTCHECK_CONFIGURE_FLAGS += \ diff --git a/autogen.sh b/autogen.sh index 7b62449be..3997db30e 100755 --- a/autogen.sh +++ b/autogen.sh @@ -39,54 +39,3 @@ fi intltoolize --force --automake autoreconf --force --install --symlink - -libdir() { - echo $(cd "$1/$(gcc -print-multi-os-directory)"; pwd) -} - -args="\ ---sysconfdir=/etc \ ---localstatedir=/var \ ---libdir=$(libdir /usr/lib) \ -$gtkdocargs" - -if [ -f "$topdir/.config.args" ]; then - args="$args $(cat $topdir/.config.args)" -fi - -if [ ! -L /bin ]; then -args="$args \ ---with-rootprefix= \ ---with-rootlibdir=$(libdir /lib) \ -" -fi - -cd $oldpwd - -if [ "x$1" = "xc" ]; then - $topdir/configure CFLAGS='-g -O0 -ftrapv' --enable-compat-libs --enable-kdbus $args - make clean -elif [ "x$1" = "xt" ]; then - $topdir/configure CFLAGS='-g -O0 -ftrapv' --enable-compat-libs --enable-kdbus --enable-terminal $args - make clean -elif [ "x$1" = "xg" ]; then - $topdir/configure CFLAGS='-g -Og -ftrapv' --enable-compat-libs --enable-kdbus $args - make clean -elif [ "x$1" = "xa" ]; then - $topdir/configure CFLAGS='-g -O0 -Wsuggest-attribute=pure -Wsuggest-attribute=const -ftrapv' --enable-compat-libs --enable-kdbus $args - make clean -elif [ "x$1" = "xl" ]; then - $topdir/configure CC=clang CFLAGS='-g -O0 -ftrapv' --enable-compat-libs --enable-kdbus $args - make clean -elif [ "x$1" = "xs" ]; then - scan-build $topdir/configure CFLAGS='-std=gnu99 -g -O0 -ftrapv' --enable-kdbus $args - scan-build make -else - echo - echo "----------------------------------------------------------------" - echo "Initialized build system. For a common configuration please run:" - echo "----------------------------------------------------------------" - echo - echo "$topdir/configure CFLAGS='-g -O0 -ftrapv' --enable-compat-libs --enable-kdbus $args" - echo -fi diff --git a/configure.ac b/configure.ac index e77cfe299..150773890 100644 --- a/configure.ac +++ b/configure.ac @@ -293,6 +293,13 @@ AM_CONDITIONAL(HAVE_DBUS, [test "$have_dbus" = "yes"]) # ------------------------------------------------------------------------------ PKG_CHECK_MODULES(UDEV, [libudev]) +AC_ARG_WITH([udevrulesdir], + AS_HELP_STRING([--with-udevrulesdir=DIR], [Directory for udev rules files]), + [], + [with_udevrulesdir=$($PKG_CONFIG --variable=udevdir udev)/rules.d]) +AC_SUBST([udevrulesdir], [$with_udevrulesdir]) +AC_SUBST([udevbindir], [$($PKG_CONFIG --variable=udevdir udev)/../bin]) + # ------------------------------------------------------------------------------ have_coverage=no AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable test coverage])) @@ -560,10 +567,6 @@ AC_ARG_WITH([zshcompletiondir], AS_HELP_STRING([--with-zshcompletiondir=DIR], [Zsh completions directory]), [], [with_zshcompletiondir=${datadir}/zsh/site-functions]) -AC_ARG_WITH([rootprefix], - AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), - [], [with_rootprefix=${ac_default_prefix}]) - AC_ARG_WITH([rootlibdir], AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]), [], @@ -641,7 +644,6 @@ AC_SUBST([bashcompletiondir], [$with_bashcompletiondir]) AC_SUBST([zshcompletiondir], [$with_zshcompletiondir]) AC_SUBST([pamlibdir], [$with_pamlibdir]) AC_SUBST([pamconfdir], [$with_pamconfdir]) -AC_SUBST([rootprefix], [$with_rootprefix]) AC_SUBST([rootlibdir], [$with_rootlibdir]) AC_CONFIG_FILES([ @@ -669,7 +671,6 @@ AC_MSG_RESULT([ extra debugging: ${enable_debug} prefix: ${prefix} - rootprefix: ${with_rootprefix} sysconf dir: ${sysconfdir} datarootdir: ${datarootdir} includedir: ${includedir} diff --git a/src/login/71-seat.rules.in b/src/login/71-seat.rules.in index ad26acbbb..5bf0a13c6 100644 --- a/src/login/71-seat.rules.in +++ b/src/login/71-seat.rules.in @@ -38,11 +38,11 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{idProduct}=="401a", ATTR{product} SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{idProduct}=="401a", ATTR{product}=="mimo inc", \ ATTR{../idVendor}=="058f", ATTR{../idProduct}=="6254", \ ENV{ID_AVOID_LOOP}=="", \ - RUN+="@rootbindir@/udevadm trigger --parent-match=%p/.." + RUN+="@udevbindir@/udevadm trigger --parent-match=%p/.." TAG=="seat", ENV{ID_PATH}=="", IMPORT{builtin}="path_id" TAG=="seat", ENV{ID_FOR_SEAT}=="", ENV{ID_PATH_TAG}!="", ENV{ID_FOR_SEAT}="$env{SUBSYSTEM}-$env{ID_PATH_TAG}" -SUBSYSTEM=="input", ATTR{name}=="Wiebetech LLC Wiebetech", RUN+="@rootbindir@/loginctl lock-sessions" +SUBSYSTEM=="input", ATTR{name}=="Wiebetech LLC Wiebetech", RUN+="@bindir@/loginctl lock-sessions" LABEL="seat_end" -- 2.30.2