summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-06-24 13:17:26 +0100
committerSimon McVittie <smcv@collabora.com>2022-07-13 20:36:13 +0100
commitff92efa389a57a5250c6996df6614234d4d462e0 (patch)
tree47b7c2a8ef387e3f380dfff21e0ee38508db268f /meson.build
parente75d8a7cbc98c13a1e75360e7ea6a36123ad849d (diff)
downloaddbus-ff92efa389a57a5250c6996df6614234d4d462e0.tar.gz
build: Implement a runtime_dir option
If the prefix is /usr, then this defaults to /run, similar to the special cases for /var and /etc built into Meson. This is correct for typical modern Linux distributions implementing FHS 3.0. This is intentionally not consistent with Autotools and CMake: if distributions are transitioning to a different way to build dbus, then that's a good time to re-evaluate their build options. Otherwise, this defaults to LOCALSTATEDIR/run, consistent with Autotools and CMake. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build18
1 files changed, 15 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index 469a267a..0c21e865 100644
--- a/meson.build
+++ b/meson.build
@@ -690,9 +690,21 @@ dbus_enable_modular_tests = (
docs_dir = get_option('datadir') / 'doc' / 'dbus'
+# TODO: If a future Meson version gets a runstatedir option, try both.
+# https://github.com/mesonbuild/meson/issues/4141
+runstatedir = get_option('runtime_dir')
+
+if runstatedir == ''
+ if get_option('prefix') == '/usr'
+ runstatedir = '/run'
+ else
+ runstatedir = get_option('localstatedir') / 'run'
+ endif
+endif
+
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_RUNSTATEDIR', get_option('prefix') / runstatedir)
data_config.set('EXPANDED_BINDIR', get_option('prefix') / get_option('bindir'))
data_config.set('EXPANDED_DATADIR', get_option('prefix') / get_option('datadir'))
@@ -703,7 +715,7 @@ config.set_quoted('DBUS_DATADIR',get_option('prefix') / get_option('datadir'))
data_config.set('DBUS_LIBEXECDIR', get_option('prefix') / get_option('libexecdir'))
config.set_quoted('DBUS_RUNSTATEDIR',
- get_option('localstatedir')
+ get_option('prefix') / runstatedir
)
config.set_quoted('DBUS_MACHINE_UUID_FILE',
get_option('prefix') / get_option('localstatedir') / 'lib'/'dbus'/'machine-id'
@@ -747,7 +759,7 @@ config.set_quoted('DBUS_SYSTEM_BUS_DEFAULT_ADDRESS', system_bus_default_address)
system_pid_file = get_option('system_pid_file')
if system_pid_file == ''
- system_pid_file = '/run'/'dbus'/'pid'
+ system_pid_file = get_option('prefix') / runstatedir / 'dbus'/'pid'
endif
data_config.set('DBUS_SYSTEM_PID_FILE', system_pid_file)