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