From d2c8db59ebe5e07cb66cc3789e2d5b48302b2703 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20Mr=C3=A1zek?= Date: Mon, 16 Sep 2024 17:56:27 +0200 Subject: [PATCH] meson.build: use non-standard prefix for run_dir --- meson.build | 12 ++++++++++-- python/constants.py.in | 2 +- python/meson.build | 1 - 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 0bd46ad6d..85c69fa79 100644 --- a/meson.build +++ b/meson.build @@ -33,6 +33,7 @@ message('------------------------------') # Variables +auto_prefixes = ['/', '/usr', '/usr/local'] libkres_soversion = 9 libext = '.so' @@ -54,7 +55,15 @@ modules_dir = lib_dir / 'kres_modules' sbin_dir = prefix / get_option('sbindir') bin_dir = prefix / get_option('bindir') if host_machine.system() == 'linux' - run_dir = '/run' / 'knot-resolver' + # When installing from sources with a non-standard prefix, + # we need to set the correct run directory with the prefix, + # otherwise rwx permissions will fail with a validation error + # on the run directory + if prefix in auto_prefixes + run_dir = '/run' / 'knot-resolver' + else + run_dir = prefix / 'run' / 'knot-resolver' + endif elif host_machine.system() == 'darwin' run_dir = prefix / get_option('localstatedir') / 'run' / 'knot-resolver' else @@ -71,7 +80,6 @@ completion_dir = prefix / 'share' # When installing from sources into a non-standard prefix and the library is # shared/dynamic, we need to set the executables' RPATH so that they can find # `libkresd`, otherwise running them will fail with dynamic linkage errors -auto_prefixes = ['/', '/usr', '/usr/local'] rpath_opt = get_option('install_rpath') if (get_option('default_library') == 'static' or rpath_opt == 'disabled' or diff --git a/python/constants.py.in b/python/constants.py.in index 3f2eb734f..0f1c3a882 100644 --- a/python/constants.py.in +++ b/python/constants.py.in @@ -5,7 +5,7 @@ USER = "@user@" GROUP = "@group@" # dirs paths -RUN_DIR = Path("@prefix@@run_dir@") +RUN_DIR = Path("@run_dir@") ETC_DIR = Path("@etc_dir@") SBIN_DIR = Path("@sbin_dir@") CACHE_DIR = Path("@cache_dir@") diff --git a/python/meson.build b/python/meson.build index a0ea0c066..38794daa2 100644 --- a/python/meson.build +++ b/python/meson.build @@ -5,7 +5,6 @@ constants_config = configuration_data() constants_config.set('version', meson.project_version()) constants_config.set('user', user) constants_config.set('group', group) -constants_config.set('prefix', prefix) constants_config.set('run_dir', run_dir) constants_config.set('etc_dir', etc_dir) constants_config.set('sbin_dir', sbin_dir) -- 2.47.3