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