From: Simon McVittie Date: Fri, 24 Jun 2022 12:17:26 +0000 (+0100) Subject: build: Implement a runtime_dir option X-Git-Tag: dbus-1.15.0~32^2~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff92efa389a57a5250c6996df6614234d4d462e0;p=thirdparty%2Fdbus.git 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 --- diff --git a/meson.build b/meson.build index 469a267ab..0c21e8658 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) diff --git a/meson_options.txt b/meson_options.txt index ce2934537..4babdd65f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -170,6 +170,15 @@ option( description: 'Make pkg-config metadata relocatable' ) +# Deliberately not named runstatedir to avoid colliding with +# https://github.com/mesonbuild/meson/issues/4141 +option( + 'runtime_dir', + type: 'string', + value: '', + description: 'Directory for transient runtime state [default: LOCALSTATEDIR/run or /run]' +) + option( 'selinux', type: 'feature',