]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
On Windows, load local configuration relative to bus setup
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 1 Oct 2015 18:17:49 +0000 (19:17 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 2 Oct 2015 10:24:05 +0000 (11:24 +0100)
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
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Tested-by: Ralf Habacker <ralf.habacker@freenet.de>
bus/legacy-config/session.conf.in
bus/legacy-config/system.conf.in
bus/session.conf.in
bus/system.conf.in
cmake/CMakeLists.txt
configure.ac

index aaea9104c3cdc5aa4ca090b6f572b28d8507c8e1..b35024e66980b8defc1c412cffff2622e4a48962 100644 (file)
@@ -3,17 +3,16 @@ This configuration file is no longer required and may be removed.
 
 In older versions of dbus, this file defined the behaviour of the well-known
 session bus. That behaviour is now determined by
-@DBUS_DATADIR@/dbus-1/session.conf, which should not be edited.
+@DATADIR_FROM_PKGSYSCONFDIR@/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 <busconfig>
-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 <busconfig> 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
-@DBUS_DATADIR@/dbus-1/session.d/*.conf instead.
+@DATADIR_FROM_PKGSYSCONFDIR@/dbus-1/session.d/*.conf instead.
 -->
 <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
index 84ed2967d01af3fa98f1e66a6a4467348a697d86..17aba08b8f7d20c734a150c8a65fd9011c45059c 100644 (file)
@@ -3,17 +3,16 @@ This configuration file is no longer required and may be removed.
 
 In older versions of dbus, this file defined the behaviour of the well-known
 system bus. That behaviour is now determined by
-@DBUS_DATADIR@/dbus-1/system.conf, which should not be edited.
+@DATADIR_FROM_PKGSYSCONFDIR@/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 <busconfig>
-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 <busconfig> 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
-@DBUS_DATADIR@/dbus-1/system.d/*.conf instead.
+@DATADIR_FROM_PKGSYSCONFDIR@/dbus-1/system.d/*.conf instead.
 -->
 <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
  "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
index 97e1f6730f6eca4594a0e9c59c2a36b2a7ee4c03..affa7f1d95dd96a435ed5cda136b7d4041911479 100644 (file)
   </policy>
 
   <!-- Include legacy configuration location -->
-  <include ignore_missing="yes">@DBUS_SYSCONFDIR@/dbus-1/session.conf</include>
+  <include ignore_missing="yes">@SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/session.conf</include>
 
   <!-- Config files are placed here that among other things, 
        further restrict the above policy for specific services. -->
   <includedir>session.d</includedir>
 
-  <includedir>@DBUS_SYSCONFDIR@/dbus-1/session.d</includedir>
+  <includedir>@SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/session.d</includedir>
 
   <!-- This is included last so local configuration can override what's 
        in this standard file -->
-  <include ignore_missing="yes">@DBUS_SYSCONFDIR@/dbus-1/session-local.conf</include>
+  <include ignore_missing="yes">@SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/session-local.conf</include>
 
   <include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
 
index 3679115e4b600df1a97b329a0c6e28c579b76786..014f67eeb1709fc85080dad936260283262d7eeb 100644 (file)
   </policy>
 
   <!-- Include legacy configuration location -->
-  <include ignore_missing="yes">@DBUS_SYSCONFDIR@/dbus-1/system.conf</include>
+  <include ignore_missing="yes">@SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/system.conf</include>
 
   <!-- Config files are placed here that among other things, punch 
        holes in the above policy for specific services. -->
   <includedir>system.d</includedir>
 
-  <includedir>@DBUS_SYSCONFDIR@/dbus-1/system.d</includedir>
+  <includedir>@SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/system.d</includedir>
 
   <!-- This is included last so local configuration can override what's 
        in this standard file -->
-  <include ignore_missing="yes">@DBUS_SYSCONFDIR@/dbus-1/system-local.conf</include>
+  <include ignore_missing="yes">@SYSCONFDIR_FROM_PKGDATADIR@/dbus-1/system-local.conf</include>
 
   <include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>
 
index e072dfa0081479b5b4e6504a23c901f9d83d7cb6..4db9c67ae19f3daaf4ce41eaad2117d8c9786696 100644 (file)
@@ -92,7 +92,20 @@ 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)
+set(DATADIR_FROM_PKGSYSCONFDIR ../../share)
+else()
+set(SYSCONFDIR_FROM_PKGDATADIR ${EXPANDED_SYSCONFDIR})
+set(DATADIR_FROM_PKGSYSCONFDIR ${EXPANDED_DATADIR})
+endif()
+
 set(DBUS_LIBEXECDIR          ${EXPANDED_LIBDIR})
 set(DBUS_DATADIR             ${EXPANDED_DATADIR})
 
index 529e96016e52fa2abbf2e690d2349cb42562b5e4..da14b704f1ca56f48b9cc679b1c2e731c6961aad 100644 (file)
@@ -1690,9 +1690,21 @@ 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 "$EXPANDED_SYSCONFDIR" = "$EXPANDED_PREFIX/etc" && \
+       test "$EXPANDED_DATADIR" = "$EXPANDED_PREFIX/share"],
+      [SYSCONFDIR_FROM_PKGDATADIR="../../etc"
+       DATADIR_FROM_PKGSYSCONFDIR="../../share"],
+      [SYSCONFDIR_FROM_PKGDATADIR="$EXPANDED_SYSCONFDIR"
+       DATADIR_FROM_PKGSYSCONFDIR="$EXPANDED_DATADIR"])
+AC_SUBST([SYSCONFDIR_FROM_PKGDATADIR])
+AC_SUBST([DATADIR_FROM_PKGSYSCONFDIR])
 
 #### Tell tests where to find certain stuff in builddir