meson: add extra-exec-search-path option

Alows to add more paths to the default paths that are used to search for
binaries.
This commit is contained in:
nikstur authored and Zbigniew Jędrzejewski-Szmek committed 2026-10-09 11:22:20 +02:00
1 parent 34127b7c4c
commit b6ba95e0b1
4 files changed
+22 -8

No files matched your search

+4 -3
View File
@@ -4203,11 +4203,12 @@ StandardInputData=V2XigLJyZSBubyBzdHJhbmdlcnMgdG8gbG92ZQpZb3Uga25vdyB0aGUgcnVsZX
<term><varname>$PATH</varname></term>
<listitem><para>Colon-separated list of directories to use when launching
executables. <command>systemd</command> uses a fixed value of
executables. <command>systemd</command> uses a built-in value of
<literal><filename>/usr/local/sbin</filename>:<filename>/usr/local/bin</filename>:<filename>/usr/sbin</filename>:<filename>/usr/bin</filename></literal>
in the system manager. In case of the user manager, a different path may be configured by the
distribution. It is recommended to not rely on the order of entries, and have only one program
with a given name in <varname>$PATH</varname>.</para>
distribution. The distribution may also add other paths to the end of this list for both the
system and the user manager. It is recommended to not rely on the order of entries, and have only
one program with a given name in <varname>$PATH</varname>.</para>
<xi:include href="version-info.xml" xpointer="v208"/></listitem>
</varlistentry>
+11
View File
@@ -1028,6 +1028,17 @@ if default_user_path != ''
conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
endif
extra_exec_search_path = get_option('extra-exec-search-path')
if extra_exec_search_path != ''
foreach p : extra_exec_search_path.split(':')
if not p.startswith('/')
error(f'Extra exec search path is not absolute: "@p@"')
endif
endforeach
extra_exec_search_path = f':@extra_exec_search_path@'
endif
conf.set_quoted('EXTRA_EXEC_SEARCH_PATH_SUFFIX', extra_exec_search_path)
#####################################################################
libm = cc.find_library('m')
+2
View File
@@ -101,6 +101,8 @@ option('default-user-shell', type : 'string', value : '/bin/bash',
description : 'default interactive shell')
option('default-user-timeout-sec', type : 'integer', value : 90,
description : 'default timeout for user unit start/stop')
option('extra-exec-search-path', type : 'string',
description : 'colon-separated list of additional absolute directories appended to the built-in executable search path')
option('extra-net-naming-schemes', type : 'string',
description : 'comma-separated list of extra net.naming_scheme= definitions')
option('fallback-default-target', type : 'string', value : 'graphical.target',
+5 -5
View File
@@ -9,17 +9,17 @@
#define PATH_MERGED_BIN(x) x "bin"
#define PATH_MERGED_BIN_NULSTR(x) x "bin\0"
#define DEFAULT_PATH_WITH_FULL_SBIN PATH_SPLIT_BIN("/usr/local/") ":" PATH_SPLIT_BIN("/usr/")
#define DEFAULT_PATH_WITH_LOCAL_SBIN PATH_SPLIT_BIN("/usr/local/") ":" PATH_MERGED_BIN("/usr/")
#define DEFAULT_PATH_WITHOUT_SBIN PATH_MERGED_BIN("/usr/local/") ":" PATH_MERGED_BIN("/usr/")
#define DEFAULT_PATH_WITH_FULL_SBIN PATH_SPLIT_BIN("/usr/local/") ":" PATH_SPLIT_BIN("/usr/") EXTRA_EXEC_SEARCH_PATH_SUFFIX
#define DEFAULT_PATH_WITH_LOCAL_SBIN PATH_SPLIT_BIN("/usr/local/") ":" PATH_MERGED_BIN("/usr/") EXTRA_EXEC_SEARCH_PATH_SUFFIX
#define DEFAULT_PATH_WITHOUT_SBIN PATH_MERGED_BIN("/usr/local/") ":" PATH_MERGED_BIN("/usr/") EXTRA_EXEC_SEARCH_PATH_SUFFIX
#define DEFAULT_PATH_COMPAT DEFAULT_PATH_WITH_FULL_SBIN ":" PATH_SPLIT_BIN("/")
#define DEFAULT_PATH_COMPAT PATH_SPLIT_BIN("/usr/local/") ":" PATH_SPLIT_BIN("/usr/") ":" PATH_SPLIT_BIN("/") EXTRA_EXEC_SEARCH_PATH_SUFFIX
const char* default_PATH(void);
static inline const char* default_user_PATH(void) {
#ifdef DEFAULT_USER_PATH
return DEFAULT_USER_PATH;
return DEFAULT_USER_PATH EXTRA_EXEC_SEARCH_PATH_SUFFIX;
#else
return default_PATH();
#endif