]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
build: Resolve localstatedir, sysconfdir relative to prefix
authorSimon McVittie <smcv@collabora.com>
Fri, 24 Jun 2022 11:47:25 +0000 (12:47 +0100)
committerSimon McVittie <smcv@collabora.com>
Wed, 13 Jul 2022 19:36:13 +0000 (20:36 +0100)
If the prefix is something like /opt/dbus, then --localstatedir=var
should result in using /opt/dbus/var, and so on. However, if configured
with --localstatedir=/var, then the prefix is ignored.

Meson special-cases these to default to /var and /etc (respectively),
as absolute paths, if the prefix is /usr; so distribution builds will
typically still end up using /var and /etc.

Signed-off-by: Simon McVittie <smcv@collabora.com>
meson.build

index 96476adde76945d6c2e35004e3539879be1d4d68..a703db3a93af3c9a8597ed33a95b1a22832d7a28 100644 (file)
@@ -689,8 +689,8 @@ dbus_enable_modular_tests = (
 
 docs_dir = get_option('datadir') / 'doc' / 'dbus'
 
-data_config.set('EXPANDED_LOCALSTATEDIR', '/' / get_option('localstatedir'))
-data_config.set('EXPANDED_SYSCONFDIR',    '/' / get_option('sysconfdir'))
+data_config.set('EXPANDED_LOCALSTATEDIR', get_option('prefix') / get_option('localstatedir'))
+data_config.set('EXPANDED_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
 data_config.set('EXPANDED_RUNSTATEDIR',   '/' / 'run')
 data_config.set('EXPANDED_BINDIR',  get_option('prefix') / get_option('bindir'))
 data_config.set('EXPANDED_DATADIR', get_option('prefix') / get_option('datadir'))
@@ -720,7 +720,11 @@ if system_socket == ''
     # We don't use runstatedir for this (yet?), because /var/run has been the
     # interoperable system bus socket for 10+ years.
     # See https://bugs.freedesktop.org/show_bug.cgi?id=101628
-    system_socket = '/' / get_option('localstatedir')/'run'/'dbus'/'system_bus_socket'
+    system_socket = (
+        get_option('prefix')
+        / get_option('localstatedir')
+        /'run'/'dbus'/'system_bus_socket'
+    )
 endif
 data_config.set('DBUS_SYSTEM_SOCKET', system_socket)
 
@@ -958,7 +962,7 @@ pkgconfig.generate(
          'bindir': '${prefix}' / get_option('bindir'),
          'datadir': '${prefix}' / get_option('datadir'),
          'datarootdir': '${prefix}' / get_option('datadir'),
-         'sysconfdir': '/' / get_option('sysconfdir'),
+         'sysconfdir': '${prefix}' / get_option('sysconfdir'),
 
          'daemondir': '${bindir}',
          'system_bus_default_address': system_bus_default_address,