From c2b2e0e728b37667f89bb050c4733a6eaabf33ce Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 24 Jun 2022 12:47:25 +0100 Subject: [PATCH] build: Resolve localstatedir, sysconfdir relative to prefix 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 --- meson.build | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 96476adde..a703db3a9 100644 --- a/meson.build +++ b/meson.build @@ -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, -- 2.47.3