]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | # SPDX-License-Identifier: LGPL-2.1-or-later |
3a726fcd | 2 | |
5c23128d | 3 | project('systemd', 'c', |
ca1e8584 | 4 | version : '249', |
5c23128d ZJS |
5 | license : 'LGPLv2+', |
6 | default_options: [ | |
37efbbd8 ZJS |
7 | 'c_std=gnu99', |
8 | 'prefix=/usr', | |
9 | 'sysconfdir=/etc', | |
10 | 'localstatedir=/var', | |
827ca909 | 11 | 'warning_level=2', |
5c23128d | 12 | ], |
9247df5a | 13 | meson_version : '>= 0.53.2', |
5c23128d ZJS |
14 | ) |
15 | ||
ca1e8584 LP |
16 | libsystemd_version = '0.32.0' |
17 | libudev_version = '1.7.2' | |
56d50ab1 | 18 | |
5c23128d | 19 | conf = configuration_data() |
e11a25ca ZJS |
20 | conf.set_quoted('PROJECT_URL', 'https://www.freedesktop.org/wiki/Software/systemd') |
21 | conf.set('PROJECT_VERSION', meson.project_version(), | |
6ffeca8c | 22 | description : 'Numerical project version (used where a simple number is expected)') |
5c23128d | 23 | |
1485aacb DC |
24 | # This is to be used instead of meson.source_root(), as the latter will return |
25 | # the wrong result when systemd is being built as a meson subproject | |
26 | project_source_root = meson.current_source_dir() | |
81e06775 | 27 | project_build_root = meson.current_build_dir() |
a0b15b41 | 28 | relative_source_path = run_command('realpath', |
81e06775 | 29 | '--relative-to=@0@'.format(project_build_root), |
a0b15b41 ZJS |
30 | project_source_root).stdout().strip() |
31 | conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path) | |
1485aacb | 32 | |
47350c5f ZJS |
33 | conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer', |
34 | description : 'tailor build to development or release builds') | |
839bdf25 | 35 | |
c09edc79 ZJS |
36 | want_ossfuzz = get_option('oss-fuzz') |
37 | want_libfuzzer = get_option('llvm-fuzz') | |
c29537f3 | 38 | if want_ossfuzz and want_libfuzzer |
6b8d32ea | 39 | error('only one of oss-fuzz or llvm-fuzz can be specified') |
c09edc79 | 40 | endif |
87ac55a1 EV |
41 | |
42 | skip_deps = want_ossfuzz or want_libfuzzer | |
6b8d32ea | 43 | fuzzer_build = want_ossfuzz or want_libfuzzer |
c09edc79 | 44 | |
5c23128d ZJS |
45 | ##################################################################### |
46 | ||
003c8879 | 47 | # Try to install the git pre-commit hook |
e2d612a8 ZJS |
48 | add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false) |
49 | if add_git_hook_sh.found() | |
50 | git_hook = run_command(add_git_hook_sh) | |
51 | if git_hook.returncode() == 0 | |
52 | message(git_hook.stdout().strip()) | |
53 | endif | |
003c8879 ZJS |
54 | endif |
55 | ||
56 | ##################################################################### | |
57 | ||
2675413e ZJS |
58 | if get_option('split-usr') == 'auto' |
59 | split_usr = run_command('test', '-L', '/bin').returncode() != 0 | |
60 | else | |
61 | split_usr = get_option('split-usr') == 'true' | |
62 | endif | |
9afd5e7b ZJS |
63 | if split_usr |
64 | warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n' | |
65 | + ' split-usr mode is going to be removed\n' + | |
66 | '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') | |
67 | endif | |
671f0f8d ZJS |
68 | conf.set10('HAVE_SPLIT_USR', split_usr, |
69 | description : '/usr/bin and /bin directories are separate') | |
9a8e64b0 | 70 | |
157baa87 ZJS |
71 | if get_option('split-bin') == 'auto' |
72 | split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0 | |
73 | else | |
74 | split_bin = get_option('split-bin') == 'true' | |
75 | endif | |
671f0f8d ZJS |
76 | conf.set10('HAVE_SPLIT_BIN', split_bin, |
77 | description : 'bin and sbin directories are separate') | |
157baa87 | 78 | |
74344a17 | 79 | rootprefixdir = get_option('rootprefix') |
74344a17 ZJS |
80 | # Unusual rootprefixdir values are used by some distros |
81 | # (see https://github.com/systemd/systemd/pull/7461). | |
ba7f4ae6 | 82 | rootprefix_default = split_usr ? '/' : '/usr' |
9a8e64b0 ZJS |
83 | if rootprefixdir == '' |
84 | rootprefixdir = rootprefix_default | |
74344a17 | 85 | endif |
23bdba61 | 86 | rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir |
5c23128d | 87 | |
8ef8f3d5 FB |
88 | have_standalone_binaries = get_option('standalone-binaries') |
89 | ||
5c23128d ZJS |
90 | sysvinit_path = get_option('sysvinit-path') |
91 | sysvrcnd_path = get_option('sysvrcnd-path') | |
348b4437 | 92 | conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '', |
349cc4a5 | 93 | description : 'SysV init scripts and rcN.d links are supported') |
6fe23ff3 | 94 | conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs')) |
5c23128d | 95 | |
cdf7ad38 NL |
96 | if get_option('hibernate') and not get_option('initrd') |
97 | error('hibernate depends on initrd') | |
98 | endif | |
99 | ||
a8b627aa LP |
100 | conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max')) |
101 | conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open')) | |
09dad04c | 102 | conf.set('HIGH_RLIMIT_NOFILE', 512*1024) |
a8b627aa | 103 | |
fce9abb2 ZJS |
104 | # Meson ignores the preceding arguments when joining paths if an absolute |
105 | # component is encountered, so this should canonicalize various paths when they | |
106 | # are absolute or relative. | |
5c23128d ZJS |
107 | prefixdir = get_option('prefix') |
108 | if not prefixdir.startswith('/') | |
37efbbd8 | 109 | error('Prefix is not absolute: "@0@"'.format(prefixdir)) |
5c23128d | 110 | endif |
b2d74870 | 111 | if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/') |
d895e10a ZJS |
112 | error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format( |
113 | rootprefixdir, prefixdir)) | |
114 | endif | |
115 | ||
fce9abb2 ZJS |
116 | bindir = prefixdir / get_option('bindir') |
117 | libdir = prefixdir / get_option('libdir') | |
118 | sysconfdir = prefixdir / get_option('sysconfdir') | |
119 | includedir = prefixdir / get_option('includedir') | |
120 | datadir = prefixdir / get_option('datadir') | |
121 | localstatedir = '/' / get_option('localstatedir') | |
5c23128d | 122 | |
fce9abb2 ZJS |
123 | rootbindir = rootprefixdir / 'bin' |
124 | rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin') | |
125 | rootlibexecdir = rootprefixdir / 'lib/systemd' | |
5c23128d ZJS |
126 | |
127 | rootlibdir = get_option('rootlibdir') | |
128 | if rootlibdir == '' | |
fce9abb2 | 129 | rootlibdir = rootprefixdir / libdir.split('/')[-1] |
5c23128d ZJS |
130 | endif |
131 | ||
225d08b8 JT |
132 | install_sysconfdir = get_option('install-sysconfdir') != 'false' |
133 | install_sysconfdir_samples = get_option('install-sysconfdir') == 'true' | |
5c23128d | 134 | # Dirs of external packages |
fce9abb2 ZJS |
135 | pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig' |
136 | pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig' | |
137 | polkitpolicydir = datadir / 'polkit-1/actions' | |
138 | polkitrulesdir = datadir / 'polkit-1/rules.d' | |
139 | polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d' | |
140 | xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d' | |
8a38aac3 YW |
141 | rpmmacrosdir = get_option('rpmmacrosdir') |
142 | if rpmmacrosdir != 'no' | |
fce9abb2 | 143 | rpmmacrosdir = prefixdir / rpmmacrosdir |
8a38aac3 | 144 | endif |
fce9abb2 | 145 | modprobedir = rootprefixdir / 'lib/modprobe.d' |
5c23128d ZJS |
146 | |
147 | # Our own paths | |
fce9abb2 ZJS |
148 | pkgdatadir = datadir / 'systemd' |
149 | environmentdir = prefixdir / 'lib/environment.d' | |
150 | pkgsysconfdir = sysconfdir / 'systemd' | |
151 | userunitdir = prefixdir / 'lib/systemd/user' | |
152 | userpresetdir = prefixdir / 'lib/systemd/user-preset' | |
153 | tmpfilesdir = prefixdir / 'lib/tmpfiles.d' | |
154 | sysusersdir = prefixdir / 'lib/sysusers.d' | |
155 | sysctldir = prefixdir / 'lib/sysctl.d' | |
156 | binfmtdir = prefixdir / 'lib/binfmt.d' | |
157 | modulesloaddir = prefixdir / 'lib/modules-load.d' | |
158 | networkdir = rootprefixdir / 'lib/systemd/network' | |
159 | pkgincludedir = includedir / 'systemd' | |
160 | systemgeneratordir = rootlibexecdir / 'system-generators' | |
161 | usergeneratordir = prefixdir / 'lib/systemd/user-generators' | |
162 | systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators' | |
163 | userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators' | |
164 | systemshutdowndir = rootlibexecdir / 'system-shutdown' | |
165 | systemsleepdir = rootlibexecdir / 'system-sleep' | |
166 | systemunitdir = rootprefixdir / 'lib/systemd/system' | |
167 | systempresetdir = rootprefixdir / 'lib/systemd/system-preset' | |
168 | udevlibexecdir = rootprefixdir / 'lib/udev' | |
169 | udevrulesdir = udevlibexecdir / 'rules.d' | |
170 | udevhwdbdir = udevlibexecdir / 'hwdb.d' | |
171 | catalogdir = prefixdir / 'lib/systemd/catalog' | |
172 | kernelinstalldir = prefixdir / 'lib/kernel/install.d' | |
173 | factorydir = datadir / 'factory' | |
174 | bootlibdir = prefixdir / 'lib/systemd/boot/efi' | |
175 | testsdir = prefixdir / 'lib/systemd/tests' | |
176 | systemdstatedir = localstatedir / 'lib/systemd' | |
177 | catalogstatedir = systemdstatedir / 'catalog' | |
178 | randomseeddir = localstatedir / 'lib/systemd' | |
179 | profiledir = rootlibexecdir / 'portable' / 'profile' | |
180 | ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d' | |
5c23128d | 181 | |
75aaade1 TB |
182 | docdir = get_option('docdir') |
183 | if docdir == '' | |
fce9abb2 | 184 | docdir = datadir / 'doc/systemd' |
75aaade1 TB |
185 | endif |
186 | ||
5c23128d ZJS |
187 | dbuspolicydir = get_option('dbuspolicydir') |
188 | if dbuspolicydir == '' | |
fce9abb2 | 189 | dbuspolicydir = datadir / 'dbus-1/system.d' |
5c23128d ZJS |
190 | endif |
191 | ||
192 | dbussessionservicedir = get_option('dbussessionservicedir') | |
193 | if dbussessionservicedir == '' | |
fce9abb2 | 194 | dbussessionservicedir = datadir / 'dbus-1/services' |
5c23128d ZJS |
195 | endif |
196 | ||
197 | dbussystemservicedir = get_option('dbussystemservicedir') | |
198 | if dbussystemservicedir == '' | |
fce9abb2 | 199 | dbussystemservicedir = datadir / 'dbus-1/system-services' |
5c23128d ZJS |
200 | endif |
201 | ||
202 | pamlibdir = get_option('pamlibdir') | |
203 | if pamlibdir == '' | |
fce9abb2 | 204 | pamlibdir = rootlibdir / 'security' |
5c23128d ZJS |
205 | endif |
206 | ||
207 | pamconfdir = get_option('pamconfdir') | |
208 | if pamconfdir == '' | |
fce9abb2 | 209 | pamconfdir = prefixdir / 'lib/pam.d' |
5c23128d ZJS |
210 | endif |
211 | ||
d1ae38d8 OK |
212 | libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir') |
213 | if libcryptsetup_plugins_dir == '' | |
fce9abb2 | 214 | libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup' |
d1ae38d8 OK |
215 | endif |
216 | ||
444d5863 | 217 | memory_accounting_default = get_option('memory-accounting-default') |
36cf4507 | 218 | status_unit_format_default = get_option('status-unit-format-default') |
444d5863 | 219 | |
491bf10c ZJS |
220 | conf.set_quoted('BINFMT_DIR', binfmtdir) |
221 | conf.set_quoted('BOOTLIBDIR', bootlibdir) | |
fce9abb2 | 222 | conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database') |
491bf10c | 223 | conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root')) |
6fe23ff3 | 224 | conf.set_quoted('DOC_DIR', docdir) |
fce9abb2 | 225 | conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd') |
491bf10c ZJS |
226 | conf.set_quoted('ENVIRONMENT_DIR', environmentdir) |
227 | conf.set_quoted('INCLUDE_DIR', includedir) | |
228 | conf.set_quoted('LIBDIR', libdir) | |
229 | conf.set_quoted('MODPROBE_DIR', modprobedir) | |
230 | conf.set_quoted('MODULESLOAD_DIR', modulesloaddir) | |
5c23128d | 231 | conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir) |
fce9abb2 | 232 | conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent') |
491bf10c | 233 | conf.set_quoted('PREFIX', prefixdir) |
fce9abb2 | 234 | conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed') |
491bf10c | 235 | conf.set_quoted('RANDOM_SEED_DIR', randomseeddir) |
452d2dfd | 236 | conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local')) |
491bf10c ZJS |
237 | conf.set_quoted('ROOTBINDIR', rootbindir) |
238 | conf.set_quoted('ROOTLIBDIR', rootlibdir) | |
239 | conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir) | |
240 | conf.set_quoted('ROOTPREFIX', rootprefixdir) | |
241 | conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash) | |
242 | conf.set_quoted('SYSCONF_DIR', sysconfdir) | |
243 | conf.set_quoted('SYSCTL_DIR', sysctldir) | |
fce9abb2 ZJS |
244 | conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl') |
245 | conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd') | |
491bf10c | 246 | conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir) |
fce9abb2 ZJS |
247 | conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent') |
248 | conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup') | |
249 | conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export') | |
250 | conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck') | |
251 | conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs') | |
252 | conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework') | |
253 | conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs') | |
254 | conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import') | |
255 | conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map') | |
256 | conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map') | |
257 | conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs') | |
258 | conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull') | |
259 | conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown') | |
260 | conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', bindir / 'systemd-stdio-bridge') | |
261 | conf.set_quoted('SYSTEMD_TEST_DATA', testsdir / 'testdata') | |
262 | conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent') | |
263 | conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper') | |
264 | conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork') | |
265 | conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup') | |
266 | conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system') | |
491bf10c | 267 | conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir) |
96d33e4a | 268 | conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir) |
491bf10c ZJS |
269 | conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir) |
270 | conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir) | |
5c23128d ZJS |
271 | conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir) |
272 | conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) | |
491bf10c ZJS |
273 | conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path) |
274 | conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path) | |
835cf75a ZJS |
275 | conf.set_quoted('SYSUSERS_DIR', sysusersdir) |
276 | conf.set_quoted('TMPFILES_DIR', tmpfilesdir) | |
5c23128d | 277 | conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) |
491bf10c ZJS |
278 | conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir) |
279 | conf.set_quoted('UDEV_RULES_DIR', udevrulesdir) | |
36d55958 | 280 | conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout')) |
fce9abb2 | 281 | conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user') |
491bf10c ZJS |
282 | conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir) |
283 | conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir) | |
284 | conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir) | |
fce9abb2 | 285 | conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg') |
491bf10c | 286 | conf.set_quoted('USER_PRESET_DIR', userpresetdir) |
fce9abb2 | 287 | conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg') |
491bf10c ZJS |
288 | |
289 | conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper()) | |
e5d86ebe | 290 | conf.set10('ENABLE_URLIFY', get_option('urlify')) |
491bf10c | 291 | conf.set10('ENABLE_FEXECVE', get_option('fexecve')) |
30538ff1 | 292 | conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default) |
36cf4507 | 293 | conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper()) |
e11a25ca | 294 | conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default) |
5c23128d | 295 | |
5c23128d ZJS |
296 | ##################################################################### |
297 | ||
298 | cc = meson.get_compiler('c') | |
299 | pkgconfig = import('pkgconfig') | |
dd1e33c8 | 300 | check_compilation_sh = find_program('tools/check-compilation.sh') |
b68dfb9e | 301 | meson_build_sh = find_program('tools/meson-build.sh') |
5c23128d | 302 | |
d3da291e ZJS |
303 | want_tests = get_option('tests') |
304 | slow_tests = want_tests != 'false' and get_option('slow-tests') | |
c56463fd | 305 | fuzz_tests = want_tests != 'false' and get_option('fuzz-tests') |
d3da291e ZJS |
306 | install_tests = get_option('install-tests') |
307 | ||
46e63a2a | 308 | if add_languages('cpp', required : fuzzer_build) |
3b2bdd62 | 309 | # Used only for tests |
e9f4f566 ZJS |
310 | cxx = meson.get_compiler('cpp') |
311 | cxx_cmd = ' '.join(cxx.cmd_array()) | |
1b2acaa7 | 312 | else |
9b0ca019 | 313 | cxx_cmd = '' |
94e2523b ZJS |
314 | endif |
315 | ||
31e57a35 | 316 | if want_libfuzzer |
9c5c4677 EV |
317 | fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false) |
318 | if fuzzing_engine.found() | |
319 | add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c') | |
320 | elif cc.has_argument('-fsanitize=fuzzer-no-link') | |
321 | add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c') | |
322 | else | |
323 | error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported') | |
324 | endif | |
c09edc79 | 325 | elif want_ossfuzz |
7db7d5b7 JR |
326 | fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine') |
327 | endif | |
328 | ||
e9f4f566 ZJS |
329 | # Those generate many false positives, and we do not want to change the code to |
330 | # avoid them. | |
331 | basic_disabled_warnings = [ | |
505ab9dd | 332 | '-Wno-format-signedness', |
e9f4f566 | 333 | '-Wno-missing-field-initializers', |
505ab9dd | 334 | '-Wno-unused-parameter', |
e9f4f566 | 335 | ] |
e9f4f566 | 336 | |
65267363 | 337 | possible_common_cc_flags = [ |
505ab9dd YW |
338 | '-Wdate-time', |
339 | '-Wendif-labels', | |
340 | '-Werror=format=2', | |
341 | '-Werror=implicit-function-declaration', | |
342 | '-Werror=incompatible-pointer-types', | |
ebbb1e36 | 343 | '-Werror=int-conversion', |
505ab9dd YW |
344 | '-Werror=overflow', |
345 | '-Werror=return-type', | |
346 | '-Werror=shift-count-overflow', | |
347 | '-Werror=shift-overflow=2', | |
30a4ddff | 348 | '-Werror=undef', |
702d4027 | 349 | '-Werror=unused-function', |
505ab9dd YW |
350 | '-Wfloat-equal', |
351 | '-Wimplicit-fallthrough=5', | |
352 | '-Winit-self', | |
30a4ddff YW |
353 | '-Wlogical-op', |
354 | '-Wmissing-include-dirs', | |
505ab9dd YW |
355 | '-Wmissing-noreturn', |
356 | '-Wnested-externs', | |
30a4ddff YW |
357 | '-Wold-style-definition', |
358 | '-Wpointer-arith', | |
30a4ddff | 359 | '-Wredundant-decls', |
30a4ddff | 360 | '-Wshadow', |
30a4ddff | 361 | '-Wstrict-aliasing=2', |
505ab9dd YW |
362 | '-Wstrict-prototypes', |
363 | '-Wsuggest-attribute=noreturn', | |
30a4ddff | 364 | '-Wwrite-strings', |
bf7efeb1 FB |
365 | |
366 | # negative arguments are correctly detected starting with meson 0.46. | |
eed33623 ZJS |
367 | '-Wno-error=#warnings', # clang |
368 | '-Wno-string-plus-int', # clang | |
30a4ddff YW |
369 | ] |
370 | ||
68c98a41 ZJS |
371 | # Disable -Wmaybe-unitialized when compiling with -Os/-O1/-O3/etc. There are |
372 | # too many false positives with gcc >= 8. Effectively, we only test with -O0 | |
373 | # and -O2; this should be enough to catch most important cases without too much | |
374 | # busywork. See https://github.com/systemd/systemd/pull/19226. | |
375 | if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or | |
376 | cc.version().version_compare('<10')) | |
65267363 | 377 | possible_common_cc_flags += '-Wno-maybe-uninitialized' |
68c98a41 ZJS |
378 | endif |
379 | ||
bc2a4af2 ZJS |
380 | # Disable -Wno-unused-result with gcc, see |
381 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425. | |
382 | if cc.get_id() == 'gcc' | |
383 | possible_common_cc_flags += '-Wno-unused-result' | |
384 | endif | |
385 | ||
30a4ddff | 386 | # --as-needed and --no-undefined are provided by meson by default, |
9247df5a | 387 | # run 'meson configure' to see what is enabled |
30a4ddff YW |
388 | possible_link_flags = [ |
389 | '-Wl,-z,relro', | |
390 | '-Wl,-z,now', | |
68e70ac2 | 391 | '-fstack-protector', |
30a4ddff | 392 | ] |
5c23128d | 393 | |
30a4ddff | 394 | if cc.get_id() == 'clang' |
65267363 | 395 | possible_common_cc_flags += [ |
30a4ddff YW |
396 | '-Wno-typedef-redefinition', |
397 | '-Wno-gnu-variable-sized-type-not-at-end', | |
398 | ] | |
399 | endif | |
400 | ||
16e09d51 YW |
401 | possible_cc_flags = possible_common_cc_flags + [ |
402 | '-Werror=missing-declarations', | |
403 | '-Werror=missing-prototypes', | |
404 | '-fdiagnostics-show-option', | |
405 | '-ffast-math', | |
406 | '-fno-common', | |
407 | '-fno-strict-aliasing', | |
408 | '-fstack-protector', | |
409 | '-fstack-protector-strong', | |
410 | '-fvisibility=hidden', | |
411 | '--param=ssp-buffer-size=4', | |
412 | ] | |
413 | ||
30a4ddff | 414 | if get_option('buildtype') != 'debug' |
16e09d51 | 415 | possible_cc_flags += [ |
30a4ddff YW |
416 | '-ffunction-sections', |
417 | '-fdata-sections', | |
418 | ] | |
419 | ||
420 | possible_link_flags += '-Wl,--gc-sections' | |
421 | endif | |
422 | ||
e9f4f566 | 423 | add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c') |
30a4ddff | 424 | add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c') |
7a6397d2 | 425 | add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c') |
30a4ddff | 426 | |
94c0c5b7 ZJS |
427 | have = cc.has_argument('-Wzero-length-bounds') |
428 | conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have) | |
429 | ||
9e70f2f8 | 430 | if cc.compiles(''' |
5c23128d ZJS |
431 | #include <time.h> |
432 | #include <inttypes.h> | |
433 | typedef uint64_t usec_t; | |
434 | usec_t now(clockid_t clock); | |
435 | int main(void) { | |
436 | struct timespec now; | |
437 | return 0; | |
438 | } | |
38c1c96d | 439 | ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing') |
37efbbd8 | 440 | add_project_arguments('-Werror=shadow', language : 'c') |
5c23128d ZJS |
441 | endif |
442 | ||
e9f4f566 ZJS |
443 | if cxx_cmd != '' |
444 | add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp') | |
445 | endif | |
446 | ||
0e3cc902 | 447 | cpp = ' '.join(cc.cmd_array()) + ' -E' |
9cc0e6e9 | 448 | |
6695c200 ZJS |
449 | has_wstringop_truncation = cc.has_argument('-Wstringop-truncation') |
450 | ||
5c23128d ZJS |
451 | ##################################################################### |
452 | # compilation result tests | |
453 | ||
2c201c21 ZJS |
454 | conf.set('_GNU_SOURCE', true) |
455 | conf.set('__SANE_USERSPACE_TYPES__', true) | |
6695c200 | 456 | conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation) |
5c23128d | 457 | |
5c23128d ZJS |
458 | conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>')) |
459 | conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>')) | |
460 | conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>')) | |
461 | conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>')) | |
462 | ||
463 | decl_headers = ''' | |
464 | #include <uchar.h> | |
84e8edec | 465 | #include <sys/mount.h> |
4c2e1b39 | 466 | #include <sys/stat.h> |
84e8edec | 467 | #include <linux/fs.h> |
5c23128d | 468 | ''' |
5c23128d ZJS |
469 | |
470 | foreach decl : ['char16_t', | |
471 | 'char32_t', | |
84e8edec | 472 | 'struct mount_attr', |
4c2e1b39 | 473 | 'struct statx', |
5c23128d | 474 | ] |
2c201c21 ZJS |
475 | |
476 | # We get -1 if the size cannot be determined | |
9c869d08 ZJS |
477 | have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 |
478 | ||
479 | if decl == 'struct statx' | |
480 | if have | |
481 | want_linux_stat_h = false | |
482 | else | |
483 | have = cc.sizeof(decl, | |
484 | prefix : decl_headers + '#include <linux/stat.h>', | |
485 | args : '-D_GNU_SOURCE') > 0 | |
486 | want_linux_stat_h = have | |
487 | endif | |
488 | endif | |
489 | ||
349cc4a5 | 490 | conf.set10('HAVE_' + decl.underscorify().to_upper(), have) |
5c23128d ZJS |
491 | endforeach |
492 | ||
9c869d08 | 493 | conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h) |
75720bff | 494 | |
5c23128d | 495 | foreach ident : ['secure_getenv', '__secure_getenv'] |
349cc4a5 | 496 | conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident)) |
5c23128d ZJS |
497 | endforeach |
498 | ||
499 | foreach ident : [ | |
85db59b7 | 500 | ['memfd_create', '''#include <sys/mman.h>'''], |
7b961e40 LP |
501 | ['gettid', '''#include <sys/types.h> |
502 | #include <unistd.h>'''], | |
3c042add LP |
503 | ['pivot_root', '''#include <stdlib.h> |
504 | #include <unistd.h>'''], # no known header declares pivot_root | |
51fe206f ZJS |
505 | ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get |
506 | ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set | |
85db59b7 | 507 | ['name_to_handle_at', '''#include <sys/types.h> |
37efbbd8 ZJS |
508 | #include <sys/stat.h> |
509 | #include <fcntl.h>'''], | |
85db59b7 | 510 | ['setns', '''#include <sched.h>'''], |
2acfd0ff LP |
511 | ['renameat2', '''#include <stdio.h> |
512 | #include <fcntl.h>'''], | |
37efbbd8 ZJS |
513 | ['kcmp', '''#include <linux/kcmp.h>'''], |
514 | ['keyctl', '''#include <sys/types.h> | |
515 | #include <keyutils.h>'''], | |
85db59b7 | 516 | ['copy_file_range', '''#include <sys/syscall.h> |
37efbbd8 | 517 | #include <unistd.h>'''], |
71e5200f DM |
518 | ['bpf', '''#include <sys/syscall.h> |
519 | #include <unistd.h>'''], | |
4c2e1b39 LP |
520 | ['statx', '''#include <sys/types.h> |
521 | #include <sys/stat.h> | |
522 | #include <unistd.h>'''], | |
aa484f35 | 523 | ['explicit_bzero' , '''#include <string.h>'''], |
5bb20fd3 | 524 | ['reallocarray', '''#include <stdlib.h>'''], |
b070c7c0 MS |
525 | ['set_mempolicy', '''#include <stdlib.h> |
526 | #include <unistd.h>'''], | |
527 | ['get_mempolicy', '''#include <stdlib.h> | |
528 | #include <unistd.h>'''], | |
5f152f43 LP |
529 | ['pidfd_send_signal', '''#include <stdlib.h> |
530 | #include <unistd.h> | |
531 | #include <signal.h> | |
532 | #include <sys/wait.h>'''], | |
533 | ['pidfd_open', '''#include <stdlib.h> | |
534 | #include <unistd.h> | |
535 | #include <signal.h> | |
536 | #include <sys/wait.h>'''], | |
5ead4e85 LP |
537 | ['rt_sigqueueinfo', '''#include <stdlib.h> |
538 | #include <unistd.h> | |
539 | #include <signal.h> | |
540 | #include <sys/wait.h>'''], | |
4b6f74f5 | 541 | ['mallinfo', '''#include <malloc.h>'''], |
1885169c | 542 | ['mallinfo2', '''#include <malloc.h>'''], |
8939eeae | 543 | ['execveat', '''#include <unistd.h>'''], |
441e0fdb | 544 | ['close_range', '''#include <unistd.h>'''], |
420297c9 | 545 | ['epoll_pwait2', '''#include <sys/epoll.h>'''], |
84e8edec LP |
546 | ['mount_setattr', '''#include <sys/mount.h>'''], |
547 | ['move_mount', '''#include <sys/mount.h>'''], | |
548 | ['open_tree', '''#include <sys/mount.h>'''], | |
37efbbd8 ZJS |
549 | ] |
550 | ||
85db59b7 | 551 | have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') |
4b9545f1 | 552 | conf.set10('HAVE_' + ident[0].to_upper(), have) |
5c23128d ZJS |
553 | endforeach |
554 | ||
85db59b7 | 555 | if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE') |
349cc4a5 | 556 | conf.set10('USE_SYS_RANDOM_H', true) |
4b9545f1 | 557 | conf.set10('HAVE_GETRANDOM', true) |
4984c8be ZJS |
558 | else |
559 | have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''') | |
349cc4a5 | 560 | conf.set10('USE_SYS_RANDOM_H', false) |
4b9545f1 | 561 | conf.set10('HAVE_GETRANDOM', have) |
4984c8be ZJS |
562 | endif |
563 | ||
5c23128d ZJS |
564 | ##################################################################### |
565 | ||
064b8e2c DDM |
566 | version_tag = get_option('version-tag') |
567 | if version_tag != '' | |
568 | vcs_data = configuration_data() | |
569 | vcs_data.set('VCS_TAG', version_tag) | |
570 | version_h = configure_file(configuration : vcs_data, | |
571 | input : 'src/version/version.h.in', | |
572 | output : 'version.h') | |
573 | else | |
574 | vcs_tagger = [ | |
575 | project_source_root + '/tools/meson-vcs-tag.sh', | |
576 | project_source_root, | |
577 | meson.project_version()] | |
578 | ||
579 | version_h = vcs_tag( | |
580 | input : 'src/version/version.h.in', | |
581 | output : 'version.h', | |
582 | command: vcs_tagger) | |
583 | endif | |
d1084aa2 LT |
584 | |
585 | versiondep = declare_dependency(sources: version_h) | |
586 | ||
0f4c4f38 ZJS |
587 | sh = find_program('sh') |
588 | echo = find_program('echo') | |
589 | test = find_program('test') | |
5c23128d | 590 | sed = find_program('sed') |
5c23128d | 591 | awk = find_program('awk') |
5c23128d | 592 | stat = find_program('stat') |
0f4c4f38 | 593 | ln = find_program('ln') |
d68b342b | 594 | git = find_program('git', required : false) |
b68dfb9e | 595 | env = find_program('env') |
b1ffacb6 | 596 | perl = find_program('perl', required : false) |
0f4c4f38 | 597 | rsync = find_program('rsync', required : false) |
7c22f07c | 598 | meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh' |
0f4c4f38 | 599 | test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh') |
5c23128d | 600 | |
94e75a54 | 601 | mkdir_p = 'mkdir -p $DESTDIR/@0@' |
d83f4f50 | 602 | splash_bmp = files('test/splash.bmp') |
94e75a54 | 603 | |
9247df5a | 604 | # If -Dxxx-path option is found, use that. Otherwise, check in $PATH, |
5c23128d | 605 | # /usr/sbin, /sbin, and fall back to the default from middle column. |
2fa645f1 | 606 | progs = [['quotaon', '/usr/sbin/quotaon' ], |
5c23128d | 607 | ['quotacheck', '/usr/sbin/quotacheck' ], |
5c23128d ZJS |
608 | ['kmod', '/usr/bin/kmod' ], |
609 | ['kexec', '/usr/sbin/kexec' ], | |
610 | ['sulogin', '/usr/sbin/sulogin' ], | |
611 | ['mount', '/usr/bin/mount', 'MOUNT_PATH'], | |
612 | ['umount', '/usr/bin/umount', 'UMOUNT_PATH'], | |
613 | ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'], | |
614 | ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'], | |
6db90462 | 615 | ['nologin', '/usr/sbin/nologin', ], |
5c23128d ZJS |
616 | ] |
617 | foreach prog : progs | |
37efbbd8 ZJS |
618 | path = get_option(prog[0] + '-path') |
619 | if path != '' | |
620 | message('Using @1@ for @0@'.format(prog[0], path)) | |
621 | else | |
622 | exe = find_program(prog[0], | |
623 | '/usr/sbin/' + prog[0], | |
624 | '/sbin/' + prog[0], | |
625 | required: false) | |
626 | path = exe.found() ? exe.path() : prog[1] | |
627 | endif | |
628 | name = prog.length() > 2 ? prog[2] : prog[0].to_upper() | |
629 | conf.set_quoted(name, path) | |
5c23128d ZJS |
630 | endforeach |
631 | ||
2fa645f1 MG |
632 | conf.set_quoted('TELINIT', get_option('telinit-path')) |
633 | ||
0f4c4f38 | 634 | if run_command(ln, '--relative', '--help').returncode() != 0 |
cd001016 | 635 | error('ln does not support --relative (added in coreutils 8.16)') |
1276a9f6 | 636 | endif |
5c23128d ZJS |
637 | |
638 | ############################################################ | |
639 | ||
e0698c66 ZJS |
640 | if run_command('python3', '-c', 'import jinja2').returncode() != 0 |
641 | error('python3 jinja2 missing') | |
642 | endif | |
643 | ||
644 | ############################################################ | |
645 | ||
5c23128d ZJS |
646 | gperf = find_program('gperf') |
647 | ||
648 | gperf_test_format = ''' | |
649 | #include <string.h> | |
650 | const char * in_word_set(const char *, @0@); | |
651 | @1@ | |
652 | ''' | |
653 | gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C' | |
0f4c4f38 | 654 | gperf_snippet = run_command(sh, '-c', gperf_snippet_format.format(gperf.path())) |
5c23128d ZJS |
655 | gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout()) |
656 | if cc.compiles(gperf_test) | |
37efbbd8 | 657 | gperf_len_type = 'size_t' |
5c23128d | 658 | else |
37efbbd8 ZJS |
659 | gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout()) |
660 | if cc.compiles(gperf_test) | |
661 | gperf_len_type = 'unsigned' | |
662 | else | |
663 | error('unable to determine gperf len type') | |
664 | endif | |
5c23128d ZJS |
665 | endif |
666 | message('gperf len type is @0@'.format(gperf_len_type)) | |
37efbbd8 ZJS |
667 | conf.set('GPERF_LEN_TYPE', gperf_len_type, |
668 | description : 'The type of gperf "len" parameter') | |
5c23128d ZJS |
669 | |
670 | ############################################################ | |
671 | ||
672 | if not cc.has_header('sys/capability.h') | |
37efbbd8 | 673 | error('POSIX caps headers not found') |
5c23128d | 674 | endif |
9f555bba | 675 | foreach header : ['crypt.h', |
5c23128d ZJS |
676 | 'linux/memfd.h', |
677 | 'linux/vm_sockets.h', | |
af8786b1 | 678 | 'sys/auxv.h', |
5c23128d ZJS |
679 | 'valgrind/memcheck.h', |
680 | 'valgrind/valgrind.h', | |
420297c9 | 681 | 'linux/time_types.h', |
b428efa5 | 682 | 'sys/sdt.h', |
5c23128d | 683 | ] |
2c201c21 | 684 | |
349cc4a5 ZJS |
685 | conf.set10('HAVE_' + header.underscorify().to_upper(), |
686 | cc.has_header(header)) | |
5c23128d ZJS |
687 | endforeach |
688 | ||
689 | ############################################################ | |
690 | ||
eef4b800 ZJS |
691 | fallback_hostname = get_option('fallback-hostname') |
692 | if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-' | |
693 | error('Invalid fallback-hostname configuration') | |
694 | # A more extensive test is done in test-hostname-util. Let's catch | |
695 | # the most obvious errors here so we don't fail with an assert later. | |
696 | endif | |
697 | conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname) | |
698 | ||
5c23128d ZJS |
699 | default_hierarchy = get_option('default-hierarchy') |
700 | conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy, | |
701 | description : 'default cgroup hierarchy as string') | |
702 | if default_hierarchy == 'legacy' | |
37efbbd8 | 703 | conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE') |
5c23128d | 704 | elif default_hierarchy == 'hybrid' |
37efbbd8 | 705 | conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD') |
5c23128d | 706 | else |
37efbbd8 | 707 | conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL') |
5c23128d ZJS |
708 | endif |
709 | ||
06da5c63 ZJS |
710 | default_net_naming_scheme = get_option('default-net-naming-scheme') |
711 | conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme) | |
77faadfd ZJS |
712 | if default_net_naming_scheme != 'latest' |
713 | conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST', | |
714 | 'NAMING_' + default_net_naming_scheme.underscorify().to_upper()) | |
715 | endif | |
06da5c63 | 716 | |
5c23128d | 717 | time_epoch = get_option('time-epoch') |
ac09340e | 718 | if time_epoch == -1 |
0f4c4f38 | 719 | time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"').stdout().strip() |
0390b094 | 720 | if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0 |
bd190899 | 721 | # If we're in a git repository, use the creation time of the latest git tag. |
0f4c4f38 ZJS |
722 | latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags').stdout().strip() |
723 | time_epoch = run_command(git, 'log', '--no-show-signature', '-1', '--format=%at', latest_tag).stdout() | |
0390b094 ZJS |
724 | endif |
725 | if time_epoch == '' | |
6dbf352c | 726 | NEWS = files('NEWS') |
0390b094 | 727 | time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout() |
6dbf352c | 728 | endif |
0390b094 | 729 | time_epoch = time_epoch.to_int() |
5c23128d | 730 | endif |
5c23128d ZJS |
731 | conf.set('TIME_EPOCH', time_epoch) |
732 | ||
b10abe4b EI |
733 | conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max')) |
734 | ||
fc1a5d1a ZJS |
735 | foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5). |
736 | ['system-uid-max', 'SYS_UID_MAX', 999], | |
737 | ['system-alloc-gid-min', 'SYS_GID_MIN', 1], | |
738 | ['system-gid-max', 'SYS_GID_MAX', 999]] | |
739 | v = get_option(tuple[0]) | |
740 | if v == -1 | |
741 | v = run_command( | |
742 | awk, | |
743 | '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]), | |
744 | '/etc/login.defs').stdout().strip() | |
745 | if v == '' | |
746 | v = tuple[2] | |
747 | else | |
748 | v = v.to_int() | |
749 | endif | |
2f62cf35 | 750 | endif |
fc1a5d1a | 751 | conf.set(tuple[0].underscorify().to_upper(), v) |
fc1a5d1a ZJS |
752 | endforeach |
753 | if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX') | |
754 | error('Invalid uid allocation range') | |
5c23128d | 755 | endif |
fc1a5d1a ZJS |
756 | if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX') |
757 | error('Invalid gid allocation range') | |
5c23128d | 758 | endif |
5c23128d | 759 | |
ac09340e YW |
760 | dynamic_uid_min = get_option('dynamic-uid-min') |
761 | dynamic_uid_max = get_option('dynamic-uid-max') | |
87d5e4f2 LP |
762 | conf.set('DYNAMIC_UID_MIN', dynamic_uid_min) |
763 | conf.set('DYNAMIC_UID_MAX', dynamic_uid_max) | |
87d5e4f2 | 764 | |
ac09340e YW |
765 | container_uid_base_min = get_option('container-uid-base-min') |
766 | container_uid_base_max = get_option('container-uid-base-max') | |
87d5e4f2 LP |
767 | conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min) |
768 | conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max) | |
87d5e4f2 | 769 | |
afde4574 LP |
770 | nobody_user = get_option('nobody-user') |
771 | nobody_group = get_option('nobody-group') | |
772 | ||
2484bff3 CQ |
773 | if not meson.is_cross_build() |
774 | getent_result = run_command('getent', 'passwd', '65534') | |
775 | if getent_result.returncode() == 0 | |
776 | name = getent_result.stdout().split(':')[0] | |
777 | if name != nobody_user | |
778 | warning('\n' + | |
779 | 'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) + | |
780 | 'Your build will result in an user table setup that is incompatible with the local system.') | |
781 | endif | |
afde4574 | 782 | endif |
2484bff3 CQ |
783 | id_result = run_command('id', '-u', nobody_user) |
784 | if id_result.returncode() == 0 | |
785 | id = id_result.stdout().to_int() | |
786 | if id != 65534 | |
787 | warning('\n' + | |
788 | 'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) + | |
789 | 'Your build will result in an user table setup that is incompatible with the local system.') | |
790 | endif | |
afde4574 | 791 | endif |
afde4574 | 792 | |
2484bff3 CQ |
793 | getent_result = run_command('getent', 'group', '65534') |
794 | if getent_result.returncode() == 0 | |
795 | name = getent_result.stdout().split(':')[0] | |
796 | if name != nobody_group | |
797 | warning('\n' + | |
798 | 'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) + | |
799 | 'Your build will result in an group table setup that is incompatible with the local system.') | |
800 | endif | |
afde4574 | 801 | endif |
2484bff3 CQ |
802 | id_result = run_command('id', '-g', nobody_group) |
803 | if id_result.returncode() == 0 | |
804 | id = id_result.stdout().to_int() | |
805 | if id != 65534 | |
806 | warning('\n' + | |
d5b3e510 | 807 | 'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n'.format(nobody_group, id) + |
2484bff3 CQ |
808 | 'Your build will result in an group table setup that is incompatible with the local system.') |
809 | endif | |
afde4574 LP |
810 | endif |
811 | endif | |
8374cc62 | 812 | if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup') |
8ea9fad7 YW |
813 | warning('\n' + |
814 | 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) + | |
815 | 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.') | |
8374cc62 | 816 | endif |
afde4574 LP |
817 | |
818 | conf.set_quoted('NOBODY_USER_NAME', nobody_user) | |
819 | conf.set_quoted('NOBODY_GROUP_NAME', nobody_group) | |
87d5e4f2 | 820 | |
9a797ddc ZJS |
821 | static_ugids = [] |
822 | foreach option : ['adm-gid', | |
823 | 'audio-gid', | |
824 | 'cdrom-gid', | |
825 | 'dialout-gid', | |
826 | 'disk-gid', | |
827 | 'input-gid', | |
828 | 'kmem-gid', | |
829 | 'kvm-gid', | |
830 | 'lp-gid', | |
831 | 'render-gid', | |
832 | 'sgx-gid', | |
833 | 'tape-gid', | |
834 | 'tty-gid', | |
835 | 'users-gid', | |
836 | 'utmp-gid', | |
837 | 'video-gid', | |
838 | 'wheel-gid', | |
839 | 'systemd-journal-gid', | |
840 | 'systemd-network-uid', | |
841 | 'systemd-resolve-uid', | |
842 | 'systemd-timesync-uid'] | |
843 | name = option.underscorify().to_upper() | |
844 | val = get_option(option) | |
845 | ||
846 | # Ensure provided GID argument is numeric, otherwise fall back to default assignment | |
847 | conf.set(name, val >= 0 ? val : '-') | |
848 | if val >= 0 | |
849 | static_ugids += '@0@:@1@'.format(option, val) | |
850 | endif | |
851 | endforeach | |
84786b8e | 852 | |
348b4437 YW |
853 | conf.set10('ENABLE_ADM_GROUP', get_option('adm-group')) |
854 | conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group')) | |
5c23128d | 855 | |
ace5e311 | 856 | dev_kvm_mode = get_option('dev-kvm-mode') |
d924a938 | 857 | conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation |
ace5e311 | 858 | conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666') |
055a083a | 859 | group_render_mode = get_option('group-render-mode') |
8feaea5e | 860 | conf.set_quoted('GROUP_RENDER_MODE', group_render_mode) |
055a083a | 861 | conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666') |
5c23128d | 862 | |
2a4c156d ZJS |
863 | kill_user_processes = get_option('default-kill-user-processes') |
864 | conf.set10('KILL_USER_PROCESSES', kill_user_processes) | |
5c23128d | 865 | |
829257d1 ZJS |
866 | dns_servers = get_option('dns-servers') |
867 | conf.set_quoted('DNS_SERVERS', dns_servers) | |
5c23128d | 868 | |
829257d1 ZJS |
869 | ntp_servers = get_option('ntp-servers') |
870 | conf.set_quoted('NTP_SERVERS', ntp_servers) | |
5c23128d | 871 | |
8ca9e92c | 872 | default_locale = get_option('default-locale') |
03475e22 | 873 | if default_locale == '' |
50f2fc77 JH |
874 | if not meson.is_cross_build() |
875 | choose_default_locale_sh = find_program('tools/choose-default-locale.sh') | |
876 | default_locale = run_command(choose_default_locale_sh).stdout().strip() | |
877 | else | |
878 | default_locale = 'C.UTF-8' | |
879 | endif | |
03475e22 | 880 | endif |
8ca9e92c DR |
881 | conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale) |
882 | ||
8f20232f | 883 | localegen_path = get_option('localegen-path') |
8f20232f MK |
884 | if localegen_path != '' |
885 | conf.set_quoted('LOCALEGEN_PATH', localegen_path) | |
8f20232f | 886 | endif |
71ae5ce5 | 887 | conf.set10('HAVE_LOCALEGEN', localegen_path != '') |
8f20232f | 888 | |
5c23128d ZJS |
889 | conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) |
890 | ||
21d0dd5a | 891 | service_watchdog = get_option('service-watchdog') |
7bc9ea51 | 892 | watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog |
059cc610 | 893 | conf.set_quoted('SERVICE_WATCHDOG', watchdog_value) |
21d0dd5a | 894 | |
059cc610 | 895 | conf.set_quoted('SUSHELL', get_option('debug-shell')) |
93912e87 | 896 | conf.set_quoted('DEBUGTTY', get_option('debug-tty')) |
3131bfe3 | 897 | |
349cc4a5 ZJS |
898 | enable_debug_hashmap = false |
899 | enable_debug_mmap_cache = false | |
d6601495 | 900 | enable_debug_siphash = false |
8f6b442a | 901 | foreach name : get_option('debug-extra') |
ad7aa760 YW |
902 | if name == 'hashmap' |
903 | enable_debug_hashmap = true | |
904 | elif name == 'mmap-cache' | |
905 | enable_debug_mmap_cache = true | |
d6601495 YW |
906 | elif name == 'siphash' |
907 | enable_debug_siphash = true | |
ad7aa760 YW |
908 | else |
909 | message('unknown debug option "@0@", ignoring'.format(name)) | |
910 | endif | |
911 | endforeach | |
349cc4a5 ZJS |
912 | conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap) |
913 | conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache) | |
d6601495 | 914 | conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash) |
671677da | 915 | |
d18cb393 | 916 | conf.set10('VALGRIND', get_option('valgrind')) |
fd5dec9a | 917 | conf.set10('LOG_TRACE', get_option('log-trace')) |
d18cb393 | 918 | |
3602ca6f ZJS |
919 | default_user_path = get_option('user-path') |
920 | if default_user_path != '' | |
921 | conf.set_quoted('DEFAULT_USER_PATH', default_user_path) | |
922 | endif | |
923 | ||
5bc655cd | 924 | |
5c23128d ZJS |
925 | ##################################################################### |
926 | ||
927 | threads = dependency('threads') | |
928 | librt = cc.find_library('rt') | |
929 | libm = cc.find_library('m') | |
930 | libdl = cc.find_library('dl') | |
931 | libcrypt = cc.find_library('crypt') | |
932 | ||
06ca077b | 933 | crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>''' |
e8644a41 | 934 | foreach ident : [ |
feee7f62 LB |
935 | ['crypt_ra', crypt_header], |
936 | ['crypt_preferred_method', crypt_header], | |
937 | ['crypt_gensalt_ra', crypt_header]] | |
e8644a41 ZJS |
938 | |
939 | have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE', | |
940 | dependencies : libcrypt) | |
941 | conf.set10('HAVE_' + ident[0].to_upper(), have) | |
942 | endforeach | |
943 | ||
1800cc85 ZJS |
944 | libcap = dependency('libcap', required : false) |
945 | if not libcap.found() | |
946 | # Compat with Ubuntu 14.04 which ships libcap w/o .pc file | |
947 | libcap = cc.find_library('cap') | |
948 | endif | |
949 | ||
7d861e12 JK |
950 | want_bpf_framework = get_option('bpf-framework') |
951 | bpf_framework_required = want_bpf_framework == 'true' | |
952 | ||
953 | libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2') | |
954 | conf.set10('HAVE_LIBBPF', libbpf.found()) | |
955 | ||
956 | if want_bpf_framework == 'false' | |
957 | conf.set10('BPF_FRAMEWORK', 0) | |
958 | else | |
959 | clang = find_program('clang', required : bpf_framework_required) | |
960 | llvm_strip = find_program('llvm-strip', required : bpf_framework_required) | |
68e101da ZJS |
961 | |
962 | # Debian installs this in /usr/sbin/ which is not in $PATH. | |
963 | # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian. | |
936cfad7 | 964 | bpftool = find_program('bpftool', '/usr/sbin/bpftool', required : bpf_framework_required) |
68e101da | 965 | |
7d861e12 JK |
966 | bpf_arches = ['x86_64'] |
967 | deps_found = libbpf.found() and clang.found() and llvm_strip.found() and bpftool.found() | |
968 | # Can build BPF program from source code in restricted C | |
969 | conf.set10('BPF_FRAMEWORK', | |
970 | bpf_arches.contains(host_machine.cpu_family()) and deps_found) | |
971 | endif | |
972 | ||
5c23128d | 973 | libmount = dependency('mount', |
c0b4b0f8 | 974 | version : fuzzer_build ? '>= 0' : '>= 2.30') |
5c23128d | 975 | |
e594a3b1 LP |
976 | want_libfdisk = get_option('fdisk') |
977 | if want_libfdisk != 'false' and not skip_deps | |
978 | libfdisk = dependency('fdisk', | |
e71f5585 | 979 | version : '>= 2.33', |
e594a3b1 LP |
980 | required : want_libfdisk == 'true') |
981 | have = libfdisk.found() | |
982 | else | |
983 | have = false | |
984 | libfdisk = [] | |
985 | endif | |
986 | conf.set10('HAVE_LIBFDISK', have) | |
987 | ||
70a5db58 LP |
988 | want_pwquality = get_option('pwquality') |
989 | if want_pwquality != 'false' and not skip_deps | |
990 | libpwquality = dependency('pwquality', required : want_pwquality == 'true') | |
991 | have = libpwquality.found() | |
992 | else | |
993 | have = false | |
994 | libpwquality = [] | |
995 | endif | |
996 | conf.set10('HAVE_PWQUALITY', have) | |
997 | ||
5c23128d | 998 | want_seccomp = get_option('seccomp') |
87ac55a1 | 999 | if want_seccomp != 'false' and not skip_deps |
37efbbd8 | 1000 | libseccomp = dependency('libseccomp', |
9f0e9c01 | 1001 | version : '>= 2.3.1', |
37efbbd8 | 1002 | required : want_seccomp == 'true') |
349cc4a5 | 1003 | have = libseccomp.found() |
5c23128d | 1004 | else |
349cc4a5 | 1005 | have = false |
37efbbd8 | 1006 | libseccomp = [] |
5c23128d | 1007 | endif |
349cc4a5 | 1008 | conf.set10('HAVE_SECCOMP', have) |
5c23128d ZJS |
1009 | |
1010 | want_selinux = get_option('selinux') | |
87ac55a1 | 1011 | if want_selinux != 'false' and not skip_deps |
37efbbd8 ZJS |
1012 | libselinux = dependency('libselinux', |
1013 | version : '>= 2.1.9', | |
1014 | required : want_selinux == 'true') | |
349cc4a5 | 1015 | have = libselinux.found() |
5c23128d | 1016 | else |
349cc4a5 | 1017 | have = false |
37efbbd8 | 1018 | libselinux = [] |
5c23128d | 1019 | endif |
349cc4a5 | 1020 | conf.set10('HAVE_SELINUX', have) |
5c23128d ZJS |
1021 | |
1022 | want_apparmor = get_option('apparmor') | |
87ac55a1 | 1023 | if want_apparmor != 'false' and not skip_deps |
37efbbd8 | 1024 | libapparmor = dependency('libapparmor', |
2ffadd3c | 1025 | version : '>= 2.13', |
37efbbd8 | 1026 | required : want_apparmor == 'true') |
349cc4a5 | 1027 | have = libapparmor.found() |
5c23128d | 1028 | else |
349cc4a5 | 1029 | have = false |
37efbbd8 | 1030 | libapparmor = [] |
5c23128d | 1031 | endif |
349cc4a5 | 1032 | conf.set10('HAVE_APPARMOR', have) |
5c23128d | 1033 | |
07b382cc ZJS |
1034 | have = get_option('smack') and get_option('smack-run-label') != '' |
1035 | conf.set10('HAVE_SMACK_RUN_LABEL', have) | |
1036 | if have | |
1037 | conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label')) | |
1038 | endif | |
5c23128d | 1039 | |
3ca0cb73 ZJS |
1040 | want_polkit = get_option('polkit') |
1041 | install_polkit = false | |
1042 | install_polkit_pkla = false | |
87ac55a1 | 1043 | if want_polkit != 'false' and not skip_deps |
37efbbd8 | 1044 | install_polkit = true |
3ca0cb73 | 1045 | |
37efbbd8 ZJS |
1046 | libpolkit = dependency('polkit-gobject-1', |
1047 | required : false) | |
1048 | if libpolkit.found() and libpolkit.version().version_compare('< 0.106') | |
1049 | message('Old polkit detected, will install pkla files') | |
1050 | install_polkit_pkla = true | |
1051 | endif | |
3ca0cb73 | 1052 | endif |
349cc4a5 | 1053 | conf.set10('ENABLE_POLKIT', install_polkit) |
3ca0cb73 | 1054 | |
36f0387e | 1055 | want_acl = get_option('acl') |
87ac55a1 | 1056 | if want_acl != 'false' and not skip_deps |
36f0387e | 1057 | libacl = cc.find_library('acl', required : want_acl == 'true') |
349cc4a5 | 1058 | have = libacl.found() |
36f0387e | 1059 | else |
349cc4a5 | 1060 | have = false |
36f0387e ZJS |
1061 | libacl = [] |
1062 | endif | |
349cc4a5 | 1063 | conf.set10('HAVE_ACL', have) |
36f0387e | 1064 | |
5c23128d | 1065 | want_audit = get_option('audit') |
87ac55a1 | 1066 | if want_audit != 'false' and not skip_deps |
37efbbd8 | 1067 | libaudit = dependency('audit', required : want_audit == 'true') |
349cc4a5 | 1068 | have = libaudit.found() |
5c23128d | 1069 | else |
349cc4a5 | 1070 | have = false |
37efbbd8 | 1071 | libaudit = [] |
5c23128d | 1072 | endif |
349cc4a5 | 1073 | conf.set10('HAVE_AUDIT', have) |
5c23128d ZJS |
1074 | |
1075 | want_blkid = get_option('blkid') | |
87ac55a1 | 1076 | if want_blkid != 'false' and not skip_deps |
37efbbd8 | 1077 | libblkid = dependency('blkid', required : want_blkid == 'true') |
349cc4a5 | 1078 | have = libblkid.found() |
4fcc033b KZ |
1079 | |
1080 | conf.set10('HAVE_BLKID_PROBE_SET_HINT', | |
1081 | have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid)) | |
5c23128d | 1082 | else |
349cc4a5 | 1083 | have = false |
37efbbd8 | 1084 | libblkid = [] |
5c23128d | 1085 | endif |
349cc4a5 | 1086 | conf.set10('HAVE_BLKID', have) |
5c23128d ZJS |
1087 | |
1088 | want_kmod = get_option('kmod') | |
87ac55a1 | 1089 | if want_kmod != 'false' and not skip_deps |
37efbbd8 ZJS |
1090 | libkmod = dependency('libkmod', |
1091 | version : '>= 15', | |
1092 | required : want_kmod == 'true') | |
349cc4a5 | 1093 | have = libkmod.found() |
5c23128d | 1094 | else |
349cc4a5 | 1095 | have = false |
37efbbd8 | 1096 | libkmod = [] |
5c23128d | 1097 | endif |
349cc4a5 | 1098 | conf.set10('HAVE_KMOD', have) |
5c23128d ZJS |
1099 | |
1100 | want_pam = get_option('pam') | |
87ac55a1 | 1101 | if want_pam != 'false' and not skip_deps |
37efbbd8 ZJS |
1102 | libpam = cc.find_library('pam', required : want_pam == 'true') |
1103 | libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true') | |
349cc4a5 | 1104 | have = libpam.found() and libpam_misc.found() |
5c23128d | 1105 | else |
349cc4a5 | 1106 | have = false |
37efbbd8 ZJS |
1107 | libpam = [] |
1108 | libpam_misc = [] | |
5c23128d | 1109 | endif |
349cc4a5 | 1110 | conf.set10('HAVE_PAM', have) |
5c23128d ZJS |
1111 | |
1112 | want_microhttpd = get_option('microhttpd') | |
87ac55a1 | 1113 | if want_microhttpd != 'false' and not skip_deps |
37efbbd8 ZJS |
1114 | libmicrohttpd = dependency('libmicrohttpd', |
1115 | version : '>= 0.9.33', | |
1116 | required : want_microhttpd == 'true') | |
349cc4a5 | 1117 | have = libmicrohttpd.found() |
5c23128d | 1118 | else |
349cc4a5 | 1119 | have = false |
37efbbd8 | 1120 | libmicrohttpd = [] |
5c23128d | 1121 | endif |
349cc4a5 | 1122 | conf.set10('HAVE_MICROHTTPD', have) |
5c23128d ZJS |
1123 | |
1124 | want_libcryptsetup = get_option('libcryptsetup') | |
d1ae38d8 OK |
1125 | want_libcryptsetup_plugins = get_option('libcryptsetup-plugins') |
1126 | ||
1127 | if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false' | |
1128 | error('libcryptsetup-plugins can not be requested without libcryptsetup') | |
1129 | endif | |
1130 | ||
87ac55a1 | 1131 | if want_libcryptsetup != 'false' and not skip_deps |
37efbbd8 | 1132 | libcryptsetup = dependency('libcryptsetup', |
d1ae38d8 OK |
1133 | version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1', |
1134 | required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true') | |
349cc4a5 | 1135 | have = libcryptsetup.found() |
70a5db58 LP |
1136 | |
1137 | conf.set10('HAVE_CRYPT_SET_METADATA_SIZE', | |
1138 | have and cc.has_function('crypt_set_metadata_size', dependencies : libcryptsetup)) | |
c2923fdc LB |
1139 | conf.set10('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', |
1140 | have and cc.has_function('crypt_activate_by_signed_key', dependencies : libcryptsetup)) | |
3c2c8e62 LB |
1141 | conf.set10('HAVE_CRYPT_TOKEN_MAX', |
1142 | have and cc.has_function('crypt_token_max', dependencies : libcryptsetup)) | |
5c23128d | 1143 | else |
349cc4a5 | 1144 | have = false |
37efbbd8 | 1145 | libcryptsetup = [] |
5c23128d | 1146 | endif |
349cc4a5 | 1147 | conf.set10('HAVE_LIBCRYPTSETUP', have) |
5c23128d | 1148 | |
d1ae38d8 OK |
1149 | if want_libcryptsetup_plugins != 'false' and not skip_deps |
1150 | have = (cc.has_function('crypt_activate_by_token_pin', dependencies : libcryptsetup) and | |
1151 | cc.has_function('crypt_token_external_path', dependencies : libcryptsetup)) | |
1152 | else | |
1153 | have = false | |
1154 | endif | |
1155 | conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have) | |
1156 | ||
5c23128d | 1157 | want_libcurl = get_option('libcurl') |
87ac55a1 | 1158 | if want_libcurl != 'false' and not skip_deps |
37efbbd8 ZJS |
1159 | libcurl = dependency('libcurl', |
1160 | version : '>= 7.32.0', | |
1161 | required : want_libcurl == 'true') | |
349cc4a5 | 1162 | have = libcurl.found() |
5c23128d | 1163 | else |
349cc4a5 | 1164 | have = false |
37efbbd8 | 1165 | libcurl = [] |
5c23128d | 1166 | endif |
349cc4a5 | 1167 | conf.set10('HAVE_LIBCURL', have) |
47350c5f | 1168 | conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1) |
5c23128d ZJS |
1169 | |
1170 | want_libidn = get_option('libidn') | |
87057e24 ZJS |
1171 | want_libidn2 = get_option('libidn2') |
1172 | if want_libidn == 'true' and want_libidn2 == 'true' | |
1173 | error('libidn and libidn2 cannot be requested simultaneously') | |
1174 | endif | |
1175 | ||
1b931399 YW |
1176 | if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps |
1177 | libidn = dependency('libidn2', | |
1178 | required : want_libidn2 == 'true') | |
349cc4a5 | 1179 | have = libidn.found() |
87057e24 | 1180 | else |
349cc4a5 | 1181 | have = false |
87057e24 ZJS |
1182 | libidn = [] |
1183 | endif | |
1b931399 YW |
1184 | conf.set10('HAVE_LIBIDN2', have) |
1185 | if not have and want_libidn != 'false' and not skip_deps | |
7f7ab228 | 1186 | # libidn is used for both libidn and libidn2 objects |
1b931399 YW |
1187 | libidn = dependency('libidn', |
1188 | required : want_libidn == 'true') | |
349cc4a5 ZJS |
1189 | have = libidn.found() |
1190 | else | |
1191 | have = false | |
5c23128d | 1192 | endif |
1b931399 | 1193 | conf.set10('HAVE_LIBIDN', have) |
5c23128d ZJS |
1194 | |
1195 | want_libiptc = get_option('libiptc') | |
87ac55a1 | 1196 | if want_libiptc != 'false' and not skip_deps |
37efbbd8 ZJS |
1197 | libiptc = dependency('libiptc', |
1198 | required : want_libiptc == 'true') | |
349cc4a5 | 1199 | have = libiptc.found() |
5c23128d | 1200 | else |
349cc4a5 | 1201 | have = false |
37efbbd8 | 1202 | libiptc = [] |
5c23128d | 1203 | endif |
349cc4a5 | 1204 | conf.set10('HAVE_LIBIPTC', have) |
5c23128d ZJS |
1205 | |
1206 | want_qrencode = get_option('qrencode') | |
87ac55a1 | 1207 | if want_qrencode != 'false' and not skip_deps |
37efbbd8 | 1208 | libqrencode = dependency('libqrencode', |
a6c7811f | 1209 | version : '>= 4', |
37efbbd8 | 1210 | required : want_qrencode == 'true') |
349cc4a5 | 1211 | have = libqrencode.found() |
5c23128d | 1212 | else |
349cc4a5 | 1213 | have = false |
37efbbd8 | 1214 | libqrencode = [] |
5c23128d | 1215 | endif |
349cc4a5 | 1216 | conf.set10('HAVE_QRENCODE', have) |
5c23128d | 1217 | |
a44fb601 | 1218 | want_gcrypt = get_option('gcrypt') |
87ac55a1 | 1219 | if want_gcrypt != 'false' and not skip_deps |
a44fb601 ZJS |
1220 | libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true') |
1221 | libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true') | |
349cc4a5 | 1222 | have = libgcrypt.found() and libgpg_error.found() |
a44fb601 | 1223 | else |
349cc4a5 ZJS |
1224 | have = false |
1225 | endif | |
1226 | if not have | |
1227 | # link to neither of the libs if one is not found | |
a44fb601 ZJS |
1228 | libgcrypt = [] |
1229 | libgpg_error = [] | |
1230 | endif | |
349cc4a5 | 1231 | conf.set10('HAVE_GCRYPT', have) |
a44fb601 | 1232 | |
5c23128d | 1233 | want_gnutls = get_option('gnutls') |
87ac55a1 | 1234 | if want_gnutls != 'false' and not skip_deps |
37efbbd8 ZJS |
1235 | libgnutls = dependency('gnutls', |
1236 | version : '>= 3.1.4', | |
1237 | required : want_gnutls == 'true') | |
349cc4a5 | 1238 | have = libgnutls.found() |
5c23128d | 1239 | else |
349cc4a5 | 1240 | have = false |
37efbbd8 | 1241 | libgnutls = [] |
5c23128d | 1242 | endif |
349cc4a5 | 1243 | conf.set10('HAVE_GNUTLS', have) |
5c23128d | 1244 | |
096cbdce | 1245 | want_openssl = get_option('openssl') |
87ac55a1 | 1246 | if want_openssl != 'false' and not skip_deps |
096cbdce IT |
1247 | libopenssl = dependency('openssl', |
1248 | version : '>= 1.1.0', | |
1249 | required : want_openssl == 'true') | |
1250 | have = libopenssl.found() | |
1251 | else | |
1252 | have = false | |
1253 | libopenssl = [] | |
1254 | endif | |
1255 | conf.set10('HAVE_OPENSSL', have) | |
1256 | ||
839fddbe LP |
1257 | want_p11kit = get_option('p11kit') |
1258 | if want_p11kit != 'false' and not skip_deps | |
1259 | libp11kit = dependency('p11-kit-1', | |
6164ec4c ZJS |
1260 | version : '>= 0.23.3', |
1261 | required : want_p11kit == 'true') | |
839fddbe LP |
1262 | have = libp11kit.found() |
1263 | else | |
1264 | have = false | |
1265 | libp11kit = [] | |
1266 | endif | |
1267 | conf.set10('HAVE_P11KIT', have) | |
1268 | ||
af4fbd46 LP |
1269 | want_libfido2 = get_option('libfido2') |
1270 | if want_libfido2 != 'false' and not skip_deps | |
1271 | libfido2 = dependency('libfido2', | |
1272 | required : want_libfido2 == 'true') | |
1273 | have = libfido2.found() | |
1274 | else | |
1275 | have = false | |
1276 | libfido2 = [] | |
1277 | endif | |
1278 | conf.set10('HAVE_LIBFIDO2', have) | |
1279 | ||
5e521624 LP |
1280 | want_tpm2 = get_option('tpm2') |
1281 | if want_tpm2 != 'false' and not skip_deps | |
1282 | tpm2 = dependency('tss2-esys tss2-rc tss2-mu', | |
ba081955 | 1283 | required : want_tpm2 == 'true') |
5e521624 LP |
1284 | have = tpm2.found() |
1285 | else | |
1286 | have = false | |
1287 | tpm2 = [] | |
1288 | endif | |
1289 | conf.set10('HAVE_TPM2', have) | |
1290 | ||
5c23128d | 1291 | want_elfutils = get_option('elfutils') |
87ac55a1 | 1292 | if want_elfutils != 'false' and not skip_deps |
37efbbd8 ZJS |
1293 | libdw = dependency('libdw', |
1294 | required : want_elfutils == 'true') | |
349cc4a5 | 1295 | have = libdw.found() |
5c23128d | 1296 | else |
349cc4a5 | 1297 | have = false |
37efbbd8 | 1298 | libdw = [] |
5c23128d | 1299 | endif |
349cc4a5 | 1300 | conf.set10('HAVE_ELFUTILS', have) |
5c23128d ZJS |
1301 | |
1302 | want_zlib = get_option('zlib') | |
87ac55a1 | 1303 | if want_zlib != 'false' and not skip_deps |
37efbbd8 ZJS |
1304 | libz = dependency('zlib', |
1305 | required : want_zlib == 'true') | |
349cc4a5 | 1306 | have = libz.found() |
5c23128d | 1307 | else |
349cc4a5 | 1308 | have = false |
37efbbd8 | 1309 | libz = [] |
5c23128d | 1310 | endif |
349cc4a5 | 1311 | conf.set10('HAVE_ZLIB', have) |
5c23128d ZJS |
1312 | |
1313 | want_bzip2 = get_option('bzip2') | |
87ac55a1 | 1314 | if want_bzip2 != 'false' and not skip_deps |
37efbbd8 ZJS |
1315 | libbzip2 = cc.find_library('bz2', |
1316 | required : want_bzip2 == 'true') | |
349cc4a5 | 1317 | have = libbzip2.found() |
5c23128d | 1318 | else |
349cc4a5 | 1319 | have = false |
37efbbd8 | 1320 | libbzip2 = [] |
5c23128d | 1321 | endif |
349cc4a5 | 1322 | conf.set10('HAVE_BZIP2', have) |
5c23128d ZJS |
1323 | |
1324 | want_xz = get_option('xz') | |
87ac55a1 | 1325 | if want_xz != 'false' and not skip_deps |
37efbbd8 ZJS |
1326 | libxz = dependency('liblzma', |
1327 | required : want_xz == 'true') | |
d80b051c | 1328 | have_xz = libxz.found() |
5c23128d | 1329 | else |
d80b051c | 1330 | have_xz = false |
37efbbd8 | 1331 | libxz = [] |
5c23128d | 1332 | endif |
d80b051c | 1333 | conf.set10('HAVE_XZ', have_xz) |
5c23128d ZJS |
1334 | |
1335 | want_lz4 = get_option('lz4') | |
87ac55a1 | 1336 | if want_lz4 != 'false' and not skip_deps |
37efbbd8 | 1337 | liblz4 = dependency('liblz4', |
e0a1d4b0 | 1338 | version : '>= 1.3.0', |
37efbbd8 | 1339 | required : want_lz4 == 'true') |
d80b051c | 1340 | have_lz4 = liblz4.found() |
5c23128d | 1341 | else |
d80b051c | 1342 | have_lz4 = false |
37efbbd8 | 1343 | liblz4 = [] |
5c23128d | 1344 | endif |
d80b051c | 1345 | conf.set10('HAVE_LZ4', have_lz4) |
5c23128d | 1346 | |
ef5924aa NL |
1347 | want_zstd = get_option('zstd') |
1348 | if want_zstd != 'false' and not skip_deps | |
1349 | libzstd = dependency('libzstd', | |
1350 | required : want_zstd == 'true', | |
1351 | version : '>= 1.4.0') | |
d80b051c | 1352 | have_zstd = libzstd.found() |
ef5924aa | 1353 | else |
d80b051c | 1354 | have_zstd = false |
ef5924aa NL |
1355 | libzstd = [] |
1356 | endif | |
d80b051c LP |
1357 | conf.set10('HAVE_ZSTD', have_zstd) |
1358 | ||
1359 | conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd) | |
ef5924aa | 1360 | |
a44fb601 | 1361 | want_xkbcommon = get_option('xkbcommon') |
87ac55a1 | 1362 | if want_xkbcommon != 'false' and not skip_deps |
a44fb601 ZJS |
1363 | libxkbcommon = dependency('xkbcommon', |
1364 | version : '>= 0.3.0', | |
1365 | required : want_xkbcommon == 'true') | |
349cc4a5 | 1366 | have = libxkbcommon.found() |
a44fb601 | 1367 | else |
349cc4a5 | 1368 | have = false |
a44fb601 ZJS |
1369 | libxkbcommon = [] |
1370 | endif | |
349cc4a5 | 1371 | conf.set10('HAVE_XKBCOMMON', have) |
a44fb601 | 1372 | |
c4c978a0 ZJS |
1373 | want_pcre2 = get_option('pcre2') |
1374 | if want_pcre2 != 'false' | |
1375 | libpcre2 = dependency('libpcre2-8', | |
1376 | required : want_pcre2 == 'true') | |
1377 | have = libpcre2.found() | |
1378 | else | |
1379 | have = false | |
1380 | libpcre2 = [] | |
1381 | endif | |
1382 | conf.set10('HAVE_PCRE2', have) | |
1383 | ||
69e96427 | 1384 | want_glib = get_option('glib') |
87ac55a1 | 1385 | if want_glib != 'false' and not skip_deps |
37efbbd8 ZJS |
1386 | libglib = dependency('glib-2.0', |
1387 | version : '>= 2.22.0', | |
1388 | required : want_glib == 'true') | |
1389 | libgobject = dependency('gobject-2.0', | |
1390 | version : '>= 2.22.0', | |
1391 | required : want_glib == 'true') | |
1392 | libgio = dependency('gio-2.0', | |
1393 | required : want_glib == 'true') | |
2c201c21 | 1394 | have = libglib.found() and libgobject.found() and libgio.found() |
69e96427 | 1395 | else |
349cc4a5 | 1396 | have = false |
37efbbd8 ZJS |
1397 | libglib = [] |
1398 | libgobject = [] | |
1399 | libgio = [] | |
69e96427 | 1400 | endif |
349cc4a5 | 1401 | conf.set10('HAVE_GLIB', have) |
69e96427 ZJS |
1402 | |
1403 | want_dbus = get_option('dbus') | |
87ac55a1 | 1404 | if want_dbus != 'false' and not skip_deps |
37efbbd8 ZJS |
1405 | libdbus = dependency('dbus-1', |
1406 | version : '>= 1.3.2', | |
1407 | required : want_dbus == 'true') | |
349cc4a5 | 1408 | have = libdbus.found() |
69e96427 | 1409 | else |
349cc4a5 | 1410 | have = false |
37efbbd8 | 1411 | libdbus = [] |
69e96427 | 1412 | endif |
349cc4a5 | 1413 | conf.set10('HAVE_DBUS', have) |
69e96427 | 1414 | |
42303dcb | 1415 | default_dnssec = get_option('default-dnssec') |
87ac55a1 | 1416 | if skip_deps |
b4081f3e JR |
1417 | default_dnssec = 'no' |
1418 | endif | |
349cc4a5 | 1419 | if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0 |
42303dcb YW |
1420 | message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.') |
1421 | default_dnssec = 'no' | |
1422 | endif | |
1423 | conf.set('DEFAULT_DNSSEC_MODE', | |
1424 | 'DNSSEC_' + default_dnssec.underscorify().to_upper()) | |
411d1f4c | 1425 | conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec) |
42303dcb | 1426 | |
56ddbf10 YW |
1427 | dns_over_tls = get_option('dns-over-tls') |
1428 | if dns_over_tls != 'false' | |
096cbdce IT |
1429 | if dns_over_tls == 'openssl' |
1430 | have_gnutls = false | |
1431 | else | |
38e053c5 | 1432 | have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0')) |
096cbdce IT |
1433 | if dns_over_tls == 'gnutls' and not have_gnutls |
1434 | error('DNS-over-TLS support was requested with gnutls, but dependencies are not available') | |
1435 | endif | |
56ddbf10 | 1436 | endif |
096cbdce IT |
1437 | if dns_over_tls == 'gnutls' or have_gnutls |
1438 | have_openssl = false | |
1439 | else | |
1440 | have_openssl = conf.get('HAVE_OPENSSL') == 1 | |
1441 | if dns_over_tls != 'auto' and not have_openssl | |
1442 | str = dns_over_tls == 'openssl' ? ' with openssl' : '' | |
b349bc59 | 1443 | error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str)) |
096cbdce IT |
1444 | endif |
1445 | endif | |
1446 | have = have_gnutls or have_openssl | |
56ddbf10 | 1447 | else |
be5536a6 MO |
1448 | have = false |
1449 | have_gnutls = false | |
1450 | have_openssl = false | |
56ddbf10 YW |
1451 | endif |
1452 | conf.set10('ENABLE_DNS_OVER_TLS', have) | |
096cbdce IT |
1453 | conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls) |
1454 | conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl) | |
56ddbf10 | 1455 | |
c9299be2 | 1456 | default_dns_over_tls = get_option('default-dns-over-tls') |
87ac55a1 | 1457 | if skip_deps |
c9299be2 | 1458 | default_dns_over_tls = 'no' |
5d67a7ae | 1459 | endif |
56ddbf10 | 1460 | if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0 |
4310bfc2 | 1461 | message('default-dns-over-tls cannot be enabled or set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.') |
c9299be2 | 1462 | default_dns_over_tls = 'no' |
5d67a7ae | 1463 | endif |
c9299be2 IT |
1464 | conf.set('DEFAULT_DNS_OVER_TLS_MODE', |
1465 | 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper()) | |
411d1f4c | 1466 | conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls) |
5d67a7ae | 1467 | |
3614df05 ZJS |
1468 | default_mdns = get_option('default-mdns') |
1469 | conf.set('DEFAULT_MDNS_MODE', | |
1470 | 'RESOLVE_SUPPORT_' + default_mdns.to_upper()) | |
411d1f4c | 1471 | conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns) |
3614df05 ZJS |
1472 | |
1473 | default_llmnr = get_option('default-llmnr') | |
1474 | conf.set('DEFAULT_LLMNR_MODE', | |
1475 | 'RESOLVE_SUPPORT_' + default_llmnr.to_upper()) | |
411d1f4c | 1476 | conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr) |
3614df05 | 1477 | |
e594a3b1 LP |
1478 | want_repart = get_option('repart') |
1479 | if want_repart != 'false' | |
1480 | have = (conf.get('HAVE_OPENSSL') == 1 and | |
1481 | conf.get('HAVE_LIBFDISK') == 1) | |
1482 | if want_repart == 'true' and not have | |
1483 | error('repart support was requested, but dependencies are not available') | |
1484 | endif | |
1485 | else | |
1486 | have = false | |
1487 | endif | |
1488 | conf.set10('ENABLE_REPART', have) | |
1489 | ||
5c23128d | 1490 | want_importd = get_option('importd') |
4390be30 | 1491 | if want_importd != 'false' |
349cc4a5 ZJS |
1492 | have = (conf.get('HAVE_LIBCURL') == 1 and |
1493 | conf.get('HAVE_ZLIB') == 1 and | |
349cc4a5 ZJS |
1494 | conf.get('HAVE_XZ') == 1 and |
1495 | conf.get('HAVE_GCRYPT') == 1) | |
1496 | if want_importd == 'true' and not have | |
37efbbd8 ZJS |
1497 | error('importd support was requested, but dependencies are not available') |
1498 | endif | |
349cc4a5 ZJS |
1499 | else |
1500 | have = false | |
5c23128d | 1501 | endif |
349cc4a5 | 1502 | conf.set10('ENABLE_IMPORTD', have) |
5c23128d | 1503 | |
70a5db58 LP |
1504 | want_homed = get_option('homed') |
1505 | if want_homed != 'false' | |
1506 | have = (conf.get('HAVE_OPENSSL') == 1 and | |
1507 | conf.get('HAVE_LIBFDISK') == 1 and | |
1508 | conf.get('HAVE_LIBCRYPTSETUP') == 1) | |
1509 | if want_homed == 'true' and not have | |
1510 | error('homed support was requested, but dependencies are not available') | |
1511 | endif | |
1512 | else | |
1513 | have = false | |
1514 | endif | |
1515 | conf.set10('ENABLE_HOMED', have) | |
1516 | ||
af06ddf5 YW |
1517 | have = have and conf.get('HAVE_PAM') == 1 |
1518 | conf.set10('ENABLE_PAM_HOME', have) | |
1519 | ||
d58c5f0f | 1520 | have = get_option('oomd') |
c199dd3f AZ |
1521 | conf.set10('ENABLE_OOMD', have) |
1522 | ||
5c23128d | 1523 | want_remote = get_option('remote') |
4390be30 | 1524 | if want_remote != 'false' |
349cc4a5 ZJS |
1525 | have_deps = [conf.get('HAVE_MICROHTTPD') == 1, |
1526 | conf.get('HAVE_LIBCURL') == 1] | |
37efbbd8 ZJS |
1527 | # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so |
1528 | # it's possible to build one without the other. Complain only if | |
5238e957 | 1529 | # support was explicitly requested. The auxiliary files like sysusers |
37efbbd8 ZJS |
1530 | # config should be installed when any of the programs are built. |
1531 | if want_remote == 'true' and not (have_deps[0] and have_deps[1]) | |
1532 | error('remote support was requested, but dependencies are not available') | |
1533 | endif | |
349cc4a5 ZJS |
1534 | have = have_deps[0] or have_deps[1] |
1535 | else | |
1536 | have = false | |
5c23128d | 1537 | endif |
349cc4a5 | 1538 | conf.set10('ENABLE_REMOTE', have) |
5c23128d | 1539 | |
b3259a6e ZJS |
1540 | foreach term : ['analyze', |
1541 | 'backlight', | |
a9149d87 ZJS |
1542 | 'binfmt', |
1543 | 'coredump', | |
b3259a6e ZJS |
1544 | 'efi', |
1545 | 'environment-d', | |
1546 | 'firstboot', | |
1547 | 'gshadow', | |
1548 | 'hibernate', | |
a9149d87 | 1549 | 'hostnamed', |
b3259a6e ZJS |
1550 | 'hwdb', |
1551 | 'idn', | |
1552 | 'ima', | |
1553 | 'initrd', | |
53393c89 | 1554 | 'compat-mutable-uid-boundaries', |
7e0079f9 | 1555 | 'nscd', |
b3259a6e | 1556 | 'ldconfig', |
a9149d87 | 1557 | 'localed', |
b3259a6e | 1558 | 'logind', |
a9149d87 ZJS |
1559 | 'machined', |
1560 | 'networkd', | |
b3259a6e ZJS |
1561 | 'nss-myhostname', |
1562 | 'nss-systemd', | |
1563 | 'portabled', | |
9bca4ae4 | 1564 | 'sysext', |
b3259a6e | 1565 | 'pstore', |
a9149d87 | 1566 | 'quotacheck', |
b3259a6e ZJS |
1567 | 'randomseed', |
1568 | 'resolve', | |
1569 | 'rfkill', | |
1570 | 'smack', | |
a9149d87 | 1571 | 'sysusers', |
b3259a6e ZJS |
1572 | 'timedated', |
1573 | 'timesyncd', | |
a9149d87 | 1574 | 'tmpfiles', |
a9149d87 | 1575 | 'tpm', |
b3259a6e ZJS |
1576 | 'userdb', |
1577 | 'utmp', | |
1578 | 'vconsole', | |
1579 | 'xdg-autostart'] | |
a9149d87 ZJS |
1580 | have = get_option(term) |
1581 | name = 'ENABLE_' + term.underscorify().to_upper() | |
1582 | conf.set10(name, have) | |
5c23128d ZJS |
1583 | endforeach |
1584 | ||
bd7e6aa7 ZJS |
1585 | enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1 |
1586 | ||
08540a95 YW |
1587 | foreach tuple : [['nss-mymachines', 'machined'], |
1588 | ['nss-resolve', 'resolve']] | |
1589 | want = get_option(tuple[0]) | |
1590 | if want != 'false' | |
1591 | have = get_option(tuple[1]) | |
1592 | if want == 'true' and not have | |
1593 | error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1])) | |
1594 | endif | |
1595 | else | |
1596 | have = false | |
1597 | endif | |
1598 | name = 'ENABLE_' + tuple[0].underscorify().to_upper() | |
1599 | conf.set10(name, have) | |
1600 | endforeach | |
1601 | ||
1602 | enable_nss = false | |
1603 | foreach term : ['ENABLE_NSS_MYHOSTNAME', | |
1604 | 'ENABLE_NSS_MYMACHINES', | |
1605 | 'ENABLE_NSS_RESOLVE', | |
1606 | 'ENABLE_NSS_SYSTEMD'] | |
1607 | if conf.get(term) == 1 | |
1608 | enable_nss = true | |
1609 | endif | |
1610 | endforeach | |
1611 | conf.set10('ENABLE_NSS', enable_nss) | |
1612 | ||
348b4437 | 1613 | conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd')) |
6129ec85 | 1614 | |
b68dfb9e | 1615 | conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests) |
00d82c81 | 1616 | |
5c23128d ZJS |
1617 | ##################################################################### |
1618 | ||
1619 | if get_option('efi') | |
37efbbd8 | 1620 | efi_arch = host_machine.cpu_family() |
b710072d | 1621 | |
6800fe7f | 1622 | if efi_arch == 'x86' |
37efbbd8 | 1623 | EFI_MACHINE_TYPE_NAME = 'ia32' |
6800fe7f | 1624 | gnu_efi_arch = 'ia32' |
37efbbd8 ZJS |
1625 | elif efi_arch == 'x86_64' |
1626 | EFI_MACHINE_TYPE_NAME = 'x64' | |
6800fe7f | 1627 | gnu_efi_arch = 'x86_64' |
37efbbd8 ZJS |
1628 | elif efi_arch == 'arm' |
1629 | EFI_MACHINE_TYPE_NAME = 'arm' | |
6800fe7f | 1630 | gnu_efi_arch = 'arm' |
37efbbd8 ZJS |
1631 | elif efi_arch == 'aarch64' |
1632 | EFI_MACHINE_TYPE_NAME = 'aa64' | |
6800fe7f | 1633 | gnu_efi_arch = 'aarch64' |
a00ff2e1 ERB |
1634 | elif efi_arch == 'riscv64' |
1635 | EFI_MACHINE_TYPE_NAME = 'riscv64' | |
1636 | gnu_efi_arch = 'riscv64' | |
37efbbd8 ZJS |
1637 | else |
1638 | EFI_MACHINE_TYPE_NAME = '' | |
6800fe7f | 1639 | gnu_efi_arch = '' |
37efbbd8 | 1640 | endif |
5c23128d | 1641 | |
349cc4a5 | 1642 | have = true |
37efbbd8 | 1643 | conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME) |
349cc4a5 ZJS |
1644 | else |
1645 | have = false | |
5c23128d | 1646 | endif |
349cc4a5 | 1647 | conf.set10('ENABLE_EFI', have) |
5c23128d | 1648 | |
34357545 MS |
1649 | subdir('src/fundamental') |
1650 | subdir('src/boot/efi') | |
1651 | conf.set10('HAVE_GNU_EFI', have_gnu_efi) | |
1652 | ||
f6fe732f YW |
1653 | ############################################################ |
1654 | ||
7d861e12 | 1655 | build_bpf_skel_py = find_program('tools/build-bpf-skel.py') |
d3821a33 | 1656 | generate_gperfs = find_program('tools/generate-gperfs.py') |
f6fe732f YW |
1657 | make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py') |
1658 | make_directive_index_py = find_program('tools/make-directive-index.py') | |
1659 | make_man_index_py = find_program('tools/make-man-index.py') | |
6b1aac3c | 1660 | meson_render_jinja2 = find_program('tools/meson-render-jinja2.py') |
d3821a33 ZJS |
1661 | update_dbus_docs_py = find_program('tools/update-dbus-docs.py') |
1662 | update_hwdb_sh = find_program('tools/update-hwdb.sh') | |
1663 | update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh') | |
1664 | update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh') | |
1665 | xml_helper_py = find_program('tools/xml_helper.py') | |
f6fe732f | 1666 | |
5c23128d ZJS |
1667 | ##################################################################### |
1668 | ||
1669 | config_h = configure_file( | |
37efbbd8 ZJS |
1670 | output : 'config.h', |
1671 | configuration : conf) | |
5c23128d | 1672 | |
f6fe732f YW |
1673 | add_project_arguments('-include', 'config.h', language : 'c') |
1674 | ||
1675 | ############################################################ | |
348b4437 | 1676 | |
b61016f2 YW |
1677 | # binaries that have --help and are intended for use by humans, |
1678 | # usually, but not always, installed in /bin. | |
1679 | public_programs = [] | |
1680 | ||
1681 | tests = [] | |
1682 | fuzzers = [] | |
1683 | ||
8d40961c YW |
1684 | basic_includes = include_directories( |
1685 | 'src/basic', | |
e5bc5f1f | 1686 | 'src/fundamental', |
8d40961c YW |
1687 | 'src/systemd', |
1688 | '.') | |
1689 | ||
1690 | libsystemd_includes = [basic_includes, include_directories( | |
1691 | 'src/libsystemd/sd-bus', | |
1692 | 'src/libsystemd/sd-device', | |
1693 | 'src/libsystemd/sd-event', | |
1694 | 'src/libsystemd/sd-hwdb', | |
1695 | 'src/libsystemd/sd-id128', | |
1696 | 'src/libsystemd/sd-journal', | |
1697 | 'src/libsystemd/sd-netlink', | |
1698 | 'src/libsystemd/sd-network', | |
1699 | 'src/libsystemd/sd-resolve')] | |
1700 | ||
1701 | includes = [libsystemd_includes, include_directories('src/shared')] | |
5c23128d | 1702 | |
5c23128d ZJS |
1703 | subdir('po') |
1704 | subdir('catalog') | |
5c23128d ZJS |
1705 | subdir('src/basic') |
1706 | subdir('src/libsystemd') | |
3976f372 YW |
1707 | subdir('src/shared') |
1708 | subdir('src/udev') | |
1709 | subdir('src/libudev') | |
d1ae38d8 | 1710 | subdir('src/cryptsetup/cryptsetup-tokens') |
5c23128d | 1711 | |
5c23128d | 1712 | libsystemd = shared_library( |
37efbbd8 | 1713 | 'systemd', |
a5d8835c | 1714 | disable_mempool_c, |
56d50ab1 | 1715 | version : libsystemd_version, |
8d40961c | 1716 | include_directories : libsystemd_includes, |
37efbbd8 ZJS |
1717 | link_args : ['-shared', |
1718 | '-Wl,--version-script=' + libsystemd_sym_path], | |
34e221a5 ZJS |
1719 | link_with : [libbasic, |
1720 | libbasic_gcrypt], | |
99b9f8fd | 1721 | link_whole : [libsystemd_static], |
37efbbd8 ZJS |
1722 | dependencies : [threads, |
1723 | librt, | |
1724 | libxz, | |
ef5924aa | 1725 | libzstd, |
37efbbd8 ZJS |
1726 | liblz4], |
1727 | link_depends : libsystemd_sym, | |
1728 | install : true, | |
1729 | install_dir : rootlibdir) | |
5c23128d | 1730 | |
70848ecf DC |
1731 | install_libsystemd_static = static_library( |
1732 | 'systemd', | |
1733 | libsystemd_sources, | |
975464e0 ZJS |
1734 | basic_sources, |
1735 | basic_gcrypt_sources, | |
e5bc5f1f | 1736 | fundamental_sources, |
be44b572 | 1737 | disable_mempool_c, |
8d40961c | 1738 | include_directories : libsystemd_includes, |
70848ecf DC |
1739 | build_by_default : static_libsystemd != 'false', |
1740 | install : static_libsystemd != 'false', | |
1741 | install_dir : rootlibdir, | |
40dbce36 | 1742 | pic : static_libsystemd_pic, |
70848ecf DC |
1743 | dependencies : [threads, |
1744 | librt, | |
1745 | libxz, | |
ef5924aa | 1746 | libzstd, |
70848ecf | 1747 | liblz4, |
c5fd89ad | 1748 | libdl, |
975464e0 ZJS |
1749 | libcap, |
1750 | libblkid, | |
1751 | libmount, | |
011d129c LP |
1752 | libgcrypt, |
1753 | libopenssl], | |
70848ecf DC |
1754 | c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC'])) |
1755 | ||
3976f372 YW |
1756 | libudev = shared_library( |
1757 | 'udev', | |
1758 | disable_mempool_c, | |
1759 | version : libudev_version, | |
1760 | include_directories : includes, | |
1761 | link_args : ['-shared', | |
1762 | '-Wl,--version-script=' + libudev_sym_path], | |
1763 | link_with : [libsystemd_static, libshared_static], | |
1764 | link_whole : libudev_basic, | |
1765 | dependencies : [threads], | |
1766 | link_depends : libudev_sym, | |
1767 | install : true, | |
1768 | install_dir : rootlibdir) | |
1769 | ||
1770 | install_libudev_static = static_library( | |
1771 | 'udev', | |
1772 | basic_sources, | |
e5bc5f1f | 1773 | fundamental_sources, |
3976f372 YW |
1774 | shared_sources, |
1775 | libsystemd_sources, | |
1776 | libudev_sources, | |
1777 | disable_mempool_c, | |
1778 | include_directories : includes, | |
1779 | build_by_default : static_libudev != 'false', | |
1780 | install : static_libudev != 'false', | |
1781 | install_dir : rootlibdir, | |
1782 | link_depends : libudev_sym, | |
1783 | dependencies : libshared_deps + [libmount], | |
1784 | c_args : static_libudev_pic ? [] : ['-fno-PIC'], | |
1785 | pic : static_libudev_pic) | |
1786 | ||
d1ae38d8 OK |
1787 | if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1 |
1788 | if conf.get('HAVE_TPM2') == 1 | |
1789 | cryptsetup_token_systemd_tpm2 = shared_library( | |
1790 | 'cryptsetup-token-systemd-tpm2', | |
1791 | link_args : ['-shared', | |
1792 | '-Wl,--version-script=' + cryptsetup_token_sym_path], | |
99c645b8 | 1793 | dependencies : libshared_deps + [libcryptsetup, versiondep], |
d1ae38d8 OK |
1794 | link_with : [libshared], |
1795 | link_whole : [cryptsetup_token_systemd_tpm2_static], | |
1796 | link_depends : cryptsetup_token_sym, | |
1797 | install_rpath : rootlibexecdir, | |
1798 | install : true, | |
1799 | install_dir : libcryptsetup_plugins_dir) | |
1800 | endif | |
351716e1 OK |
1801 | |
1802 | if conf.get('HAVE_LIBFIDO2') == 1 | |
1803 | cryptsetup_token_systemd_fido2 = shared_library( | |
1804 | 'cryptsetup-token-systemd-fido2', | |
1805 | link_args : ['-shared', | |
1806 | '-Wl,--version-script=' + cryptsetup_token_sym_path], | |
1807 | dependencies : libshared_deps + [libcryptsetup, versiondep], | |
1808 | link_with : [libshared], | |
1809 | link_whole : [cryptsetup_token_systemd_fido2_static], | |
1810 | link_depends : cryptsetup_token_sym, | |
1811 | install_rpath : rootlibexecdir, | |
1812 | install : true, | |
1813 | install_dir : libcryptsetup_plugins_dir) | |
1814 | endif | |
8186022c OK |
1815 | |
1816 | if conf.get('HAVE_P11KIT') == 1 | |
1817 | cryptsetup_token_systemd_pkcs11 = shared_library( | |
1818 | 'cryptsetup-token-systemd-pkcs11', | |
1819 | link_args : ['-shared', | |
1820 | '-Wl,--version-script=' + cryptsetup_token_sym_path], | |
1821 | dependencies : libshared_deps + [libcryptsetup, versiondep], | |
1822 | link_with : [libshared], | |
1823 | link_whole : [cryptsetup_token_systemd_pkcs11_static], | |
1824 | link_depends : cryptsetup_token_sym, | |
1825 | install_rpath : rootlibexecdir, | |
1826 | install : true, | |
1827 | install_dir : libcryptsetup_plugins_dir) | |
1828 | endif | |
d1ae38d8 OK |
1829 | endif |
1830 | ||
47354b44 ZJS |
1831 | ############################################################ |
1832 | ||
b61016f2 | 1833 | # systemd-analyze requires 'libcore' |
83b6af36 | 1834 | subdir('src/core') |
b61016f2 YW |
1835 | # systemd-journal-remote requires 'libjournal_core' |
1836 | subdir('src/journal') | |
1837 | # systemd-networkd requires 'libsystemd_network' | |
1838 | subdir('src/libsystemd-network') | |
83b6af36 ZJS |
1839 | |
1840 | subdir('src/analyze') | |
f98df767 | 1841 | subdir('src/busctl') |
b61016f2 | 1842 | subdir('src/coredump') |
2ad279cf | 1843 | subdir('src/cryptenroll') |
b4d1892a | 1844 | subdir('src/cryptsetup') |
b61016f2 | 1845 | subdir('src/home') |
83b6af36 ZJS |
1846 | subdir('src/hostname') |
1847 | subdir('src/import') | |
b61016f2 | 1848 | subdir('src/journal-remote') |
83b6af36 ZJS |
1849 | subdir('src/kernel-install') |
1850 | subdir('src/locale') | |
b61016f2 | 1851 | subdir('src/login') |
83b6af36 | 1852 | subdir('src/machine') |
b61016f2 | 1853 | subdir('src/network') |
83b6af36 | 1854 | subdir('src/nspawn') |
b61016f2 YW |
1855 | subdir('src/oom') |
1856 | subdir('src/partition') | |
1857 | subdir('src/portable') | |
1858 | subdir('src/pstore') | |
83b6af36 | 1859 | subdir('src/resolve') |
2a9b4bbe | 1860 | subdir('src/rpm') |
b61016f2 | 1861 | subdir('src/shutdown') |
9bca4ae4 | 1862 | subdir('src/sysext') |
c3512573 | 1863 | subdir('src/systemctl') |
83b6af36 ZJS |
1864 | subdir('src/timedate') |
1865 | subdir('src/timesync') | |
db64ba81 | 1866 | subdir('src/tmpfiles') |
b61016f2 | 1867 | subdir('src/userdb') |
83b6af36 | 1868 | subdir('src/vconsole') |
0275e918 | 1869 | subdir('src/xdg-autostart-generator') |
83b6af36 | 1870 | |
3976f372 YW |
1871 | subdir('src/systemd') |
1872 | ||
83b6af36 | 1873 | subdir('src/test') |
7db7d5b7 | 1874 | subdir('src/fuzz') |
ef2ad30a | 1875 | subdir('rules.d') |
83b6af36 ZJS |
1876 | subdir('test') |
1877 | ||
1878 | ############################################################ | |
1879 | ||
1880 | # only static linking apart from libdl, to make sure that the | |
1881 | # module is linked to all libraries that it uses. | |
1882 | test_dlopen = executable( | |
37efbbd8 ZJS |
1883 | 'test-dlopen', |
1884 | test_dlopen_c, | |
a5d8835c | 1885 | disable_mempool_c, |
37efbbd8 ZJS |
1886 | include_directories : includes, |
1887 | link_with : [libbasic], | |
fd1939fb YW |
1888 | dependencies : [libdl], |
1889 | build_by_default : want_tests != 'false') | |
83b6af36 | 1890 | |
08540a95 | 1891 | foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'], |
cbaaf7b9 | 1892 | ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']], |
08540a95 | 1893 | ['mymachines', 'ENABLE_NSS_MYMACHINES'], |
8d40961c | 1894 | ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]] |
5c23128d | 1895 | |
349cc4a5 | 1896 | condition = tuple[1] == '' or conf.get(tuple[1]) == 1 |
37efbbd8 ZJS |
1897 | if condition |
1898 | module = tuple[0] | |
37efbbd8 ZJS |
1899 | |
1900 | sym = 'src/nss-@0@/nss-@0@.sym'.format(module) | |
fce9abb2 | 1901 | version_script_arg = project_source_root / sym |
37efbbd8 | 1902 | |
1684c56f LP |
1903 | sources = ['src/nss-@0@/nss-@0@.c'.format(module)] |
1904 | if tuple.length() > 2 | |
cbaaf7b9 YW |
1905 | foreach s : tuple[2] |
1906 | sources += ['src/nss-@0@/@1@'.format(module, s)] | |
1907 | endforeach | |
1684c56f LP |
1908 | endif |
1909 | ||
8d40961c YW |
1910 | incs = tuple.length() > 3 ? tuple[3] : includes |
1911 | ||
37efbbd8 ZJS |
1912 | nss = shared_library( |
1913 | 'nss_' + module, | |
1684c56f | 1914 | sources, |
a5d8835c | 1915 | disable_mempool_c, |
37efbbd8 | 1916 | version : '2', |
8d40961c | 1917 | include_directories : incs, |
b4b36f44 LP |
1918 | # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned |
1919 | link_args : ['-Wl,-z,nodelete', | |
1920 | '-shared', | |
700805f6 | 1921 | '-Wl,--version-script=' + version_script_arg], |
37e4d7a8 | 1922 | link_with : [libsystemd_static, |
733cbd00 | 1923 | libshared_static, |
37efbbd8 ZJS |
1924 | libbasic], |
1925 | dependencies : [threads, | |
5486a31d | 1926 | librt], |
37efbbd8 ZJS |
1927 | link_depends : sym, |
1928 | install : true, | |
1929 | install_dir : rootlibdir) | |
1930 | ||
1931 | # We cannot use shared_module because it does not support version suffix. | |
1932 | # Unfortunately shared_library insists on creating the symlink… | |
7c22f07c | 1933 | meson.add_install_script('sh', '-c', |
37efbbd8 ZJS |
1934 | 'rm $DESTDIR@0@/libnss_@1@.so' |
1935 | .format(rootlibdir, module)) | |
1936 | ||
938be089 ZJS |
1937 | if want_tests != 'false' |
1938 | test('dlopen-nss_' + module, | |
1939 | test_dlopen, | |
1940 | # path to dlopen must include a slash | |
1941 | args : nss.full_path()) | |
1942 | endif | |
37efbbd8 | 1943 | endif |
5c23128d ZJS |
1944 | endforeach |
1945 | ||
1946 | ############################################################ | |
1947 | ||
6164ec4c ZJS |
1948 | executable( |
1949 | 'systemd', | |
1950 | systemd_sources, | |
1951 | include_directories : includes, | |
1952 | link_with : [libcore, | |
1953 | libshared], | |
1954 | dependencies : [versiondep, | |
1955 | threads, | |
1956 | librt, | |
1957 | libseccomp, | |
1958 | libselinux, | |
1959 | libmount, | |
1960 | libblkid], | |
1961 | install_rpath : rootlibexecdir, | |
1962 | install : true, | |
1963 | install_dir : rootlibexecdir) | |
5c23128d | 1964 | |
ba7f4ae6 | 1965 | meson.add_install_script(meson_make_symlink, |
fce9abb2 ZJS |
1966 | rootlibexecdir / 'systemd', |
1967 | rootsbindir / 'init') | |
ba7f4ae6 | 1968 | |
6164ec4c ZJS |
1969 | public_programs += executable( |
1970 | 'systemd-analyze', | |
1971 | systemd_analyze_sources, | |
8d40961c | 1972 | include_directories : core_includes, |
6164ec4c ZJS |
1973 | link_with : [libcore, |
1974 | libshared], | |
1975 | dependencies : [versiondep, | |
1976 | threads, | |
1977 | librt, | |
1978 | libseccomp, | |
1979 | libselinux, | |
1980 | libmount, | |
1981 | libblkid], | |
1982 | install_rpath : rootlibexecdir, | |
b3259a6e | 1983 | install : conf.get('ENABLE_ANALYZE')) |
5c23128d | 1984 | |
6164ec4c ZJS |
1985 | executable( |
1986 | 'systemd-journald', | |
1987 | systemd_journald_sources, | |
1988 | include_directories : includes, | |
1989 | link_with : [libjournal_core, | |
1990 | libshared], | |
1991 | dependencies : [threads, | |
1992 | libxz, | |
1993 | liblz4, | |
ef5924aa NL |
1994 | libselinux, |
1995 | libzstd], | |
6164ec4c ZJS |
1996 | install_rpath : rootlibexecdir, |
1997 | install : true, | |
1998 | install_dir : rootlibexecdir) | |
5c23128d | 1999 | |
6164ec4c ZJS |
2000 | public_programs += executable( |
2001 | 'systemd-cat', | |
2002 | systemd_cat_sources, | |
2003 | include_directories : includes, | |
2004 | link_with : [libjournal_core, | |
2005 | libshared], | |
2006 | dependencies : [threads], | |
2007 | install_rpath : rootlibexecdir, | |
2008 | install : true) | |
2009 | ||
2010 | public_programs += executable( | |
2011 | 'journalctl', | |
2012 | journalctl_sources, | |
2013 | include_directories : includes, | |
2014 | link_with : [libshared], | |
2015 | dependencies : [threads, | |
e44b5004 | 2016 | libdl, |
6164ec4c ZJS |
2017 | libxz, |
2018 | liblz4, | |
9200bb30 LP |
2019 | libzstd, |
2020 | libdl], | |
6164ec4c ZJS |
2021 | install_rpath : rootlibexecdir, |
2022 | install : true, | |
2023 | install_dir : rootbindir) | |
35a1ff4c | 2024 | |
6164ec4c ZJS |
2025 | executable( |
2026 | 'systemd-getty-generator', | |
2027 | 'src/getty-generator/getty-generator.c', | |
2028 | include_directories : includes, | |
2029 | link_with : [libshared], | |
2030 | install_rpath : rootlibexecdir, | |
2031 | install : true, | |
2032 | install_dir : systemgeneratordir) | |
5c23128d | 2033 | |
6164ec4c ZJS |
2034 | executable( |
2035 | 'systemd-debug-generator', | |
2036 | 'src/debug-generator/debug-generator.c', | |
2037 | include_directories : includes, | |
2038 | link_with : [libshared], | |
2039 | install_rpath : rootlibexecdir, | |
2040 | install : true, | |
2041 | install_dir : systemgeneratordir) | |
2042 | ||
2043 | executable( | |
2044 | 'systemd-run-generator', | |
2045 | 'src/run-generator/run-generator.c', | |
2046 | include_directories : includes, | |
2047 | link_with : [libshared], | |
2048 | install_rpath : rootlibexecdir, | |
2049 | install : true, | |
2050 | install_dir : systemgeneratordir) | |
2051 | ||
2052 | executable( | |
2053 | 'systemd-fstab-generator', | |
2054 | 'src/fstab-generator/fstab-generator.c', | |
2055 | include_directories : includes, | |
bac11cd6 | 2056 | link_with : [libshared], |
6164ec4c ZJS |
2057 | install_rpath : rootlibexecdir, |
2058 | install : true, | |
2059 | install_dir : systemgeneratordir) | |
5c23128d | 2060 | |
349cc4a5 | 2061 | if conf.get('ENABLE_ENVIRONMENT_D') == 1 |
6164ec4c ZJS |
2062 | executable( |
2063 | '30-systemd-environment-d-generator', | |
2064 | 'src/environment-d-generator/environment-d-generator.c', | |
2065 | include_directories : includes, | |
2066 | link_with : [libshared], | |
2067 | install_rpath : rootlibexecdir, | |
2068 | install : true, | |
2069 | install_dir : userenvgeneratordir) | |
7b76fce1 | 2070 | |
37efbbd8 | 2071 | meson.add_install_script(meson_make_symlink, |
fce9abb2 ZJS |
2072 | sysconfdir / 'environment', |
2073 | environmentdir / '99-environment.conf') | |
5c23128d ZJS |
2074 | endif |
2075 | ||
349cc4a5 | 2076 | if conf.get('ENABLE_HIBERNATE') == 1 |
6164ec4c ZJS |
2077 | executable( |
2078 | 'systemd-hibernate-resume-generator', | |
2079 | 'src/hibernate-resume/hibernate-resume-generator.c', | |
2080 | include_directories : includes, | |
2081 | link_with : [libshared], | |
2082 | install_rpath : rootlibexecdir, | |
2083 | install : true, | |
2084 | install_dir : systemgeneratordir) | |
2085 | ||
2086 | executable( | |
2087 | 'systemd-hibernate-resume', | |
2088 | 'src/hibernate-resume/hibernate-resume.c', | |
2089 | include_directories : includes, | |
2090 | link_with : [libshared], | |
2091 | install_rpath : rootlibexecdir, | |
2092 | install : true, | |
2093 | install_dir : rootlibexecdir) | |
37efbbd8 ZJS |
2094 | endif |
2095 | ||
349cc4a5 | 2096 | if conf.get('HAVE_BLKID') == 1 |
6164ec4c ZJS |
2097 | executable( |
2098 | 'systemd-gpt-auto-generator', | |
2099 | 'src/gpt-auto-generator/gpt-auto-generator.c', | |
6164ec4c ZJS |
2100 | include_directories : includes, |
2101 | link_with : [libshared], | |
2102 | dependencies : libblkid, | |
2103 | install_rpath : rootlibexecdir, | |
2104 | install : true, | |
2105 | install_dir : systemgeneratordir) | |
2106 | ||
2107 | public_programs += executable( | |
2108 | 'systemd-dissect', | |
2109 | 'src/dissect/dissect.c', | |
2110 | include_directories : includes, | |
2111 | link_with : [libshared], | |
2112 | install_rpath : rootlibexecdir, | |
5a151082 | 2113 | install : true) |
5c23128d ZJS |
2114 | endif |
2115 | ||
1ec57f33 | 2116 | if conf.get('ENABLE_RESOLVE') == 1 |
6164ec4c ZJS |
2117 | executable( |
2118 | 'systemd-resolved', | |
2119 | systemd_resolved_sources, | |
8d40961c | 2120 | include_directories : resolve_includes, |
6164ec4c ZJS |
2121 | link_with : [libshared, |
2122 | libbasic_gcrypt, | |
2123 | libsystemd_resolve_core], | |
2124 | dependencies : systemd_resolved_dependencies, | |
2125 | install_rpath : rootlibexecdir, | |
2126 | install : true, | |
2127 | install_dir : rootlibexecdir) | |
2128 | ||
2129 | public_programs += executable( | |
2130 | 'resolvectl', | |
2131 | resolvectl_sources, | |
2132 | include_directories : includes, | |
2133 | link_with : [libshared, | |
2134 | libbasic_gcrypt, | |
2135 | libsystemd_resolve_core], | |
2136 | dependencies : [threads, | |
2137 | libgpg_error, | |
2138 | libm, | |
2139 | libidn], | |
2140 | install_rpath : rootlibexecdir, | |
2141 | install : true) | |
088c1363 LP |
2142 | |
2143 | meson.add_install_script(meson_make_symlink, | |
fce9abb2 ZJS |
2144 | bindir / 'resolvectl', |
2145 | rootsbindir / 'resolvconf') | |
c2e84cab YW |
2146 | |
2147 | meson.add_install_script(meson_make_symlink, | |
fce9abb2 ZJS |
2148 | bindir / 'resolvectl', |
2149 | bindir / 'systemd-resolve') | |
5c23128d ZJS |
2150 | endif |
2151 | ||
349cc4a5 | 2152 | if conf.get('ENABLE_LOGIND') == 1 |
6164ec4c ZJS |
2153 | executable( |
2154 | 'systemd-logind', | |
2155 | systemd_logind_sources, | |
2156 | include_directories : includes, | |
2157 | link_with : [liblogind_core, | |
2158 | libshared], | |
2159 | dependencies : [threads, | |
2160 | libacl], | |
2161 | install_rpath : rootlibexecdir, | |
2162 | install : true, | |
2163 | install_dir : rootlibexecdir) | |
2164 | ||
2165 | public_programs += executable( | |
2166 | 'loginctl', | |
2167 | loginctl_sources, | |
2168 | include_directories : includes, | |
2169 | link_with : [libshared], | |
2170 | dependencies : [threads, | |
2171 | liblz4, | |
ef5924aa NL |
2172 | libxz, |
2173 | libzstd], | |
6164ec4c ZJS |
2174 | install_rpath : rootlibexecdir, |
2175 | install : true, | |
2176 | install_dir : rootbindir) | |
2177 | ||
2178 | public_programs += executable( | |
2179 | 'systemd-inhibit', | |
2180 | 'src/login/inhibit.c', | |
2181 | include_directories : includes, | |
2182 | link_with : [libshared], | |
2183 | install_rpath : rootlibexecdir, | |
2184 | install : true, | |
2185 | install_dir : rootbindir) | |
37efbbd8 | 2186 | |
349cc4a5 | 2187 | if conf.get('HAVE_PAM') == 1 |
fce9abb2 | 2188 | version_script_arg = project_source_root / pam_systemd_sym |
37efbbd8 ZJS |
2189 | pam_systemd = shared_library( |
2190 | 'pam_systemd', | |
2191 | pam_systemd_c, | |
2192 | name_prefix : '', | |
2193 | include_directories : includes, | |
2194 | link_args : ['-shared', | |
2195 | '-Wl,--version-script=' + version_script_arg], | |
37e4d7a8 | 2196 | link_with : [libsystemd_static, |
37efbbd8 ZJS |
2197 | libshared_static], |
2198 | dependencies : [threads, | |
2199 | libpam, | |
2200 | libpam_misc], | |
2201 | link_depends : pam_systemd_sym, | |
2202 | install : true, | |
2203 | install_dir : pamlibdir) | |
2204 | ||
938be089 ZJS |
2205 | if want_tests != 'false' |
2206 | test('dlopen-pam_systemd', | |
2207 | test_dlopen, | |
2208 | # path to dlopen must include a slash | |
c1cd6743 | 2209 | args : pam_systemd.full_path()) |
938be089 | 2210 | endif |
37efbbd8 | 2211 | endif |
005a29f2 | 2212 | |
6164ec4c ZJS |
2213 | executable( |
2214 | 'systemd-user-runtime-dir', | |
2215 | user_runtime_dir_sources, | |
2216 | include_directories : includes, | |
2217 | link_with : [libshared], | |
2218 | install_rpath : rootlibexecdir, | |
2219 | install : true, | |
2220 | install_dir : rootlibexecdir) | |
07ee5adb | 2221 | endif |
a9f0f5e5 | 2222 | |
349cc4a5 | 2223 | if conf.get('HAVE_PAM') == 1 |
6164ec4c ZJS |
2224 | executable( |
2225 | 'systemd-user-sessions', | |
2226 | 'src/user-sessions/user-sessions.c', | |
2227 | include_directories : includes, | |
2228 | link_with : [libshared], | |
2229 | install_rpath : rootlibexecdir, | |
2230 | install : true, | |
2231 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2232 | endif |
2233 | ||
34357545 | 2234 | if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1 |
6164ec4c ZJS |
2235 | public_programs += executable( |
2236 | 'bootctl', | |
2237 | 'src/boot/bootctl.c', | |
2238 | include_directories : includes, | |
2239 | link_with : [libshared], | |
2240 | dependencies : [libblkid], | |
2241 | install_rpath : rootlibexecdir, | |
2242 | install : true) | |
2243 | ||
2244 | public_programs += executable( | |
2245 | 'systemd-bless-boot', | |
2246 | 'src/boot/bless-boot.c', | |
2247 | include_directories : includes, | |
2248 | link_with : [libshared], | |
2249 | dependencies : [libblkid], | |
2250 | install_rpath : rootlibexecdir, | |
2251 | install : true, | |
2252 | install_dir : rootlibexecdir) | |
2253 | ||
2254 | executable( | |
2255 | 'systemd-bless-boot-generator', | |
2256 | 'src/boot/bless-boot-generator.c', | |
2257 | include_directories : includes, | |
2258 | link_with : [libshared], | |
2259 | install_rpath : rootlibexecdir, | |
2260 | install : true, | |
2261 | install_dir : systemgeneratordir) | |
2262 | endif | |
2263 | ||
2264 | executable( | |
2265 | 'systemd-boot-check-no-failures', | |
2266 | 'src/boot/boot-check-no-failures.c', | |
2267 | include_directories : includes, | |
2268 | link_with : [libshared], | |
2269 | dependencies : [libblkid], | |
2270 | install_rpath : rootlibexecdir, | |
2271 | install : true, | |
2272 | install_dir : rootlibexecdir) | |
005a29f2 | 2273 | |
6164ec4c ZJS |
2274 | public_programs += executable( |
2275 | 'systemd-socket-activate', | |
2276 | 'src/activate/activate.c', | |
2277 | include_directories : includes, | |
2278 | link_with : [libshared], | |
2279 | dependencies : [threads], | |
2280 | install_rpath : rootlibexecdir, | |
2281 | install : true) | |
f3794366 | 2282 | |
6164ec4c ZJS |
2283 | public_programs += executable( |
2284 | 'systemctl', | |
c3512573 | 2285 | systemctl_sources, |
6164ec4c ZJS |
2286 | include_directories : includes, |
2287 | link_with : systemctl_link_with, | |
2288 | dependencies : [threads, | |
2289 | libcap, | |
2290 | libselinux, | |
2291 | libxz, | |
ef5924aa NL |
2292 | liblz4, |
2293 | libzstd], | |
6164ec4c ZJS |
2294 | install_rpath : rootlibexecdir, |
2295 | install : true, | |
2296 | install_dir : rootbindir) | |
5c23128d | 2297 | |
61d0578b | 2298 | if conf.get('ENABLE_PORTABLED') == 1 |
6164ec4c ZJS |
2299 | executable( |
2300 | 'systemd-portabled', | |
2301 | systemd_portabled_sources, | |
2302 | include_directories : includes, | |
2303 | link_with : [libshared], | |
409f4cf1 | 2304 | dependencies : [threads, libselinux], |
6164ec4c ZJS |
2305 | install_rpath : rootlibexecdir, |
2306 | install : true, | |
2307 | install_dir : rootlibexecdir) | |
2308 | ||
2309 | public_programs += executable( | |
2310 | 'portablectl', | |
2311 | 'src/portable/portablectl.c', | |
2312 | include_directories : includes, | |
2313 | link_with : [libshared], | |
2314 | dependencies : [threads], | |
2315 | install_rpath : rootlibexecdir, | |
2316 | install : true, | |
2317 | install_dir : rootbindir) | |
61d0578b LP |
2318 | endif |
2319 | ||
9bca4ae4 LP |
2320 | if conf.get('ENABLE_SYSEXT') == 1 |
2321 | public_programs += executable( | |
2322 | 'systemd-sysext', | |
2323 | systemd_sysext_sources, | |
2324 | include_directories : includes, | |
2325 | link_with : [libshared], | |
2326 | install_rpath : rootlibexecdir, | |
2327 | install : true, | |
aac5fbff | 2328 | install_dir : rootbindir) |
9bca4ae4 LP |
2329 | endif |
2330 | ||
d093b62c | 2331 | if conf.get('ENABLE_USERDB') == 1 |
6164ec4c ZJS |
2332 | executable( |
2333 | 'systemd-userwork', | |
2334 | systemd_userwork_sources, | |
2335 | include_directories : includes, | |
2336 | link_with : [libshared], | |
2337 | dependencies : [threads], | |
2338 | install_rpath : rootlibexecdir, | |
2339 | install : true, | |
2340 | install_dir : rootlibexecdir) | |
2341 | ||
2342 | executable( | |
2343 | 'systemd-userdbd', | |
2344 | systemd_userdbd_sources, | |
2345 | include_directories : includes, | |
2346 | link_with : [libshared], | |
2347 | dependencies : [threads], | |
2348 | install_rpath : rootlibexecdir, | |
2349 | install : true, | |
2350 | install_dir : rootlibexecdir) | |
2351 | ||
460e5af0 | 2352 | public_programs += executable( |
6164ec4c ZJS |
2353 | 'userdbctl', |
2354 | userdbctl_sources, | |
2355 | include_directories : includes, | |
2356 | link_with : [libshared], | |
2357 | dependencies : [threads], | |
2358 | install_rpath : rootlibexecdir, | |
2359 | install : true, | |
2360 | install_dir : rootbindir) | |
d093b62c LP |
2361 | endif |
2362 | ||
70a5db58 | 2363 | if conf.get('ENABLE_HOMED') == 1 |
6164ec4c ZJS |
2364 | executable( |
2365 | 'systemd-homework', | |
2366 | systemd_homework_sources, | |
2367 | include_directories : includes, | |
2368 | link_with : [libshared], | |
2369 | dependencies : [threads, | |
6164ec4c ZJS |
2370 | libblkid, |
2371 | libcrypt, | |
2372 | libopenssl, | |
2373 | libfdisk, | |
69cb2896 | 2374 | libp11kit], |
6164ec4c ZJS |
2375 | install_rpath : rootlibexecdir, |
2376 | install : true, | |
2377 | install_dir : rootlibexecdir) | |
2378 | ||
2379 | executable( | |
2380 | 'systemd-homed', | |
2381 | systemd_homed_sources, | |
8d40961c | 2382 | include_directories : home_includes, |
6164ec4c ZJS |
2383 | link_with : [libshared], |
2384 | dependencies : [threads, | |
2385 | libcrypt, | |
679badd7 | 2386 | libopenssl], |
6164ec4c ZJS |
2387 | install_rpath : rootlibexecdir, |
2388 | install : true, | |
2389 | install_dir : rootlibexecdir) | |
2390 | ||
460e5af0 | 2391 | public_programs += executable( |
6164ec4c ZJS |
2392 | 'homectl', |
2393 | homectl_sources, | |
2394 | include_directories : includes, | |
2395 | link_with : [libshared], | |
2396 | dependencies : [threads, | |
2397 | libcrypt, | |
2398 | libopenssl, | |
2399 | libp11kit, | |
da3920c3 | 2400 | libdl], |
6164ec4c ZJS |
2401 | install_rpath : rootlibexecdir, |
2402 | install : true, | |
2403 | install_dir : rootbindir) | |
26cf9fb7 LP |
2404 | |
2405 | if conf.get('HAVE_PAM') == 1 | |
fce9abb2 | 2406 | version_script_arg = project_source_root / pam_systemd_home_sym |
26cf9fb7 LP |
2407 | pam_systemd = shared_library( |
2408 | 'pam_systemd_home', | |
2409 | pam_systemd_home_c, | |
2410 | name_prefix : '', | |
2411 | include_directories : includes, | |
2412 | link_args : ['-shared', | |
2413 | '-Wl,--version-script=' + version_script_arg], | |
2414 | link_with : [libsystemd_static, | |
2415 | libshared_static], | |
2416 | dependencies : [threads, | |
2417 | libpam, | |
2418 | libpam_misc, | |
2419 | libcrypt], | |
2420 | link_depends : pam_systemd_home_sym, | |
2421 | install : true, | |
2422 | install_dir : pamlibdir) | |
2423 | endif | |
70a5db58 LP |
2424 | endif |
2425 | ||
6589a569 | 2426 | foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] + |
ba081955 | 2427 | (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : [])) |
ba7f4ae6 | 2428 | meson.add_install_script(meson_make_symlink, |
fce9abb2 ZJS |
2429 | rootbindir / 'systemctl', |
2430 | rootsbindir / alias) | |
ba7f4ae6 ZJS |
2431 | endforeach |
2432 | ||
63e2d171 | 2433 | meson.add_install_script(meson_make_symlink, |
fce9abb2 ZJS |
2434 | rootbindir / 'udevadm', |
2435 | rootlibexecdir / 'systemd-udevd') | |
63e2d171 | 2436 | |
349cc4a5 | 2437 | if conf.get('ENABLE_BACKLIGHT') == 1 |
6164ec4c ZJS |
2438 | executable( |
2439 | 'systemd-backlight', | |
2440 | 'src/backlight/backlight.c', | |
2441 | include_directories : includes, | |
2442 | link_with : [libshared], | |
2443 | install_rpath : rootlibexecdir, | |
2444 | install : true, | |
2445 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2446 | endif |
2447 | ||
349cc4a5 | 2448 | if conf.get('ENABLE_RFKILL') == 1 |
6164ec4c ZJS |
2449 | executable( |
2450 | 'systemd-rfkill', | |
2451 | 'src/rfkill/rfkill.c', | |
2452 | include_directories : includes, | |
2453 | link_with : [libshared], | |
2454 | install_rpath : rootlibexecdir, | |
2455 | install : true, | |
2456 | install_dir : rootlibexecdir) | |
2457 | endif | |
2458 | ||
2459 | executable( | |
2460 | 'systemd-system-update-generator', | |
2461 | 'src/system-update-generator/system-update-generator.c', | |
2462 | include_directories : includes, | |
2463 | link_with : [libshared], | |
2464 | install_rpath : rootlibexecdir, | |
2465 | install : true, | |
2466 | install_dir : systemgeneratordir) | |
5c23128d | 2467 | |
349cc4a5 | 2468 | if conf.get('HAVE_LIBCRYPTSETUP') == 1 |
6164ec4c ZJS |
2469 | executable( |
2470 | 'systemd-cryptsetup', | |
2471 | systemd_cryptsetup_sources, | |
2472 | include_directories : includes, | |
2473 | link_with : [libshared], | |
2474 | dependencies : [libcryptsetup, | |
2475 | libp11kit], | |
2476 | install_rpath : rootlibexecdir, | |
2477 | install : true, | |
2478 | install_dir : rootlibexecdir) | |
2479 | ||
2480 | executable( | |
2481 | 'systemd-cryptsetup-generator', | |
2482 | 'src/cryptsetup/cryptsetup-generator.c', | |
2483 | include_directories : includes, | |
2484 | link_with : [libshared], | |
6164ec4c ZJS |
2485 | install_rpath : rootlibexecdir, |
2486 | install : true, | |
2487 | install_dir : systemgeneratordir) | |
2488 | ||
2489 | executable( | |
2490 | 'systemd-veritysetup', | |
2491 | 'src/veritysetup/veritysetup.c', | |
2492 | include_directories : includes, | |
2493 | link_with : [libshared], | |
2494 | dependencies : [libcryptsetup], | |
2495 | install_rpath : rootlibexecdir, | |
2496 | install : true, | |
2497 | install_dir : rootlibexecdir) | |
2498 | ||
2499 | executable( | |
2500 | 'systemd-veritysetup-generator', | |
2501 | 'src/veritysetup/veritysetup-generator.c', | |
2502 | include_directories : includes, | |
2503 | link_with : [libshared], | |
6164ec4c ZJS |
2504 | install_rpath : rootlibexecdir, |
2505 | install : true, | |
2506 | install_dir : systemgeneratordir) | |
8710a681 | 2507 | |
8710a681 LP |
2508 | executable( |
2509 | 'systemd-cryptenroll', | |
2510 | systemd_cryptenroll_sources, | |
2511 | include_directories : includes, | |
2512 | link_with : [libshared], | |
2513 | dependencies : [libcryptsetup, | |
5e521624 | 2514 | libdl, |
8710a681 LP |
2515 | libopenssl, |
2516 | libp11kit], | |
2517 | install_rpath : rootlibexecdir, | |
a1fd722b | 2518 | install : true) |
5c23128d ZJS |
2519 | endif |
2520 | ||
349cc4a5 | 2521 | if conf.get('HAVE_SYSV_COMPAT') == 1 |
6164ec4c ZJS |
2522 | executable( |
2523 | 'systemd-sysv-generator', | |
2524 | 'src/sysv-generator/sysv-generator.c', | |
2525 | include_directories : includes, | |
2526 | link_with : [libshared], | |
2527 | install_rpath : rootlibexecdir, | |
2528 | install : true, | |
2529 | install_dir : systemgeneratordir) | |
2530 | ||
2531 | executable( | |
2532 | 'systemd-rc-local-generator', | |
2533 | 'src/rc-local-generator/rc-local-generator.c', | |
2534 | include_directories : includes, | |
2535 | link_with : [libshared], | |
2536 | install_rpath : rootlibexecdir, | |
2537 | install : true, | |
2538 | install_dir : systemgeneratordir) | |
5c23128d ZJS |
2539 | endif |
2540 | ||
8feca247 BB |
2541 | if conf.get('ENABLE_XDG_AUTOSTART') == 1 |
2542 | executable( | |
2543 | 'systemd-xdg-autostart-generator', | |
0275e918 | 2544 | systemd_xdg_autostart_generator_sources, |
8feca247 BB |
2545 | include_directories : includes, |
2546 | link_with : [libshared], | |
2547 | install_rpath : rootlibexecdir, | |
2548 | install : true, | |
2549 | install_dir : usergeneratordir) | |
2550 | ||
2551 | executable( | |
2552 | 'systemd-xdg-autostart-condition', | |
2553 | 'src/xdg-autostart-generator/xdg-autostart-condition.c', | |
2554 | include_directories : includes, | |
2555 | link_with : [libshared], | |
2556 | install_rpath : rootlibexecdir, | |
2557 | install : true, | |
2558 | install_dir : rootlibexecdir) | |
2559 | endif | |
2560 | ||
349cc4a5 | 2561 | if conf.get('ENABLE_HOSTNAMED') == 1 |
6164ec4c ZJS |
2562 | executable( |
2563 | 'systemd-hostnamed', | |
2564 | 'src/hostname/hostnamed.c', | |
2565 | include_directories : includes, | |
2566 | link_with : [libshared], | |
2567 | install_rpath : rootlibexecdir, | |
2568 | install : true, | |
2569 | install_dir : rootlibexecdir) | |
2570 | ||
2571 | public_programs += executable( | |
2572 | 'hostnamectl', | |
2573 | 'src/hostname/hostnamectl.c', | |
2574 | include_directories : includes, | |
2575 | link_with : [libshared], | |
2576 | install_rpath : rootlibexecdir, | |
2577 | install : true) | |
5c23128d ZJS |
2578 | endif |
2579 | ||
349cc4a5 ZJS |
2580 | if conf.get('ENABLE_LOCALED') == 1 |
2581 | if conf.get('HAVE_XKBCOMMON') == 1 | |
37efbbd8 ZJS |
2582 | # logind will load libxkbcommon.so dynamically on its own |
2583 | deps = [libdl] | |
aff870ef | 2584 | extra_includes = [libxkbcommon.get_pkgconfig_variable('includedir')] |
37efbbd8 ZJS |
2585 | else |
2586 | deps = [] | |
aff870ef | 2587 | extra_includes = [] |
37efbbd8 ZJS |
2588 | endif |
2589 | ||
6164ec4c ZJS |
2590 | executable( |
2591 | 'systemd-localed', | |
2592 | systemd_localed_sources, | |
aff870ef | 2593 | include_directories : includes + extra_includes, |
6164ec4c ZJS |
2594 | link_with : [libshared], |
2595 | dependencies : deps, | |
2596 | install_rpath : rootlibexecdir, | |
2597 | install : true, | |
2598 | install_dir : rootlibexecdir) | |
2599 | ||
2600 | public_programs += executable( | |
2601 | 'localectl', | |
2602 | localectl_sources, | |
2603 | include_directories : includes, | |
2604 | link_with : [libshared], | |
2605 | install_rpath : rootlibexecdir, | |
2606 | install : true) | |
5c23128d ZJS |
2607 | endif |
2608 | ||
349cc4a5 | 2609 | if conf.get('ENABLE_TIMEDATED') == 1 |
6164ec4c ZJS |
2610 | executable( |
2611 | 'systemd-timedated', | |
2612 | 'src/timedate/timedated.c', | |
2613 | include_directories : includes, | |
2614 | link_with : [libshared], | |
2615 | install_rpath : rootlibexecdir, | |
2616 | install : true, | |
2617 | install_dir : rootlibexecdir) | |
6129ec85 | 2618 | endif |
5c23128d | 2619 | |
6129ec85 | 2620 | if conf.get('ENABLE_TIMEDATECTL') == 1 |
6164ec4c ZJS |
2621 | public_programs += executable( |
2622 | 'timedatectl', | |
2623 | 'src/timedate/timedatectl.c', | |
2624 | include_directories : includes, | |
2625 | install_rpath : rootlibexecdir, | |
2626 | link_with : [libshared], | |
2627 | dependencies : [libm], | |
2628 | install : true) | |
5c23128d ZJS |
2629 | endif |
2630 | ||
349cc4a5 | 2631 | if conf.get('ENABLE_TIMESYNCD') == 1 |
6164ec4c ZJS |
2632 | executable( |
2633 | 'systemd-timesyncd', | |
2634 | systemd_timesyncd_sources, | |
2635 | include_directories : includes, | |
f5a5284e | 2636 | link_with : [libtimesyncd_core], |
6164ec4c ZJS |
2637 | dependencies : [threads, |
2638 | libm], | |
2639 | install_rpath : rootlibexecdir, | |
2640 | install : true, | |
2641 | install_dir : rootlibexecdir) | |
2642 | ||
2643 | executable( | |
2644 | 'systemd-time-wait-sync', | |
cf242350 | 2645 | 'src/timesync/wait-sync.c', |
6164ec4c | 2646 | include_directories : includes, |
f5a5284e | 2647 | link_with : [libtimesyncd_core], |
6164ec4c ZJS |
2648 | install_rpath : rootlibexecdir, |
2649 | install : true, | |
2650 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2651 | endif |
2652 | ||
349cc4a5 | 2653 | if conf.get('ENABLE_MACHINED') == 1 |
6164ec4c ZJS |
2654 | executable( |
2655 | 'systemd-machined', | |
2656 | systemd_machined_sources, | |
2657 | include_directories : includes, | |
2658 | link_with : [libmachine_core, | |
2659 | libshared], | |
2660 | install_rpath : rootlibexecdir, | |
2661 | install : true, | |
2662 | install_dir : rootlibexecdir) | |
2663 | ||
2664 | public_programs += executable( | |
2665 | 'machinectl', | |
2666 | 'src/machine/machinectl.c', | |
2667 | include_directories : includes, | |
2668 | link_with : [libshared], | |
2669 | dependencies : [threads, | |
2670 | libxz, | |
ef5924aa NL |
2671 | liblz4, |
2672 | libzstd], | |
6164ec4c ZJS |
2673 | install_rpath : rootlibexecdir, |
2674 | install : true, | |
2675 | install_dir : rootbindir) | |
5c23128d ZJS |
2676 | endif |
2677 | ||
349cc4a5 | 2678 | if conf.get('ENABLE_IMPORTD') == 1 |
6164ec4c ZJS |
2679 | executable( |
2680 | 'systemd-importd', | |
2681 | systemd_importd_sources, | |
2682 | include_directories : includes, | |
2683 | link_with : [libshared], | |
2684 | dependencies : [threads], | |
2685 | install_rpath : rootlibexecdir, | |
2686 | install : true, | |
2687 | install_dir : rootlibexecdir) | |
2688 | ||
2689 | systemd_pull = executable( | |
2690 | 'systemd-pull', | |
2691 | systemd_pull_sources, | |
2692 | include_directories : includes, | |
2693 | link_with : [libshared], | |
2694 | dependencies : [versiondep, | |
2695 | libcurl, | |
2696 | libz, | |
2697 | libbzip2, | |
2698 | libxz, | |
2699 | libgcrypt], | |
2700 | install_rpath : rootlibexecdir, | |
2701 | install : true, | |
2702 | install_dir : rootlibexecdir) | |
2703 | ||
2704 | systemd_import = executable( | |
2705 | 'systemd-import', | |
2706 | systemd_import_sources, | |
2707 | include_directories : includes, | |
2708 | link_with : [libshared], | |
2709 | dependencies : [libcurl, | |
2710 | libz, | |
2711 | libbzip2, | |
2712 | libxz], | |
2713 | install_rpath : rootlibexecdir, | |
2714 | install : true, | |
2715 | install_dir : rootlibexecdir) | |
2716 | ||
2717 | systemd_import_fs = executable( | |
2718 | 'systemd-import-fs', | |
2719 | systemd_import_fs_sources, | |
2720 | include_directories : includes, | |
2721 | link_with : [libshared], | |
2722 | install_rpath : rootlibexecdir, | |
2723 | install : true, | |
2724 | install_dir : rootlibexecdir) | |
2725 | ||
2726 | systemd_export = executable( | |
2727 | 'systemd-export', | |
2728 | systemd_export_sources, | |
2729 | include_directories : includes, | |
2730 | link_with : [libshared], | |
2731 | dependencies : [libcurl, | |
2732 | libz, | |
2733 | libbzip2, | |
2734 | libxz], | |
2735 | install_rpath : rootlibexecdir, | |
2736 | install : true, | |
2737 | install_dir : rootlibexecdir) | |
1d7579c4 LP |
2738 | |
2739 | public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export] | |
37efbbd8 ZJS |
2740 | endif |
2741 | ||
349cc4a5 | 2742 | if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1 |
6164ec4c ZJS |
2743 | public_programs += executable( |
2744 | 'systemd-journal-upload', | |
2745 | systemd_journal_upload_sources, | |
2746 | include_directories : includes, | |
2747 | link_with : [libshared], | |
2748 | dependencies : [versiondep, | |
2749 | threads, | |
2750 | libcurl, | |
2751 | libgnutls, | |
2752 | libxz, | |
ef5924aa NL |
2753 | liblz4, |
2754 | libzstd], | |
6164ec4c ZJS |
2755 | install_rpath : rootlibexecdir, |
2756 | install : true, | |
2757 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2758 | endif |
2759 | ||
349cc4a5 | 2760 | if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 |
6164ec4c ZJS |
2761 | public_programs += executable( |
2762 | 'systemd-journal-remote', | |
2763 | systemd_journal_remote_sources, | |
2764 | include_directories : includes, | |
2765 | link_with : [libshared, | |
2766 | libsystemd_journal_remote], | |
2767 | dependencies : [threads, | |
2768 | libmicrohttpd, | |
2769 | libgnutls, | |
2770 | libxz, | |
ef5924aa NL |
2771 | liblz4, |
2772 | libzstd], | |
6164ec4c ZJS |
2773 | install_rpath : rootlibexecdir, |
2774 | install : true, | |
2775 | install_dir : rootlibexecdir) | |
2776 | ||
2777 | public_programs += executable( | |
2778 | 'systemd-journal-gatewayd', | |
2779 | systemd_journal_gatewayd_sources, | |
2780 | include_directories : includes, | |
2781 | link_with : [libshared], | |
2782 | dependencies : [threads, | |
2783 | libmicrohttpd, | |
2784 | libgnutls, | |
2785 | libxz, | |
ef5924aa NL |
2786 | liblz4, |
2787 | libzstd], | |
6164ec4c ZJS |
2788 | install_rpath : rootlibexecdir, |
2789 | install : true, | |
2790 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2791 | endif |
2792 | ||
349cc4a5 | 2793 | if conf.get('ENABLE_COREDUMP') == 1 |
6164ec4c ZJS |
2794 | executable( |
2795 | 'systemd-coredump', | |
2796 | systemd_coredump_sources, | |
2797 | include_directories : includes, | |
2798 | link_with : [libshared], | |
2799 | dependencies : [threads, | |
2800 | libacl, | |
2801 | libdw, | |
2802 | libxz, | |
ef5924aa NL |
2803 | liblz4, |
2804 | libzstd], | |
6164ec4c ZJS |
2805 | install_rpath : rootlibexecdir, |
2806 | install : true, | |
2807 | install_dir : rootlibexecdir) | |
2808 | ||
2809 | public_programs += executable( | |
2810 | 'coredumpctl', | |
2811 | coredumpctl_sources, | |
2812 | include_directories : includes, | |
2813 | link_with : [libshared], | |
2814 | dependencies : [threads, | |
2815 | libxz, | |
ef5924aa NL |
2816 | liblz4, |
2817 | libzstd], | |
6164ec4c ZJS |
2818 | install_rpath : rootlibexecdir, |
2819 | install : true) | |
5c23128d ZJS |
2820 | endif |
2821 | ||
9b4abc69 | 2822 | if conf.get('ENABLE_PSTORE') == 1 |
6164ec4c ZJS |
2823 | executable( |
2824 | 'systemd-pstore', | |
2825 | systemd_pstore_sources, | |
2826 | include_directories : includes, | |
2827 | link_with : [libshared], | |
2828 | dependencies : [threads, | |
2829 | libacl, | |
2830 | libdw, | |
2831 | libxz, | |
ef5924aa NL |
2832 | liblz4, |
2833 | libzstd], | |
6164ec4c ZJS |
2834 | install_rpath : rootlibexecdir, |
2835 | install : true, | |
2836 | install_dir : rootlibexecdir) | |
9b4abc69 ED |
2837 | endif |
2838 | ||
9de5e321 AZ |
2839 | if conf.get('ENABLE_OOMD') == 1 |
2840 | executable('systemd-oomd', | |
2841 | systemd_oomd_sources, | |
2842 | include_directories : includes, | |
2843 | link_with : [libshared], | |
2844 | dependencies : [], | |
2845 | install_rpath : rootlibexecdir, | |
2846 | install : true, | |
2847 | install_dir : rootlibexecdir) | |
5c616ecf AZ |
2848 | |
2849 | public_programs += executable( | |
ba081955 ZJS |
2850 | 'oomctl', |
2851 | oomctl_sources, | |
2852 | include_directories : includes, | |
2853 | link_with : [libshared], | |
2854 | dependencies : [], | |
2855 | install_rpath : rootlibexecdir, | |
2856 | install : true, | |
2857 | install_dir : rootbindir) | |
9de5e321 AZ |
2858 | endif |
2859 | ||
349cc4a5 | 2860 | if conf.get('ENABLE_BINFMT') == 1 |
6164ec4c ZJS |
2861 | public_programs += executable( |
2862 | 'systemd-binfmt', | |
2863 | 'src/binfmt/binfmt.c', | |
2864 | include_directories : includes, | |
2865 | link_with : [libshared], | |
2866 | install_rpath : rootlibexecdir, | |
2867 | install : true, | |
2868 | install_dir : rootlibexecdir) | |
37efbbd8 | 2869 | |
7c22f07c ZJS |
2870 | meson.add_install_script('sh', '-c', |
2871 | mkdir_p.format(binfmtdir)) | |
d7aa78c3 | 2872 | if install_sysconfdir |
7c22f07c | 2873 | meson.add_install_script('sh', '-c', |
fce9abb2 | 2874 | mkdir_p.format(sysconfdir / 'binfmt.d')) |
d7aa78c3 | 2875 | endif |
37efbbd8 ZJS |
2876 | endif |
2877 | ||
e594a3b1 | 2878 | if conf.get('ENABLE_REPART') == 1 |
6164ec4c ZJS |
2879 | exe = executable( |
2880 | 'systemd-repart', | |
2881 | systemd_repart_sources, | |
2882 | include_directories : includes, | |
2883 | link_with : [libshared], | |
2884 | dependencies : [threads, | |
6164ec4c ZJS |
2885 | libblkid, |
2886 | libfdisk, | |
2887 | libopenssl], | |
2888 | install_rpath : rootlibexecdir, | |
2889 | install : true, | |
2890 | install_dir : rootbindir) | |
2d2d0a57 | 2891 | public_programs += exe |
e29e4d57 ZJS |
2892 | |
2893 | if want_tests != 'false' | |
2894 | test('test-repart', | |
2895 | test_repart_sh, | |
2896 | args : exe.full_path()) | |
2897 | endif | |
e594a3b1 LP |
2898 | endif |
2899 | ||
349cc4a5 | 2900 | if conf.get('ENABLE_VCONSOLE') == 1 |
6164ec4c ZJS |
2901 | executable( |
2902 | 'systemd-vconsole-setup', | |
2903 | 'src/vconsole/vconsole-setup.c', | |
2904 | include_directories : includes, | |
2905 | link_with : [libshared], | |
2906 | install_rpath : rootlibexecdir, | |
2907 | install : true, | |
2908 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2909 | endif |
2910 | ||
349cc4a5 | 2911 | if conf.get('ENABLE_RANDOMSEED') == 1 |
6164ec4c ZJS |
2912 | executable( |
2913 | 'systemd-random-seed', | |
2914 | 'src/random-seed/random-seed.c', | |
2915 | include_directories : includes, | |
2916 | link_with : [libshared], | |
2917 | install_rpath : rootlibexecdir, | |
2918 | install : true, | |
2919 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2920 | endif |
2921 | ||
349cc4a5 | 2922 | if conf.get('ENABLE_FIRSTBOOT') == 1 |
6164ec4c ZJS |
2923 | executable( |
2924 | 'systemd-firstboot', | |
2925 | 'src/firstboot/firstboot.c', | |
2926 | include_directories : includes, | |
2927 | link_with : [libshared], | |
2928 | dependencies : [libcrypt], | |
2929 | install_rpath : rootlibexecdir, | |
2930 | install : true, | |
2931 | install_dir : rootbindir) | |
2932 | endif | |
2933 | ||
2934 | executable( | |
2935 | 'systemd-remount-fs', | |
2936 | 'src/remount-fs/remount-fs.c', | |
2937 | include_directories : includes, | |
bac11cd6 | 2938 | link_with : [libshared], |
6164ec4c ZJS |
2939 | install_rpath : rootlibexecdir, |
2940 | install : true, | |
2941 | install_dir : rootlibexecdir) | |
5c23128d | 2942 | |
6164ec4c ZJS |
2943 | executable( |
2944 | 'systemd-machine-id-setup', | |
2945 | 'src/machine-id-setup/machine-id-setup-main.c', | |
2946 | include_directories : includes, | |
bac11cd6 | 2947 | link_with : [libshared], |
6164ec4c ZJS |
2948 | install_rpath : rootlibexecdir, |
2949 | install : true, | |
2950 | install_dir : rootbindir) | |
5c23128d | 2951 | |
6164ec4c ZJS |
2952 | executable( |
2953 | 'systemd-fsck', | |
2954 | 'src/fsck/fsck.c', | |
2955 | include_directories : includes, | |
2956 | link_with : [libshared], | |
2957 | install_rpath : rootlibexecdir, | |
2958 | install : true, | |
2959 | install_dir : rootlibexecdir) | |
5c23128d | 2960 | |
80750adb ZJS |
2961 | executable('systemd-growfs', |
2962 | 'src/partition/growfs.c', | |
2963 | include_directories : includes, | |
2964 | link_with : [libshared], | |
2965 | install_rpath : rootlibexecdir, | |
2966 | install : true, | |
2967 | install_dir : rootlibexecdir) | |
2968 | ||
6164ec4c ZJS |
2969 | executable( |
2970 | 'systemd-makefs', | |
2971 | 'src/partition/makefs.c', | |
2972 | include_directories : includes, | |
2973 | link_with : [libshared], | |
2974 | install_rpath : rootlibexecdir, | |
2975 | install : true, | |
2976 | install_dir : rootlibexecdir) | |
b7f28ac5 | 2977 | |
6164ec4c ZJS |
2978 | executable( |
2979 | 'systemd-sleep', | |
2980 | 'src/sleep/sleep.c', | |
2981 | include_directories : includes, | |
2982 | link_with : [libshared], | |
2983 | install_rpath : rootlibexecdir, | |
2984 | install : true, | |
2985 | install_dir : rootlibexecdir) | |
5c23128d | 2986 | |
225d08b8 | 2987 | if install_sysconfdir_samples |
d7aa78c3 JT |
2988 | install_data('src/sleep/sleep.conf', |
2989 | install_dir : pkgsysconfdir) | |
2990 | endif | |
d25e127d | 2991 | |
6164ec4c ZJS |
2992 | public_programs += executable( |
2993 | 'systemd-sysctl', | |
2994 | 'src/sysctl/sysctl.c', | |
2995 | include_directories : includes, | |
2996 | link_with : [libshared], | |
2997 | install_rpath : rootlibexecdir, | |
2998 | install : true, | |
2999 | install_dir : rootlibexecdir) | |
5c23128d | 3000 | |
6164ec4c ZJS |
3001 | executable( |
3002 | 'systemd-ac-power', | |
3003 | 'src/ac-power/ac-power.c', | |
3004 | include_directories : includes, | |
3005 | link_with : [libshared], | |
3006 | install_rpath : rootlibexecdir, | |
3007 | install : true, | |
3008 | install_dir : rootlibexecdir) | |
5c23128d | 3009 | |
6164ec4c ZJS |
3010 | public_programs += executable( |
3011 | 'systemd-detect-virt', | |
3012 | 'src/detect-virt/detect-virt.c', | |
3013 | include_directories : includes, | |
3014 | link_with : [libshared], | |
3015 | install_rpath : rootlibexecdir, | |
3016 | install : true) | |
5c23128d | 3017 | |
6164ec4c ZJS |
3018 | public_programs += executable( |
3019 | 'systemd-delta', | |
3020 | 'src/delta/delta.c', | |
3021 | include_directories : includes, | |
3022 | link_with : [libshared], | |
3023 | install_rpath : rootlibexecdir, | |
3024 | install : true) | |
5c23128d | 3025 | |
6164ec4c ZJS |
3026 | public_programs += executable( |
3027 | 'systemd-escape', | |
3028 | 'src/escape/escape.c', | |
3029 | include_directories : includes, | |
3030 | link_with : [libshared], | |
3031 | install_rpath : rootlibexecdir, | |
3032 | install : true, | |
3033 | install_dir : rootbindir) | |
3034 | ||
3035 | public_programs += executable( | |
3036 | 'systemd-notify', | |
3037 | 'src/notify/notify.c', | |
3038 | include_directories : includes, | |
3039 | link_with : [libshared], | |
3040 | install_rpath : rootlibexecdir, | |
3041 | install : true, | |
3042 | install_dir : rootbindir) | |
3043 | ||
5945640e LP |
3044 | public_programs += executable( |
3045 | 'systemd-creds', | |
3046 | 'src/creds/creds.c', | |
3047 | include_directories : includes, | |
3048 | link_with : [libshared], | |
3049 | dependencies : [threads, | |
3050 | libopenssl], | |
3051 | install_rpath : rootlibexecdir, | |
3052 | install : true, | |
3053 | install_dir : rootbindir) | |
3054 | ||
6164ec4c ZJS |
3055 | executable( |
3056 | 'systemd-volatile-root', | |
3057 | 'src/volatile-root/volatile-root.c', | |
3058 | include_directories : includes, | |
3059 | link_with : [libshared], | |
3060 | install_rpath : rootlibexecdir, | |
cdf7ad38 | 3061 | install : conf.get('ENABLE_INITRD') == 1, |
6164ec4c ZJS |
3062 | install_dir : rootlibexecdir) |
3063 | ||
3064 | executable( | |
3065 | 'systemd-cgroups-agent', | |
3066 | 'src/cgroups-agent/cgroups-agent.c', | |
3067 | include_directories : includes, | |
3068 | link_with : [libshared], | |
3069 | install_rpath : rootlibexecdir, | |
3070 | install : true, | |
3071 | install_dir : rootlibexecdir) | |
3072 | ||
3073 | public_programs += executable( | |
3074 | 'systemd-id128', | |
3075 | 'src/id128/id128.c', | |
3076 | include_directories : includes, | |
3077 | link_with : [libshared], | |
3078 | install_rpath : rootlibexecdir, | |
3079 | install : true) | |
3080 | ||
3081 | public_programs += executable( | |
3082 | 'systemd-path', | |
3083 | 'src/path/path.c', | |
3084 | include_directories : includes, | |
3085 | link_with : [libshared], | |
3086 | install_rpath : rootlibexecdir, | |
3087 | install : true) | |
3088 | ||
3089 | public_programs += executable( | |
3090 | 'systemd-ask-password', | |
3091 | 'src/ask-password/ask-password.c', | |
3092 | include_directories : includes, | |
3093 | link_with : [libshared], | |
3094 | install_rpath : rootlibexecdir, | |
3095 | install : true, | |
3096 | install_dir : rootbindir) | |
3097 | ||
3098 | executable( | |
3099 | 'systemd-reply-password', | |
3100 | 'src/reply-password/reply-password.c', | |
3101 | include_directories : includes, | |
3102 | link_with : [libshared], | |
3103 | install_rpath : rootlibexecdir, | |
3104 | install : true, | |
3105 | install_dir : rootlibexecdir) | |
3106 | ||
3107 | public_programs += executable( | |
3108 | 'systemd-tty-ask-password-agent', | |
3109 | 'src/tty-ask-password-agent/tty-ask-password-agent.c', | |
3110 | include_directories : includes, | |
3111 | link_with : [libshared], | |
3112 | install_rpath : rootlibexecdir, | |
3113 | install : true, | |
3114 | install_dir : rootbindir) | |
3115 | ||
3116 | public_programs += executable( | |
3117 | 'systemd-cgls', | |
3118 | 'src/cgls/cgls.c', | |
3119 | include_directories : includes, | |
3120 | link_with : [libshared], | |
3121 | install_rpath : rootlibexecdir, | |
3122 | install : true) | |
3123 | ||
3124 | public_programs += executable( | |
3125 | 'systemd-cgtop', | |
3126 | 'src/cgtop/cgtop.c', | |
3127 | include_directories : includes, | |
3128 | link_with : [libshared], | |
3129 | install_rpath : rootlibexecdir, | |
3130 | install : true) | |
3131 | ||
3132 | executable( | |
3133 | 'systemd-initctl', | |
3134 | 'src/initctl/initctl.c', | |
3135 | include_directories : includes, | |
3136 | link_with : [libshared], | |
3137 | install_rpath : rootlibexecdir, | |
6589a569 | 3138 | install : (conf.get('HAVE_SYSV_COMPAT') == 1), |
6164ec4c | 3139 | install_dir : rootlibexecdir) |
5c23128d | 3140 | |
6164ec4c ZJS |
3141 | public_programs += executable( |
3142 | 'systemd-mount', | |
3143 | 'src/mount/mount-tool.c', | |
3144 | include_directories : includes, | |
3145 | link_with : [libshared], | |
3146 | dependencies: [libmount], | |
3147 | install_rpath : rootlibexecdir, | |
3148 | install : true) | |
5c23128d | 3149 | |
7b76fce1 | 3150 | meson.add_install_script(meson_make_symlink, |
fce9abb2 | 3151 | 'systemd-mount', bindir / 'systemd-umount') |
7b76fce1 | 3152 | |
6164ec4c ZJS |
3153 | public_programs += executable( |
3154 | 'systemd-run', | |
3155 | 'src/run/run.c', | |
3156 | include_directories : includes, | |
3157 | link_with : [libshared], | |
3158 | install_rpath : rootlibexecdir, | |
3159 | install : true) | |
3160 | ||
3161 | public_programs += executable( | |
3162 | 'systemd-stdio-bridge', | |
3163 | 'src/stdio-bridge/stdio-bridge.c', | |
3164 | include_directories : includes, | |
3165 | link_with : [libshared], | |
3166 | dependencies : [versiondep], | |
3167 | install_rpath : rootlibexecdir, | |
3168 | install : true) | |
3169 | ||
3170 | public_programs += executable( | |
3171 | 'busctl', | |
f98df767 | 3172 | busctl_sources, |
6164ec4c ZJS |
3173 | include_directories : includes, |
3174 | link_with : [libshared], | |
3175 | install_rpath : rootlibexecdir, | |
3176 | install : true) | |
5c23128d | 3177 | |
bd7e6aa7 ZJS |
3178 | if enable_sysusers |
3179 | exe = executable( | |
6164ec4c ZJS |
3180 | 'systemd-sysusers', |
3181 | 'src/sysusers/sysusers.c', | |
3182 | include_directories : includes, | |
3183 | link_with : [libshared], | |
3184 | install_rpath : rootlibexecdir, | |
3185 | install : true, | |
3186 | install_dir : rootbindir) | |
bd7e6aa7 ZJS |
3187 | public_programs += exe |
3188 | ||
3189 | if want_tests != 'false' | |
3190 | test('test-sysusers', | |
3191 | test_sysusers_sh, | |
3192 | # https://github.com/mesonbuild/meson/issues/2681 | |
3193 | args : exe.full_path()) | |
3194 | endif | |
8ef8f3d5 FB |
3195 | |
3196 | if have_standalone_binaries | |
bd7e6aa7 | 3197 | exe = executable( |
8ef8f3d5 FB |
3198 | 'systemd-sysusers.standalone', |
3199 | 'src/sysusers/sysusers.c', | |
3200 | include_directories : includes, | |
3537577c | 3201 | c_args : '-DSTANDALONE', |
8ef8f3d5 FB |
3202 | link_with : [libshared_static, |
3203 | libbasic, | |
3204 | libbasic_gcrypt, | |
99b9f8fd | 3205 | libsystemd_static], |
8ef8f3d5 FB |
3206 | install : true, |
3207 | install_dir : rootbindir) | |
bd7e6aa7 ZJS |
3208 | public_programs += exe |
3209 | ||
3210 | if want_tests != 'false' | |
3211 | test('test-sysusers.standalone', | |
3212 | test_sysusers_sh, | |
3213 | # https://github.com/mesonbuild/meson/issues/2681 | |
3214 | args : exe.full_path()) | |
3215 | endif | |
8ef8f3d5 | 3216 | endif |
5c23128d ZJS |
3217 | endif |
3218 | ||
349cc4a5 | 3219 | if conf.get('ENABLE_TMPFILES') == 1 |
6164ec4c ZJS |
3220 | exe = executable( |
3221 | 'systemd-tmpfiles', | |
db64ba81 | 3222 | systemd_tmpfiles_sources, |
6164ec4c ZJS |
3223 | include_directories : includes, |
3224 | link_with : [libshared], | |
3225 | dependencies : [libacl], | |
3226 | install_rpath : rootlibexecdir, | |
3227 | install : true, | |
3228 | install_dir : rootbindir) | |
5a8b1640 | 3229 | public_programs += exe |
d9daae55 | 3230 | |
938be089 ZJS |
3231 | if want_tests != 'false' |
3232 | test('test-systemd-tmpfiles', | |
3233 | test_systemd_tmpfiles_py, | |
3234 | # https://github.com/mesonbuild/meson/issues/2681 | |
3235 | args : exe.full_path()) | |
3236 | endif | |
db64ba81 FB |
3237 | |
3238 | if have_standalone_binaries | |
3239 | public_programs += executable( | |
3240 | 'systemd-tmpfiles.standalone', | |
3241 | systemd_tmpfiles_sources, | |
3242 | include_directories : includes, | |
3537577c | 3243 | c_args : '-DSTANDALONE', |
db64ba81 FB |
3244 | link_with : [libshared_static, |
3245 | libbasic, | |
3246 | libbasic_gcrypt, | |
99b9f8fd | 3247 | libsystemd_static], |
db64ba81 FB |
3248 | dependencies : [libacl], |
3249 | install : true, | |
3250 | install_dir : rootbindir) | |
3251 | endif | |
5c23128d ZJS |
3252 | endif |
3253 | ||
349cc4a5 | 3254 | if conf.get('ENABLE_HWDB') == 1 |
ecd1bfdd | 3255 | systemd_hwdb = executable( |
6164ec4c ZJS |
3256 | 'systemd-hwdb', |
3257 | 'src/hwdb/hwdb.c', | |
6164ec4c | 3258 | include_directories : includes, |
e4b127e2 | 3259 | link_with : udev_link_with, |
6164ec4c ZJS |
3260 | install_rpath : udev_rpath, |
3261 | install : true, | |
3262 | install_dir : rootbindir) | |
ecd1bfdd ZJS |
3263 | public_programs += systemd_hwdb |
3264 | ||
3265 | if want_tests != 'false' | |
3266 | test('hwdb-test', | |
3267 | hwdb_test_sh, | |
3268 | args : [systemd_hwdb.full_path()], | |
3269 | timeout : 90) | |
3270 | endif | |
37efbbd8 ZJS |
3271 | endif |
3272 | ||
349cc4a5 | 3273 | if conf.get('ENABLE_QUOTACHECK') == 1 |
6164ec4c ZJS |
3274 | executable( |
3275 | 'systemd-quotacheck', | |
3276 | 'src/quotacheck/quotacheck.c', | |
3277 | include_directories : includes, | |
3278 | link_with : [libshared], | |
3279 | install_rpath : rootlibexecdir, | |
3280 | install : true, | |
3281 | install_dir : rootlibexecdir) | |
3282 | endif | |
3283 | ||
3284 | public_programs += executable( | |
3285 | 'systemd-socket-proxyd', | |
3286 | 'src/socket-proxy/socket-proxyd.c', | |
3287 | include_directories : includes, | |
3288 | link_with : [libshared], | |
3289 | dependencies : [threads], | |
3290 | install_rpath : rootlibexecdir, | |
3291 | install : true, | |
3292 | install_dir : rootlibexecdir) | |
5c23128d | 3293 | |
6164ec4c ZJS |
3294 | public_programs += executable( |
3295 | 'udevadm', | |
3296 | udevadm_sources, | |
6164ec4c | 3297 | include_directories : includes, |
e4b127e2 | 3298 | link_with : [libudevd_core], |
6164ec4c ZJS |
3299 | dependencies : [versiondep, |
3300 | threads, | |
3301 | libkmod, | |
3302 | libidn, | |
3303 | libacl, | |
3304 | libblkid], | |
3305 | install_rpath : udev_rpath, | |
3306 | install : true, | |
3307 | install_dir : rootbindir) | |
3308 | ||
3309 | executable( | |
3310 | 'systemd-shutdown', | |
3311 | systemd_shutdown_sources, | |
3312 | include_directories : includes, | |
bac11cd6 | 3313 | link_with : [libshared], |
6164ec4c ZJS |
3314 | dependencies : [libmount], |
3315 | install_rpath : rootlibexecdir, | |
3316 | install : true, | |
3317 | install_dir : rootlibexecdir) | |
3318 | ||
3319 | executable( | |
3320 | 'systemd-update-done', | |
3321 | 'src/update-done/update-done.c', | |
3322 | include_directories : includes, | |
3323 | link_with : [libshared], | |
3324 | install_rpath : rootlibexecdir, | |
3325 | install : true, | |
3326 | install_dir : rootlibexecdir) | |
3327 | ||
3328 | executable( | |
3329 | 'systemd-update-utmp', | |
3330 | 'src/update-utmp/update-utmp.c', | |
3331 | include_directories : includes, | |
3332 | link_with : [libshared], | |
3333 | dependencies : [libaudit], | |
3334 | install_rpath : rootlibexecdir, | |
55678b9e | 3335 | install : (conf.get('ENABLE_UTMP') == 1), |
6164ec4c | 3336 | install_dir : rootlibexecdir) |
5c23128d | 3337 | |
349cc4a5 | 3338 | if conf.get('HAVE_KMOD') == 1 |
6164ec4c ZJS |
3339 | executable( |
3340 | 'systemd-modules-load', | |
3341 | 'src/modules-load/modules-load.c', | |
3342 | include_directories : includes, | |
3343 | link_with : [libshared], | |
3344 | dependencies : [libkmod], | |
3345 | install_rpath : rootlibexecdir, | |
3346 | install : true, | |
3347 | install_dir : rootlibexecdir) | |
94e75a54 | 3348 | |
7c22f07c ZJS |
3349 | meson.add_install_script('sh', '-c', |
3350 | mkdir_p.format(modulesloaddir)) | |
d7aa78c3 | 3351 | if install_sysconfdir |
7c22f07c | 3352 | meson.add_install_script('sh', '-c', |
fce9abb2 | 3353 | mkdir_p.format(sysconfdir / 'modules-load.d')) |
d7aa78c3 | 3354 | endif |
5c23128d ZJS |
3355 | endif |
3356 | ||
6164ec4c ZJS |
3357 | public_programs += executable( |
3358 | 'systemd-nspawn', | |
3359 | systemd_nspawn_sources, | |
3360 | include_directories : includes, | |
bac11cd6 | 3361 | link_with : [libnspawn_core, |
6164ec4c ZJS |
3362 | libshared], |
3363 | dependencies : [libblkid, | |
3364 | libseccomp], | |
3365 | install_rpath : rootlibexecdir, | |
3366 | install : true) | |
5c23128d | 3367 | |
349cc4a5 | 3368 | if conf.get('ENABLE_NETWORKD') == 1 |
6164ec4c ZJS |
3369 | executable( |
3370 | 'systemd-networkd', | |
3371 | systemd_networkd_sources, | |
8d40961c | 3372 | include_directories : network_includes, |
6164ec4c ZJS |
3373 | link_with : [libnetworkd_core, |
3374 | libsystemd_network, | |
6164ec4c ZJS |
3375 | networkd_link_with], |
3376 | dependencies : [threads], | |
3377 | install_rpath : rootlibexecdir, | |
3378 | install : true, | |
3379 | install_dir : rootlibexecdir) | |
3380 | ||
3381 | executable( | |
3382 | 'systemd-networkd-wait-online', | |
3383 | systemd_networkd_wait_online_sources, | |
3384 | include_directories : includes, | |
8d40961c | 3385 | link_with : [networkd_link_with], |
6164ec4c ZJS |
3386 | install_rpath : rootlibexecdir, |
3387 | install : true, | |
3388 | install_dir : rootlibexecdir) | |
3389 | ||
3390 | public_programs += executable( | |
3391 | 'networkctl', | |
3392 | networkctl_sources, | |
8d40961c | 3393 | include_directories : libsystemd_network_includes, |
6164ec4c ZJS |
3394 | link_with : [libsystemd_network, |
3395 | networkd_link_with], | |
3396 | install_rpath : rootlibexecdir, | |
3397 | install : true, | |
3398 | install_dir : rootbindir) | |
3399 | ||
3400 | exe = executable( | |
3401 | 'systemd-network-generator', | |
3402 | network_generator_sources, | |
3403 | include_directories : includes, | |
3404 | link_with : [networkd_link_with], | |
3405 | install_rpath : rootlibexecdir, | |
3406 | install : true, | |
3407 | install_dir : rootlibexecdir) | |
fbaa1137 ZJS |
3408 | |
3409 | if want_tests != 'false' | |
3410 | test('test-network-generator-conversion', | |
3411 | test_network_generator_conversion_sh, | |
3412 | # https://github.com/mesonbuild/meson/issues/2681 | |
3413 | args : exe.full_path()) | |
3414 | endif | |
dcfe072a | 3415 | endif |
e821f6a9 | 3416 | |
6164ec4c ZJS |
3417 | executable( |
3418 | 'systemd-sulogin-shell', | |
73e994f2 | 3419 | 'src/sulogin-shell/sulogin-shell.c', |
6164ec4c ZJS |
3420 | include_directories : includes, |
3421 | link_with : [libshared], | |
3422 | install_rpath : rootlibexecdir, | |
3423 | install : true, | |
3424 | install_dir : rootlibexecdir) | |
e821f6a9 | 3425 | |
69e96427 ZJS |
3426 | ############################################################ |
3427 | ||
e2d41370 FB |
3428 | custom_target( |
3429 | 'systemd-runtest.env', | |
3430 | output : 'systemd-runtest.env', | |
0f4c4f38 ZJS |
3431 | command : [sh, '-c', |
3432 | '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format( | |
fce9abb2 ZJS |
3433 | project_source_root / 'test', |
3434 | project_build_root / 'catalog')], | |
e2d41370 FB |
3435 | build_by_default : true) |
3436 | ||
a626cb15 ZJS |
3437 | test_cflags = ['-DTEST_CODE=1'] |
3438 | # We intentionally do not do inline initializations with definitions for a | |
3439 | # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we | |
3440 | # use the variable unexpectedly. This triggers a lot of maybe-uninitialized | |
3441 | # false positives when the combination of -O2 and -flto is used. Suppress them. | |
3442 | if '-O2' in get_option('c_args') and '-flto=auto' in get_option('c_args') | |
3443 | test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized') | |
3444 | endif | |
3445 | ||
69e96427 | 3446 | foreach tuple : tests |
37efbbd8 | 3447 | sources = tuple[0] |
5acb3cab YW |
3448 | link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared] |
3449 | dependencies = tuple.length() > 2 ? tuple[2] : [] | |
3450 | incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes | |
3451 | condition = tuple.length() > 4 ? tuple[4] : '' | |
3452 | type = tuple.length() > 5 ? tuple[5] : '' | |
3453 | defs = tuple.length() > 6 ? tuple[6] : [] | |
a626cb15 | 3454 | defs += test_cflags |
5acb3cab | 3455 | parallel = tuple.length() > 7 ? tuple[7] : true |
37efbbd8 ZJS |
3456 | timeout = 30 |
3457 | ||
3458 | name = sources[0].split('/')[-1].split('.')[0] | |
3459 | if type.startswith('timeout=') | |
3460 | timeout = type.split('=')[1].to_int() | |
3461 | type = '' | |
3462 | endif | |
3b2bdd62 ZJS |
3463 | |
3464 | if condition == '' or conf.get(condition) == 1 | |
37efbbd8 ZJS |
3465 | exe = executable( |
3466 | name, | |
3467 | sources, | |
3468 | include_directories : incs, | |
3469 | link_with : link_with, | |
60722ad7 ZJS |
3470 | dependencies : [versiondep, |
3471 | dependencies], | |
37efbbd8 | 3472 | c_args : defs, |
3b2bdd62 | 3473 | build_by_default : want_tests != 'false', |
37efbbd8 | 3474 | install_rpath : rootlibexecdir, |
7cdd9783 | 3475 | install : install_tests, |
fce9abb2 | 3476 | install_dir : testsdir / type) |
37efbbd8 ZJS |
3477 | |
3478 | if type == 'manual' | |
3479 | message('@0@ is a manual test'.format(name)) | |
3480 | elif type == 'unsafe' and want_tests != 'unsafe' | |
3481 | message('@0@ is an unsafe test'.format(name)) | |
3b2bdd62 | 3482 | elif want_tests != 'false' |
37efbbd8 ZJS |
3483 | test(name, exe, |
3484 | env : test_env, | |
3485 | timeout : timeout) | |
3486 | endif | |
3487 | else | |
3488 | message('Not compiling @0@ because @1@ is not true'.format(name, condition)) | |
3489 | endif | |
69e96427 ZJS |
3490 | endforeach |
3491 | ||
0632b4cd | 3492 | exe = executable( |
37efbbd8 ZJS |
3493 | 'test-libsystemd-sym', |
3494 | test_libsystemd_sym_c, | |
3495 | include_directories : includes, | |
3496 | link_with : [libsystemd], | |
fd1939fb | 3497 | build_by_default : want_tests != 'false', |
37efbbd8 ZJS |
3498 | install : install_tests, |
3499 | install_dir : testsdir) | |
938be089 ZJS |
3500 | if want_tests != 'false' |
3501 | test('test-libsystemd-sym', exe) | |
3502 | endif | |
37ab1a25 | 3503 | |
0632b4cd ZJS |
3504 | exe = executable( |
3505 | 'test-libsystemd-static-sym', | |
3506 | test_libsystemd_sym_c, | |
3507 | include_directories : includes, | |
0632b4cd ZJS |
3508 | link_with : [install_libsystemd_static], |
3509 | dependencies : [threads], # threads is already included in dependencies on the library, | |
3510 | # but does not seem to get propagated. Add here as a work-around. | |
fd1939fb | 3511 | build_by_default : want_tests != 'false' and static_libsystemd_pic, |
20f3d32d | 3512 | install : install_tests and static_libsystemd_pic, |
0632b4cd | 3513 | install_dir : testsdir) |
938be089 | 3514 | if want_tests != 'false' and static_libsystemd_pic |
0632b4cd ZJS |
3515 | test('test-libsystemd-static-sym', exe) |
3516 | endif | |
37ab1a25 | 3517 | |
0632b4cd | 3518 | exe = executable( |
37efbbd8 ZJS |
3519 | 'test-libudev-sym', |
3520 | test_libudev_sym_c, | |
e4b127e2 | 3521 | include_directories : libudev_includes, |
a626cb15 | 3522 | c_args : ['-Wno-deprecated-declarations'] + test_cflags, |
37efbbd8 | 3523 | link_with : [libudev], |
fd1939fb | 3524 | build_by_default : want_tests != 'false', |
37efbbd8 ZJS |
3525 | install : install_tests, |
3526 | install_dir : testsdir) | |
938be089 ZJS |
3527 | if want_tests != 'false' |
3528 | test('test-libudev-sym', exe) | |
3529 | endif | |
0632b4cd ZJS |
3530 | |
3531 | exe = executable( | |
3532 | 'test-libudev-static-sym', | |
3533 | test_libudev_sym_c, | |
e4b127e2 | 3534 | include_directories : libudev_includes, |
a626cb15 | 3535 | c_args : ['-Wno-deprecated-declarations'] + test_cflags, |
0632b4cd | 3536 | link_with : [install_libudev_static], |
fd1939fb | 3537 | build_by_default : want_tests != 'false' and static_libudev_pic, |
20f3d32d | 3538 | install : install_tests and static_libudev_pic, |
0632b4cd | 3539 | install_dir : testsdir) |
938be089 | 3540 | if want_tests != 'false' and static_libudev_pic |
0632b4cd ZJS |
3541 | test('test-libudev-static-sym', exe) |
3542 | endif | |
e0bec52f | 3543 | |
69e96427 | 3544 | ############################################################ |
5c23128d | 3545 | |
7db7d5b7 JR |
3546 | fuzzer_exes = [] |
3547 | ||
7e299ffe ZJS |
3548 | foreach tuple : fuzzers |
3549 | sources = tuple[0] | |
5acb3cab YW |
3550 | link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared] |
3551 | dependencies = tuple.length() > 2 ? tuple[2] : [] | |
3552 | incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes | |
3553 | defs = tuple.length() > 4 ? tuple[4] : [] | |
7e299ffe ZJS |
3554 | link_args = [] |
3555 | ||
3556 | if want_ossfuzz | |
3557 | dependencies += fuzzing_engine | |
3558 | elif want_libfuzzer | |
3559 | if fuzzing_engine.found() | |
9c5c4677 EV |
3560 | dependencies += fuzzing_engine |
3561 | else | |
7e299ffe | 3562 | link_args += ['-fsanitize=fuzzer'] |
9c5c4677 | 3563 | endif |
7e299ffe ZJS |
3564 | else |
3565 | sources += 'src/fuzz/fuzz-main.c' | |
3566 | endif | |
7db7d5b7 | 3567 | |
7e299ffe | 3568 | name = sources[0].split('/')[-1].split('.')[0] |
7db7d5b7 | 3569 | |
f78ad5f0 | 3570 | exe = executable( |
7e299ffe ZJS |
3571 | name, |
3572 | sources, | |
3573 | include_directories : [incs, include_directories('src/fuzz')], | |
3574 | link_with : link_with, | |
3575 | dependencies : dependencies, | |
a626cb15 | 3576 | c_args : defs + test_cflags, |
7e299ffe ZJS |
3577 | link_args: link_args, |
3578 | install : false, | |
f78ad5f0 ZJS |
3579 | build_by_default : fuzzer_build) |
3580 | fuzzer_exes += exe | |
3581 | ||
3582 | if want_tests != 'false' | |
3583 | # Run the fuzz regression tests without any sanitizers enabled. | |
3584 | # Additional invocations with sanitizers may be added below. | |
3585 | foreach p : fuzz_regression_tests | |
3586 | b = p.split('/')[-2] | |
3587 | c = p.split('/')[-1] | |
3588 | ||
3589 | if b == name | |
3590 | test('@0@_@1@'.format(b, c), | |
3591 | exe, | |
fce9abb2 | 3592 | args : [project_source_root / p]) |
f78ad5f0 ZJS |
3593 | endif |
3594 | endforeach | |
3595 | endif | |
7e299ffe | 3596 | endforeach |
7db7d5b7 | 3597 | |
6839ce33 | 3598 | alias_target('fuzzers', fuzzer_exes) |
7db7d5b7 JR |
3599 | |
3600 | ############################################################ | |
3601 | ||
378e9d2b | 3602 | subdir('modprobe.d') |
5c23128d ZJS |
3603 | subdir('sysctl.d') |
3604 | subdir('sysusers.d') | |
3605 | subdir('tmpfiles.d') | |
4f10b807 ZJS |
3606 | subdir('hwdb.d') |
3607 | subdir('units') | |
e783f957 | 3608 | subdir('presets') |
5c23128d ZJS |
3609 | subdir('network') |
3610 | subdir('man') | |
3611 | subdir('shell-completion/bash') | |
3612 | subdir('shell-completion/zsh') | |
9e825ebf FB |
3613 | subdir('docs/sysvinit') |
3614 | subdir('docs/var-log') | |
5c23128d | 3615 | |
5c23128d ZJS |
3616 | install_subdir('factory/etc', |
3617 | install_dir : factorydir) | |
3618 | ||
d7aa78c3 JT |
3619 | if install_sysconfdir |
3620 | install_data('xorg/50-systemd-user.sh', | |
3621 | install_dir : xinitrcdir) | |
3622 | endif | |
f09eb768 | 3623 | install_data('LICENSE.GPL2', |
5c23128d | 3624 | 'LICENSE.LGPL2.1', |
f09eb768 LP |
3625 | 'NEWS', |
3626 | 'README', | |
eea98402 | 3627 | 'docs/CODING_STYLE.md', |
1d1cb168 | 3628 | 'docs/DISTRO_PORTING.md', |
9e825ebf | 3629 | 'docs/ENVIRONMENT.md', |
5425f8a5 | 3630 | 'docs/HACKING.md', |
9e825ebf | 3631 | 'docs/TRANSIENT-SETTINGS.md', |
b6dc0d7d | 3632 | 'docs/TRANSLATORS.md', |
9e825ebf | 3633 | 'docs/UIDS-GIDS.md', |
2bc48bbd | 3634 | 'docs/GVARIANT-SERIALIZATION.md', |
5c23128d | 3635 | install_dir : docdir) |
d68b342b | 3636 | |
7c22f07c ZJS |
3637 | meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir)) |
3638 | meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir)) | |
94e75a54 | 3639 | |
d68b342b ZJS |
3640 | ############################################################ |
3641 | ||
2d4efd1d LB |
3642 | # Ensure that changes to the docs/ directory do not break the |
3643 | # basic Github pages build. But only run it in developer mode, | |
3644 | # as it might be fragile due to changes in the tooling, and it is | |
3645 | # not generally useful for users. | |
3646 | jekyll = find_program('jekyll', required : false) | |
3647 | if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found() | |
3648 | test('github-pages', | |
3649 | jekyll, | |
3650 | args : ['build', | |
fce9abb2 ZJS |
3651 | '--source', project_source_root / 'docs', |
3652 | '--destination', project_build_root / '_site']) | |
2d4efd1d LB |
3653 | endif |
3654 | ||
3655 | ############################################################ | |
3656 | ||
dd1e33c8 | 3657 | check_help = find_program('tools/check-help.sh') |
005a29f2 ZJS |
3658 | |
3659 | foreach exec : public_programs | |
37efbbd8 | 3660 | name = exec.full_path().split('/')[-1] |
938be089 ZJS |
3661 | if want_tests != 'false' |
3662 | test('check-help-' + name, | |
dd1e33c8 | 3663 | check_help, |
c1cd6743 | 3664 | args : exec.full_path()) |
938be089 | 3665 | endif |
005a29f2 ZJS |
3666 | endforeach |
3667 | ||
3668 | ############################################################ | |
3669 | ||
c6448ee3 ZJS |
3670 | check_directives_sh = find_program('tools/check-directives.sh') |
3671 | ||
3672 | if want_tests != 'false' | |
3673 | test('check-directives', | |
3674 | check_directives_sh, | |
34fde9f8 | 3675 | args : [project_source_root, project_build_root]) |
c6448ee3 ZJS |
3676 | endif |
3677 | ||
3678 | ############################################################ | |
3679 | ||
52d4d1d3 ZJS |
3680 | # Enable tests for all supported sanitizers |
3681 | foreach tuple : sanitizers | |
3682 | sanitizer = tuple[0] | |
3683 | build = tuple[1] | |
b68dfb9e | 3684 | |
7a6397d2 | 3685 | if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer)) |
52d4d1d3 ZJS |
3686 | prev = '' |
3687 | foreach p : fuzz_regression_tests | |
3688 | b = p.split('/')[-2] | |
3689 | c = p.split('/')[-1] | |
3690 | ||
3691 | name = '@0@:@1@'.format(b, sanitizer) | |
3692 | ||
3693 | if name != prev | |
3694 | if want_tests == 'false' | |
3695 | message('Not compiling @0@ because tests is set to false'.format(name)) | |
1763ef1d | 3696 | elif fuzz_tests |
52d4d1d3 ZJS |
3697 | exe = custom_target( |
3698 | name, | |
3699 | output : name, | |
3700 | depends : build, | |
0f4c4f38 | 3701 | command : [ln, '-fs', |
fce9abb2 | 3702 | build.full_path() / b, |
52d4d1d3 ZJS |
3703 | '@OUTPUT@'], |
3704 | build_by_default : true) | |
3705 | else | |
1763ef1d | 3706 | message('Not compiling @0@ because fuzz-tests is set to false'.format(name)) |
52d4d1d3 ZJS |
3707 | endif |
3708 | endif | |
3709 | prev = name | |
3710 | ||
1763ef1d | 3711 | if fuzz_tests |
0f82a2ab | 3712 | test('@0@_@1@_@2@'.format(b, c, sanitizer), |
52d4d1d3 | 3713 | env, |
89767158 EV |
3714 | env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'], |
3715 | timeout : 60, | |
52d4d1d3 | 3716 | args : [exe.full_path(), |
fce9abb2 | 3717 | project_source_root / p]) |
52d4d1d3 ZJS |
3718 | endif |
3719 | endforeach | |
b68dfb9e ZJS |
3720 | endif |
3721 | endforeach | |
3722 | ||
52d4d1d3 | 3723 | |
b68dfb9e ZJS |
3724 | ############################################################ |
3725 | ||
0700e8ba | 3726 | if git.found() |
37efbbd8 | 3727 | all_files = run_command( |
0f4c4f38 ZJS |
3728 | env, '-u', 'GIT_WORK_TREE', |
3729 | git, '--git-dir=@0@/.git'.format(project_source_root), | |
a412ec57 ZJS |
3730 | 'ls-files', ':/*.[ch]') |
3731 | ||
37efbbd8 | 3732 | all_files = files(all_files.stdout().split()) |
d68b342b | 3733 | |
e85a690b | 3734 | custom_target( |
0700e8ba | 3735 | 'tags', |
e85a690b | 3736 | output : 'tags', |
1485aacb | 3737 | command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files) |
2f09974f | 3738 | run_target( |
0700e8ba | 3739 | 'ctags', |
1485aacb | 3740 | command : [env, 'ctags', '-o', '@0@/tags'.format(project_source_root)] + all_files) |
d68b342b | 3741 | endif |
177929c2 ZJS |
3742 | |
3743 | if git.found() | |
dd1e33c8 | 3744 | git_contrib_sh = find_program('tools/git-contrib.sh') |
a923e085 | 3745 | run_target( |
37efbbd8 | 3746 | 'git-contrib', |
dd1e33c8 | 3747 | command : [git_contrib_sh]) |
177929c2 | 3748 | endif |
dd6ab3df ZJS |
3749 | |
3750 | if git.found() | |
3751 | git_head = run_command( | |
3752 | git, | |
0f4c4f38 ZJS |
3753 | '--git-dir=@0@/.git'.format(project_source_root), |
3754 | 'rev-parse', 'HEAD').stdout().strip() | |
dd6ab3df ZJS |
3755 | git_head_short = run_command( |
3756 | git, | |
0f4c4f38 ZJS |
3757 | '--git-dir=@0@/.git'.format(project_source_root), |
3758 | 'rev-parse', '--short=7', 'HEAD').stdout().strip() | |
dd6ab3df ZJS |
3759 | |
3760 | run_target( | |
3761 | 'git-snapshot', | |
0f4c4f38 | 3762 | command : [git, 'archive', |
1485aacb | 3763 | '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root, |
dd6ab3df ZJS |
3764 | git_head_short), |
3765 | '--prefix', 'systemd-@0@/'.format(git_head), | |
3766 | 'HEAD']) | |
3767 | endif | |
829257d1 ZJS |
3768 | |
3769 | ############################################################ | |
3770 | ||
dd1e33c8 | 3771 | check_api_docs_sh = find_program('tools/check-api-docs.sh') |
51b13863 LP |
3772 | run_target( |
3773 | 'check-api-docs', | |
3774 | depends : [man, libsystemd, libudev], | |
dd1e33c8 | 3775 | command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()]) |
51b13863 | 3776 | |
f12c5d36 ZJS |
3777 | alias_target('update-dbus-docs', update_dbus_docs) |
3778 | alias_target('update-man-rules', update_man_rules) | |
e3c368f6 | 3779 | |
51b13863 | 3780 | ############################################################ |
829257d1 ZJS |
3781 | |
3782 | alt_time_epoch = run_command('date', '-Is', '-u', '-d', | |
3783 | '@@0@'.format(time_epoch)).stdout().strip() | |
12085ebb ZJS |
3784 | |
3785 | summary({ | |
3786 | 'build mode' : get_option('mode'), | |
3787 | 'split /usr' : split_usr, | |
3788 | 'split bin-sbin' : split_bin, | |
3789 | 'prefix directory' : prefixdir, | |
3790 | 'rootprefix directory' : rootprefixdir, | |
3791 | 'sysconf directory' : sysconfdir, | |
3792 | 'include directory' : includedir, | |
3793 | 'lib directory' : libdir, | |
3794 | 'rootlib directory' : rootlibdir, | |
3795 | 'SysV init scripts' : sysvinit_path, | |
3796 | 'SysV rc?.d directories' : sysvrcnd_path, | |
3797 | 'PAM modules directory' : pamlibdir, | |
3798 | 'PAM configuration directory' : pamconfdir, | |
3799 | 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir, | |
3800 | 'RPM macros directory' : rpmmacrosdir, | |
3801 | 'modprobe.d directory' : modprobedir, | |
3802 | 'D-Bus policy directory' : dbuspolicydir, | |
3803 | 'D-Bus session directory' : dbussessionservicedir, | |
3804 | 'D-Bus system directory' : dbussystemservicedir, | |
3805 | 'bash completions directory' : bashcompletiondir, | |
3806 | 'zsh completions directory' : zshcompletiondir, | |
3807 | 'extra start script' : get_option('rc-local'), | |
3808 | 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'), | |
3809 | get_option('debug-tty')), | |
3810 | 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'), | |
3811 | conf.get('SYSTEM_ALLOC_UID_MIN')), | |
3812 | 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'), | |
3813 | conf.get('SYSTEM_ALLOC_GID_MIN')), | |
3814 | 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max), | |
3815 | 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max), | |
3816 | 'static UID/GID allocations' : ' '.join(static_ugids), | |
3817 | '/dev/kvm access mode' : get_option('dev-kvm-mode'), | |
3818 | 'render group access mode' : get_option('group-render-mode'), | |
3819 | 'certificate root directory' : get_option('certificate-root'), | |
3820 | 'support URL' : support_url, | |
3821 | 'nobody user name' : nobody_user, | |
3822 | 'nobody group name' : nobody_group, | |
3823 | 'fallback hostname' : get_option('fallback-hostname'), | |
3824 | 'default DNSSEC mode' : default_dnssec, | |
3825 | 'default DNS-over-TLS mode' : default_dns_over_tls, | |
3826 | 'default mDNS mode' : default_mdns, | |
3827 | 'default LLMNR mode' : default_llmnr, | |
3828 | 'default DNS servers' : dns_servers.split(' '), | |
3829 | 'default NTP servers' : ntp_servers.split(' '), | |
3830 | 'default cgroup hierarchy' : default_hierarchy, | |
3831 | 'default net.naming-scheme value' : default_net_naming_scheme, | |
3832 | 'default KillUserProcesses value' : kill_user_processes, | |
3833 | 'default locale' : default_locale, | |
3834 | 'default user $PATH' : | |
3835 | default_user_path != '' ? default_user_path : '(same as system services)', | |
3836 | 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog, | |
3837 | 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)}) | |
829257d1 ZJS |
3838 | |
3839 | # TODO: | |
3840 | # CFLAGS: ${OUR_CFLAGS} ${CFLAGS} | |
3841 | # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS} | |
3842 | # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS} | |
3843 | ||
349cc4a5 | 3844 | if conf.get('ENABLE_EFI') == 1 |
f064b40e | 3845 | summary({'EFI arch' : efi_arch}, |
12085ebb | 3846 | section : 'Extensible Firmware Interface') |
829257d1 ZJS |
3847 | |
3848 | if have_gnu_efi | |
12085ebb ZJS |
3849 | summary({ |
3850 | 'EFI machine type' : EFI_MACHINE_TYPE_NAME, | |
3851 | 'EFI CC' : '@0@'.format(' '.join(efi_cc)), | |
3852 | 'EFI lds' : efi_lds, | |
3853 | 'EFI crt0' : efi_crt0, | |
3854 | 'EFI include directory' : efi_incdir}, | |
3855 | section : 'Extensible Firmware Interface') | |
829257d1 ZJS |
3856 | endif |
3857 | endif | |
3858 | ||
3859 | found = [] | |
3860 | missing = [] | |
3861 | ||
3862 | foreach tuple : [ | |
56d68e71 ZJS |
3863 | # dependencies |
3864 | ['ACL'], | |
829257d1 | 3865 | ['AUDIT'], |
829257d1 | 3866 | ['AppArmor'], |
56d68e71 ZJS |
3867 | ['IMA'], |
3868 | ['PAM'], | |
829257d1 | 3869 | ['SECCOMP'], |
56d68e71 | 3870 | ['SELinux'], |
829257d1 | 3871 | ['SMACK'], |
56d68e71 ZJS |
3872 | ['blkid'], |
3873 | ['elfutils'], | |
829257d1 | 3874 | ['gcrypt'], |
829257d1 | 3875 | ['gnutls'], |
7d861e12 | 3876 | ['libbpf'], |
56d68e71 | 3877 | ['libcryptsetup'], |
d1ae38d8 | 3878 | ['libcryptsetup-plugins'], |
829257d1 | 3879 | ['libcurl'], |
56d68e71 ZJS |
3880 | ['libfdisk'], |
3881 | ['libfido2'], | |
829257d1 | 3882 | ['libidn'], |
56d68e71 | 3883 | ['libidn2'], |
829257d1 | 3884 | ['libiptc'], |
56d68e71 ZJS |
3885 | ['microhttpd'], |
3886 | ['openssl'], | |
3887 | ['p11kit'], | |
3888 | ['pcre2'], | |
3889 | ['pwquality'], | |
3890 | ['qrencode'], | |
3891 | ['tpm2'], | |
3892 | ['xkbcommon'], | |
3893 | ||
3894 | # compression libs | |
3895 | ['zstd'], | |
3896 | ['lz4'], | |
3897 | ['xz'], | |
3898 | ['zlib'], | |
3899 | ['bzip2'], | |
3900 | ||
3901 | # components | |
3902 | ['backlight'], | |
829257d1 | 3903 | ['binfmt'], |
7d861e12 | 3904 | ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1], |
56d68e71 | 3905 | ['coredump'], |
829257d1 | 3906 | ['environment.d'], |
56d68e71 ZJS |
3907 | ['efi'], |
3908 | ['gnu-efi', have_gnu_efi], | |
829257d1 | 3909 | ['firstboot'], |
56d68e71 ZJS |
3910 | ['hibernate'], |
3911 | ['homed'], | |
3912 | ['hostnamed'], | |
3913 | ['hwdb'], | |
3914 | ['importd'], | |
3915 | ['initrd'], | |
3916 | ['kernel-install', get_option('kernel-install')], | |
3917 | ['localed'], | |
829257d1 ZJS |
3918 | ['logind'], |
3919 | ['machined'], | |
56d68e71 ZJS |
3920 | ['networkd'], |
3921 | ['nss-myhostname'], | |
3922 | ['nss-mymachines'], | |
3923 | ['nss-resolve'], | |
3924 | ['nss-systemd'], | |
3925 | ['oomd'], | |
61d0578b | 3926 | ['portabled'], |
56d68e71 ZJS |
3927 | ['pstore'], |
3928 | ['quotacheck'], | |
3929 | ['randomseed'], | |
3930 | ['repart'], | |
3931 | ['resolve'], | |
3932 | ['rfkill'], | |
9bca4ae4 | 3933 | ['sysext'], |
56d68e71 ZJS |
3934 | ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1], |
3935 | ['sysusers'], | |
829257d1 ZJS |
3936 | ['timedated'], |
3937 | ['timesyncd'], | |
56d68e71 ZJS |
3938 | ['tmpfiles'], |
3939 | ['userdb'], | |
3940 | ['vconsole'], | |
3941 | ['xdg-autostart'], | |
3942 | ||
3943 | # optional features | |
56d68e71 | 3944 | ['idn'], |
829257d1 | 3945 | ['polkit'], |
56d68e71 ZJS |
3946 | ['nscd'], |
3947 | ['legacy-pkla', install_polkit_pkla], | |
829257d1 | 3948 | ['kmod'], |
829257d1 ZJS |
3949 | ['dbus'], |
3950 | ['glib'], | |
829257d1 | 3951 | ['tpm'], |
ba081955 ZJS |
3952 | ['man pages', want_man], |
3953 | ['html pages', want_html], | |
3954 | ['man page indices', want_man and have_lxml], | |
829257d1 | 3955 | ['SysV compat'], |
56d68e71 | 3956 | ['compat-mutable-uid-boundaries'], |
829257d1 ZJS |
3957 | ['utmp'], |
3958 | ['ldconfig'], | |
ba081955 ZJS |
3959 | ['adm group', get_option('adm-group')], |
3960 | ['wheel group', get_option('wheel-group')], | |
b14e1b43 | 3961 | ['gshadow'], |
829257d1 ZJS |
3962 | ['debug hashmap'], |
3963 | ['debug mmap cache'], | |
d6601495 | 3964 | ['debug siphash'], |
ba081955 ZJS |
3965 | ['valgrind', conf.get('VALGRIND') == 1], |
3966 | ['trace logging', conf.get('LOG_TRACE') == 1], | |
3967 | ['install tests', install_tests], | |
19d8c9c9 LP |
3968 | ['link-udev-shared', get_option('link-udev-shared')], |
3969 | ['link-systemctl-shared', get_option('link-systemctl-shared')], | |
5ac8b50d | 3970 | ['link-networkd-shared', get_option('link-networkd-shared')], |
fd74a13e | 3971 | ['link-timesyncd-shared', get_option('link-timesyncd-shared')], |
ceedbf81 | 3972 | ['fexecve'], |
18b49798 | 3973 | ['standalone-binaries', get_option('standalone-binaries')], |
829257d1 ZJS |
3974 | ] |
3975 | ||
af4d7860 ZJS |
3976 | if tuple.length() >= 2 |
3977 | cond = tuple[1] | |
3978 | else | |
829257d1 ZJS |
3979 | ident1 = 'HAVE_' + tuple[0].underscorify().to_upper() |
3980 | ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper() | |
349cc4a5 | 3981 | cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1 |
829257d1 ZJS |
3982 | endif |
3983 | if cond | |
5a8b1640 | 3984 | found += tuple[0] |
829257d1 | 3985 | else |
5a8b1640 | 3986 | missing += tuple[0] |
829257d1 ZJS |
3987 | endif |
3988 | endforeach | |
3989 | ||
c716c253 ZJS |
3990 | if static_libsystemd == 'false' |
3991 | missing += 'static-libsystemd' | |
3992 | else | |
3993 | found += 'static-libsystemd(@0@)'.format(static_libsystemd) | |
3994 | endif | |
3995 | ||
3996 | if static_libudev == 'false' | |
3997 | missing += 'static-libudev' | |
3998 | else | |
3999 | found += 'static-libudev(@0@)'.format(static_libudev) | |
4000 | endif | |
4001 | ||
237f2da9 ZJS |
4002 | if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1 |
4003 | found += 'DNS-over-TLS(gnutls)' | |
4004 | elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1 | |
4005 | found += 'DNS-over-TLS(openssl)' | |
4006 | else | |
4007 | missing += 'DNS-over-TLS' | |
4008 | endif | |
4009 | ||
12085ebb ZJS |
4010 | summary({ |
4011 | 'enabled' : ', '.join(found), | |
4012 | 'disabled' : ', '.join(missing)}, | |
4013 | section : 'Features') | |
9a8e64b0 ZJS |
4014 | |
4015 | if rootprefixdir != rootprefix_default | |
8ea9fad7 YW |
4016 | warning('\n' + |
4017 | 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) + | |
4018 | 'systemd used fixed names for unit file directories and other paths, so anything\n' + | |
4019 | 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default)) | |
9a8e64b0 | 4020 | endif |