]> git.ipfire.org Git - thirdparty/systemd.git/blob - meson.build
Merge pull request #26082 from kraxel/uki
[thirdparty/systemd.git] / meson.build
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2
3 project('systemd', 'c',
4 version : '252',
5 license : 'LGPLv2+',
6 default_options: [
7 'c_std=gnu11',
8 'prefix=/usr',
9 'sysconfdir=/etc',
10 'localstatedir=/var',
11 'warning_level=2',
12 ],
13 meson_version : '>= 0.53.2',
14 )
15
16 libsystemd_version = '0.35.0'
17 libudev_version = '1.7.5'
18
19 conf = configuration_data()
20 conf.set_quoted('PROJECT_URL', 'https://systemd.io/')
21 conf.set('PROJECT_VERSION', meson.project_version(),
22 description : 'Numerical project version (used where a simple number is expected)')
23
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()
27 project_build_root = meson.current_build_dir()
28 relative_source_path = run_command('realpath',
29 '--relative-to=@0@'.format(project_build_root),
30 project_source_root,
31 check : true).stdout().strip()
32 conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
33
34 conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer',
35 description : 'tailor build to development or release builds')
36 verification = get_option('log-message-verification')
37 if verification == 'auto'
38 verification = conf.get('BUILD_MODE_DEVELOPER') == 1
39 else
40 verification = verification == 'true'
41 endif
42 conf.set10('LOG_MESSAGE_VERIFICATION', verification)
43
44 want_ossfuzz = get_option('oss-fuzz')
45 want_libfuzzer = get_option('llvm-fuzz')
46 if want_ossfuzz and want_libfuzzer
47 error('only one of oss-fuzz or llvm-fuzz can be specified')
48 endif
49
50 skip_deps = want_ossfuzz or get_option('skip-deps')
51 fuzzer_build = want_ossfuzz or want_libfuzzer
52
53 # If we're building *not* for actual fuzzing, allow input samples of any size
54 # (for testing and for reproduction of issues discovered with previously-higher
55 # limits).
56 conf.set10('FUZZ_USE_SIZE_LIMIT', fuzzer_build)
57
58 # We'll set this to '1' for EFI builds in a different place.
59 conf.set10('SD_BOOT', false)
60
61 # Create a title-less summary section early, so it ends up first in the output.
62 # More items are added later after they have been detected.
63 summary({'build mode' : get_option('mode')})
64
65 #####################################################################
66
67 # Try to install the git pre-commit hook
68 add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false)
69 if add_git_hook_sh.found()
70 git_hook = run_command(add_git_hook_sh, check : false)
71 if git_hook.returncode() == 0
72 message(git_hook.stdout().strip())
73 endif
74 endif
75
76 #####################################################################
77
78 fs = import('fs')
79 if get_option('split-usr') == 'auto'
80 split_usr = not fs.is_symlink('/bin')
81 else
82 split_usr = get_option('split-usr') == 'true'
83 endif
84 if split_usr
85 warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n'
86 + ' split-usr mode is going to be removed\n' +
87 '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
88 endif
89 conf.set10('HAVE_SPLIT_USR', split_usr,
90 description : '/usr/bin and /bin directories are separate')
91
92 if get_option('split-bin') == 'auto'
93 split_bin = not fs.is_symlink('/usr/sbin')
94 else
95 split_bin = get_option('split-bin') == 'true'
96 endif
97 conf.set10('HAVE_SPLIT_BIN', split_bin,
98 description : 'bin and sbin directories are separate')
99
100 rootprefixdir = get_option('rootprefix')
101 # Unusual rootprefixdir values are used by some distros
102 # (see https://github.com/systemd/systemd/pull/7461).
103 rootprefix_default = split_usr ? '/' : '/usr'
104 if rootprefixdir == ''
105 rootprefixdir = rootprefix_default
106 endif
107 rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir
108
109 have_standalone_binaries = get_option('standalone-binaries')
110
111 sysvinit_path = get_option('sysvinit-path')
112 sysvrcnd_path = get_option('sysvrcnd-path')
113 conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
114 description : 'SysV init scripts and rcN.d links are supported')
115 conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs'))
116
117 if get_option('hibernate') and not get_option('initrd')
118 error('hibernate depends on initrd')
119 endif
120
121 conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max'))
122 conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open'))
123 conf.set('HIGH_RLIMIT_NOFILE', 512*1024)
124
125 # Meson ignores the preceding arguments when joining paths if an absolute
126 # component is encountered, so this should canonicalize various paths when they
127 # are absolute or relative.
128 prefixdir = get_option('prefix')
129 if not prefixdir.startswith('/')
130 error('Prefix is not absolute: "@0@"'.format(prefixdir))
131 endif
132 if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
133 error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
134 rootprefixdir, prefixdir))
135 endif
136
137 bindir = prefixdir / get_option('bindir')
138 libdir = prefixdir / get_option('libdir')
139 sysconfdir = prefixdir / get_option('sysconfdir')
140 includedir = prefixdir / get_option('includedir')
141 datadir = prefixdir / get_option('datadir')
142 localstatedir = '/' / get_option('localstatedir')
143
144 rootbindir = rootprefixdir / 'bin'
145 rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin')
146 rootlibexecdir = rootprefixdir / 'lib/systemd'
147
148 rootlibdir = get_option('rootlibdir')
149 if rootlibdir == ''
150 # This will be a relative path if libdir is in prefix.
151 rootlibdir = get_option('libdir')
152 endif
153 if not rootlibdir.startswith('/')
154 # If we have a relative path, add rootprefixdir to the front.
155 rootlibdir = rootprefixdir / rootlibdir
156 endif
157 rootpkglibdir = rootlibdir / 'systemd'
158
159 install_sysconfdir = get_option('install-sysconfdir') != 'false'
160 install_sysconfdir_samples = get_option('install-sysconfdir') == 'true'
161 # Dirs of external packages
162 pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig'
163 pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
164 polkitpolicydir = datadir / 'polkit-1/actions'
165 polkitrulesdir = datadir / 'polkit-1/rules.d'
166 polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d'
167 xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d'
168 rpmmacrosdir = get_option('rpmmacrosdir')
169 if rpmmacrosdir != 'no'
170 rpmmacrosdir = prefixdir / rpmmacrosdir
171 endif
172 modprobedir = rootprefixdir / 'lib/modprobe.d'
173
174 # Our own paths
175 pkgdatadir = datadir / 'systemd'
176 environmentdir = prefixdir / 'lib/environment.d'
177 pkgsysconfdir = sysconfdir / 'systemd'
178 userunitdir = prefixdir / 'lib/systemd/user'
179 userpresetdir = prefixdir / 'lib/systemd/user-preset'
180 tmpfilesdir = prefixdir / 'lib/tmpfiles.d'
181 usertmpfilesdir = prefixdir / 'share/user-tmpfiles.d'
182 sysusersdir = prefixdir / 'lib/sysusers.d'
183 sysctldir = prefixdir / 'lib/sysctl.d'
184 binfmtdir = prefixdir / 'lib/binfmt.d'
185 modulesloaddir = prefixdir / 'lib/modules-load.d'
186 networkdir = rootprefixdir / 'lib/systemd/network'
187 pkgincludedir = includedir / 'systemd'
188 systemgeneratordir = rootlibexecdir / 'system-generators'
189 usergeneratordir = prefixdir / 'lib/systemd/user-generators'
190 systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators'
191 userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators'
192 systemshutdowndir = rootlibexecdir / 'system-shutdown'
193 systemsleepdir = rootlibexecdir / 'system-sleep'
194 systemunitdir = rootprefixdir / 'lib/systemd/system'
195 systempresetdir = rootprefixdir / 'lib/systemd/system-preset'
196 udevlibexecdir = rootprefixdir / 'lib/udev'
197 udevrulesdir = udevlibexecdir / 'rules.d'
198 udevhwdbdir = udevlibexecdir / 'hwdb.d'
199 catalogdir = prefixdir / 'lib/systemd/catalog'
200 kerneldir = prefixdir / 'lib/kernel'
201 kernelinstalldir = kerneldir / 'install.d'
202 factorydir = datadir / 'factory'
203 bootlibdir = prefixdir / 'lib/systemd/boot/efi'
204 testsdir = prefixdir / 'lib/systemd/tests'
205 systemdstatedir = localstatedir / 'lib/systemd'
206 catalogstatedir = systemdstatedir / 'catalog'
207 randomseeddir = localstatedir / 'lib/systemd'
208 profiledir = rootlibexecdir / 'portable' / 'profile'
209 ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d'
210
211 docdir = get_option('docdir')
212 if docdir == ''
213 docdir = datadir / 'doc/systemd'
214 endif
215
216 pamlibdir = get_option('pamlibdir')
217 if pamlibdir == ''
218 pamlibdir = rootlibdir / 'security'
219 endif
220
221 pamconfdir = get_option('pamconfdir')
222 if pamconfdir == ''
223 pamconfdir = prefixdir / 'lib/pam.d'
224 endif
225
226 libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir')
227 if libcryptsetup_plugins_dir == ''
228 libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup'
229 endif
230
231 memory_accounting_default = get_option('memory-accounting-default')
232 status_unit_format_default = get_option('status-unit-format-default')
233 if status_unit_format_default == 'auto'
234 status_unit_format_default = conf.get('BUILD_MODE_DEVELOPER') == 1 ? 'name' : 'description'
235 endif
236
237 conf.set_quoted('BINFMT_DIR', binfmtdir)
238 conf.set_quoted('BOOTLIBDIR', bootlibdir)
239 conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database')
240 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
241 conf.set_quoted('DOC_DIR', docdir)
242 conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd')
243 conf.set_quoted('ENVIRONMENT_DIR', environmentdir)
244 conf.set_quoted('INCLUDE_DIR', includedir)
245 conf.set_quoted('LIBDIR', libdir)
246 conf.set_quoted('MODPROBE_DIR', modprobedir)
247 conf.set_quoted('MODULESLOAD_DIR', modulesloaddir)
248 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
249 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent')
250 conf.set_quoted('PREFIX', prefixdir)
251 conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed')
252 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
253 conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local'))
254 conf.set_quoted('ROOTBINDIR', rootbindir)
255 conf.set_quoted('ROOTLIBDIR', rootlibdir)
256 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
257 conf.set_quoted('ROOTPREFIX', rootprefixdir)
258 conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash)
259 conf.set_quoted('SYSCONF_DIR', sysconfdir)
260 conf.set_quoted('SYSCTL_DIR', sysctldir)
261 conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl')
262 conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd')
263 conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir)
264 conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent')
265 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup')
266 conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export')
267 conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck')
268 conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs')
269 conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework')
270 conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs')
271 conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import')
272 conf.set_quoted('SYSTEMD_INTEGRITYSETUP_PATH', rootlibexecdir / 'systemd-integritysetup')
273 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map')
274 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map')
275 conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs')
276 conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull')
277 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown')
278 conf.set_quoted('SYSTEMD_TEST_DATA', testsdir / 'testdata')
279 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent')
280 conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper')
281 conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork')
282 conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup')
283 conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system')
284 conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir)
285 conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir)
286 conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir)
287 conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir)
288 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
289 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
290 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
291 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
292 conf.set_quoted('SYSUSERS_DIR', sysusersdir)
293 conf.set_quoted('TMPFILES_DIR', tmpfilesdir)
294 conf.set_quoted('USER_TMPFILES_DIR', usertmpfilesdir)
295 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
296 conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir)
297 conf.set_quoted('UDEV_RULES_DIR', udevrulesdir)
298 conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout'))
299 conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user')
300 conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir)
301 conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir)
302 conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir)
303 conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg')
304 conf.set_quoted('USER_PRESET_DIR', userpresetdir)
305 conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg')
306
307 conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
308 conf.set10('ENABLE_URLIFY', get_option('urlify'))
309 conf.set10('ENABLE_FEXECVE', get_option('fexecve'))
310 conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default)
311 conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper())
312 conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default)
313
314 conf.set10('FIRST_BOOT_FULL_PRESET', get_option('first-boot-full-preset'))
315
316 #####################################################################
317
318 cc = meson.get_compiler('c')
319 pkgconfig = import('pkgconfig')
320 meson_build_sh = find_program('tools/meson-build.sh')
321
322 want_tests = get_option('tests')
323 slow_tests = want_tests != 'false' and get_option('slow-tests')
324 fuzz_tests = want_tests != 'false' and get_option('fuzz-tests')
325 install_tests = get_option('install-tests')
326
327 if add_languages('cpp', required : fuzzer_build)
328 # Used only for tests
329 cxx = meson.get_compiler('cpp')
330 cxx_cmd = ' '.join(cxx.cmd_array())
331 else
332 cxx_cmd = ''
333 endif
334
335 if want_libfuzzer
336 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
337 if fuzzing_engine.found()
338 add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c')
339 elif cc.has_argument('-fsanitize=fuzzer-no-link')
340 add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
341 else
342 error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
343 endif
344 elif want_ossfuzz
345 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
346 endif
347
348 # Those generate many false positives, and we do not want to change the code to
349 # avoid them.
350 basic_disabled_warnings = [
351 '-Wno-missing-field-initializers',
352 '-Wno-unused-parameter',
353 ]
354
355 possible_common_cc_flags = [
356 '-Wdate-time',
357 '-Wendif-labels',
358 '-Werror=format=2',
359 '-Werror=format-signedness',
360 '-Werror=implicit-function-declaration',
361 '-Werror=incompatible-pointer-types',
362 '-Werror=int-conversion',
363 '-Werror=overflow',
364 '-Werror=override-init',
365 '-Werror=return-type',
366 '-Werror=shift-count-overflow',
367 '-Werror=shift-overflow=2',
368 '-Werror=undef',
369 '-Wfloat-equal',
370 # gperf prevents us from enabling this because it does not emit fallthrough
371 # attribute with clang.
372 #'-Wimplicit-fallthrough',
373 '-Wimplicit-fallthrough=5',
374 '-Winit-self',
375 '-Wlogical-op',
376 '-Wmissing-include-dirs',
377 '-Wmissing-noreturn',
378 '-Wnested-externs',
379 '-Wold-style-definition',
380 '-Wpointer-arith',
381 '-Wredundant-decls',
382 '-Wshadow',
383 '-Wstrict-aliasing=2',
384 '-Wstrict-prototypes',
385 '-Wsuggest-attribute=noreturn',
386 '-Wunused-function',
387 '-Wwrite-strings',
388
389 # negative arguments are correctly detected starting with meson 0.46.
390 '-Wno-error=#warnings', # clang
391 '-Wno-string-plus-int', # clang
392 ]
393
394 c_args = get_option('c_args')
395
396 # Our json library does not support -ffinite-math-only, which is enabled by -Ofast or -ffast-math.
397 if (('-Ofast' in c_args or '-ffast-math' in c_args or '-ffinite-math-only' in c_args) and '-fno-finite-math-only' not in c_args)
398 error('-Ofast, -ffast-math, or -ffinite-math-only is specified in c_args.')
399 endif
400
401 # Disable -Wmaybe-uninitialized when compiling with -Os/-O1/-O3/etc. There are
402 # too many false positives with gcc >= 8. Effectively, we only test with -O0
403 # and -O2; this should be enough to catch most important cases without too much
404 # busywork. See https://github.com/systemd/systemd/pull/19226.
405 if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or
406 cc.version().version_compare('<10') or
407 '-Os' in c_args or
408 '-O1' in c_args or
409 '-O3' in c_args or
410 '-Og' in c_args)
411 possible_common_cc_flags += '-Wno-maybe-uninitialized'
412 endif
413
414 # Disable -Wno-unused-result with gcc, see
415 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425.
416 if cc.get_id() == 'gcc'
417 possible_common_cc_flags += '-Wno-unused-result'
418 endif
419
420 # --as-needed and --no-undefined are provided by meson by default,
421 # run 'meson configure' to see what is enabled
422 possible_link_flags = [
423 '-Wl,--fatal-warnings',
424 '-Wl,-z,now',
425 '-Wl,-z,relro',
426 '-fstack-protector',
427 ]
428
429 if get_option('b_sanitize') == 'none'
430 possible_link_flags += '-Wl,--warn-common'
431 endif
432
433 if cc.get_id() == 'clang'
434 possible_common_cc_flags += [
435 '-Wno-typedef-redefinition',
436 '-Wno-gnu-variable-sized-type-not-at-end',
437 ]
438 endif
439
440 if get_option('mode') == 'release'
441 # We could enable 'pattern' for developer mode, but that can interfere with
442 # valgrind and sanitizer builds. Also, clang does not zero-initialize unions,
443 # breaking some of our code (https://reviews.llvm.org/D68115).
444 possible_common_cc_flags += '-ftrivial-auto-var-init=zero'
445 endif
446
447 possible_cc_flags = possible_common_cc_flags + [
448 '-Werror=missing-declarations',
449 '-Werror=missing-prototypes',
450 '-fdiagnostics-show-option',
451 '-fno-common',
452 '-fno-strict-aliasing',
453 '-fstack-protector',
454 '-fstack-protector-strong',
455 '-fstrict-flex-arrays=1',
456 '-fvisibility=hidden',
457 '--param=ssp-buffer-size=4',
458 ]
459
460 if get_option('buildtype') != 'debug'
461 possible_cc_flags += [
462 '-ffunction-sections',
463 '-fdata-sections',
464 ]
465
466 possible_link_flags += '-Wl,--gc-sections'
467 endif
468
469 if get_option('mode') == 'developer'
470 possible_cc_flags += '-fno-omit-frame-pointer'
471 endif
472
473 add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c')
474 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
475 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
476
477 have = cc.has_argument('-Wzero-length-bounds')
478 conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have)
479
480 if cc.compiles('''
481 #include <time.h>
482 #include <inttypes.h>
483 typedef uint64_t usec_t;
484 usec_t now(clockid_t clock);
485 int main(void) {
486 struct timespec now;
487 return 0;
488 }
489 ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing')
490 add_project_arguments('-Werror=shadow', language : 'c')
491 endif
492
493 if cxx_cmd != ''
494 add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp')
495 endif
496
497 cpp = ' '.join(cc.cmd_array()) + ' -E'
498
499 has_wstringop_truncation = cc.has_argument('-Wstringop-truncation')
500
501 #####################################################################
502 # compilation result tests
503
504 conf.set('_GNU_SOURCE', true)
505 conf.set('__SANE_USERSPACE_TYPES__', true)
506 conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation)
507
508 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
509 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
510 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
511 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
512 conf.set('SIZEOF_TIMEX_MEMBER', cc.sizeof('typeof(((struct timex *)0)->freq)', prefix : '#include <sys/timex.h>'))
513
514 long_max = cc.compute_int(
515 'LONG_MAX',
516 prefix : '#include <limits.h>',
517 guess : 0x7FFFFFFFFFFFFFFF,
518 high : 0x7FFFFFFFFFFFFFFF)
519 assert(long_max > 100000)
520 conf.set_quoted('LONG_MAX_STR', '@0@'.format(long_max))
521
522 decl_headers = '''
523 #include <uchar.h>
524 #include <sys/mount.h>
525 #include <sys/stat.h>
526 '''
527
528 foreach decl : ['char16_t',
529 'char32_t',
530 'struct mount_attr',
531 'struct statx',
532 ]
533
534 # We get -1 if the size cannot be determined
535 have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
536
537 if decl == 'struct mount_attr'
538 if have
539 want_linux_fs_h = false
540 else
541 have = cc.sizeof(decl,
542 prefix : decl_headers + '#include <linux/fs.h>',
543 args : '-D_GNU_SOURCE') > 0
544 want_linux_fs_h = have
545 endif
546 endif
547
548 if decl == 'struct statx'
549 if have
550 want_linux_stat_h = false
551 else
552 have = cc.sizeof(decl,
553 prefix : decl_headers + '#include <linux/stat.h>',
554 args : '-D_GNU_SOURCE') > 0
555 want_linux_stat_h = have
556 endif
557 endif
558
559 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
560 endforeach
561
562 conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
563 conf.set10('WANT_LINUX_FS_H', want_linux_fs_h)
564
565 foreach ident : ['secure_getenv', '__secure_getenv']
566 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
567 endforeach
568
569 foreach ident : [
570 ['memfd_create', '''#include <sys/mman.h>'''],
571 ['gettid', '''#include <sys/types.h>
572 #include <unistd.h>'''],
573 ['pivot_root', '''#include <stdlib.h>
574 #include <unistd.h>'''], # no known header declares pivot_root
575 ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get
576 ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set
577 ['name_to_handle_at', '''#include <sys/types.h>
578 #include <sys/stat.h>
579 #include <fcntl.h>'''],
580 ['setns', '''#include <sched.h>'''],
581 ['renameat2', '''#include <stdio.h>
582 #include <fcntl.h>'''],
583 ['kcmp', '''#include <linux/kcmp.h>'''],
584 ['keyctl', '''#include <sys/types.h>
585 #include <keyutils.h>'''],
586 ['copy_file_range', '''#include <sys/syscall.h>
587 #include <unistd.h>'''],
588 ['bpf', '''#include <sys/syscall.h>
589 #include <unistd.h>'''],
590 ['statx', '''#include <sys/types.h>
591 #include <sys/stat.h>
592 #include <unistd.h>'''],
593 ['explicit_bzero' , '''#include <string.h>'''],
594 ['reallocarray', '''#include <stdlib.h>'''],
595 ['set_mempolicy', '''#include <stdlib.h>
596 #include <unistd.h>'''],
597 ['get_mempolicy', '''#include <stdlib.h>
598 #include <unistd.h>'''],
599 ['pidfd_send_signal', '''#include <stdlib.h>
600 #include <unistd.h>
601 #include <signal.h>
602 #include <sys/wait.h>'''],
603 ['pidfd_open', '''#include <stdlib.h>
604 #include <unistd.h>
605 #include <signal.h>
606 #include <sys/wait.h>'''],
607 ['rt_sigqueueinfo', '''#include <stdlib.h>
608 #include <unistd.h>
609 #include <signal.h>
610 #include <sys/wait.h>'''],
611 ['rt_tgsigqueueinfo', '''#include <stdlib.h>
612 #include <unistd.h>
613 #include <signal.h>
614 #include <sys/wait.h>'''],
615 ['mallinfo', '''#include <malloc.h>'''],
616 ['mallinfo2', '''#include <malloc.h>'''],
617 ['execveat', '''#include <unistd.h>'''],
618 ['close_range', '''#include <unistd.h>'''],
619 ['epoll_pwait2', '''#include <sys/epoll.h>'''],
620 ['mount_setattr', '''#include <sys/mount.h>'''],
621 ['move_mount', '''#include <sys/mount.h>'''],
622 ['open_tree', '''#include <sys/mount.h>'''],
623 ['fsopen', '''#include <sys/mount.h>'''],
624 ['fsconfig', '''#include <sys/mount.h>'''],
625 ['getdents64', '''#include <dirent.h>'''],
626 ]
627
628 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
629 conf.set10('HAVE_' + ident[0].to_upper(), have)
630 endforeach
631
632 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
633 conf.set10('USE_SYS_RANDOM_H', true)
634 conf.set10('HAVE_GETRANDOM', true)
635 else
636 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
637 conf.set10('USE_SYS_RANDOM_H', false)
638 conf.set10('HAVE_GETRANDOM', have)
639 endif
640
641 #####################################################################
642
643 version_tag = get_option('version-tag')
644 if version_tag != ''
645 vcs_data = configuration_data()
646 vcs_data.set('VCS_TAG', version_tag)
647 version_h = configure_file(configuration : vcs_data,
648 input : 'src/version/version.h.in',
649 output : 'version.h')
650 else
651 vcs_tagger = [
652 project_source_root + '/tools/meson-vcs-tag.sh',
653 project_source_root,
654 meson.project_version()]
655
656 version_h = vcs_tag(
657 input : 'src/version/version.h.in',
658 output : 'version.h',
659 command: vcs_tagger)
660 endif
661
662 versiondep = declare_dependency(sources: version_h)
663
664 shared_lib_tag = get_option('shared-lib-tag')
665 if shared_lib_tag == ''
666 shared_lib_tag = meson.project_version()
667 endif
668
669 sh = find_program('sh')
670 echo = find_program('echo')
671 sed = find_program('sed')
672 awk = find_program('awk')
673 stat = find_program('stat')
674 ln = find_program('ln')
675 git = find_program('git', required : false)
676 env = find_program('env')
677 perl = find_program('perl', required : false)
678 rsync = find_program('rsync', required : false)
679 meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh'
680
681 mkdir_p = 'mkdir -p $DESTDIR/@0@'
682
683 # If -Dxxx-path option is found, use that. Otherwise, check in $PATH,
684 # /usr/sbin, /sbin, and fall back to the default from middle column.
685 progs = [['quotaon', '/usr/sbin/quotaon' ],
686 ['quotacheck', '/usr/sbin/quotacheck' ],
687 ['kmod', '/usr/bin/kmod' ],
688 ['kexec', '/usr/sbin/kexec' ],
689 ['sulogin', '/usr/sbin/sulogin' ],
690 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
691 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
692 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
693 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
694 ['nologin', '/usr/sbin/nologin', ],
695 ]
696 foreach prog : progs
697 path = get_option(prog[0] + '-path')
698 if path != ''
699 message('Using @1@ for @0@'.format(prog[0], path))
700 else
701 exe = find_program(prog[0],
702 '/usr/sbin/' + prog[0],
703 '/sbin/' + prog[0],
704 required: false)
705 path = exe.found() ? exe.path() : prog[1]
706 endif
707 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
708 conf.set_quoted(name, path)
709 endforeach
710
711 conf.set_quoted('TELINIT', get_option('telinit-path'))
712
713 if run_command(ln, '--relative', '--help', check : false).returncode() != 0
714 error('ln does not support --relative (added in coreutils 8.16)')
715 endif
716
717 ############################################################
718
719 python = find_program('python3')
720 if run_command(python, '-c', 'import jinja2', check : false).returncode() != 0
721 error('python3 jinja2 missing')
722 endif
723
724 python_310 = run_command(python, '-c',
725 'import sys; sys.exit(0 if sys.version_info >= (3,10) else 1)',
726 check : false).returncode() == 0
727 if get_option('ukify') == 'auto'
728 want_ukify = python_310
729 elif get_option('ukify') == 'true' and not python310
730 error('ukify requires Python >= 3.10')
731 else
732 want_ukify = get_option('ukify') == 'true'
733 endif
734
735 ############################################################
736
737 gperf = find_program('gperf')
738
739 gperf_test_format = '''
740 #include <string.h>
741 const char * in_word_set(const char *, @0@);
742 @1@
743 '''
744 gperf_snippet = run_command(sh, '-c', 'echo foo,bar | "$1" -L ANSI-C', '_', gperf,
745 check : true)
746 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
747 if cc.compiles(gperf_test)
748 gperf_len_type = 'size_t'
749 else
750 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
751 if cc.compiles(gperf_test)
752 gperf_len_type = 'unsigned'
753 else
754 error('unable to determine gperf len type')
755 endif
756 endif
757 message('gperf len type is @0@'.format(gperf_len_type))
758 conf.set('GPERF_LEN_TYPE', gperf_len_type,
759 description : 'The type of gperf "len" parameter')
760
761 ############################################################
762
763 if not cc.has_header('sys/capability.h')
764 error('POSIX caps headers not found')
765 endif
766 foreach header : ['crypt.h',
767 'linux/memfd.h',
768 'linux/vm_sockets.h',
769 'sys/auxv.h',
770 'valgrind/memcheck.h',
771 'valgrind/valgrind.h',
772 'linux/time_types.h',
773 'sys/sdt.h',
774 ]
775
776 conf.set10('HAVE_' + header.underscorify().to_upper(),
777 cc.has_header(header))
778 endforeach
779
780 ############################################################
781
782 fallback_hostname = get_option('fallback-hostname')
783 if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-'
784 error('Invalid fallback-hostname configuration')
785 # A more extensive test is done in test-hostname-util. Let's catch
786 # the most obvious errors here so we don't fail with an assert later.
787 endif
788 conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname)
789
790 default_hierarchy = get_option('default-hierarchy')
791 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
792 description : 'default cgroup hierarchy as string')
793 if default_hierarchy == 'legacy'
794 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
795 elif default_hierarchy == 'hybrid'
796 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
797 else
798 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
799 endif
800
801 extra_net_naming_schemes = []
802 extra_net_naming_map = []
803 foreach scheme: get_option('extra-net-naming-schemes').split(',')
804 if scheme != ''
805 name = scheme.split('=')[0]
806 value = scheme.split('=')[1]
807 NAME = name.underscorify().to_upper()
808 VALUE = []
809 foreach field: value.split('+')
810 VALUE += 'NAMING_' + field.underscorify().to_upper()
811 endforeach
812 extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE))
813 extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME)
814 endif
815 endforeach
816 conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes))
817 conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map))
818
819 default_net_naming_scheme = get_option('default-net-naming-scheme')
820 conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
821 if default_net_naming_scheme != 'latest'
822 conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST',
823 'NAMING_' + default_net_naming_scheme.underscorify().to_upper())
824 endif
825
826 time_epoch = get_option('time-epoch')
827 if time_epoch <= 0
828 time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check : true).stdout().strip()
829 if time_epoch == '' and git.found() and fs.exists('.git')
830 # If we're in a git repository, use the creation time of the latest git tag.
831 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags',
832 check : false)
833 if latest_tag.returncode() == 0
834 time_epoch = run_command(
835 git, 'log', '--no-show-signature', '-1', '--format=%at',
836 latest_tag.stdout().strip(),
837 check : false).stdout()
838 endif
839 endif
840 if time_epoch == ''
841 NEWS = files('NEWS')
842 time_epoch = run_command(stat, '-c', '%Y', NEWS,
843 check : true).stdout()
844 endif
845 time_epoch = time_epoch.strip().to_int()
846 endif
847 conf.set('TIME_EPOCH', time_epoch)
848
849 conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max'))
850
851 default_user_shell = get_option('default-user-shell')
852 conf.set_quoted('DEFAULT_USER_SHELL', default_user_shell)
853 conf.set_quoted('DEFAULT_USER_SHELL_NAME', fs.name(default_user_shell))
854
855 foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5).
856 ['system-uid-max', 'SYS_UID_MAX', 999],
857 ['system-alloc-gid-min', 'SYS_GID_MIN', 1],
858 ['system-gid-max', 'SYS_GID_MAX', 999]]
859 v = get_option(tuple[0])
860 if v <= 0
861 v = run_command(
862 awk,
863 '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]),
864 '/etc/login.defs',
865 check : false).stdout().strip()
866 if v == ''
867 v = tuple[2]
868 else
869 v = v.to_int()
870 endif
871 endif
872 conf.set(tuple[0].underscorify().to_upper(), v)
873 endforeach
874 if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX')
875 error('Invalid uid allocation range')
876 endif
877 if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX')
878 error('Invalid gid allocation range')
879 endif
880
881 dynamic_uid_min = get_option('dynamic-uid-min')
882 dynamic_uid_max = get_option('dynamic-uid-max')
883 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
884 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
885
886 container_uid_base_min = get_option('container-uid-base-min')
887 container_uid_base_max = get_option('container-uid-base-max')
888 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
889 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
890
891 nobody_user = get_option('nobody-user')
892 nobody_group = get_option('nobody-group')
893
894 if not meson.is_cross_build()
895 getent_result = run_command('getent', 'passwd', '65534', check : false)
896 if getent_result.returncode() == 0
897 name = getent_result.stdout().split(':')[0]
898 if name != nobody_user
899 warning('\n' +
900 '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) +
901 'Your build will result in an user table setup that is incompatible with the local system.')
902 endif
903 endif
904 id_result = run_command('id', '-u', nobody_user, check : false)
905 if id_result.returncode() == 0
906 id = id_result.stdout().strip().to_int()
907 if id != 65534
908 warning('\n' +
909 '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) +
910 'Your build will result in an user table setup that is incompatible with the local system.')
911 endif
912 endif
913
914 getent_result = run_command('getent', 'group', '65534', check : false)
915 if getent_result.returncode() == 0
916 name = getent_result.stdout().split(':')[0]
917 if name != nobody_group
918 warning('\n' +
919 '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) +
920 'Your build will result in an group table setup that is incompatible with the local system.')
921 endif
922 endif
923 id_result = run_command('id', '-g', nobody_group, check : false)
924 if id_result.returncode() == 0
925 id = id_result.stdout().strip().to_int()
926 if id != 65534
927 warning('\n' +
928 '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) +
929 'Your build will result in an group table setup that is incompatible with the local system.')
930 endif
931 endif
932 endif
933 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
934 warning('\n' +
935 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
936 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
937 endif
938
939 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
940 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
941
942 static_ugids = []
943 foreach option : ['adm-gid',
944 'audio-gid',
945 'cdrom-gid',
946 'dialout-gid',
947 'disk-gid',
948 'input-gid',
949 'kmem-gid',
950 'kvm-gid',
951 'lp-gid',
952 'render-gid',
953 'sgx-gid',
954 'tape-gid',
955 'tty-gid',
956 'users-gid',
957 'utmp-gid',
958 'video-gid',
959 'wheel-gid',
960 'systemd-journal-gid',
961 'systemd-network-uid',
962 'systemd-resolve-uid',
963 'systemd-timesync-uid']
964 name = option.underscorify().to_upper()
965 val = get_option(option)
966
967 # Ensure provided GID argument is numeric, otherwise fall back to default assignment
968 conf.set(name, val > 0 ? val : '-')
969 if val > 0
970 static_ugids += '@0@:@1@'.format(option, val)
971 endif
972 endforeach
973
974 conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
975 conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
976
977 dev_kvm_mode = get_option('dev-kvm-mode')
978 conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation
979 conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666')
980 group_render_mode = get_option('group-render-mode')
981 conf.set_quoted('GROUP_RENDER_MODE', group_render_mode)
982 conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666')
983
984 kill_user_processes = get_option('default-kill-user-processes')
985 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
986
987 dns_servers = get_option('dns-servers')
988 conf.set_quoted('DNS_SERVERS', dns_servers)
989
990 ntp_servers = get_option('ntp-servers')
991 conf.set_quoted('NTP_SERVERS', ntp_servers)
992
993 default_locale = get_option('default-locale')
994 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
995
996 nspawn_locale = get_option('nspawn-locale')
997 conf.set_quoted('SYSTEMD_NSPAWN_LOCALE', nspawn_locale)
998
999 localegen_path = get_option('localegen-path')
1000 if localegen_path != ''
1001 conf.set_quoted('LOCALEGEN_PATH', localegen_path)
1002 endif
1003 conf.set10('HAVE_LOCALEGEN', localegen_path != '')
1004
1005 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
1006
1007 service_watchdog = get_option('service-watchdog')
1008 watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog
1009 conf.set_quoted('SERVICE_WATCHDOG', watchdog_value)
1010
1011 conf.set_quoted('SUSHELL', get_option('debug-shell'))
1012 conf.set_quoted('DEBUGTTY', get_option('debug-tty'))
1013
1014 enable_debug_hashmap = false
1015 enable_debug_mmap_cache = false
1016 enable_debug_siphash = false
1017 foreach name : get_option('debug-extra')
1018 if name == 'hashmap'
1019 enable_debug_hashmap = true
1020 elif name == 'mmap-cache'
1021 enable_debug_mmap_cache = true
1022 elif name == 'siphash'
1023 enable_debug_siphash = true
1024 else
1025 message('unknown debug option "@0@", ignoring'.format(name))
1026 endif
1027 endforeach
1028 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
1029 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
1030 conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash)
1031
1032 conf.set10('VALGRIND', get_option('valgrind'))
1033 conf.set10('LOG_TRACE', get_option('log-trace'))
1034
1035 default_user_path = get_option('user-path')
1036 if default_user_path != ''
1037 conf.set_quoted('DEFAULT_USER_PATH', default_user_path)
1038 endif
1039
1040
1041 #####################################################################
1042
1043 threads = dependency('threads')
1044 librt = cc.find_library('rt')
1045 libm = cc.find_library('m')
1046 libdl = cc.find_library('dl')
1047 libcrypt = cc.find_library('crypt')
1048
1049 # On some architectures, libatomic is required. But on some installations,
1050 # it is found, but actual linking fails. So let's try to use it opportunistically.
1051 # If it is installed, but not needed, it will be dropped because of --as-needed.
1052 if cc.links('''int main(int argc, char **argv) { return 0; }''',
1053 args : '-latomic',
1054 name : 'libatomic')
1055 libatomic = declare_dependency(link_args : '-latomic')
1056 else
1057 libatomic = []
1058 endif
1059
1060 crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>'''
1061 foreach ident : [
1062 ['crypt_ra', crypt_header],
1063 ['crypt_preferred_method', crypt_header],
1064 ['crypt_gensalt_ra', crypt_header]]
1065
1066 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE',
1067 dependencies : libcrypt)
1068 conf.set10('HAVE_' + ident[0].to_upper(), have)
1069 endforeach
1070
1071 libcap = dependency('libcap', required : false)
1072 if not libcap.found()
1073 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
1074 libcap = cc.find_library('cap')
1075 endif
1076
1077 want_bpf_framework = get_option('bpf-framework')
1078 bpf_compiler = get_option('bpf-compiler')
1079 bpf_framework_required = want_bpf_framework == 'true'
1080
1081 libbpf_version_requirement = '>= 0.1.0'
1082 if bpf_compiler == 'gcc'
1083 libbpf_version_requirement = '>= 1.0.0'
1084 endif
1085 libbpf = dependency('libbpf', required : bpf_framework_required, version : libbpf_version_requirement)
1086 conf.set10('HAVE_LIBBPF', libbpf.found())
1087
1088 bpftool_strip_version_requirement = '>= 5.13.0'
1089 if bpf_compiler == 'gcc'
1090 bpftool_strip_version_requirement = '>= 7.0.0'
1091 endif
1092
1093 if want_bpf_framework == 'false' or not libbpf.found() or skip_deps
1094 conf.set10('BPF_FRAMEWORK', false)
1095 else
1096 clang_found = false
1097 clang_supports_bpf = false
1098 bpf_gcc_found = false
1099 bpftool_strip = false
1100 deps_found = false
1101
1102 if bpf_compiler == 'clang'
1103 # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu
1104 # (like clang-10/llvm-strip-10)
1105 if meson.is_cross_build() or cc.get_id() != 'clang' or cc.cmd_array()[0].contains('afl-clang') or cc.cmd_array()[0].contains('hfuzz-clang')
1106 r = find_program('clang', required : bpf_framework_required, version : '>= 10.0.0')
1107 clang_found = r.found()
1108 if clang_found
1109 clang = r.path()
1110 endif
1111 # Assume that the required flags are supported by the found clang.
1112 clang_supports_flags = clang_found
1113 else
1114 clang_found = true
1115 clang = cc.cmd_array()
1116 clang_supports_flags = cc.has_argument('-Wno-compare-distinct-pointer-types')
1117 endif
1118
1119 if clang_found
1120 # Check if 'clang -target bpf' is supported.
1121 clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
1122 endif
1123 elif bpf_compiler == 'gcc'
1124 warning('GCC BPF Compiler support is experimental and not recommended.')
1125 bpf_gcc = find_program('bpf-gcc',
1126 required : true,
1127 version : '>= 12.1.0')
1128 bpf_gcc_found = bpf_gcc.found()
1129 endif
1130
1131 if clang_supports_bpf or bpf_gcc_found
1132 # Debian installs this in /usr/sbin/ which is not in $PATH.
1133 # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
1134 # We use 'bpftool gen object' subcommand for bpftool strip, it was added by d80b2fcbe0a023619e0fc73112f2a02c2662f6ab (v5.13).
1135 bpftool_strip_required = bpf_framework_required and bpf_compiler == 'gcc'
1136 bpftool = find_program('bpftool',
1137 '/usr/sbin/bpftool',
1138 required : bpftool_strip_required,
1139 version : bpftool_strip_version_requirement)
1140
1141 if bpftool.found()
1142 bpftool_strip = true
1143 deps_found = true
1144 elif bpf_compiler == 'clang'
1145 # We require the 'bpftool gen skeleton' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
1146 bpftool = find_program('bpftool',
1147 '/usr/sbin/bpftool',
1148 required : bpf_framework_required,
1149 version : '>= 5.6.0')
1150 endif
1151
1152 # We use `llvm-strip` as a fallback if `bpftool gen object` strip support is not available.
1153 if not bpftool_strip and bpftool.found() and clang_supports_bpf
1154 if not meson.is_cross_build()
1155 llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
1156 check : true).stdout().strip()
1157 else
1158 llvm_strip_bin = 'llvm-strip'
1159 endif
1160 llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
1161 deps_found = llvm_strip.found()
1162 endif
1163 endif
1164
1165 # Can build BPF program from source code in restricted C
1166 conf.set10('BPF_FRAMEWORK', deps_found)
1167 endif
1168
1169 libmount = dependency('mount',
1170 version : fuzzer_build ? '>= 0' : '>= 2.30')
1171
1172 want_libfdisk = get_option('fdisk')
1173 if want_libfdisk != 'false' and not skip_deps
1174 libfdisk = dependency('fdisk',
1175 version : '>= 2.32',
1176 required : want_libfdisk == 'true')
1177 have = libfdisk.found()
1178 else
1179 have = false
1180 libfdisk = []
1181 endif
1182 conf.set10('HAVE_LIBFDISK', have)
1183
1184 want_pwquality = get_option('pwquality')
1185 if want_pwquality != 'false' and not skip_deps
1186 libpwquality = dependency('pwquality', required : want_pwquality == 'true')
1187 have = libpwquality.found()
1188 else
1189 have = false
1190 libpwquality = []
1191 endif
1192 conf.set10('HAVE_PWQUALITY', have)
1193
1194 want_seccomp = get_option('seccomp')
1195 if want_seccomp != 'false' and not skip_deps
1196 libseccomp = dependency('libseccomp',
1197 version : '>= 2.3.1',
1198 required : want_seccomp == 'true')
1199 have = libseccomp.found()
1200 else
1201 have = false
1202 libseccomp = []
1203 endif
1204 conf.set10('HAVE_SECCOMP', have)
1205
1206 want_selinux = get_option('selinux')
1207 if want_selinux != 'false' and not skip_deps
1208 libselinux = dependency('libselinux',
1209 version : '>= 2.1.9',
1210 required : want_selinux == 'true')
1211 have = libselinux.found()
1212 else
1213 have = false
1214 libselinux = []
1215 endif
1216 conf.set10('HAVE_SELINUX', have)
1217
1218 want_apparmor = get_option('apparmor')
1219 if want_apparmor != 'false' and not skip_deps
1220 libapparmor = dependency('libapparmor',
1221 version : '>= 2.13',
1222 required : want_apparmor == 'true')
1223 have = libapparmor.found()
1224 else
1225 have = false
1226 libapparmor = []
1227 endif
1228 conf.set10('HAVE_APPARMOR', have)
1229
1230 have = get_option('smack') and get_option('smack-run-label') != ''
1231 conf.set10('HAVE_SMACK_RUN_LABEL', have)
1232 if have
1233 conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label'))
1234 endif
1235
1236 have = get_option('smack') and get_option('smack-default-process-label') != ''
1237 if have
1238 conf.set_quoted('SMACK_DEFAULT_PROCESS_LABEL', get_option('smack-default-process-label'))
1239 endif
1240
1241 want_polkit = get_option('polkit')
1242 install_polkit = false
1243 install_polkit_pkla = false
1244 if want_polkit != 'false' and not skip_deps
1245 install_polkit = true
1246
1247 libpolkit = dependency('polkit-gobject-1',
1248 required : false)
1249 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1250 message('Old polkit detected, will install pkla files')
1251 install_polkit_pkla = true
1252 endif
1253 endif
1254 conf.set10('ENABLE_POLKIT', install_polkit)
1255
1256 want_acl = get_option('acl')
1257 if want_acl != 'false' and not skip_deps
1258 libacl = cc.find_library('acl', required : want_acl == 'true')
1259 have = libacl.found()
1260 else
1261 have = false
1262 libacl = []
1263 endif
1264 conf.set10('HAVE_ACL', have)
1265
1266 want_audit = get_option('audit')
1267 if want_audit != 'false' and not skip_deps
1268 libaudit = dependency('audit', required : want_audit == 'true')
1269 have = libaudit.found()
1270 else
1271 have = false
1272 libaudit = []
1273 endif
1274 conf.set10('HAVE_AUDIT', have)
1275
1276 want_blkid = get_option('blkid')
1277 if want_blkid != 'false' and not skip_deps
1278 libblkid = dependency('blkid', required : want_blkid == 'true')
1279 have = libblkid.found()
1280
1281 conf.set10('HAVE_BLKID_PROBE_SET_HINT',
1282 have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid))
1283 else
1284 have = false
1285 libblkid = []
1286 endif
1287 conf.set10('HAVE_BLKID', have)
1288
1289 want_kmod = get_option('kmod')
1290 if want_kmod != 'false' and not skip_deps
1291 libkmod = dependency('libkmod',
1292 version : '>= 15',
1293 required : want_kmod == 'true')
1294 have = libkmod.found()
1295 else
1296 have = false
1297 libkmod = []
1298 endif
1299 conf.set10('HAVE_KMOD', have)
1300
1301 want_xenctrl = get_option('xenctrl')
1302 if want_xenctrl != 'false' and not skip_deps
1303 libxenctrl = dependency('xencontrol',
1304 version : '>= 4.9',
1305 required : want_xenctrl == 'true')
1306 have = libxenctrl.found()
1307 else
1308 have = false
1309 libxenctrl = []
1310 endif
1311 conf.set10('HAVE_XENCTRL', have)
1312
1313 want_pam = get_option('pam')
1314 if want_pam != 'false' and not skip_deps
1315 libpam = cc.find_library('pam', required : want_pam == 'true')
1316 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1317 have = libpam.found() and libpam_misc.found()
1318 else
1319 have = false
1320 libpam = []
1321 libpam_misc = []
1322 endif
1323 conf.set10('HAVE_PAM', have)
1324
1325 want_microhttpd = get_option('microhttpd')
1326 if want_microhttpd != 'false' and not skip_deps
1327 libmicrohttpd = dependency('libmicrohttpd',
1328 version : '>= 0.9.33',
1329 required : want_microhttpd == 'true')
1330 have = libmicrohttpd.found()
1331 else
1332 have = false
1333 libmicrohttpd = []
1334 endif
1335 conf.set10('HAVE_MICROHTTPD', have)
1336
1337 want_libcryptsetup = get_option('libcryptsetup')
1338 want_libcryptsetup_plugins = get_option('libcryptsetup-plugins')
1339
1340 if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false'
1341 error('libcryptsetup-plugins can not be requested without libcryptsetup')
1342 endif
1343
1344 if want_libcryptsetup != 'false' and not skip_deps
1345 libcryptsetup = dependency('libcryptsetup',
1346 version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1',
1347 required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true')
1348 have = libcryptsetup.found()
1349
1350 foreach ident : ['crypt_set_metadata_size',
1351 'crypt_activate_by_signed_key',
1352 'crypt_token_max',
1353 'crypt_reencrypt_init_by_passphrase',
1354 'crypt_reencrypt',
1355 'crypt_set_data_offset']
1356 have_ident = have and cc.has_function(
1357 ident,
1358 prefix : '#include <libcryptsetup.h>',
1359 dependencies : libcryptsetup)
1360 conf.set10('HAVE_' + ident.to_upper(), have_ident)
1361 endforeach
1362 else
1363 have = false
1364 libcryptsetup = []
1365 endif
1366 conf.set10('HAVE_LIBCRYPTSETUP', have)
1367
1368 if want_libcryptsetup_plugins != 'false' and not skip_deps
1369 have = (cc.has_function(
1370 'crypt_activate_by_token_pin',
1371 prefix : '#include <libcryptsetup.h>',
1372 dependencies : libcryptsetup) and
1373 cc.has_function(
1374 'crypt_token_external_path',
1375 prefix : '#include <libcryptsetup.h>',
1376 dependencies : libcryptsetup))
1377 else
1378 have = false
1379 endif
1380 conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have)
1381
1382 want_libcurl = get_option('libcurl')
1383 if want_libcurl != 'false' and not skip_deps
1384 libcurl = dependency('libcurl',
1385 version : '>= 7.32.0',
1386 required : want_libcurl == 'true')
1387 have = libcurl.found()
1388 else
1389 have = false
1390 libcurl = []
1391 endif
1392 conf.set10('HAVE_LIBCURL', have)
1393 conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
1394
1395 want_libidn = get_option('libidn')
1396 want_libidn2 = get_option('libidn2')
1397 if want_libidn == 'true' and want_libidn2 == 'true'
1398 error('libidn and libidn2 cannot be requested simultaneously')
1399 endif
1400
1401 if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps
1402 libidn = dependency('libidn2',
1403 required : want_libidn2 == 'true')
1404 have = libidn.found()
1405 else
1406 have = false
1407 libidn = []
1408 endif
1409 conf.set10('HAVE_LIBIDN2', have)
1410 if not have and want_libidn != 'false' and not skip_deps
1411 # libidn is used for both libidn and libidn2 objects
1412 libidn = dependency('libidn',
1413 required : want_libidn == 'true')
1414 have = libidn.found()
1415 else
1416 have = false
1417 endif
1418 conf.set10('HAVE_LIBIDN', have)
1419
1420 want_libiptc = get_option('libiptc')
1421 if want_libiptc != 'false' and not skip_deps
1422 libiptc = dependency('libiptc',
1423 required : want_libiptc == 'true')
1424 have = libiptc.found()
1425 else
1426 have = false
1427 libiptc = []
1428 endif
1429 conf.set10('HAVE_LIBIPTC', have)
1430
1431 want_qrencode = get_option('qrencode')
1432 if want_qrencode != 'false' and not skip_deps
1433 libqrencode = dependency('libqrencode',
1434 version : '>= 3',
1435 required : want_qrencode == 'true')
1436 have = libqrencode.found()
1437 else
1438 have = false
1439 libqrencode = []
1440 endif
1441 conf.set10('HAVE_QRENCODE', have)
1442
1443 want_gcrypt = get_option('gcrypt')
1444 if want_gcrypt != 'false' and not skip_deps
1445 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1446 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1447 have = libgcrypt.found() and libgpg_error.found()
1448 else
1449 have = false
1450 endif
1451 if not have
1452 # link to neither of the libs if one is not found
1453 libgcrypt = []
1454 libgpg_error = []
1455 endif
1456 conf.set10('HAVE_GCRYPT', have)
1457
1458 want_gnutls = get_option('gnutls')
1459 if want_gnutls != 'false' and not skip_deps
1460 libgnutls = dependency('gnutls',
1461 version : '>= 3.1.4',
1462 required : want_gnutls == 'true')
1463 have = libgnutls.found()
1464 else
1465 have = false
1466 libgnutls = []
1467 endif
1468 conf.set10('HAVE_GNUTLS', have)
1469
1470 want_openssl = get_option('openssl')
1471 if want_openssl != 'false' and not skip_deps
1472 libopenssl = dependency('openssl',
1473 version : '>= 1.1.0',
1474 required : want_openssl == 'true')
1475 have = libopenssl.found()
1476 else
1477 have = false
1478 libopenssl = []
1479 endif
1480 conf.set10('HAVE_OPENSSL', have)
1481
1482 want_p11kit = get_option('p11kit')
1483 if want_p11kit != 'false' and not skip_deps
1484 libp11kit = dependency('p11-kit-1',
1485 version : '>= 0.23.3',
1486 required : want_p11kit == 'true')
1487 have = libp11kit.found()
1488 libp11kit_cflags = libp11kit.partial_dependency(includes: true, compile_args: true)
1489 else
1490 have = false
1491 libp11kit_cflags = []
1492 libp11kit = []
1493 endif
1494 conf.set10('HAVE_P11KIT', have)
1495
1496 want_libfido2 = get_option('libfido2')
1497 if want_libfido2 != 'false' and not skip_deps
1498 if conf.get('HAVE_OPENSSL') == 1
1499 libfido2 = dependency('libfido2',
1500 required : want_libfido2 == 'true')
1501 have = libfido2.found()
1502 elif want_libfido2 == 'true'
1503 error('libfido2=true requires openssl')
1504 else
1505 have = false
1506 libfido2 = []
1507 endif
1508 else
1509 have = false
1510 libfido2 = []
1511 endif
1512 conf.set10('HAVE_LIBFIDO2', have)
1513
1514 want_tpm2 = get_option('tpm2')
1515 if want_tpm2 != 'false' and not skip_deps
1516 tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
1517 required : want_tpm2 == 'true')
1518 have = tpm2.found()
1519 have_esys3 = tpm2.version().version_compare('>= 3.0.0')
1520 else
1521 have = false
1522 have_esys3 = false
1523 tpm2 = []
1524 endif
1525 conf.set10('HAVE_TPM2', have)
1526 conf.set10('HAVE_TSS2_ESYS3', have_esys3)
1527
1528 want_elfutils = get_option('elfutils')
1529 if want_elfutils != 'false' and not skip_deps
1530 libdw = dependency('libdw',
1531 required : want_elfutils == 'true')
1532 have = libdw.found()
1533
1534 # New in elfutils 0.177
1535 conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING',
1536 have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw))
1537 else
1538 have = false
1539 libdw = []
1540 endif
1541 conf.set10('HAVE_ELFUTILS', have)
1542
1543 want_zlib = get_option('zlib')
1544 if want_zlib != 'false' and not skip_deps
1545 libz = dependency('zlib',
1546 required : want_zlib == 'true')
1547 have = libz.found()
1548 else
1549 have = false
1550 libz = []
1551 endif
1552 conf.set10('HAVE_ZLIB', have)
1553
1554 want_bzip2 = get_option('bzip2')
1555 if want_bzip2 != 'false' and not skip_deps
1556 libbzip2 = cc.find_library('bz2',
1557 required : want_bzip2 == 'true')
1558 have = libbzip2.found()
1559 else
1560 have = false
1561 libbzip2 = []
1562 endif
1563 conf.set10('HAVE_BZIP2', have)
1564
1565 want_xz = get_option('xz')
1566 if want_xz != 'false' and not skip_deps
1567 libxz = dependency('liblzma',
1568 required : want_xz == 'true')
1569 have_xz = libxz.found()
1570 else
1571 have_xz = false
1572 libxz = []
1573 endif
1574 conf.set10('HAVE_XZ', have_xz)
1575
1576 want_lz4 = get_option('lz4')
1577 if want_lz4 != 'false' and not skip_deps
1578 liblz4 = dependency('liblz4',
1579 version : '>= 1.3.0',
1580 required : want_lz4 == 'true')
1581 have_lz4 = liblz4.found()
1582 else
1583 have_lz4 = false
1584 liblz4 = []
1585 endif
1586 conf.set10('HAVE_LZ4', have_lz4)
1587
1588 want_zstd = get_option('zstd')
1589 if want_zstd != 'false' and not skip_deps
1590 libzstd = dependency('libzstd',
1591 required : want_zstd == 'true',
1592 version : '>= 1.4.0')
1593 have_zstd = libzstd.found()
1594 else
1595 have_zstd = false
1596 libzstd = []
1597 endif
1598 conf.set10('HAVE_ZSTD', have_zstd)
1599
1600 conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
1601
1602 compression = get_option('default-compression')
1603 if compression == 'auto'
1604 if have_zstd
1605 compression = 'zstd'
1606 elif have_lz4
1607 compression = 'lz4'
1608 elif have_xz
1609 compression = 'xz'
1610 else
1611 compression = 'none'
1612 endif
1613 elif compression == 'zstd' and not have_zstd
1614 error('default-compression=zstd requires zstd')
1615 elif compression == 'lz4' and not have_lz4
1616 error('default-compression=lz4 requires lz4')
1617 elif compression == 'xz' and not have_xz
1618 error('default-compression=xz requires xz')
1619 endif
1620 conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper()))
1621
1622 want_xkbcommon = get_option('xkbcommon')
1623 if want_xkbcommon != 'false' and not skip_deps
1624 libxkbcommon = dependency('xkbcommon',
1625 version : '>= 0.3.0',
1626 required : want_xkbcommon == 'true')
1627 have = libxkbcommon.found()
1628 else
1629 have = false
1630 libxkbcommon = []
1631 endif
1632 conf.set10('HAVE_XKBCOMMON', have)
1633
1634 want_pcre2 = get_option('pcre2')
1635 if want_pcre2 != 'false' and not skip_deps
1636 libpcre2 = dependency('libpcre2-8',
1637 required : want_pcre2 == 'true')
1638 have = libpcre2.found()
1639 else
1640 have = false
1641 libpcre2 = []
1642 endif
1643 conf.set10('HAVE_PCRE2', have)
1644
1645 want_glib = get_option('glib')
1646 if want_glib != 'false' and not skip_deps
1647 libglib = dependency('glib-2.0',
1648 version : '>= 2.22.0',
1649 required : want_glib == 'true')
1650 libgobject = dependency('gobject-2.0',
1651 version : '>= 2.22.0',
1652 required : want_glib == 'true')
1653 libgio = dependency('gio-2.0',
1654 required : want_glib == 'true')
1655 have = libglib.found() and libgobject.found() and libgio.found()
1656 else
1657 have = false
1658 libglib = []
1659 libgobject = []
1660 libgio = []
1661 endif
1662 conf.set10('HAVE_GLIB', have)
1663
1664 want_dbus = get_option('dbus')
1665 if want_dbus != 'false' and not skip_deps
1666 libdbus = dependency('dbus-1',
1667 version : '>= 1.3.2',
1668 required : want_dbus == 'true')
1669 have = libdbus.found()
1670 else
1671 have = false
1672 libdbus = []
1673 endif
1674 conf.set10('HAVE_DBUS', have)
1675
1676 dbusdatadir = datadir / 'dbus-1'
1677 if conf.get('HAVE_DBUS') == 1
1678 dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
1679 endif
1680
1681 dbuspolicydir = get_option('dbuspolicydir')
1682 if dbuspolicydir == ''
1683 dbuspolicydir = dbusdatadir / 'system.d'
1684 endif
1685
1686 dbussessionservicedir = get_option('dbussessionservicedir')
1687 if dbussessionservicedir == ''
1688 dbussessionservicedir = dbusdatadir / 'services'
1689 if conf.get('HAVE_DBUS') == 1
1690 dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
1691 endif
1692 endif
1693
1694 dbussystemservicedir = get_option('dbussystemservicedir')
1695 if dbussystemservicedir == ''
1696 dbussystemservicedir = dbusdatadir / 'system-services'
1697 if conf.get('HAVE_DBUS') == 1
1698 dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
1699 endif
1700 endif
1701
1702 dbus_interfaces_dir = get_option('dbus-interfaces-dir')
1703 if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
1704 if meson.is_cross_build() and dbus_interfaces_dir != 'yes'
1705 dbus_interfaces_dir = 'no'
1706 warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
1707 else
1708 dbus_interfaces_dir = dbusdatadir / 'interfaces'
1709 if conf.get('HAVE_DBUS') == 1
1710 dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
1711 endif
1712 endif
1713 endif
1714
1715 # We support one or the other. If gcrypt is available, we assume it's there to
1716 # be used, and use it in preference.
1717 opt = get_option('cryptolib')
1718 if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0
1719 error('openssl requested as the default cryptolib, but not available')
1720 endif
1721 conf.set10('PREFER_OPENSSL',
1722 opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0))
1723 conf.set10('HAVE_OPENSSL_OR_GCRYPT',
1724 conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1)
1725 lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? [libopenssl] : [libgcrypt, libgpg_error]
1726
1727 dns_over_tls = get_option('dns-over-tls')
1728 if dns_over_tls != 'false'
1729 if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1
1730 error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib')
1731 endif
1732
1733 if dns_over_tls == 'gnutls'
1734 have_openssl = false
1735 else
1736 have_openssl = conf.get('HAVE_OPENSSL') == 1
1737 if dns_over_tls == 'openssl' and not have_openssl
1738 error('DNS-over-TLS support was requested with openssl, but dependencies are not available')
1739 endif
1740 endif
1741 if dns_over_tls == 'openssl' or have_openssl
1742 have_gnutls = false
1743 else
1744 have_gnutls = conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0')
1745 if dns_over_tls != 'auto' and not have_gnutls
1746 str = dns_over_tls == 'gnutls' ? ' with gnutls' : ''
1747 error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str))
1748 endif
1749 endif
1750 have = have_gnutls or have_openssl
1751 else
1752 have = false
1753 have_gnutls = false
1754 have_openssl = false
1755 endif
1756 conf.set10('ENABLE_DNS_OVER_TLS', have)
1757 conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls)
1758 conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl)
1759
1760 default_dns_over_tls = get_option('default-dns-over-tls')
1761 if skip_deps
1762 default_dns_over_tls = 'no'
1763 endif
1764 if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1765 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.')
1766 default_dns_over_tls = 'no'
1767 endif
1768 conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1769 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1770 conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls)
1771
1772 default_mdns = get_option('default-mdns')
1773 conf.set('DEFAULT_MDNS_MODE',
1774 'RESOLVE_SUPPORT_' + default_mdns.to_upper())
1775 conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns)
1776
1777 default_llmnr = get_option('default-llmnr')
1778 conf.set('DEFAULT_LLMNR_MODE',
1779 'RESOLVE_SUPPORT_' + default_llmnr.to_upper())
1780 conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr)
1781
1782 want_repart = get_option('repart')
1783 if want_repart != 'false'
1784 have = conf.get('HAVE_LIBFDISK') == 1
1785 if want_repart == 'true' and not have
1786 error('repart support was requested, but dependencies are not available')
1787 endif
1788 else
1789 have = false
1790 endif
1791 conf.set10('ENABLE_REPART', have)
1792
1793 default_dnssec = get_option('default-dnssec')
1794 if skip_deps
1795 default_dnssec = 'no'
1796 endif
1797 if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0
1798 message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.')
1799 default_dnssec = 'no'
1800 endif
1801 conf.set('DEFAULT_DNSSEC_MODE',
1802 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1803 conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec)
1804
1805 want_sysupdate = get_option('sysupdate')
1806 if want_sysupdate != 'false'
1807 have = (conf.get('HAVE_OPENSSL') == 1 and
1808 conf.get('HAVE_LIBFDISK') == 1)
1809 if want_sysupdate == 'true' and not have
1810 error('sysupdate support was requested, but dependencies are not available')
1811 endif
1812 else
1813 have = false
1814 endif
1815 conf.set10('ENABLE_SYSUPDATE', have)
1816
1817 want_importd = get_option('importd')
1818 if want_importd != 'false'
1819 have = (conf.get('HAVE_LIBCURL') == 1 and
1820 conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and
1821 conf.get('HAVE_ZLIB') == 1 and
1822 conf.get('HAVE_XZ') == 1)
1823 if want_importd == 'true' and not have
1824 error('importd support was requested, but dependencies are not available')
1825 endif
1826 else
1827 have = false
1828 endif
1829 conf.set10('ENABLE_IMPORTD', have)
1830
1831 want_kernel_install = get_option('kernel-install')
1832 conf.set10('ENABLE_KERNEL_INSTALL', want_kernel_install)
1833
1834 want_homed = get_option('homed')
1835 if want_homed != 'false'
1836 have = (conf.get('HAVE_OPENSSL') == 1 and
1837 conf.get('HAVE_LIBFDISK') == 1 and
1838 conf.get('HAVE_LIBCRYPTSETUP') == 1)
1839 if want_homed == 'true' and not have
1840 error('homed support was requested, but dependencies are not available')
1841 endif
1842 else
1843 have = false
1844 endif
1845 conf.set10('ENABLE_HOMED', have)
1846
1847 have = have and conf.get('HAVE_PAM') == 1
1848 conf.set10('ENABLE_PAM_HOME', have)
1849
1850 have = get_option('oomd')
1851 conf.set10('ENABLE_OOMD', have)
1852
1853 want_remote = get_option('remote')
1854 if want_remote != 'false'
1855 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1856 conf.get('HAVE_LIBCURL') == 1]
1857 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1858 # it's possible to build one without the other. Complain only if
1859 # support was explicitly requested. The auxiliary files like sysusers
1860 # config should be installed when any of the programs are built.
1861 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1862 error('remote support was requested, but dependencies are not available')
1863 endif
1864 have = have_deps[0] or have_deps[1]
1865 else
1866 have = false
1867 endif
1868 conf.set10('ENABLE_REMOTE', have)
1869
1870 foreach term : ['analyze',
1871 'backlight',
1872 'binfmt',
1873 'coredump',
1874 'efi',
1875 'environment-d',
1876 'firstboot',
1877 'gshadow',
1878 'hibernate',
1879 'hostnamed',
1880 'hwdb',
1881 'idn',
1882 'ima',
1883 'initrd',
1884 'compat-mutable-uid-boundaries',
1885 'nscd',
1886 'ldconfig',
1887 'localed',
1888 'logind',
1889 'machined',
1890 'networkd',
1891 'nss-myhostname',
1892 'nss-systemd',
1893 'portabled',
1894 'sysext',
1895 'pstore',
1896 'quotacheck',
1897 'randomseed',
1898 'resolve',
1899 'rfkill',
1900 'smack',
1901 'sysusers',
1902 'timedated',
1903 'timesyncd',
1904 'tmpfiles',
1905 'tpm',
1906 'userdb',
1907 'utmp',
1908 'vconsole',
1909 'xdg-autostart']
1910 have = get_option(term)
1911 name = 'ENABLE_' + term.underscorify().to_upper()
1912 conf.set10(name, have)
1913 endforeach
1914
1915 enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
1916
1917 foreach tuple : [['nss-mymachines', 'machined'],
1918 ['nss-resolve', 'resolve']]
1919 want = get_option(tuple[0])
1920 if want != 'false'
1921 have = get_option(tuple[1])
1922 if want == 'true' and not have
1923 error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1]))
1924 endif
1925 else
1926 have = false
1927 endif
1928 name = 'ENABLE_' + tuple[0].underscorify().to_upper()
1929 conf.set10(name, have)
1930 endforeach
1931
1932 enable_nss = false
1933 foreach term : ['ENABLE_NSS_MYHOSTNAME',
1934 'ENABLE_NSS_MYMACHINES',
1935 'ENABLE_NSS_RESOLVE',
1936 'ENABLE_NSS_SYSTEMD']
1937 if conf.get(term) == 1
1938 enable_nss = true
1939 endif
1940 endforeach
1941 conf.set10('ENABLE_NSS', enable_nss)
1942
1943 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1944
1945 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1946
1947 ############################################################
1948
1949 tests = []
1950 fuzzers = []
1951 catalogs = []
1952
1953 ############################################################
1954
1955 # Include these now as they provide gnu-efi detection.
1956 subdir('src/fundamental')
1957 subdir('src/boot/efi')
1958
1959 ############################################################
1960
1961 generate_gperfs = find_program('tools/generate-gperfs.py')
1962 make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
1963 make_directive_index_py = find_program('tools/make-directive-index.py')
1964 make_man_index_py = find_program('tools/make-man-index.py')
1965 meson_render_jinja2 = find_program('tools/meson-render-jinja2.py')
1966 update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
1967 update_man_rules_py = find_program('tools/update-man-rules.py')
1968 update_hwdb_sh = find_program('tools/update-hwdb.sh')
1969 update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh')
1970 update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh')
1971 xml_helper_py = find_program('tools/xml_helper.py')
1972 export_dbus_interfaces_py = find_program('tools/dbus_exporter.py')
1973
1974 ############################################################
1975
1976 if get_option('b_coverage')
1977 add_project_arguments('-include', 'src/basic/coverage.h', language : 'c')
1978 endif
1979
1980 ############################################################
1981
1982 config_h = configure_file(
1983 output : 'config.h',
1984 configuration : conf)
1985
1986 add_project_arguments('-include', 'config.h', language : 'c')
1987
1988 jinja2_cmdline = [meson_render_jinja2, config_h, version_h]
1989
1990 ############################################################
1991
1992 # binaries that have --help and are intended for use by humans,
1993 # usually, but not always, installed in /bin.
1994 public_programs = []
1995
1996 # D-Bus introspection XML export
1997 dbus_programs = []
1998
1999 basic_includes = include_directories(
2000 'src/basic',
2001 'src/fundamental',
2002 'src/systemd',
2003 '.')
2004
2005 libsystemd_includes = [basic_includes, include_directories(
2006 'src/libsystemd/sd-bus',
2007 'src/libsystemd/sd-device',
2008 'src/libsystemd/sd-event',
2009 'src/libsystemd/sd-hwdb',
2010 'src/libsystemd/sd-id128',
2011 'src/libsystemd/sd-journal',
2012 'src/libsystemd/sd-netlink',
2013 'src/libsystemd/sd-network',
2014 'src/libsystemd/sd-resolve')]
2015
2016 includes = [libsystemd_includes, include_directories('src/shared')]
2017
2018 subdir('po')
2019 subdir('catalog')
2020 subdir('src/basic')
2021 subdir('src/libsystemd')
2022 subdir('src/shared')
2023 subdir('src/udev')
2024 subdir('src/libudev')
2025 subdir('src/cryptsetup/cryptsetup-tokens')
2026
2027 alias_target('devel', libsystemd_pc, libudev_pc)
2028
2029 libsystemd = shared_library(
2030 'systemd',
2031 version : libsystemd_version,
2032 include_directories : libsystemd_includes,
2033 link_args : ['-shared',
2034 '-Wl,--version-script=' + libsystemd_sym_path],
2035 link_with : [libbasic,
2036 libbasic_gcrypt,
2037 libbasic_compress],
2038 link_whole : [libsystemd_static],
2039 dependencies : [threads,
2040 librt],
2041 link_depends : libsystemd_sym,
2042 install : true,
2043 install_tag: 'libsystemd',
2044 install_dir : rootlibdir)
2045
2046 alias_target('libsystemd', libsystemd)
2047
2048 install_libsystemd_static = static_library(
2049 'systemd',
2050 libsystemd_sources,
2051 basic_sources,
2052 basic_gcrypt_sources,
2053 basic_compress_sources,
2054 fundamental_sources,
2055 include_directories : libsystemd_includes,
2056 build_by_default : static_libsystemd != 'false',
2057 install : static_libsystemd != 'false',
2058 install_tag: 'libsystemd',
2059 install_dir : rootlibdir,
2060 pic : static_libsystemd_pic,
2061 dependencies : [threads,
2062 librt,
2063 libxz,
2064 libzstd,
2065 liblz4,
2066 libdl,
2067 libcap,
2068 libblkid,
2069 libmount,
2070 libgcrypt,
2071 libopenssl,
2072 versiondep],
2073 c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
2074
2075 libudev = shared_library(
2076 'udev',
2077 version : libudev_version,
2078 include_directories : includes,
2079 link_args : ['-shared',
2080 '-Wl,--version-script=' + libudev_sym_path],
2081 link_with : [libsystemd_static, libshared_static],
2082 link_whole : libudev_basic,
2083 dependencies : [threads],
2084 link_depends : libudev_sym,
2085 install : true,
2086 install_tag: 'libudev',
2087 install_dir : rootlibdir)
2088
2089 alias_target('libudev', libudev)
2090
2091 install_libudev_static = static_library(
2092 'udev',
2093 basic_sources,
2094 fundamental_sources,
2095 shared_sources,
2096 libsystemd_sources,
2097 libudev_sources,
2098 include_directories : includes,
2099 build_by_default : static_libudev != 'false',
2100 install : static_libudev != 'false',
2101 install_tag: 'libudev',
2102 install_dir : rootlibdir,
2103 link_depends : libudev_sym,
2104 dependencies : [libshared_deps,
2105 libmount,
2106 versiondep],
2107 c_args : static_libudev_pic ? [] : ['-fno-PIC'],
2108 pic : static_libudev_pic)
2109
2110 if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1
2111 if conf.get('HAVE_TPM2') == 1
2112 cryptsetup_token_systemd_tpm2 = shared_library(
2113 'cryptsetup-token-systemd-tpm2',
2114 cryptsetup_token_systemd_tpm2_sources,
2115 include_directories : includes,
2116 link_args : ['-shared',
2117 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2118 link_with : [lib_cryptsetup_token_common,
2119 libshared],
2120 dependencies : [libcryptsetup,
2121 tpm2,
2122 versiondep],
2123 link_depends : cryptsetup_token_sym,
2124 install_rpath : rootpkglibdir,
2125 install : true,
2126 install_dir : libcryptsetup_plugins_dir)
2127 endif
2128
2129 if conf.get('HAVE_LIBFIDO2') == 1
2130 cryptsetup_token_systemd_fido2 = shared_library(
2131 'cryptsetup-token-systemd-fido2',
2132 cryptsetup_token_systemd_fido2_sources,
2133 include_directories : includes,
2134 link_args : ['-shared',
2135 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2136 link_with : [lib_cryptsetup_token_common,
2137 libshared],
2138 dependencies : [libcryptsetup,
2139 libfido2,
2140 versiondep],
2141 link_depends : cryptsetup_token_sym,
2142 install_rpath : rootpkglibdir,
2143 install : true,
2144 install_dir : libcryptsetup_plugins_dir)
2145 endif
2146
2147 if conf.get('HAVE_P11KIT') == 1
2148 cryptsetup_token_systemd_pkcs11 = shared_library(
2149 'cryptsetup-token-systemd-pkcs11',
2150 cryptsetup_token_systemd_pkcs11_sources,
2151 include_directories : includes,
2152 link_args : ['-shared',
2153 '-Wl,--version-script=' + cryptsetup_token_sym_path],
2154 link_with : [lib_cryptsetup_token_common,
2155 libshared],
2156 dependencies : [libcryptsetup,
2157 libp11kit,
2158 versiondep],
2159 link_depends : cryptsetup_token_sym,
2160 install_rpath : rootpkglibdir,
2161 install : true,
2162 install_dir : libcryptsetup_plugins_dir)
2163 endif
2164 endif
2165
2166 ############################################################
2167
2168 # systemd-analyze requires 'libcore'
2169 subdir('src/core')
2170 # systemd-journal-remote requires 'libjournal_core'
2171 subdir('src/journal')
2172 # systemd-networkd requires 'libsystemd_network'
2173 subdir('src/libsystemd-network')
2174
2175 subdir('src/analyze')
2176 subdir('src/busctl')
2177 subdir('src/coredump')
2178 subdir('src/cryptenroll')
2179 subdir('src/cryptsetup')
2180 subdir('src/home')
2181 subdir('src/hostname')
2182 subdir('src/import')
2183 subdir('src/journal-remote')
2184 subdir('src/kernel-install')
2185 subdir('src/locale')
2186 subdir('src/login')
2187 subdir('src/machine')
2188 subdir('src/network')
2189 subdir('src/nspawn')
2190 subdir('src/oom')
2191 subdir('src/partition')
2192 subdir('src/portable')
2193 subdir('src/pstore')
2194 subdir('src/resolve')
2195 subdir('src/rpm')
2196 subdir('src/shutdown')
2197 subdir('src/sysext')
2198 subdir('src/systemctl')
2199 subdir('src/sysupdate')
2200 subdir('src/timedate')
2201 subdir('src/timesync')
2202 subdir('src/tmpfiles')
2203 subdir('src/userdb')
2204 subdir('src/xdg-autostart-generator')
2205
2206 subdir('src/systemd')
2207
2208 subdir('src/test')
2209 subdir('src/fuzz')
2210 subdir('rules.d')
2211 subdir('test')
2212 subdir('src/ukify/test') # needs to be last for test_env variable
2213
2214 ############################################################
2215
2216 # only static linking apart from libdl, to make sure that the
2217 # module is linked to all libraries that it uses.
2218 test_dlopen = executable(
2219 'test-dlopen',
2220 test_dlopen_c,
2221 include_directories : includes,
2222 link_with : [libbasic],
2223 dependencies : [libdl],
2224 build_by_default : want_tests != 'false')
2225
2226 foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
2227 ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
2228 ['mymachines', 'ENABLE_NSS_MYMACHINES'],
2229 ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
2230
2231 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
2232 if condition
2233 module = tuple[0]
2234
2235 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
2236 version_script_arg = project_source_root / sym
2237
2238 sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
2239 if tuple.length() > 2
2240 foreach s : tuple[2]
2241 sources += ['src/nss-@0@/@1@'.format(module, s)]
2242 endforeach
2243 endif
2244
2245 incs = tuple.length() > 3 ? tuple[3] : includes
2246
2247 nss = shared_library(
2248 'nss_' + module,
2249 sources,
2250 version : '2',
2251 include_directories : incs,
2252 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
2253 link_args : ['-Wl,-z,nodelete',
2254 '-shared',
2255 '-Wl,--version-script=' + version_script_arg],
2256 link_with : [libsystemd_static,
2257 libshared_static,
2258 libbasic],
2259 dependencies : [threads,
2260 librt],
2261 link_depends : sym,
2262 install : true,
2263 install_tag : 'nss',
2264 install_dir : rootlibdir)
2265
2266 # We cannot use shared_module because it does not support version suffix.
2267 # Unfortunately shared_library insists on creating the symlink…
2268 meson.add_install_script('sh', '-c',
2269 'rm $DESTDIR@0@/libnss_@1@.so'
2270 .format(rootlibdir, module),
2271 install_tag : 'nss'
2272 )
2273
2274 if want_tests != 'false'
2275 test('dlopen-nss_' + module,
2276 test_dlopen,
2277 # path to dlopen must include a slash
2278 args : nss.full_path(),
2279 depends : nss)
2280 endif
2281 endif
2282 endforeach
2283
2284 ############################################################
2285
2286 exe = executable(
2287 'systemd',
2288 systemd_sources,
2289 include_directories : includes,
2290 link_with : [libcore,
2291 libshared],
2292 dependencies : [libseccomp,
2293 versiondep],
2294 install_rpath : rootpkglibdir,
2295 install : true,
2296 install_dir : rootlibexecdir)
2297 dbus_programs += exe
2298 public_programs += exe
2299
2300 meson.add_install_script(meson_make_symlink,
2301 rootlibexecdir / 'systemd',
2302 rootsbindir / 'init')
2303
2304 exe = executable(
2305 'systemd-analyze',
2306 systemd_analyze_sources,
2307 include_directories : core_includes,
2308 link_with : [libcore,
2309 libshared],
2310 dependencies : [libseccomp,
2311 versiondep],
2312 install_rpath : rootpkglibdir,
2313 install : conf.get('ENABLE_ANALYZE') == 1)
2314 public_programs += exe
2315
2316 if want_tests != 'false'
2317 test('test-compare-versions',
2318 test_compare_versions_sh,
2319 args : exe.full_path())
2320 endif
2321
2322 executable(
2323 'systemd-journald',
2324 systemd_journald_sources,
2325 include_directories : includes,
2326 link_with : [libjournal_core,
2327 libshared],
2328 dependencies : [threads,
2329 libxz,
2330 liblz4,
2331 libselinux,
2332 libzstd,
2333 versiondep],
2334 install_rpath : rootpkglibdir,
2335 install : true,
2336 install_dir : rootlibexecdir)
2337
2338 public_programs += executable(
2339 'systemd-cat',
2340 systemd_cat_sources,
2341 include_directories : includes,
2342 link_with : [libjournal_core,
2343 libshared],
2344 dependencies : [threads,
2345 versiondep],
2346 install_rpath : rootpkglibdir,
2347 install : true)
2348
2349 if get_option('link-journalctl-shared')
2350 journalctl_link_with = [libshared]
2351 else
2352 journalctl_link_with = [libsystemd_static,
2353 libshared_static,
2354 libbasic_gcrypt]
2355 endif
2356
2357 public_programs += executable(
2358 'journalctl',
2359 journalctl_sources,
2360 include_directories : includes,
2361 link_with : [journalctl_link_with],
2362 dependencies : [threads,
2363 libdl,
2364 libxz,
2365 liblz4,
2366 libzstd,
2367 libdl,
2368 versiondep],
2369 install_rpath : rootpkglibdir,
2370 install : true,
2371 install_dir : rootbindir)
2372
2373 executable(
2374 'systemd-getty-generator',
2375 'src/getty-generator/getty-generator.c',
2376 include_directories : includes,
2377 link_with : [libshared],
2378 install_rpath : rootpkglibdir,
2379 install : true,
2380 install_dir : systemgeneratordir)
2381
2382 executable(
2383 'systemd-debug-generator',
2384 'src/debug-generator/debug-generator.c',
2385 include_directories : includes,
2386 link_with : [libshared],
2387 install_rpath : rootpkglibdir,
2388 install : true,
2389 install_dir : systemgeneratordir)
2390
2391 executable(
2392 'systemd-run-generator',
2393 'src/run-generator/run-generator.c',
2394 include_directories : includes,
2395 link_with : [libshared],
2396 install_rpath : rootpkglibdir,
2397 install : true,
2398 install_dir : systemgeneratordir)
2399
2400 exe = executable(
2401 'systemd-fstab-generator',
2402 'src/fstab-generator/fstab-generator.c',
2403 include_directories : includes,
2404 link_with : [libshared],
2405 install_rpath : rootpkglibdir,
2406 install : true,
2407 install_dir : systemgeneratordir)
2408
2409 meson.add_install_script(meson_make_symlink,
2410 systemgeneratordir / 'systemd-fstab-generator',
2411 rootlibexecdir / 'systemd-sysroot-fstab-check')
2412
2413 if want_tests != 'false'
2414 test('test-fstab-generator',
2415 test_fstab_generator_sh,
2416 # https://github.com/mesonbuild/meson/issues/2681
2417 args : exe.full_path(),
2418 depends : exe)
2419 endif
2420
2421 if conf.get('ENABLE_ENVIRONMENT_D') == 1
2422 executable(
2423 '30-systemd-environment-d-generator',
2424 'src/environment-d-generator/environment-d-generator.c',
2425 include_directories : includes,
2426 link_with : [libshared],
2427 install_rpath : rootpkglibdir,
2428 install : true,
2429 install_dir : userenvgeneratordir)
2430
2431 meson.add_install_script(meson_make_symlink,
2432 sysconfdir / 'environment',
2433 environmentdir / '99-environment.conf')
2434 endif
2435
2436 if conf.get('ENABLE_HIBERNATE') == 1
2437 executable(
2438 'systemd-hibernate-resume-generator',
2439 'src/hibernate-resume/hibernate-resume-generator.c',
2440 include_directories : includes,
2441 link_with : [libshared],
2442 install_rpath : rootpkglibdir,
2443 install : true,
2444 install_dir : systemgeneratordir)
2445
2446 executable(
2447 'systemd-hibernate-resume',
2448 'src/hibernate-resume/hibernate-resume.c',
2449 include_directories : includes,
2450 link_with : [libshared],
2451 install_rpath : rootpkglibdir,
2452 install : true,
2453 install_dir : rootlibexecdir)
2454 endif
2455
2456 if conf.get('HAVE_BLKID') == 1
2457 executable(
2458 'systemd-gpt-auto-generator',
2459 'src/gpt-auto-generator/gpt-auto-generator.c',
2460 include_directories : includes,
2461 link_with : [libshared],
2462 dependencies : libblkid,
2463 install_rpath : rootpkglibdir,
2464 install : true,
2465 install_dir : systemgeneratordir)
2466
2467 public_programs += executable(
2468 'systemd-dissect',
2469 'src/dissect/dissect.c',
2470 include_directories : includes,
2471 link_with : [libshared],
2472 dependencies : [versiondep],
2473 install_rpath : rootpkglibdir,
2474 install : true)
2475 endif
2476
2477 if conf.get('ENABLE_RESOLVE') == 1
2478 dbus_programs += executable(
2479 'systemd-resolved',
2480 systemd_resolved_sources,
2481 include_directories : resolve_includes,
2482 link_with : [libshared,
2483 libbasic_gcrypt,
2484 libsystemd_resolve_core],
2485 dependencies : systemd_resolved_dependencies,
2486 install_rpath : rootpkglibdir,
2487 install : true,
2488 install_dir : rootlibexecdir)
2489
2490 public_programs += executable(
2491 'resolvectl',
2492 resolvectl_sources,
2493 include_directories : includes,
2494 link_with : [libshared,
2495 libbasic_gcrypt,
2496 libsystemd_resolve_core],
2497 dependencies : [threads,
2498 lib_openssl_or_gcrypt,
2499 libm,
2500 libidn,
2501 versiondep],
2502 install_rpath : rootpkglibdir,
2503 install : true)
2504
2505 meson.add_install_script(meson_make_symlink,
2506 bindir / 'resolvectl',
2507 rootsbindir / 'resolvconf')
2508
2509 meson.add_install_script(meson_make_symlink,
2510 bindir / 'resolvectl',
2511 bindir / 'systemd-resolve')
2512 endif
2513
2514 if conf.get('ENABLE_LOGIND') == 1
2515 dbus_programs += executable(
2516 'systemd-logind',
2517 systemd_logind_sources,
2518 include_directories : includes,
2519 link_with : [liblogind_core,
2520 libshared],
2521 dependencies : [threads,
2522 libacl,
2523 versiondep],
2524 install_rpath : rootpkglibdir,
2525 install : true,
2526 install_dir : rootlibexecdir)
2527
2528 public_programs += executable(
2529 'loginctl',
2530 loginctl_sources,
2531 include_directories : includes,
2532 link_with : [libshared],
2533 dependencies : [threads,
2534 liblz4,
2535 libxz,
2536 libzstd,
2537 versiondep],
2538 install_rpath : rootpkglibdir,
2539 install : true,
2540 install_dir : rootbindir)
2541
2542 public_programs += executable(
2543 'systemd-inhibit',
2544 'src/login/inhibit.c',
2545 include_directories : includes,
2546 link_with : [libshared],
2547 dependencies : [versiondep],
2548 install_rpath : rootpkglibdir,
2549 install : true,
2550 install_dir : rootbindir)
2551
2552 if conf.get('HAVE_PAM') == 1
2553 version_script_arg = project_source_root / pam_systemd_sym
2554 pam_systemd = shared_library(
2555 'pam_systemd',
2556 pam_systemd_c,
2557 name_prefix : '',
2558 include_directories : includes,
2559 link_args : ['-shared',
2560 '-Wl,--version-script=' + version_script_arg],
2561 link_with : [libsystemd_static,
2562 libshared_static],
2563 dependencies : [threads,
2564 libpam,
2565 libpam_misc,
2566 versiondep],
2567 link_depends : pam_systemd_sym,
2568 install : true,
2569 install_tag : 'pam',
2570 install_dir : pamlibdir)
2571
2572 if want_tests != 'false'
2573 test('dlopen-pam_systemd',
2574 test_dlopen,
2575 # path to dlopen must include a slash
2576 args : pam_systemd.full_path(),
2577 depends : pam_systemd)
2578 endif
2579 endif
2580
2581 executable(
2582 'systemd-user-runtime-dir',
2583 user_runtime_dir_sources,
2584 include_directories : includes,
2585 link_with : [libshared],
2586 install_rpath : rootpkglibdir,
2587 install : true,
2588 install_dir : rootlibexecdir)
2589 endif
2590
2591 if conf.get('HAVE_PAM') == 1
2592 executable(
2593 'systemd-user-sessions',
2594 'src/user-sessions/user-sessions.c',
2595 include_directories : includes,
2596 link_with : [libshared],
2597 install_rpath : rootpkglibdir,
2598 install : true,
2599 install_dir : rootlibexecdir)
2600 endif
2601
2602 if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
2603 if get_option('link-boot-shared')
2604 boot_link_with = [libshared]
2605 else
2606 boot_link_with = [libsystemd_static, libshared_static]
2607 endif
2608
2609 exe = executable(
2610 'bootctl',
2611 ['src/boot/bootctl.c',
2612 'src/boot/bootctl.h',
2613 'src/boot/bootctl-install.c',
2614 'src/boot/bootctl-install.h',
2615 'src/boot/bootctl-random-seed.c',
2616 'src/boot/bootctl-random-seed.h',
2617 'src/boot/bootctl-reboot-to-firmware.c',
2618 'src/boot/bootctl-reboot-to-firmware.h',
2619 'src/boot/bootctl-set-efivar.c',
2620 'src/boot/bootctl-set-efivar.h',
2621 'src/boot/bootctl-status.c',
2622 'src/boot/bootctl-status.h',
2623 'src/boot/bootctl-systemd-efi-options.c',
2624 'src/boot/bootctl-systemd-efi-options.h',
2625 'src/boot/bootctl-uki.c',
2626 'src/boot/bootctl-uki.h',
2627 'src/boot/bootctl-util.c',
2628 'src/boot/bootctl-util.h'],
2629 include_directories : includes,
2630 link_with : [boot_link_with],
2631 dependencies : [libblkid,
2632 versiondep],
2633 install_rpath : rootpkglibdir,
2634 install : true)
2635 public_programs += exe
2636
2637 if want_tests != 'false'
2638 test('test-bootctl-json',
2639 test_bootctl_json_sh,
2640 args : exe.full_path(),
2641 depends : exe)
2642 endif
2643
2644 public_programs += executable(
2645 'systemd-bless-boot',
2646 'src/boot/bless-boot.c',
2647 include_directories : includes,
2648 link_with : [boot_link_with],
2649 dependencies : [libblkid,
2650 versiondep],
2651 install_rpath : rootpkglibdir,
2652 install : true,
2653 install_dir : rootlibexecdir)
2654
2655 executable(
2656 'systemd-bless-boot-generator',
2657 'src/boot/bless-boot-generator.c',
2658 include_directories : includes,
2659 link_with : [boot_link_with],
2660 install_rpath : rootpkglibdir,
2661 install : true,
2662 install_dir : systemgeneratordir)
2663
2664 if conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_TPM2') == 1
2665 executable(
2666 'systemd-measure',
2667 'src/boot/measure.c',
2668 include_directories : includes,
2669 link_with : [libshared],
2670 dependencies : [libopenssl,
2671 versiondep],
2672 install_rpath : rootpkglibdir,
2673 install : true,
2674 install_dir : rootlibexecdir)
2675 executable(
2676 'systemd-pcrphase',
2677 'src/boot/pcrphase.c',
2678 include_directories : includes,
2679 link_with : [libshared],
2680 dependencies : [libopenssl,
2681 tpm2,
2682 libblkid,
2683 versiondep],
2684 install_rpath : rootpkglibdir,
2685 install : true,
2686 install_dir : rootlibexecdir)
2687 endif
2688 endif
2689
2690 executable(
2691 'systemd-boot-check-no-failures',
2692 'src/boot/boot-check-no-failures.c',
2693 include_directories : includes,
2694 link_with : [libshared],
2695 dependencies : [libblkid,
2696 versiondep],
2697 install_rpath : rootpkglibdir,
2698 install : true,
2699 install_dir : rootlibexecdir)
2700
2701 public_programs += executable(
2702 'systemd-socket-activate',
2703 'src/activate/activate.c',
2704 include_directories : includes,
2705 link_with : [libshared],
2706 dependencies : [threads,
2707 versiondep],
2708 install_rpath : rootpkglibdir,
2709 install : true)
2710
2711 systemctl = executable(
2712 'systemctl',
2713 systemctl_sources,
2714 include_directories : includes,
2715 link_with : systemctl_link_with,
2716 dependencies : [threads,
2717 libcap,
2718 libselinux,
2719 libxz,
2720 liblz4,
2721 libzstd,
2722 versiondep],
2723 install_rpath : rootpkglibdir,
2724 install : true,
2725 install_dir : rootbindir)
2726 public_programs += systemctl
2727
2728 if conf.get('ENABLE_PORTABLED') == 1
2729 dbus_programs += executable(
2730 'systemd-portabled',
2731 systemd_portabled_sources,
2732 include_directories : includes,
2733 link_with : [libshared],
2734 dependencies : [threads,
2735 libselinux,
2736 versiondep],
2737 install_rpath : rootpkglibdir,
2738 install : true,
2739 install_dir : rootlibexecdir)
2740
2741 public_programs += executable(
2742 'portablectl',
2743 'src/portable/portablectl.c',
2744 include_directories : includes,
2745 link_with : [libshared],
2746 dependencies : [threads,
2747 versiondep],
2748 install_rpath : rootpkglibdir,
2749 install : true,
2750 install_dir : rootbindir)
2751 endif
2752
2753 if conf.get('ENABLE_SYSEXT') == 1
2754 public_programs += executable(
2755 'systemd-sysext',
2756 systemd_sysext_sources,
2757 include_directories : includes,
2758 link_with : [libshared],
2759 dependencies : [versiondep],
2760 install_rpath : rootpkglibdir,
2761 install : true,
2762 install_dir : rootbindir)
2763 endif
2764
2765 if conf.get('ENABLE_USERDB') == 1
2766 executable(
2767 'systemd-userwork',
2768 systemd_userwork_sources,
2769 include_directories : includes,
2770 link_with : [libshared],
2771 dependencies : [threads,
2772 versiondep],
2773 install_rpath : rootpkglibdir,
2774 install : true,
2775 install_dir : rootlibexecdir)
2776
2777 executable(
2778 'systemd-userdbd',
2779 systemd_userdbd_sources,
2780 include_directories : includes,
2781 link_with : [libshared],
2782 dependencies : [threads,
2783 versiondep],
2784 install_rpath : rootpkglibdir,
2785 install : true,
2786 install_dir : rootlibexecdir)
2787
2788 public_programs += executable(
2789 'userdbctl',
2790 userdbctl_sources,
2791 include_directories : includes,
2792 link_with : [libshared],
2793 dependencies : [threads,
2794 versiondep],
2795 install_rpath : rootpkglibdir,
2796 install : true)
2797 endif
2798
2799 if conf.get('ENABLE_HOMED') == 1
2800 executable(
2801 'systemd-homework',
2802 systemd_homework_sources,
2803 include_directories : includes,
2804 link_with : [libshared,
2805 libshared_fdisk],
2806 dependencies : [threads,
2807 libblkid,
2808 libcrypt,
2809 libopenssl,
2810 libfdisk,
2811 libp11kit,
2812 versiondep],
2813 install_rpath : rootpkglibdir,
2814 install : true,
2815 install_dir : rootlibexecdir)
2816
2817 dbus_programs += executable(
2818 'systemd-homed',
2819 systemd_homed_sources,
2820 include_directories : home_includes,
2821 link_with : [libshared],
2822 dependencies : [threads,
2823 libcrypt,
2824 libopenssl,
2825 libm,
2826 versiondep],
2827 install_rpath : rootpkglibdir,
2828 install : true,
2829 install_dir : rootlibexecdir)
2830
2831 public_programs += executable(
2832 'homectl',
2833 homectl_sources,
2834 include_directories : includes,
2835 link_with : [libshared],
2836 dependencies : [threads,
2837 libcrypt,
2838 libopenssl,
2839 libp11kit,
2840 libdl,
2841 versiondep],
2842 install_rpath : rootpkglibdir,
2843 install : true)
2844
2845 if conf.get('HAVE_PAM') == 1
2846 version_script_arg = project_source_root / pam_systemd_home_sym
2847 pam_systemd_home = shared_library(
2848 'pam_systemd_home',
2849 pam_systemd_home_c,
2850 name_prefix : '',
2851 include_directories : includes,
2852 link_args : ['-shared',
2853 '-Wl,--version-script=' + version_script_arg],
2854 link_with : [libsystemd_static,
2855 libshared_static],
2856 dependencies : [threads,
2857 libpam,
2858 libpam_misc,
2859 libcrypt,
2860 versiondep],
2861 link_depends : pam_systemd_home_sym,
2862 install : true,
2863 install_tag : 'pam',
2864 install_dir : pamlibdir)
2865
2866 if want_tests != 'false'
2867 test('dlopen-pam_systemd_home',
2868 test_dlopen,
2869 # path to dlopen must include a slash
2870 args : pam_systemd_home.full_path(),
2871 depends : pam_systemd_home)
2872 endif
2873 endif
2874 endif
2875
2876 foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
2877 (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
2878 meson.add_install_script(meson_make_symlink,
2879 rootbindir / 'systemctl',
2880 rootsbindir / alias)
2881 endforeach
2882
2883 meson.add_install_script(meson_make_symlink,
2884 rootbindir / 'udevadm',
2885 rootlibexecdir / 'systemd-udevd')
2886
2887 if conf.get('ENABLE_BACKLIGHT') == 1
2888 executable(
2889 'systemd-backlight',
2890 'src/backlight/backlight.c',
2891 include_directories : includes,
2892 link_with : [libshared],
2893 install_rpath : rootpkglibdir,
2894 install : true,
2895 install_dir : rootlibexecdir)
2896 endif
2897
2898 if conf.get('ENABLE_RFKILL') == 1
2899 executable(
2900 'systemd-rfkill',
2901 'src/rfkill/rfkill.c',
2902 include_directories : includes,
2903 link_with : [libshared],
2904 install_rpath : rootpkglibdir,
2905 install : true,
2906 install_dir : rootlibexecdir)
2907 endif
2908
2909 executable(
2910 'systemd-system-update-generator',
2911 'src/system-update-generator/system-update-generator.c',
2912 include_directories : includes,
2913 link_with : [libshared],
2914 install_rpath : rootpkglibdir,
2915 install : true,
2916 install_dir : systemgeneratordir)
2917
2918 if conf.get('HAVE_LIBCRYPTSETUP') == 1
2919 executable(
2920 'systemd-cryptsetup',
2921 systemd_cryptsetup_sources,
2922 include_directories : includes,
2923 link_with : [libshared],
2924 dependencies : [libcryptsetup,
2925 libp11kit,
2926 versiondep,
2927 libopenssl],
2928 install_rpath : rootpkglibdir,
2929 install : true,
2930 install_dir : rootlibexecdir)
2931
2932 executable(
2933 'systemd-cryptsetup-generator',
2934 'src/cryptsetup/cryptsetup-generator.c',
2935 include_directories : includes,
2936 link_with : [libshared],
2937 install_rpath : rootpkglibdir,
2938 install : true,
2939 install_dir : systemgeneratordir)
2940
2941 executable(
2942 'systemd-veritysetup',
2943 'src/veritysetup/veritysetup.c',
2944 include_directories : includes,
2945 link_with : [libshared],
2946 dependencies : [libcryptsetup,
2947 versiondep],
2948 install_rpath : rootpkglibdir,
2949 install : true,
2950 install_dir : rootlibexecdir)
2951
2952 executable(
2953 'systemd-veritysetup-generator',
2954 'src/veritysetup/veritysetup-generator.c',
2955 include_directories : includes,
2956 link_with : [libshared],
2957 dependencies : [versiondep],
2958 install_rpath : rootpkglibdir,
2959 install : true,
2960 install_dir : systemgeneratordir)
2961
2962 public_programs += executable(
2963 'systemd-cryptenroll',
2964 systemd_cryptenroll_sources,
2965 include_directories : includes,
2966 link_with : [libshared],
2967 dependencies : [libcryptsetup,
2968 libdl,
2969 libopenssl,
2970 libp11kit,
2971 versiondep],
2972 install_rpath : rootpkglibdir,
2973 install : true)
2974
2975 executable(
2976 'systemd-integritysetup',
2977 ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
2978 include_directories : includes,
2979 link_with : [libshared],
2980 dependencies : [libcryptsetup,
2981 versiondep],
2982 install_rpath : rootpkglibdir,
2983 install : true,
2984 install_dir : rootlibexecdir)
2985
2986 executable(
2987 'systemd-integritysetup-generator',
2988 ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'],
2989 include_directories : includes,
2990 link_with : [libshared],
2991 install_rpath : rootpkglibdir,
2992 install : true,
2993 install_dir : systemgeneratordir)
2994 endif
2995
2996 if conf.get('HAVE_SYSV_COMPAT') == 1
2997 exe = executable(
2998 'systemd-sysv-generator',
2999 'src/sysv-generator/sysv-generator.c',
3000 include_directories : includes,
3001 link_with : [libshared],
3002 install_rpath : rootpkglibdir,
3003 install : true,
3004 install_dir : systemgeneratordir)
3005
3006 sysv_generator_test_py = find_program('test/sysv-generator-test.py')
3007 if want_tests != 'false'
3008 test('sysv-generator-test',
3009 sysv_generator_test_py,
3010 depends : exe)
3011 endif
3012
3013 executable(
3014 'systemd-rc-local-generator',
3015 'src/rc-local-generator/rc-local-generator.c',
3016 include_directories : includes,
3017 link_with : [libshared],
3018 install_rpath : rootpkglibdir,
3019 install : true,
3020 install_dir : systemgeneratordir)
3021 endif
3022
3023 if conf.get('ENABLE_XDG_AUTOSTART') == 1
3024 executable(
3025 'systemd-xdg-autostart-generator',
3026 systemd_xdg_autostart_generator_sources,
3027 include_directories : includes,
3028 link_with : [libshared],
3029 install_rpath : rootpkglibdir,
3030 install : true,
3031 install_dir : usergeneratordir)
3032
3033 executable(
3034 'systemd-xdg-autostart-condition',
3035 'src/xdg-autostart-generator/xdg-autostart-condition.c',
3036 include_directories : includes,
3037 link_with : [libshared],
3038 install_rpath : rootpkglibdir,
3039 install : true,
3040 install_dir : rootlibexecdir)
3041 endif
3042
3043 if conf.get('ENABLE_HOSTNAMED') == 1
3044 dbus_programs += executable(
3045 'systemd-hostnamed',
3046 'src/hostname/hostnamed.c',
3047 include_directories : includes,
3048 link_with : [libshared],
3049 install_rpath : rootpkglibdir,
3050 install : true,
3051 install_dir : rootlibexecdir)
3052
3053 public_programs += executable(
3054 'hostnamectl',
3055 'src/hostname/hostnamectl.c',
3056 include_directories : includes,
3057 link_with : [libshared],
3058 dependencies : [versiondep],
3059 install_rpath : rootpkglibdir,
3060 install : true)
3061 endif
3062
3063 if conf.get('ENABLE_LOCALED') == 1
3064 if conf.get('HAVE_XKBCOMMON') == 1
3065 # logind will load libxkbcommon.so dynamically on its own, but we still
3066 # need to specify where the headers are
3067 deps = [libdl,
3068 libxkbcommon.partial_dependency(compile_args: true),
3069 versiondep]
3070 else
3071 deps = [versiondep]
3072 endif
3073
3074 dbus_programs += executable(
3075 'systemd-localed',
3076 systemd_localed_sources,
3077 include_directories : includes,
3078 link_with : [libshared],
3079 dependencies : deps,
3080 install_rpath : rootpkglibdir,
3081 install : true,
3082 install_dir : rootlibexecdir)
3083
3084 public_programs += executable(
3085 'localectl',
3086 localectl_sources,
3087 include_directories : includes,
3088 link_with : [libshared],
3089 dependencies : [versiondep],
3090 install_rpath : rootpkglibdir,
3091 install : true)
3092 endif
3093
3094 if conf.get('ENABLE_TIMEDATED') == 1
3095 dbus_programs += executable(
3096 'systemd-timedated',
3097 'src/timedate/timedated.c',
3098 include_directories : includes,
3099 link_with : [libshared],
3100 install_rpath : rootpkglibdir,
3101 install : true,
3102 install_dir : rootlibexecdir)
3103 endif
3104
3105 if conf.get('ENABLE_TIMEDATECTL') == 1
3106 public_programs += executable(
3107 'timedatectl',
3108 'src/timedate/timedatectl.c',
3109 include_directories : includes,
3110 install_rpath : rootpkglibdir,
3111 link_with : [libshared],
3112 dependencies : [libm,
3113 versiondep],
3114 install : true)
3115 endif
3116
3117 if conf.get('ENABLE_TIMESYNCD') == 1
3118 executable(
3119 'systemd-timesyncd',
3120 systemd_timesyncd_sources,
3121 include_directories : includes,
3122 link_with : [libtimesyncd_core],
3123 dependencies : [threads,
3124 libm,
3125 versiondep],
3126 install_rpath : rootpkglibdir,
3127 install : true,
3128 install_dir : rootlibexecdir)
3129
3130 executable(
3131 'systemd-time-wait-sync',
3132 'src/timesync/wait-sync.c',
3133 include_directories : includes,
3134 link_with : [libtimesyncd_core],
3135 install_rpath : rootpkglibdir,
3136 install : true,
3137 install_dir : rootlibexecdir)
3138 endif
3139
3140 if conf.get('ENABLE_MACHINED') == 1
3141 dbus_programs += executable(
3142 'systemd-machined',
3143 systemd_machined_sources,
3144 include_directories : includes,
3145 link_with : [libmachine_core,
3146 libshared],
3147 install_rpath : rootpkglibdir,
3148 install : true,
3149 install_dir : rootlibexecdir)
3150
3151 public_programs += executable(
3152 'machinectl',
3153 'src/machine/machinectl.c',
3154 include_directories : includes,
3155 link_with : [libshared],
3156 dependencies : [threads,
3157 libxz,
3158 liblz4,
3159 libzstd,
3160 versiondep],
3161 install_rpath : rootpkglibdir,
3162 install : true,
3163 install_dir : rootbindir)
3164 endif
3165
3166 if conf.get('ENABLE_IMPORTD') == 1
3167 dbus_programs += executable(
3168 'systemd-importd',
3169 systemd_importd_sources,
3170 include_directories : includes,
3171 link_with : [libshared],
3172 dependencies : [threads,
3173 versiondep],
3174 install_rpath : rootpkglibdir,
3175 install : true,
3176 install_dir : rootlibexecdir)
3177
3178 systemd_pull = executable(
3179 'systemd-pull',
3180 systemd_pull_sources,
3181 include_directories : includes,
3182 link_with : [libshared,
3183 lib_import_common],
3184 dependencies : [libcurl,
3185 lib_openssl_or_gcrypt,
3186 libz,
3187 libbzip2,
3188 libxz,
3189 versiondep],
3190 install_rpath : rootpkglibdir,
3191 install : true,
3192 install_dir : rootlibexecdir)
3193
3194 systemd_import = executable(
3195 'systemd-import',
3196 systemd_import_sources,
3197 include_directories : includes,
3198 link_with : [libshared,
3199 lib_import_common],
3200 dependencies : [libcurl,
3201 libz,
3202 libbzip2,
3203 libxz,
3204 versiondep],
3205 install_rpath : rootpkglibdir,
3206 install : true,
3207 install_dir : rootlibexecdir)
3208
3209 systemd_import_fs = executable(
3210 'systemd-import-fs',
3211 systemd_import_fs_sources,
3212 include_directories : includes,
3213 link_with : [libshared,
3214 lib_import_common],
3215 dependencies : [versiondep],
3216 install_rpath : rootpkglibdir,
3217 install : true,
3218 install_dir : rootlibexecdir)
3219
3220 systemd_export = executable(
3221 'systemd-export',
3222 systemd_export_sources,
3223 include_directories : includes,
3224 link_with : [libshared,
3225 lib_import_common],
3226 dependencies : [libcurl,
3227 libz,
3228 libbzip2,
3229 libxz,
3230 versiondep],
3231 install_rpath : rootpkglibdir,
3232 install : true,
3233 install_dir : rootlibexecdir)
3234
3235 public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export]
3236 endif
3237
3238 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
3239 public_programs += executable(
3240 'systemd-journal-upload',
3241 systemd_journal_upload_sources,
3242 include_directories : includes,
3243 link_with : [libshared],
3244 dependencies : [threads,
3245 libcurl,
3246 libgnutls,
3247 libxz,
3248 liblz4,
3249 libzstd,
3250 versiondep],
3251 install_rpath : rootpkglibdir,
3252 install : true,
3253 install_dir : rootlibexecdir)
3254 endif
3255
3256 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
3257 public_programs += executable(
3258 'systemd-journal-remote',
3259 systemd_journal_remote_sources,
3260 include_directories : journal_includes,
3261 link_with : [libshared,
3262 libsystemd_journal_remote],
3263 dependencies : [threads,
3264 libmicrohttpd,
3265 libgnutls,
3266 libxz,
3267 liblz4,
3268 libzstd,
3269 versiondep],
3270 install_rpath : rootpkglibdir,
3271 install : true,
3272 install_dir : rootlibexecdir)
3273
3274 public_programs += executable(
3275 'systemd-journal-gatewayd',
3276 systemd_journal_gatewayd_sources,
3277 include_directories : journal_includes,
3278 link_with : [libshared],
3279 dependencies : [threads,
3280 libmicrohttpd,
3281 libgnutls,
3282 libxz,
3283 liblz4,
3284 libzstd,
3285 versiondep],
3286 install_rpath : rootpkglibdir,
3287 install : true,
3288 install_dir : rootlibexecdir)
3289 endif
3290
3291 if conf.get('ENABLE_COREDUMP') == 1
3292 executable(
3293 'systemd-coredump',
3294 systemd_coredump_sources,
3295 include_directories : includes,
3296 link_with : [libshared,
3297 libbasic_compress],
3298 dependencies : [threads,
3299 libacl,
3300 libxz,
3301 liblz4,
3302 libzstd,
3303 versiondep],
3304 install_rpath : rootpkglibdir,
3305 install : true,
3306 install_dir : rootlibexecdir)
3307
3308 public_programs += executable(
3309 'coredumpctl',
3310 coredumpctl_sources,
3311 include_directories : includes,
3312 link_with : [libshared,
3313 libbasic_compress],
3314 dependencies : [threads,
3315 libxz,
3316 liblz4,
3317 libzstd,
3318 versiondep],
3319 install_rpath : rootpkglibdir,
3320 install : true)
3321 endif
3322
3323 if conf.get('ENABLE_PSTORE') == 1
3324 executable(
3325 'systemd-pstore',
3326 systemd_pstore_sources,
3327 include_directories : includes,
3328 link_with : [libshared],
3329 dependencies : [threads,
3330 libacl,
3331 libxz,
3332 liblz4,
3333 libzstd,
3334 versiondep],
3335 install_rpath : rootpkglibdir,
3336 install : true,
3337 install_dir : rootlibexecdir)
3338 endif
3339
3340 if conf.get('ENABLE_OOMD') == 1
3341 dbus_programs += executable('systemd-oomd',
3342 systemd_oomd_sources,
3343 include_directories : includes,
3344 link_with : [libshared],
3345 dependencies : [libatomic,
3346 versiondep],
3347 install_rpath : rootpkglibdir,
3348 install : true,
3349 install_dir : rootlibexecdir)
3350
3351 public_programs += executable(
3352 'oomctl',
3353 oomctl_sources,
3354 include_directories : includes,
3355 link_with : [libshared],
3356 dependencies : [versiondep],
3357 install_rpath : rootpkglibdir,
3358 install : true)
3359 endif
3360
3361 if conf.get('ENABLE_BINFMT') == 1
3362 public_programs += executable(
3363 'systemd-binfmt',
3364 'src/binfmt/binfmt.c',
3365 include_directories : includes,
3366 link_with : [libshared],
3367 dependencies : [versiondep],
3368 install_rpath : rootpkglibdir,
3369 install : true,
3370 install_dir : rootlibexecdir)
3371
3372 meson.add_install_script('sh', '-c',
3373 mkdir_p.format(binfmtdir))
3374 if install_sysconfdir
3375 meson.add_install_script('sh', '-c',
3376 mkdir_p.format(sysconfdir / 'binfmt.d'))
3377 endif
3378 endif
3379
3380 if conf.get('ENABLE_SYSUPDATE') == 1
3381 exe = executable(
3382 'systemd-sysupdate',
3383 systemd_sysupdate_sources,
3384 include_directories : includes,
3385 link_with : [libshared,
3386 libshared_fdisk],
3387 dependencies : [threads,
3388 libblkid,
3389 libfdisk,
3390 libopenssl,
3391 versiondep],
3392 install_rpath : rootpkglibdir,
3393 install : true,
3394 install_dir : rootlibexecdir)
3395 public_programs += exe
3396 endif
3397
3398 if conf.get('ENABLE_VCONSOLE') == 1
3399 executable(
3400 'systemd-vconsole-setup',
3401 'src/vconsole/vconsole-setup.c',
3402 include_directories : includes,
3403 link_with : [libshared],
3404 install_rpath : rootpkglibdir,
3405 install : true,
3406 install_dir : rootlibexecdir)
3407 endif
3408
3409 if conf.get('ENABLE_RANDOMSEED') == 1
3410 executable(
3411 'systemd-random-seed',
3412 'src/random-seed/random-seed.c',
3413 include_directories : includes,
3414 link_with : [libshared],
3415 dependencies : [versiondep],
3416 install_rpath : rootpkglibdir,
3417 install : true,
3418 install_dir : rootlibexecdir)
3419 endif
3420
3421 if conf.get('ENABLE_FIRSTBOOT') == 1
3422 public_programs += executable(
3423 'systemd-firstboot',
3424 'src/firstboot/firstboot.c',
3425 include_directories : includes,
3426 link_with : [libshared],
3427 dependencies : [libcrypt,
3428 versiondep],
3429 install_rpath : rootpkglibdir,
3430 install : true,
3431 install_dir : rootbindir)
3432 endif
3433
3434 executable(
3435 'systemd-remount-fs',
3436 'src/remount-fs/remount-fs.c',
3437 include_directories : includes,
3438 link_with : [libshared],
3439 dependencies : [versiondep],
3440 install_rpath : rootpkglibdir,
3441 install : true,
3442 install_dir : rootlibexecdir)
3443
3444 executable(
3445 'systemd-machine-id-setup',
3446 'src/machine-id-setup/machine-id-setup-main.c',
3447 include_directories : includes,
3448 link_with : [libshared],
3449 dependencies : [versiondep],
3450 install_rpath : rootpkglibdir,
3451 install : true,
3452 install_dir : rootbindir)
3453
3454 executable(
3455 'systemd-fsck',
3456 'src/fsck/fsck.c',
3457 include_directories : includes,
3458 link_with : [libshared],
3459 dependencies : [versiondep],
3460 install_rpath : rootpkglibdir,
3461 install : true,
3462 install_dir : rootlibexecdir)
3463
3464 executable(
3465 'systemd-growfs',
3466 'src/partition/growfs.c',
3467 include_directories : includes,
3468 link_with : [libshared],
3469 dependencies : [versiondep],
3470 install_rpath : rootpkglibdir,
3471 install : true,
3472 install_dir : rootlibexecdir)
3473
3474 executable(
3475 'systemd-makefs',
3476 'src/partition/makefs.c',
3477 include_directories : includes,
3478 link_with : [libshared],
3479 dependencies : [versiondep],
3480 install_rpath : rootpkglibdir,
3481 install : true,
3482 install_dir : rootlibexecdir)
3483
3484 executable(
3485 'systemd-sleep',
3486 'src/sleep/sleep.c',
3487 include_directories : includes,
3488 link_with : [libshared],
3489 dependencies : [versiondep],
3490 install_rpath : rootpkglibdir,
3491 install : true,
3492 install_dir : rootlibexecdir)
3493
3494 if install_sysconfdir_samples
3495 install_data('src/sleep/sleep.conf',
3496 install_dir : pkgsysconfdir)
3497 endif
3498
3499 public_programs += executable(
3500 'systemd-sysctl',
3501 'src/sysctl/sysctl.c',
3502 include_directories : includes,
3503 link_with : [libshared],
3504 dependencies : [versiondep],
3505 install_rpath : rootpkglibdir,
3506 install : true,
3507 install_dir : rootlibexecdir)
3508
3509 public_programs += executable(
3510 'systemd-ac-power',
3511 'src/ac-power/ac-power.c',
3512 include_directories : includes,
3513 link_with : [libshared],
3514 dependencies : [versiondep],
3515 install_rpath : rootpkglibdir,
3516 install : true)
3517
3518 public_programs += executable(
3519 'systemd-detect-virt',
3520 'src/detect-virt/detect-virt.c',
3521 include_directories : includes,
3522 link_with : [libshared],
3523 dependencies : [versiondep],
3524 install_rpath : rootpkglibdir,
3525 install : true)
3526
3527 public_programs += executable(
3528 'systemd-delta',
3529 'src/delta/delta.c',
3530 include_directories : includes,
3531 link_with : [libshared],
3532 dependencies : [versiondep],
3533 install_rpath : rootpkglibdir,
3534 install : true)
3535
3536 public_programs += executable(
3537 'systemd-escape',
3538 'src/escape/escape.c',
3539 include_directories : includes,
3540 link_with : [libshared],
3541 dependencies : [versiondep],
3542 install_rpath : rootpkglibdir,
3543 install : true,
3544 install_dir : rootbindir)
3545
3546 public_programs += executable(
3547 'systemd-notify',
3548 'src/notify/notify.c',
3549 include_directories : includes,
3550 link_with : [libshared],
3551 dependencies : [versiondep],
3552 install_rpath : rootpkglibdir,
3553 install : true,
3554 install_dir : rootbindir)
3555
3556 public_programs += executable(
3557 'systemd-creds',
3558 'src/creds/creds.c',
3559 include_directories : includes,
3560 link_with : [libshared],
3561 dependencies : [threads,
3562 libopenssl,
3563 versiondep],
3564 install_rpath : rootpkglibdir,
3565 install : true,
3566 install_dir : rootbindir)
3567
3568 executable(
3569 'systemd-volatile-root',
3570 'src/volatile-root/volatile-root.c',
3571 include_directories : includes,
3572 link_with : [libshared],
3573 install_rpath : rootpkglibdir,
3574 install : conf.get('ENABLE_INITRD') == 1,
3575 install_dir : rootlibexecdir)
3576
3577 executable(
3578 'systemd-cgroups-agent',
3579 'src/cgroups-agent/cgroups-agent.c',
3580 include_directories : includes,
3581 link_with : [libshared],
3582 install_rpath : rootpkglibdir,
3583 install : true,
3584 install_dir : rootlibexecdir)
3585
3586 systemd_id128 = executable(
3587 'systemd-id128',
3588 'src/id128/id128.c',
3589 include_directories : includes,
3590 link_with : [libshared],
3591 dependencies : [versiondep],
3592 install_rpath : rootpkglibdir,
3593 install : true)
3594 public_programs += systemd_id128
3595
3596 if want_tests != 'false'
3597 test('test-systemctl-enable',
3598 test_systemctl_enable_sh,
3599 # https://github.com/mesonbuild/meson/issues/2681
3600 args : [systemctl.full_path(),
3601 systemd_id128.full_path()])
3602 endif
3603
3604 public_programs += executable(
3605 'systemd-path',
3606 'src/path/path.c',
3607 include_directories : includes,
3608 link_with : [libshared],
3609 dependencies : [versiondep],
3610 install_rpath : rootpkglibdir,
3611 install : true)
3612
3613 public_programs += executable(
3614 'systemd-ask-password',
3615 'src/ask-password/ask-password.c',
3616 include_directories : includes,
3617 link_with : [libshared],
3618 dependencies : [versiondep],
3619 install_rpath : rootpkglibdir,
3620 install : true,
3621 install_dir : rootbindir)
3622
3623 executable(
3624 'systemd-reply-password',
3625 'src/reply-password/reply-password.c',
3626 include_directories : includes,
3627 link_with : [libshared],
3628 install_rpath : rootpkglibdir,
3629 install : true,
3630 install_dir : rootlibexecdir)
3631
3632 public_programs += executable(
3633 'systemd-tty-ask-password-agent',
3634 'src/tty-ask-password-agent/tty-ask-password-agent.c',
3635 include_directories : includes,
3636 link_with : [libshared],
3637 dependencies : [versiondep],
3638 install_rpath : rootpkglibdir,
3639 install : true,
3640 install_dir : rootbindir)
3641
3642 public_programs += executable(
3643 'systemd-cgls',
3644 'src/cgls/cgls.c',
3645 include_directories : includes,
3646 link_with : [libshared],
3647 dependencies : [versiondep],
3648 install_rpath : rootpkglibdir,
3649 install : true)
3650
3651 public_programs += executable(
3652 'systemd-cgtop',
3653 'src/cgtop/cgtop.c',
3654 include_directories : includes,
3655 link_with : [libshared],
3656 dependencies : [versiondep],
3657 install_rpath : rootpkglibdir,
3658 install : true)
3659
3660 executable(
3661 'systemd-initctl',
3662 'src/initctl/initctl.c',
3663 include_directories : includes,
3664 link_with : [libshared],
3665 install_rpath : rootpkglibdir,
3666 install : (conf.get('HAVE_SYSV_COMPAT') == 1),
3667 install_dir : rootlibexecdir)
3668
3669 public_programs += executable(
3670 'systemd-mount',
3671 'src/mount/mount-tool.c',
3672 include_directories : includes,
3673 link_with : [libshared],
3674 dependencies: [libmount,
3675 versiondep],
3676 install_rpath : rootpkglibdir,
3677 install : true)
3678
3679 meson.add_install_script(meson_make_symlink,
3680 'systemd-mount', bindir / 'systemd-umount')
3681
3682 public_programs += executable(
3683 'systemd-run',
3684 'src/run/run.c',
3685 include_directories : includes,
3686 link_with : [libshared],
3687 dependencies : [versiondep],
3688 install_rpath : rootpkglibdir,
3689 install : true)
3690
3691 public_programs += executable(
3692 'systemd-stdio-bridge',
3693 'src/stdio-bridge/stdio-bridge.c',
3694 include_directories : includes,
3695 link_with : [libshared],
3696 dependencies : [versiondep,
3697 versiondep],
3698 install_rpath : rootpkglibdir,
3699 install : true)
3700
3701 public_programs += executable(
3702 'busctl',
3703 busctl_sources,
3704 include_directories : includes,
3705 link_with : [libshared],
3706 dependencies : [versiondep],
3707 install_rpath : rootpkglibdir,
3708 install : true)
3709
3710 if enable_sysusers
3711 exe = executable(
3712 'systemd-sysusers',
3713 'src/sysusers/sysusers.c',
3714 include_directories : includes,
3715 link_with : [libshared],
3716 dependencies : [versiondep],
3717 install_rpath : rootpkglibdir,
3718 install : true,
3719 install_dir : rootbindir)
3720 public_programs += exe
3721
3722 if want_tests != 'false'
3723 test('test-sysusers',
3724 test_sysusers_sh,
3725 # https://github.com/mesonbuild/meson/issues/2681
3726 args : exe.full_path())
3727 endif
3728
3729 if have_standalone_binaries
3730 exe = executable(
3731 'systemd-sysusers.standalone',
3732 'src/sysusers/sysusers.c',
3733 include_directories : includes,
3734 c_args : '-DSTANDALONE',
3735 link_with : [libshared_static,
3736 libbasic,
3737 libbasic_gcrypt,
3738 libsystemd_static],
3739 dependencies : [versiondep],
3740 install : true,
3741 install_dir : rootbindir)
3742 public_programs += exe
3743
3744 if want_tests != 'false'
3745 test('test-sysusers.standalone',
3746 test_sysusers_sh,
3747 # https://github.com/mesonbuild/meson/issues/2681
3748 args : exe.full_path())
3749 endif
3750 endif
3751 endif
3752
3753 if conf.get('ENABLE_TMPFILES') == 1
3754 exe = executable(
3755 'systemd-tmpfiles',
3756 systemd_tmpfiles_sources,
3757 include_directories : includes,
3758 link_with : [libshared],
3759 dependencies : [libacl,
3760 versiondep],
3761 install_rpath : rootpkglibdir,
3762 install : true,
3763 install_dir : rootbindir)
3764 public_programs += exe
3765
3766 if want_tests != 'false'
3767 test('test-systemd-tmpfiles',
3768 test_systemd_tmpfiles_py,
3769 # https://github.com/mesonbuild/meson/issues/2681
3770 args : exe.full_path())
3771 endif
3772
3773 if have_standalone_binaries
3774 exe = executable(
3775 'systemd-tmpfiles.standalone',
3776 systemd_tmpfiles_sources,
3777 include_directories : includes,
3778 c_args : '-DSTANDALONE',
3779 link_with : [libshared_static,
3780 libbasic,
3781 libbasic_gcrypt,
3782 libsystemd_static],
3783 dependencies : [libacl,
3784 versiondep],
3785 install : true,
3786 install_dir : rootbindir)
3787 public_programs += exe
3788
3789 if want_tests != 'false'
3790 test('test-systemd-tmpfiles.standalone',
3791 test_systemd_tmpfiles_py,
3792 # https://github.com/mesonbuild/meson/issues/2681
3793 args : exe.full_path())
3794 endif
3795 endif
3796 endif
3797
3798 if conf.get('ENABLE_HWDB') == 1
3799 systemd_hwdb = executable(
3800 'systemd-hwdb',
3801 'src/hwdb/hwdb.c',
3802 include_directories : includes,
3803 link_with : udev_link_with,
3804 dependencies : [versiondep],
3805 install_rpath : udev_rpath,
3806 install : true,
3807 install_dir : rootbindir)
3808 public_programs += systemd_hwdb
3809
3810 if want_tests != 'false'
3811 test('hwdb-test',
3812 hwdb_test_sh,
3813 suite : 'dist-check',
3814 args : [systemd_hwdb.full_path()],
3815 timeout : 90)
3816 endif
3817 endif
3818
3819 if conf.get('ENABLE_QUOTACHECK') == 1
3820 executable(
3821 'systemd-quotacheck',
3822 'src/quotacheck/quotacheck.c',
3823 include_directories : includes,
3824 link_with : [libshared],
3825 install_rpath : rootpkglibdir,
3826 install : true,
3827 install_dir : rootlibexecdir)
3828 endif
3829
3830 public_programs += executable(
3831 'systemd-socket-proxyd',
3832 'src/socket-proxy/socket-proxyd.c',
3833 include_directories : includes,
3834 link_with : [libshared],
3835 dependencies : [threads,
3836 versiondep],
3837 install_rpath : rootpkglibdir,
3838 install : true,
3839 install_dir : rootlibexecdir)
3840
3841 udevadm = executable(
3842 'udevadm',
3843 udevadm_sources,
3844 include_directories : includes,
3845 link_with : [libudevd_core],
3846 dependencies : [threads,
3847 libkmod,
3848 libidn,
3849 libacl,
3850 libblkid,
3851 versiondep],
3852 install_rpath : udev_rpath,
3853 install : true,
3854 install_dir : rootbindir)
3855 public_programs += udevadm
3856
3857 if conf.get('ENABLE_REPART') == 1
3858 exe = executable(
3859 'systemd-repart',
3860 systemd_repart_sources,
3861 include_directories : includes,
3862 link_with : [libshared,
3863 libshared_fdisk],
3864 dependencies : [threads,
3865 libblkid,
3866 libfdisk,
3867 libopenssl,
3868 versiondep],
3869 install_rpath : rootpkglibdir,
3870 install : true,
3871 install_dir : rootbindir)
3872 public_programs += exe
3873
3874 if have_standalone_binaries
3875 exe = executable(
3876 'systemd-repart.standalone',
3877 systemd_repart_sources,
3878 include_directories : includes,
3879 c_args : '-DSTANDALONE',
3880 link_with : [libshared_static,
3881 libbasic,
3882 libbasic_gcrypt,
3883 libsystemd_static,
3884 libshared_fdisk],
3885 dependencies : [threads,
3886 libblkid,
3887 libfdisk,
3888 libopenssl,
3889 versiondep],
3890 install_rpath : rootpkglibdir,
3891 install : true,
3892 install_dir : rootbindir)
3893 public_programs += exe
3894 endif
3895 endif
3896
3897 executable(
3898 'systemd-shutdown',
3899 systemd_shutdown_sources,
3900 include_directories : includes,
3901 link_with : [libshared],
3902 dependencies : [libmount,
3903 versiondep],
3904 install_rpath : rootpkglibdir,
3905 install : true,
3906 install_dir : rootlibexecdir)
3907
3908 if have_standalone_binaries
3909 executable(
3910 'systemd-shutdown.standalone',
3911 systemd_shutdown_sources,
3912 include_directories : includes,
3913 c_args : '-DSTANDALONE',
3914 link_with : [libshared_static,
3915 libbasic,
3916 libsystemd_static],
3917 dependencies : [libmount,
3918 versiondep],
3919 install_rpath : rootpkglibdir,
3920 install : true,
3921 install_dir : rootlibexecdir)
3922 endif
3923
3924 executable(
3925 'systemd-update-done',
3926 'src/update-done/update-done.c',
3927 include_directories : includes,
3928 link_with : [libshared],
3929 dependencies : [versiondep],
3930 install_rpath : rootpkglibdir,
3931 install : true,
3932 install_dir : rootlibexecdir)
3933
3934 executable(
3935 'systemd-update-utmp',
3936 'src/update-utmp/update-utmp.c',
3937 include_directories : includes,
3938 link_with : [libshared],
3939 dependencies : [libaudit,
3940 versiondep],
3941 install_rpath : rootpkglibdir,
3942 install : (conf.get('ENABLE_UTMP') == 1),
3943 install_dir : rootlibexecdir)
3944
3945 if conf.get('HAVE_KMOD') == 1
3946 executable(
3947 'systemd-modules-load',
3948 'src/modules-load/modules-load.c',
3949 include_directories : includes,
3950 link_with : [libshared],
3951 dependencies : [libkmod,
3952 versiondep],
3953 install_rpath : rootpkglibdir,
3954 install : true,
3955 install_dir : rootlibexecdir)
3956
3957 meson.add_install_script('sh', '-c',
3958 mkdir_p.format(modulesloaddir))
3959 if install_sysconfdir
3960 meson.add_install_script('sh', '-c',
3961 mkdir_p.format(sysconfdir / 'modules-load.d'))
3962 endif
3963 endif
3964
3965 public_programs += executable(
3966 'systemd-nspawn',
3967 systemd_nspawn_sources,
3968 include_directories : includes,
3969 link_with : [libnspawn_core,
3970 libshared],
3971 dependencies : [libblkid,
3972 libseccomp,
3973 versiondep],
3974 install_rpath : rootpkglibdir,
3975 install : true)
3976
3977 if conf.get('ENABLE_NETWORKD') == 1
3978 dbus_programs += executable(
3979 'systemd-networkd',
3980 systemd_networkd_sources,
3981 include_directories : network_includes,
3982 link_with : [libnetworkd_core,
3983 libsystemd_network,
3984 networkd_link_with],
3985 dependencies : [threads,
3986 versiondep],
3987 install_rpath : rootpkglibdir,
3988 install : true,
3989 install_dir : rootlibexecdir)
3990
3991 public_programs += executable(
3992 'systemd-networkd-wait-online',
3993 systemd_networkd_wait_online_sources,
3994 include_directories : includes,
3995 link_with : [networkd_link_with],
3996 dependencies : [versiondep],
3997 install_rpath : rootpkglibdir,
3998 install : true,
3999 install_dir : rootlibexecdir)
4000
4001 public_programs += executable(
4002 'networkctl',
4003 networkctl_sources,
4004 include_directories : libsystemd_network_includes,
4005 link_with : [libsystemd_network,
4006 networkd_link_with],
4007 dependencies : [versiondep],
4008 install_rpath : rootpkglibdir,
4009 install : true,
4010 install_dir : rootbindir)
4011 endif
4012
4013 exe = executable(
4014 'systemd-network-generator',
4015 network_generator_sources,
4016 include_directories : includes,
4017 link_with : [networkd_link_with],
4018 dependencies : [versiondep],
4019 install_rpath : rootpkglibdir,
4020 install : true,
4021 install_dir : rootlibexecdir)
4022
4023 if want_tests != 'false'
4024 test('test-network-generator-conversion',
4025 test_network_generator_conversion_sh,
4026 # https://github.com/mesonbuild/meson/issues/2681
4027 args : exe.full_path(),
4028 depends : exe)
4029 endif
4030
4031 executable(
4032 'systemd-sulogin-shell',
4033 'src/sulogin-shell/sulogin-shell.c',
4034 include_directories : includes,
4035 link_with : [libshared],
4036 dependencies : [versiondep],
4037 install_rpath : rootpkglibdir,
4038 install : true,
4039 install_dir : rootlibexecdir)
4040
4041 exe = custom_target(
4042 'kernel-install',
4043 input : kernel_install_in,
4044 output : 'kernel-install',
4045 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
4046 install : want_kernel_install,
4047 install_mode : 'rwxr-xr-x',
4048 install_dir : bindir)
4049 public_programs += exe
4050
4051 if want_tests != 'false' and want_kernel_install
4052 test('test-kernel-install',
4053 test_kernel_install_sh,
4054 args : [exe.full_path(), loaderentry_install])
4055 endif
4056
4057 if want_ukify
4058 exe = custom_target(
4059 'ukify',
4060 input : 'src/ukify/ukify.py',
4061 output : 'ukify',
4062 command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'],
4063 install : true,
4064 install_mode : 'rwxr-xr-x',
4065 install_dir : rootlibexecdir)
4066 public_programs += exe
4067 endif
4068
4069 ############################################################
4070
4071 runtest_env = custom_target(
4072 'systemd-runtest.env',
4073 output : 'systemd-runtest.env',
4074 command : [sh, '-c',
4075 '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
4076 project_source_root / 'test',
4077 project_build_root / 'catalog')],
4078 depends : catalogs,
4079 build_by_default : true)
4080
4081 test_cflags = ['-DTEST_CODE=1']
4082 # We intentionally do not do inline initializations with definitions for a
4083 # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
4084 # use the variable unexpectedly. This triggers a lot of maybe-uninitialized
4085 # false positives when the combination of -O2 and -flto is used. Suppress them.
4086 if '-O2' in c_args and '-flto=auto' in c_args
4087 test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
4088 endif
4089
4090 foreach tuple : tests
4091 sources = tuple[0]
4092 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
4093 dependencies = tuple.length() > 2 ? tuple[2] : []
4094 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
4095 condition = tuple.length() > 4 ? tuple[4] : ''
4096 type = tuple.length() > 5 ? tuple[5] : ''
4097 defs = tuple.length() > 6 ? tuple[6] : []
4098 defs += test_cflags
4099 parallel = tuple.length() > 7 ? tuple[7] : true
4100 timeout = 30
4101
4102 # FIXME: Use fs.stem() with meson >= 0.54.0
4103 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
4104 if type.startswith('timeout=')
4105 timeout = type.split('=')[1].to_int()
4106 type = ''
4107 endif
4108
4109 suite = fs.name(fs.parent('@0@'.format(sources[0])))
4110 # FIXME: Use str.replace() with meson >= 0.58.0
4111 suite = suite.split('sd-')[-1]
4112
4113 if condition == '' or conf.get(condition) == 1
4114 exe = executable(
4115 name,
4116 sources,
4117 include_directories : incs,
4118 link_with : link_with,
4119 dependencies : [versiondep,
4120 dependencies],
4121 c_args : defs,
4122 build_by_default : want_tests != 'false',
4123 install_rpath : rootpkglibdir,
4124 install : install_tests,
4125 install_dir : testsdir / type,
4126 link_depends : runtest_env)
4127
4128 if type == 'manual'
4129 message('@0@ is a manual test'.format(name))
4130 elif type == 'unsafe' and want_tests != 'unsafe'
4131 message('@0@ is an unsafe test'.format(name))
4132 elif want_tests != 'false'
4133 test(name, exe,
4134 env : test_env,
4135 timeout : timeout,
4136 suite : suite,
4137 is_parallel : parallel)
4138 endif
4139 else
4140 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
4141 endif
4142 endforeach
4143
4144 exe = executable(
4145 'test-libsystemd-sym',
4146 test_libsystemd_sym_c,
4147 include_directories : includes,
4148 link_with : [libsystemd],
4149 build_by_default : want_tests != 'false',
4150 install : install_tests,
4151 install_dir : testsdir)
4152 if want_tests != 'false'
4153 test('test-libsystemd-sym', exe)
4154 endif
4155
4156 exe = executable(
4157 'test-libsystemd-static-sym',
4158 test_libsystemd_sym_c,
4159 include_directories : includes,
4160 link_with : [install_libsystemd_static],
4161 dependencies : [threads], # threads is already included in dependencies on the library,
4162 # but does not seem to get propagated. Add here as a work-around.
4163 build_by_default : want_tests != 'false' and static_libsystemd_pic,
4164 install : install_tests and static_libsystemd_pic,
4165 install_dir : testsdir)
4166 if want_tests != 'false' and static_libsystemd_pic
4167 test('test-libsystemd-static-sym', exe)
4168 endif
4169
4170 exe = executable(
4171 'test-libudev-sym',
4172 test_libudev_sym_c,
4173 include_directories : libudev_includes,
4174 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
4175 link_with : [libudev],
4176 build_by_default : want_tests != 'false',
4177 install : install_tests,
4178 install_dir : testsdir)
4179 if want_tests != 'false'
4180 test('test-libudev-sym', exe)
4181 endif
4182
4183 exe = executable(
4184 'test-libudev-static-sym',
4185 test_libudev_sym_c,
4186 include_directories : libudev_includes,
4187 c_args : ['-Wno-deprecated-declarations'] + test_cflags,
4188 link_with : [install_libudev_static],
4189 build_by_default : want_tests != 'false' and static_libudev_pic,
4190 install : install_tests and static_libudev_pic,
4191 install_dir : testsdir)
4192 if want_tests != 'false' and static_libudev_pic
4193 test('test-libudev-static-sym', exe)
4194 endif
4195
4196 ############################################################
4197
4198 fuzzer_exes = []
4199
4200 foreach tuple : fuzzers
4201 sources = tuple[0]
4202 link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
4203 dependencies = tuple.length() > 2 ? tuple[2] : []
4204 incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
4205 defs = tuple.length() > 4 ? tuple[4] : []
4206 link_args = []
4207
4208 if want_ossfuzz
4209 dependencies += fuzzing_engine
4210 elif want_libfuzzer
4211 if fuzzing_engine.found()
4212 dependencies += fuzzing_engine
4213 else
4214 link_args += ['-fsanitize=fuzzer']
4215 endif
4216 else
4217 sources += 'src/fuzz/fuzz-main.c'
4218 endif
4219 sources += fuzz_generated_directives
4220
4221 # FIXME: Use fs.stem() with meson >= 0.54.0
4222 name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0]
4223
4224 exe = executable(
4225 name,
4226 sources,
4227 include_directories : [incs, include_directories('src/fuzz')],
4228 link_with : link_with,
4229 dependencies : [dependencies,
4230 versiondep],
4231 c_args : defs + test_cflags,
4232 link_args: link_args,
4233 install : false,
4234 build_by_default : fuzzer_build)
4235 fuzzer_exes += exe
4236
4237 if want_tests != 'false' and name in fuzz_regression_tests
4238 # Run the fuzz regression tests without any sanitizers enabled.
4239 # Additional invocations with sanitizers may be added below.
4240 foreach tuple : fuzz_regression_tests[name]
4241 fuzz_dir = tuple[0]
4242 fuzz_in = tuple[1]
4243 test('@0@_@1@'.format(name, fuzz_in),
4244 exe,
4245 suite : 'fuzzers',
4246 args : [fuzz_dir != '' ? project_source_root / fuzz_dir / name / fuzz_in
4247 : fuzz_generated_in_dir / '@0@_@1@'.format(name, fuzz_in)])
4248 endforeach
4249 endif
4250 endforeach
4251
4252 alias_target('fuzzers', fuzzer_exes)
4253
4254 ############################################################
4255
4256 subdir('docs/sysvinit')
4257 subdir('docs/var-log')
4258 subdir('hwdb.d')
4259 subdir('man')
4260 subdir('modprobe.d')
4261 subdir('network')
4262 subdir('presets')
4263 subdir('shell-completion/bash')
4264 subdir('shell-completion/zsh')
4265 subdir('sysctl.d')
4266 subdir('sysusers.d')
4267 subdir('tmpfiles.d')
4268 subdir('units')
4269
4270 install_subdir('factory/etc',
4271 install_dir : factorydir)
4272 subdir('factory/templates')
4273
4274 if install_sysconfdir
4275 install_data('xorg/50-systemd-user.sh',
4276 install_dir : xinitrcdir)
4277 endif
4278 install_data('LICENSE.GPL2',
4279 'LICENSE.LGPL2.1',
4280 'NEWS',
4281 'README',
4282 'docs/CODING_STYLE.md',
4283 'docs/DISTRO_PORTING.md',
4284 'docs/ENVIRONMENT.md',
4285 'docs/HACKING.md',
4286 'docs/TRANSIENT-SETTINGS.md',
4287 'docs/TRANSLATORS.md',
4288 'docs/UIDS-GIDS.md',
4289 install_dir : docdir)
4290
4291 install_subdir('LICENSES',
4292 install_dir : docdir)
4293
4294 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
4295 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
4296
4297 ############################################################
4298
4299 # Ensure that changes to the docs/ directory do not break the
4300 # basic Github pages build. But only run it in developer mode,
4301 # as it might be fragile due to changes in the tooling, and it is
4302 # not generally useful for users.
4303 jekyll = find_program('jekyll', required : false)
4304 if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found()
4305 test('github-pages',
4306 jekyll,
4307 suite : 'dist-check',
4308 args : ['build',
4309 '--source', project_source_root / 'docs',
4310 '--destination', project_build_root / '_site'])
4311 endif
4312
4313 ############################################################
4314
4315 check_help = find_program('tools/check-help.sh')
4316 check_version = find_program('tools/check-version.sh')
4317
4318 foreach exec : public_programs
4319 name = exec.full_path().split('/')[-1]
4320 if want_tests != 'false'
4321 test('check-help-' + name,
4322 check_help,
4323 suite : 'dist-check',
4324 args : exec.full_path(),
4325 depends: exec)
4326
4327 test('check-version-' + name,
4328 check_version,
4329 suite : 'dist-check',
4330 args : [exec.full_path(),
4331 meson.project_version()],
4332 depends: exec)
4333 endif
4334 endforeach
4335
4336 # Enable tests for all supported sanitizers
4337 foreach tuple : fuzz_sanitizers
4338 sanitizer = tuple[0]
4339 build = tuple[1]
4340
4341 if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
4342 foreach fuzzer, fuzz_ins : fuzz_regression_tests
4343 name = '@0@:@1@'.format(fuzzer, sanitizer)
4344 if want_tests == 'false'
4345 message('Not compiling @0@ because tests is set to false'.format(name))
4346 continue
4347 endif
4348 if not fuzz_tests
4349 message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
4350 continue
4351 endif
4352 exe = custom_target(
4353 name,
4354 output : name,
4355 depends : [build] + fuzz_generated_directives,
4356 command : [ln, '-fs',
4357 build.full_path() / fuzzer,
4358 '@OUTPUT@'],
4359 build_by_default : true)
4360
4361 foreach tuple : fuzz_ins
4362 fuzz_dir = tuple[0]
4363 fuzz_in = tuple[1]
4364
4365 test('@0@_@1@_@2@'.format(fuzzer, fuzz_in, sanitizer),
4366 env,
4367 suite : 'fuzz+san',
4368 env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
4369 timeout : 60,
4370 args : [exe.full_path(),
4371 fuzz_dir != '' ? project_source_root / fuzz_dir / fuzzer / fuzz_in
4372 : fuzz_generated_in_dir / '@0@_@1@'.format(fuzzer, fuzz_in)])
4373 endforeach
4374 endforeach
4375 endif
4376 endforeach
4377
4378
4379 ############################################################
4380
4381 if git.found()
4382 all_files = run_command(
4383 env, '-u', 'GIT_WORK_TREE',
4384 git, '--git-dir=@0@/.git'.format(project_source_root),
4385 'ls-files', ':/*.[ch]',
4386 check : false)
4387 if all_files.returncode() == 0
4388 all_files = files(all_files.stdout().split())
4389
4390 custom_target(
4391 'tags',
4392 output : 'tags',
4393 command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files)
4394 run_target(
4395 'ctags',
4396 command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files)
4397 endif
4398 endif
4399
4400 if git.found()
4401 git_contrib_sh = find_program('tools/git-contrib.sh')
4402 run_target(
4403 'git-contrib',
4404 command : [git_contrib_sh])
4405 endif
4406
4407 if git.found()
4408 git_head = run_command(
4409 git, '--git-dir=@0@/.git'.format(project_source_root),
4410 'rev-parse', 'HEAD',
4411 check : false).stdout().strip()
4412 git_head_short = run_command(
4413 git, '--git-dir=@0@/.git'.format(project_source_root),
4414 'rev-parse', '--short=7', 'HEAD',
4415 check : false).stdout().strip()
4416
4417 run_target(
4418 'git-snapshot',
4419 command : [git, 'archive',
4420 '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root,
4421 git_head_short),
4422 '--prefix', 'systemd-@0@/'.format(git_head),
4423 'HEAD'])
4424 endif
4425
4426 ############################################################
4427
4428 check_api_docs_sh = find_program('tools/check-api-docs.sh')
4429 run_target(
4430 'check-api-docs',
4431 depends : [man, libsystemd, libudev],
4432 command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
4433
4434 alias_target('update-dbus-docs', update_dbus_docs)
4435 alias_target('update-man-rules', update_man_rules)
4436
4437 if not meson.is_cross_build()
4438 custom_target(
4439 'export-dbus-interfaces',
4440 output : fs.name(dbus_interfaces_dir),
4441 install : dbus_interfaces_dir != 'no',
4442 install_dir : fs.parent(dbus_interfaces_dir),
4443 command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs])
4444 endif
4445
4446 ############################################################
4447
4448 alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch),
4449 check : true).stdout().strip()
4450
4451 summary({
4452 'split /usr' : split_usr,
4453 'split bin-sbin' : split_bin,
4454 'prefix directory' : prefixdir,
4455 'rootprefix directory' : rootprefixdir,
4456 'sysconf directory' : sysconfdir,
4457 'include directory' : includedir,
4458 'lib directory' : libdir,
4459 'rootlib directory' : rootlibdir,
4460 'SysV init scripts' : sysvinit_path,
4461 'SysV rc?.d directories' : sysvrcnd_path,
4462 'PAM modules directory' : pamlibdir,
4463 'PAM configuration directory' : pamconfdir,
4464 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir,
4465 'RPM macros directory' : rpmmacrosdir,
4466 'modprobe.d directory' : modprobedir,
4467 'D-Bus policy directory' : dbuspolicydir,
4468 'D-Bus session directory' : dbussessionservicedir,
4469 'D-Bus system directory' : dbussystemservicedir,
4470 'D-Bus interfaces directory' : dbus_interfaces_dir,
4471 'bash completions directory' : bashcompletiondir,
4472 'zsh completions directory' : zshcompletiondir,
4473 'private shared lib version tag' : shared_lib_tag,
4474 'extra start script' : get_option('rc-local'),
4475 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'),
4476 get_option('debug-tty')),
4477 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'),
4478 conf.get('SYSTEM_ALLOC_UID_MIN')),
4479 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'),
4480 conf.get('SYSTEM_ALLOC_GID_MIN')),
4481 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max),
4482 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max),
4483 'static UID/GID allocations' : ' '.join(static_ugids),
4484 '/dev/kvm access mode' : get_option('dev-kvm-mode'),
4485 'render group access mode' : get_option('group-render-mode'),
4486 'certificate root directory' : get_option('certificate-root'),
4487 'support URL' : support_url,
4488 'nobody user name' : nobody_user,
4489 'nobody group name' : nobody_group,
4490 'fallback hostname' : get_option('fallback-hostname'),
4491 'default compression method' : compression,
4492 'default DNSSEC mode' : default_dnssec,
4493 'default DNS-over-TLS mode' : default_dns_over_tls,
4494 'default mDNS mode' : default_mdns,
4495 'default LLMNR mode' : default_llmnr,
4496 'default DNS servers' : dns_servers.split(' '),
4497 'default NTP servers' : ntp_servers.split(' '),
4498 'default cgroup hierarchy' : default_hierarchy,
4499 'default net.naming-scheme value' : default_net_naming_scheme,
4500 'default KillUserProcesses value' : kill_user_processes,
4501 'default locale' : default_locale,
4502 'default nspawn locale' : nspawn_locale,
4503 'default status unit format' : status_unit_format_default,
4504 'default user $PATH' :
4505 default_user_path != '' ? default_user_path : '(same as system services)',
4506 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog,
4507 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)})
4508
4509 # TODO:
4510 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
4511 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
4512 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
4513
4514 found = []
4515 missing = []
4516
4517 foreach tuple : [
4518 # dependencies
4519 ['ACL'],
4520 ['AUDIT'],
4521 ['AppArmor'],
4522 ['IMA'],
4523 ['PAM'],
4524 ['SECCOMP'],
4525 ['SELinux'],
4526 ['SMACK'],
4527 ['blkid'],
4528 ['elfutils'],
4529 ['gcrypt'],
4530 ['gnutls'],
4531 ['libbpf'],
4532 ['libcryptsetup'],
4533 ['libcryptsetup-plugins'],
4534 ['libcurl'],
4535 ['libfdisk'],
4536 ['libfido2'],
4537 ['libidn'],
4538 ['libidn2'],
4539 ['libiptc'],
4540 ['microhttpd'],
4541 ['openssl'],
4542 ['p11kit'],
4543 ['pcre2'],
4544 ['pwquality'],
4545 ['qrencode'],
4546 ['tpm2'],
4547 ['xkbcommon'],
4548
4549 # compression libs
4550 ['zstd'],
4551 ['lz4'],
4552 ['xz'],
4553 ['zlib'],
4554 ['bzip2'],
4555
4556 # components
4557 ['backlight'],
4558 ['binfmt'],
4559 ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1],
4560 ['coredump'],
4561 ['environment.d'],
4562 ['efi'],
4563 ['gnu-efi'],
4564 ['firstboot'],
4565 ['hibernate'],
4566 ['homed'],
4567 ['hostnamed'],
4568 ['hwdb'],
4569 ['importd'],
4570 ['initrd'],
4571 ['kernel-install'],
4572 ['localed'],
4573 ['logind'],
4574 ['machined'],
4575 ['networkd'],
4576 ['nss-myhostname'],
4577 ['nss-mymachines'],
4578 ['nss-resolve'],
4579 ['nss-systemd'],
4580 ['oomd'],
4581 ['portabled'],
4582 ['pstore'],
4583 ['quotacheck'],
4584 ['randomseed'],
4585 ['repart'],
4586 ['resolve'],
4587 ['rfkill'],
4588 ['sysext'],
4589 ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
4590 ['sysupdate'],
4591 ['sysusers'],
4592 ['timedated'],
4593 ['timesyncd'],
4594 ['tmpfiles'],
4595 ['userdb'],
4596 ['vconsole'],
4597 ['xdg-autostart'],
4598
4599 # optional features
4600 ['idn'],
4601 ['polkit'],
4602 ['nscd'],
4603 ['legacy-pkla', install_polkit_pkla],
4604 ['kmod'],
4605 ['xenctrl'],
4606 ['dbus'],
4607 ['glib'],
4608 ['tpm'],
4609 ['man pages', want_man],
4610 ['html pages', want_html],
4611 ['man page indices', want_man and have_lxml],
4612 ['SysV compat'],
4613 ['compat-mutable-uid-boundaries'],
4614 ['utmp'],
4615 ['ldconfig'],
4616 ['adm group', get_option('adm-group')],
4617 ['wheel group', get_option('wheel-group')],
4618 ['gshadow'],
4619 ['debug hashmap'],
4620 ['debug mmap cache'],
4621 ['debug siphash'],
4622 ['valgrind', conf.get('VALGRIND') == 1],
4623 ['trace logging', conf.get('LOG_TRACE') == 1],
4624 ['install tests', install_tests],
4625 ['link-udev-shared', get_option('link-udev-shared')],
4626 ['link-systemctl-shared', get_option('link-systemctl-shared')],
4627 ['link-networkd-shared', get_option('link-networkd-shared')],
4628 ['link-timesyncd-shared', get_option('link-timesyncd-shared')],
4629 ['link-journalctl-shared', get_option('link-journalctl-shared')],
4630 ['link-boot-shared', get_option('link-boot-shared')],
4631 ['first-boot-full-preset'],
4632 ['fexecve'],
4633 ['standalone-binaries', get_option('standalone-binaries')],
4634 ['coverage', get_option('b_coverage')],
4635 ]
4636
4637 if tuple.length() >= 2
4638 cond = tuple[1]
4639 else
4640 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
4641 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
4642 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
4643 endif
4644 if cond
4645 found += tuple[0]
4646 else
4647 missing += tuple[0]
4648 endif
4649 endforeach
4650
4651 if static_libsystemd == 'false'
4652 missing += 'static-libsystemd'
4653 else
4654 found += 'static-libsystemd(@0@)'.format(static_libsystemd)
4655 endif
4656
4657 if static_libudev == 'false'
4658 missing += 'static-libudev'
4659 else
4660 found += 'static-libudev(@0@)'.format(static_libudev)
4661 endif
4662
4663 if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1
4664 found += 'cryptolib(openssl)'
4665 elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1
4666 found += 'cryptolib(gcrypt)'
4667 else
4668 missing += 'cryptolib'
4669 endif
4670
4671 if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
4672 found += 'DNS-over-TLS(gnutls)'
4673 elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
4674 found += 'DNS-over-TLS(openssl)'
4675 else
4676 missing += 'DNS-over-TLS'
4677 endif
4678
4679 summary({
4680 'enabled' : ', '.join(found),
4681 'disabled' : ', '.join(missing)},
4682 section : 'Features')
4683
4684 if rootprefixdir != rootprefix_default
4685 warning('\n' +
4686 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
4687 'systemd used fixed names for unit file directories and other paths, so anything\n' +
4688 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))
4689 endif