diff --git a/meson.build b/meson.build index 7bf2aa8a6..2305b3a08 100644 --- a/meson.build +++ b/meson.build @@ -125,6 +125,17 @@ endif glib_localstatedir = glib_prefix / get_option('localstatedir') +if get_option('runtime_dir') != '' + glib_runstatedir = glib_prefix / get_option('runtime_dir') +else + # While we’d normally prefix directories like this with, for example, + # glib_localstatedir, `/run` is a bit different in that it’s for runtime state + # rather than data files, so it’s typically functionally useless to use a + # prefixed version. No other processes will be using it. So we default to the + # unprefixed system `/run` directory. + glib_runstatedir = '/run' +endif + installed_tests_metadir = join_paths(glib_datadir, 'installed-tests', meson.project_name()) installed_tests_execdir = join_paths(glib_libexecdir, 'installed-tests', meson.project_name()) installed_tests_enabled = get_option('installed_tests') @@ -2106,6 +2117,7 @@ glib_conf.set('HAVE_GETTEXT', 1) glib_conf.set_quoted('GLIB_LOCALE_DIR', join_paths(glib_datadir, 'locale')) glib_conf.set_quoted('GLIB_LOCALSTATEDIR', glib_localstatedir) +glib_conf.set_quoted('GLIB_RUNSTATEDIR', glib_runstatedir) # libmount is only used by gio, but we need to fetch the libs to generate the # pkg-config file below @@ -2446,6 +2458,7 @@ summary({ 'includedir' : glib_includedir, 'giomodulesdir' : glib_giomodulesdir, 'localstatedir' : glib_localstatedir, + 'runstatedir' : glib_runstatedir, }, section: 'Directories') if get_option('multiarch') diff --git a/meson_options.txt b/meson_options.txt index 9c2c70b6c..517d5757c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,6 +14,14 @@ option('gio_module_dir', value : '', description : 'load gio modules from this directory (default to \'libdir/gio/modules\' if unset)') +# FIXME: Deliberately not named runstatedir to avoid colliding with +# https://github.com/mesonbuild/meson/issues/4141; port to that when Meson +# supports it +option('runtime_dir', + type: 'string', + value: '', + description: 'Directory for transient runtime state [default: /run]') + option('selinux', type : 'feature', value : 'auto',