From f03345d6eac059732d715109752505bee46f934d Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 30 Sep 2015 17:06:07 +0100 Subject: [PATCH] On Windows, load local configuration relative to bus setup This makes an installed tree with /some-prefix/ etc/ dbus-1/ session-local.conf share/ dbus-1/ session.conf relocatable to any location. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92028 --- bus/legacy-config/session.conf.in | 7 +++---- bus/legacy-config/system.conf.in | 7 +++---- bus/session.conf.in | 6 +++--- bus/system.conf.in | 6 +++--- cmake/CMakeLists.txt | 13 ++++++++++++- configure.ac | 14 +++++++++++--- 6 files changed, 35 insertions(+), 18 deletions(-) diff --git a/bus/legacy-config/session.conf.in b/bus/legacy-config/session.conf.in index aaea910..e58c5ce 100644 --- a/bus/legacy-config/session.conf.in +++ b/bus/legacy-config/session.conf.in @@ -6,10 +6,9 @@ session bus. That behaviour is now determined by @DBUS_DATADIR@/dbus-1/session.conf, which should not be edited. For local configuration changes, create a file -@DBUS_SYSCONFDIR@/dbus-1/session-local.conf or files matching -@DBUS_SYSCONFDIR@/dbus-1/session.d/*.conf, with a -element containing configuration directives. These directives can -override D-Bus or OS defaults. +session-local.conf or files matching session.d/*.conf in the same directory +as this one, with a element containing configuration directives. +These directives can override D-Bus or OS defaults. For upstream or distribution-wide defaults that can be overridden by a local sysadmin, create files matching diff --git a/bus/legacy-config/system.conf.in b/bus/legacy-config/system.conf.in index 84ed296..625e993 100644 --- a/bus/legacy-config/system.conf.in +++ b/bus/legacy-config/system.conf.in @@ -6,10 +6,9 @@ system bus. That behaviour is now determined by @DBUS_DATADIR@/dbus-1/system.conf, which should not be edited. For local configuration changes, create a file -@DBUS_SYSCONFDIR@/dbus-1/system-local.conf or files matching -@DBUS_SYSCONFDIR@/dbus-1/system.d/*.conf, with a -element containing configuration directives. These directives can -override D-Bus or OS defaults. +system-local.conf or files matching system.d/*.conf in the same directory +as this one, with a element containing configuration directives. +These directives can override D-Bus or OS defaults. For upstream or distribution-wide defaults that can be overridden by a local sysadmin, create files matching diff --git a/bus/session.conf.in b/bus/session.conf.in index 97e1f67..affa7f1 100644 --- a/bus/session.conf.in +++ b/bus/session.conf.in @@ -36,17 +36,17 @@ - @DBUS_SYSCONFDIR@/dbus-1/session.conf + @SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/session.conf session.d - @DBUS_SYSCONFDIR@/dbus-1/session.d + @SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/session.d - @DBUS_SYSCONFDIR@/dbus-1/session-local.conf + @SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/session-local.conf contexts/dbus_contexts diff --git a/bus/system.conf.in b/bus/system.conf.in index 3679115..014f67e 100644 --- a/bus/system.conf.in +++ b/bus/system.conf.in @@ -98,17 +98,17 @@ - @DBUS_SYSCONFDIR@/dbus-1/system.conf + @SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/system.conf system.d - @DBUS_SYSCONFDIR@/dbus-1/system.d + @SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/system.d - @DBUS_SYSCONFDIR@/dbus-1/system-local.conf + @SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/system-local.conf contexts/dbus_contexts diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index e072dfa..ca407b8 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -92,7 +92,18 @@ set(DBUS_MACHINE_UUID_FILE ${DBUS_INSTALL_DIR}/lib/dbus/machine-id) set(DBUS_BINDIR ${EXPANDED_BINDIR}) set(DBUS_DAEMONDIR ${EXPANDED_BINDIR}) set(DBUS_LOCALSTATEDIR ${EXPANDED_LOCALSTATEDIR}) -set(DBUS_SYSCONFDIR ${EXPANDED_SYSCONFDIR}) + +# On Windows this is relative to where we put the bus setup, in +# ${datadir}/dbus-1. For simplicity, we only do this if +# ${sysconfdir} = ${prefix}/etc and ${datadir} = ${prefix}/share. +# +# On Unix, or on Windows with weird install layouts, it's the absolute path. +if(WIN32 AND ${EXPANDED_SYSCONFDIR} STREQUAL ${prefix}/etc AND ${EXPANDED_DATADIR} STREQUAL ${prefix}/share) +set(SYSCONFDIR_FROM_PKGDATADIR ../../etc) +else() +set(SYSCONFDIR_FROM_PKGDATADIR ${EXPANDED_SYSCONFDIR}) +endif() + set(DBUS_LIBEXECDIR ${EXPANDED_LIBDIR}) set(DBUS_DATADIR ${EXPANDED_DATADIR}) diff --git a/configure.ac b/configure.ac index fa960f5..b3598c9 100644 --- a/configure.ac +++ b/configure.ac @@ -1690,9 +1690,17 @@ AC_SUBST(DBUS_LIBEXECDIR) AC_DEFINE_UNQUOTED(DBUS_LIBEXECDIR,"$DBUS_LIBEXECDIR", [Directory for installing the libexec binaries]) #### Directory to source sysconfdir configuration from -DBUS_SYSCONFDIR="$EXPANDED_SYSCONFDIR" -AC_SUBST(DBUS_SYSCONFDIR) -AC_DEFINE_UNQUOTED(DBUS_SYSCONFDIR,"$DBUS_SYSCONFDIR", [Directory to source sysconfdir configuration from]) + +# On Windows this is relative to where we put the bus setup, in +# ${datadir}/dbus-1. For simplicity, we only do this if +# ${sysconfdir} = ${prefix}/etc and ${datadir} = ${prefix}/share. +# +# On Unix, or on Windows with weird install layouts, it's the absolute path. +AS_IF([test "${dbus_win}" = yes && test "${sysconfdir}" = "${prefix}/etc" && \ + test "${datadir}" = "${prefix}/share"], + [SYSCONFDIR_FROM_PKGDATADIR="../../etc"], + [SYSCONFDIR_FROM_PKGDATADIR="$EXPANDED_SYSCONFDIR"]) +AC_SUBST([SYSCONFDIR_FROM_PKGDATADIR]) #### Tell tests where to find certain stuff in builddir -- 2.5.3