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