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