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