1 # SPDX-License-Identifier: LGPL-2.1+
3 # Copyright 2017 Zbigniew Jędrzejewski-Szmek
5 # systemd is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) any later version.
10 # systemd is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
18 project('systemd', 'c',
27 meson_version : '>= 0.41',
30 libsystemd_version = '0.19.1'
31 libudev_version = '1.6.7'
33 # We need the same data in three different formats, ugh!
34 # Also, for hysterical reasons, we use different variable
35 # names, sometimes. Not all variables are included in every
37 conf = configuration_data()
38 conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
39 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
41 substs = configuration_data()
42 substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
43 substs.set('PACKAGE_VERSION', meson.project_version())
47 #####################################################################
49 # Try to install the git pre-commit hook
50 git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
51 if git_hook.returncode() == 0
52 message(git_hook.stdout().strip())
55 #####################################################################
57 conf.set10('HAVE_SPLIT_USR', get_option('split-usr'))
58 rootprefixdir = get_option('split-usr') ? '/' : '/usr'
60 sysvinit_path = get_option('sysvinit-path')
61 sysvrcnd_path = get_option('sysvrcnd-path')
62 have = sysvinit_path != '' or sysvrcnd_path != ''
63 conf.set10('HAVE_SYSV_COMPAT', have,
64 description : 'SysV init scripts and rcN.d links are supported')
65 m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
67 # join_paths ignore the preceding arguments if an absolute component is
68 # encountered, so this should canonicalize various paths when they are
69 # absolute or relative.
70 prefixdir = get_option('prefix')
71 if not prefixdir.startswith('/')
72 error('Prefix is not absolute: "@0@"'.format(prefixdir))
74 bindir = join_paths(prefixdir, get_option('bindir'))
75 libdir = join_paths(prefixdir, get_option('libdir'))
76 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
77 includedir = join_paths(prefixdir, get_option('includedir'))
78 datadir = join_paths(prefixdir, get_option('datadir'))
79 localstatedir = join_paths('/', get_option('localstatedir'))
81 rootbindir = join_paths(rootprefixdir, 'bin')
82 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
84 rootlibdir = get_option('rootlibdir')
86 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
89 # Dirs of external packages
90 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
91 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
92 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
93 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
94 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
95 varlogdir = join_paths(localstatedir, 'log')
96 xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
97 rpmmacrosdir = join_paths(prefixdir, get_option('rpmmacrosdir'))
98 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
101 pkgdatadir = join_paths(datadir, 'systemd')
102 environmentdir = join_paths(prefixdir, 'lib/environment.d')
103 pkgsysconfdir = join_paths(sysconfdir, 'systemd')
104 userunitdir = join_paths(prefixdir, 'lib/systemd/user')
105 userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
106 tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
107 sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
108 sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
109 binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
110 modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
111 networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
112 pkgincludedir = join_paths(includedir, 'systemd')
113 systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
114 usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
115 systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
116 userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
117 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
118 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
119 systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
120 systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
121 udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
122 udevhomedir = udevlibexecdir
123 udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
124 udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
125 catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
126 kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
127 factorydir = join_paths(datadir, 'factory')
128 docdir = join_paths(datadir, 'doc/systemd')
129 bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
130 testsdir = join_paths(prefixdir, 'lib/systemd/tests')
131 systemdstatedir = join_paths(localstatedir, 'lib/systemd')
132 catalogstatedir = join_paths(systemdstatedir, 'catalog')
133 randomseeddir = join_paths(localstatedir, 'lib/systemd')
135 dbuspolicydir = get_option('dbuspolicydir')
136 if dbuspolicydir == ''
137 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
140 dbussessionservicedir = get_option('dbussessionservicedir')
141 if dbussessionservicedir == ''
142 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
145 dbussystemservicedir = get_option('dbussystemservicedir')
146 if dbussystemservicedir == ''
147 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
150 pamlibdir = get_option('pamlibdir')
152 pamlibdir = join_paths(rootlibdir, 'security')
155 pamconfdir = get_option('pamconfdir')
157 pamconfdir = join_paths(sysconfdir, 'pam.d')
160 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
161 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
162 conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
163 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
164 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
165 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
166 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
167 conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
168 conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
169 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
170 conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
171 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
172 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
173 conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
174 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
175 conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
176 conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
177 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
178 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
179 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
180 conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
181 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
182 conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
183 conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
184 conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
185 conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
186 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
187 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
188 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
189 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
190 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
191 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
192 conf.set_quoted('LIBDIR', libdir)
193 conf.set_quoted('ROOTLIBDIR', rootlibdir)
194 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
195 conf.set_quoted('BOOTLIBDIR', bootlibdir)
196 conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
197 conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
198 conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
199 conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
200 conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
201 conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
203 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
204 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
206 substs.set('prefix', prefixdir)
207 substs.set('exec_prefix', prefixdir)
208 substs.set('libdir', libdir)
209 substs.set('rootlibdir', rootlibdir)
210 substs.set('includedir', includedir)
211 substs.set('pkgsysconfdir', pkgsysconfdir)
212 substs.set('bindir', bindir)
213 substs.set('rootbindir', rootbindir)
214 substs.set('rootlibexecdir', rootlibexecdir)
215 substs.set('systemunitdir', systemunitdir)
216 substs.set('userunitdir', userunitdir)
217 substs.set('systempresetdir', systempresetdir)
218 substs.set('userpresetdir', userpresetdir)
219 substs.set('udevhwdbdir', udevhwdbdir)
220 substs.set('udevrulesdir', udevrulesdir)
221 substs.set('udevlibexecdir', udevlibexecdir)
222 substs.set('catalogdir', catalogdir)
223 substs.set('tmpfilesdir', tmpfilesdir)
224 substs.set('sysusersdir', sysusersdir)
225 substs.set('sysctldir', sysctldir)
226 substs.set('binfmtdir', binfmtdir)
227 substs.set('modulesloaddir', modulesloaddir)
228 substs.set('systemgeneratordir', systemgeneratordir)
229 substs.set('usergeneratordir', usergeneratordir)
230 substs.set('systemenvgeneratordir', systemenvgeneratordir)
231 substs.set('userenvgeneratordir', userenvgeneratordir)
232 substs.set('systemshutdowndir', systemshutdowndir)
233 substs.set('systemsleepdir', systemsleepdir)
234 substs.set('VARLOGDIR', varlogdir)
235 substs.set('CERTIFICATEROOT', get_option('certificate-root'))
236 substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
237 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
238 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
239 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
240 substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
241 substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
243 #####################################################################
245 cc = meson.get_compiler('c')
246 pkgconfig = import('pkgconfig')
247 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
249 cxx = find_program('c++', required : false)
251 # Used only for tests
255 foreach arg : ['-Wextra',
258 '-Wmissing-include-dirs',
259 '-Wold-style-definition',
262 '-Wdeclaration-after-statement',
264 '-Wsuggest-attribute=noreturn',
265 '-Werror=missing-prototypes',
266 '-Werror=implicit-function-declaration',
267 '-Werror=missing-declarations',
268 '-Werror=return-type',
269 '-Werror=incompatible-pointer-types',
271 '-Wstrict-prototypes',
273 '-Wmissing-noreturn',
274 '-Wimplicit-fallthrough=3',
277 '-Wstrict-aliasing=2',
284 '-fdiagnostics-show-option',
285 '-fno-strict-aliasing',
286 '-fvisibility=hidden',
288 '-fstack-protector-strong',
290 '--param=ssp-buffer-size=4',
292 if cc.has_argument(arg)
293 add_project_arguments(arg, language : 'c')
297 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
298 # arguments, just emits a warnings. So test for the "positive" version instead.
299 foreach arg : ['unused-parameter',
300 'missing-field-initializers',
303 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
305 if cc.has_argument('-W' + arg)
306 add_project_arguments('-Wno-' + arg, language : 'c')
312 #include <inttypes.h>
313 typedef uint64_t usec_t;
314 usec_t now(clockid_t clock);
319 ', name : '-Werror=shadow with local shadowing')
320 add_project_arguments('-Werror=shadow', language : 'c')
323 if cc.get_id() == 'clang'
324 foreach arg : ['-Wno-typedef-redefinition',
325 '-Wno-gnu-variable-sized-type-not-at-end',
327 if cc.has_argument(arg,
328 name : '@0@ is supported'.format(arg))
329 add_project_arguments(arg, language : 'c')
334 link_test_c = files('tools/meson-link-test.c')
336 # --as-needed and --no-undefined are provided by meson by default,
337 # run mesonconf to see what is enabled
338 foreach arg : ['-Wl,-z,relro',
343 have = run_command(check_compilation_sh,
344 cc.cmd_array(), '-x', 'c', arg,
345 '-include', link_test_c).returncode() == 0
346 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
348 add_project_link_arguments(arg, language : 'c')
352 if get_option('buildtype') != 'debug'
353 foreach arg : ['-ffunction-sections',
355 if cc.has_argument(arg,
356 name : '@0@ is supported'.format(arg))
357 add_project_arguments(arg, language : 'c')
361 foreach arg : ['-Wl,--gc-sections']
362 have = run_command(check_compilation_sh,
363 cc.cmd_array(), '-x', 'c', arg,
364 '-include', link_test_c).returncode() == 0
365 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
367 add_project_link_arguments(arg, language : 'c')
372 cpp = ' '.join(cc.cmd_array()) + ' -E'
374 #####################################################################
375 # compilation result tests
377 conf.set('_GNU_SOURCE', true)
378 conf.set('__SANE_USERSPACE_TYPES__', true)
380 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
381 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
382 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
383 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
384 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
385 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
386 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
390 #include <linux/ethtool.h>
391 #include <linux/fib_rules.h>
393 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
395 foreach decl : ['char16_t',
398 'struct ethtool_link_settings',
399 'struct fib_rule_uid_range',
402 # We get -1 if the size cannot be determined
403 have = cc.sizeof(decl, prefix : decl_headers) > 0
404 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
407 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
408 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
409 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
410 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
411 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
412 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
413 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
414 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
415 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
416 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
417 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
418 # if_tunnel.h is buggy and cannot be included on its own
419 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
420 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
421 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
422 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
423 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
424 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
425 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
426 ['NDA_IFINDEX', 'linux/neighbour.h'],
427 ['IFA_FLAGS', 'linux/if_addr.h'],
428 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
429 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
431 prefix = decl.length() > 2 ? decl[2] : ''
432 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
433 conf.set10('HAVE_' + decl[0], have)
436 foreach ident : ['secure_getenv', '__secure_getenv']
437 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
441 ['memfd_create', '''#include <sys/memfd.h>'''],
442 ['gettid', '''#include <sys/types.h>'''],
443 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
444 ['name_to_handle_at', '''#define _GNU_SOURCE
445 #include <sys/types.h>
446 #include <sys/stat.h>
447 #include <fcntl.h>'''],
448 ['setns', '''#define _GNU_SOURCE
449 #include <sched.h>'''],
450 ['renameat2', '''#include <stdio.h>'''],
451 ['kcmp', '''#include <linux/kcmp.h>'''],
452 ['keyctl', '''#include <sys/types.h>
453 #include <keyutils.h>'''],
454 ['copy_file_range', '''#include <sys/syscall.h>
455 #include <unistd.h>'''],
456 ['bpf', '''#include <sys/syscall.h>
457 #include <unistd.h>'''],
458 ['explicit_bzero' , '''#include <string.h>'''],
461 have = cc.has_function(ident[0], prefix : ident[1])
462 conf.set10('HAVE_' + ident[0].to_upper(), have)
465 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
466 conf.set10('USE_SYS_RANDOM_H', true)
467 conf.set10('HAVE_GETRANDOM', true)
469 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
470 conf.set10('USE_SYS_RANDOM_H', false)
471 conf.set10('HAVE_GETRANDOM', have)
474 #####################################################################
476 sed = find_program('sed')
477 awk = find_program('awk')
478 m4 = find_program('m4')
479 stat = find_program('stat')
480 git = find_program('git', required : false)
482 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
483 mkdir_p = 'mkdir -p $DESTDIR/@0@'
484 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
485 splash_bmp = files('test/splash.bmp')
487 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
488 # /usr/sbin, /sbin, and fall back to the default from middle column.
489 progs = [['telinit', '/lib/sysvinit/telinit'],
490 ['quotaon', '/usr/sbin/quotaon' ],
491 ['quotacheck', '/usr/sbin/quotacheck' ],
492 ['kill', '/usr/bin/kill' ],
493 ['kmod', '/usr/bin/kmod' ],
494 ['kexec', '/usr/sbin/kexec' ],
495 ['sulogin', '/usr/sbin/sulogin' ],
496 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
497 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
498 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
499 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
502 path = get_option(prog[0] + '-path')
504 message('Using @1@ for @0@'.format(prog[0], path))
506 exe = find_program(prog[0],
507 '/usr/sbin/' + prog[0],
510 path = exe.found() ? exe.path() : prog[1]
512 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
513 conf.set_quoted(name, path)
514 substs.set(name, path)
517 if run_command('ln', '--relative', '--help').returncode() != 0
518 error('ln does not support --relative')
521 ############################################################
523 gperf = find_program('gperf')
525 gperf_test_format = '''
527 const char * in_word_set(const char *, @0@);
530 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
531 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
532 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
533 if cc.compiles(gperf_test)
534 gperf_len_type = 'size_t'
536 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
537 if cc.compiles(gperf_test)
538 gperf_len_type = 'unsigned'
540 error('unable to determine gperf len type')
543 message('gperf len type is @0@'.format(gperf_len_type))
544 conf.set('GPERF_LEN_TYPE', gperf_len_type,
545 description : 'The type of gperf "len" parameter')
547 ############################################################
549 if not cc.has_header('sys/capability.h')
550 error('POSIX caps headers not found')
552 foreach header : ['linux/btrfs.h',
554 'linux/vm_sockets.h',
556 'valgrind/memcheck.h',
557 'valgrind/valgrind.h',
560 conf.set10('HAVE_' + header.underscorify().to_upper(),
561 cc.has_header(header))
564 ############################################################
566 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
567 conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
568 gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
570 default_hierarchy = get_option('default-hierarchy')
571 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
572 description : 'default cgroup hierarchy as string')
573 if default_hierarchy == 'legacy'
574 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
575 elif default_hierarchy == 'hybrid'
576 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
578 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
581 time_epoch = get_option('time-epoch')
584 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
586 time_epoch = time_epoch.to_int()
587 conf.set('TIME_EPOCH', time_epoch)
589 system_uid_max = get_option('system-uid-max')
590 if system_uid_max == ''
591 system_uid_max = run_command(
593 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
594 '/etc/login.defs').stdout()
596 system_uid_max = system_uid_max.to_int()
597 conf.set('SYSTEM_UID_MAX', system_uid_max)
598 substs.set('systemuidmax', system_uid_max)
599 message('maximum system UID is @0@'.format(system_uid_max))
601 conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
602 conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
604 system_gid_max = get_option('system-gid-max')
605 if system_gid_max == ''
606 system_gid_max = run_command(
608 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
609 '/etc/login.defs').stdout()
611 system_gid_max = system_gid_max.to_int()
612 conf.set('SYSTEM_GID_MAX', system_gid_max)
613 substs.set('systemgidmax', system_gid_max)
614 message('maximum system GID is @0@'.format(system_gid_max))
616 tty_gid = get_option('tty-gid')
617 conf.set('TTY_GID', tty_gid)
618 substs.set('TTY_GID', tty_gid)
620 if get_option('adm-group')
621 m4_defines += ['-DENABLE_ADM_GROUP']
624 if get_option('wheel-group')
625 m4_defines += ['-DENABLE_WHEEL_GROUP']
628 substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
629 substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
631 kill_user_processes = get_option('default-kill-user-processes')
632 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
633 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
635 dns_servers = get_option('dns-servers')
636 conf.set_quoted('DNS_SERVERS', dns_servers)
637 substs.set('DNS_SERVERS', dns_servers)
639 ntp_servers = get_option('ntp-servers')
640 conf.set_quoted('NTP_SERVERS', ntp_servers)
641 substs.set('NTP_SERVERS', ntp_servers)
643 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
645 substs.set('SUSHELL', get_option('debug-shell'))
646 substs.set('DEBUGTTY', get_option('debug-tty'))
648 debug = get_option('debug')
649 enable_debug_hashmap = false
650 enable_debug_mmap_cache = false
652 foreach name : debug.split(',')
654 enable_debug_hashmap = true
655 elif name == 'mmap-cache'
656 enable_debug_mmap_cache = true
658 message('unknown debug option "@0@", ignoring'.format(name))
662 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
663 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
665 #####################################################################
667 threads = dependency('threads')
668 librt = cc.find_library('rt')
669 libm = cc.find_library('m')
670 libdl = cc.find_library('dl')
671 libcrypt = cc.find_library('crypt')
673 libcap = dependency('libcap', required : false)
674 if not libcap.found()
675 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
676 libcap = cc.find_library('cap')
679 libmount = dependency('mount',
682 want_seccomp = get_option('seccomp')
683 if want_seccomp != 'false'
684 libseccomp = dependency('libseccomp',
685 version : '>= 2.3.1',
686 required : want_seccomp == 'true')
687 have = libseccomp.found()
692 conf.set10('HAVE_SECCOMP', have)
693 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
695 want_selinux = get_option('selinux')
696 if want_selinux != 'false'
697 libselinux = dependency('libselinux',
698 version : '>= 2.1.9',
699 required : want_selinux == 'true')
700 have = libselinux.found()
705 conf.set10('HAVE_SELINUX', have)
706 m4_defines += have ? ['-DHAVE_SELINUX'] : []
708 want_apparmor = get_option('apparmor')
709 if want_apparmor != 'false'
710 libapparmor = dependency('libapparmor',
711 required : want_apparmor == 'true')
712 have = libapparmor.found()
717 conf.set10('HAVE_APPARMOR', have)
718 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
720 smack_run_label = get_option('smack-run-label')
721 if smack_run_label != ''
722 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
723 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
726 want_polkit = get_option('polkit')
727 install_polkit = false
728 install_polkit_pkla = false
729 if want_polkit != 'false'
730 install_polkit = true
732 libpolkit = dependency('polkit-gobject-1',
734 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
735 message('Old polkit detected, will install pkla files')
736 install_polkit_pkla = true
739 conf.set10('ENABLE_POLKIT', install_polkit)
741 want_acl = get_option('acl')
742 if want_acl != 'false'
743 libacl = cc.find_library('acl', required : want_acl == 'true')
744 have = libacl.found()
749 conf.set10('HAVE_ACL', have)
750 m4_defines += have ? ['-DHAVE_ACL'] : []
752 want_audit = get_option('audit')
753 if want_audit != 'false'
754 libaudit = dependency('audit', required : want_audit == 'true')
755 have = libaudit.found()
760 conf.set10('HAVE_AUDIT', have)
762 want_blkid = get_option('blkid')
763 if want_blkid != 'false'
764 libblkid = dependency('blkid', required : want_blkid == 'true')
765 have = libblkid.found()
770 conf.set10('HAVE_BLKID', have)
772 want_kmod = get_option('kmod')
773 if want_kmod != 'false'
774 libkmod = dependency('libkmod',
776 required : want_kmod == 'true')
777 have = libkmod.found()
782 conf.set10('HAVE_KMOD', have)
784 want_pam = get_option('pam')
785 if want_pam != 'false'
786 libpam = cc.find_library('pam', required : want_pam == 'true')
787 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
788 have = libpam.found() and libpam_misc.found()
794 conf.set10('HAVE_PAM', have)
795 m4_defines += have ? ['-DHAVE_PAM'] : []
797 want_microhttpd = get_option('microhttpd')
798 if want_microhttpd != 'false'
799 libmicrohttpd = dependency('libmicrohttpd',
800 version : '>= 0.9.33',
801 required : want_microhttpd == 'true')
802 have = libmicrohttpd.found()
807 conf.set10('HAVE_MICROHTTPD', have)
808 m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
810 want_libcryptsetup = get_option('libcryptsetup')
811 if want_libcryptsetup != 'false'
812 libcryptsetup = dependency('libcryptsetup',
813 version : '>= 1.6.0',
814 required : want_libcryptsetup == 'true')
815 have = libcryptsetup.found()
820 conf.set10('HAVE_LIBCRYPTSETUP', have)
822 want_libcurl = get_option('libcurl')
823 if want_libcurl != 'false'
824 libcurl = dependency('libcurl',
825 version : '>= 7.32.0',
826 required : want_libcurl == 'true')
827 have = libcurl.found()
832 conf.set10('HAVE_LIBCURL', have)
833 m4_defines += have ? ['-DHAVE_LIBCURL'] : []
835 want_libidn = get_option('libidn')
836 want_libidn2 = get_option('libidn2')
837 if want_libidn == 'true' and want_libidn2 == 'true'
838 error('libidn and libidn2 cannot be requested simultaneously')
841 if want_libidn != 'false' and want_libidn2 != 'true'
842 libidn = dependency('libidn',
843 required : want_libidn == 'true')
844 have = libidn.found()
849 conf.set10('HAVE_LIBIDN', have)
850 m4_defines += have ? ['-DHAVE_LIBIDN'] : []
851 if not have and want_libidn2 != 'false'
852 # libidn is used for both libidn and libidn2 objects
853 libidn = dependency('libidn2',
854 required : want_libidn2 == 'true')
855 have = libidn.found()
859 conf.set10('HAVE_LIBIDN2', have)
860 m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
862 want_libiptc = get_option('libiptc')
863 if want_libiptc != 'false'
864 libiptc = dependency('libiptc',
865 required : want_libiptc == 'true')
866 have = libiptc.found()
871 conf.set10('HAVE_LIBIPTC', have)
872 m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
874 want_qrencode = get_option('qrencode')
875 if want_qrencode != 'false'
876 libqrencode = dependency('libqrencode',
877 required : want_qrencode == 'true')
878 have = libqrencode.found()
883 conf.set10('HAVE_QRENCODE', have)
885 want_gcrypt = get_option('gcrypt')
886 if want_gcrypt != 'false'
887 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
888 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
889 have = libgcrypt.found() and libgpg_error.found()
894 # link to neither of the libs if one is not found
898 conf.set10('HAVE_GCRYPT', have)
900 want_gnutls = get_option('gnutls')
901 if want_gnutls != 'false'
902 libgnutls = dependency('gnutls',
903 version : '>= 3.1.4',
904 required : want_gnutls == 'true')
905 have = libgnutls.found()
910 conf.set10('HAVE_GNUTLS', have)
912 want_elfutils = get_option('elfutils')
913 if want_elfutils != 'false'
914 libdw = dependency('libdw',
915 required : want_elfutils == 'true')
921 conf.set10('HAVE_ELFUTILS', have)
923 want_zlib = get_option('zlib')
924 if want_zlib != 'false'
925 libz = dependency('zlib',
926 required : want_zlib == 'true')
932 conf.set10('HAVE_ZLIB', have)
934 want_bzip2 = get_option('bzip2')
935 if want_bzip2 != 'false'
936 libbzip2 = cc.find_library('bz2',
937 required : want_bzip2 == 'true')
938 have = libbzip2.found()
943 conf.set10('HAVE_BZIP2', have)
945 want_xz = get_option('xz')
946 if want_xz != 'false'
947 libxz = dependency('liblzma',
948 required : want_xz == 'true')
954 conf.set10('HAVE_XZ', have)
956 want_lz4 = get_option('lz4')
957 if want_lz4 != 'false'
958 liblz4 = dependency('liblz4',
959 required : want_lz4 == 'true')
960 have = liblz4.found()
965 conf.set10('HAVE_LZ4', have)
967 want_xkbcommon = get_option('xkbcommon')
968 if want_xkbcommon != 'false'
969 libxkbcommon = dependency('xkbcommon',
970 version : '>= 0.3.0',
971 required : want_xkbcommon == 'true')
972 have = libxkbcommon.found()
977 conf.set10('HAVE_XKBCOMMON', have)
979 want_glib = get_option('glib')
980 if want_glib != 'false'
981 libglib = dependency('glib-2.0',
982 version : '>= 2.22.0',
983 required : want_glib == 'true')
984 libgobject = dependency('gobject-2.0',
985 version : '>= 2.22.0',
986 required : want_glib == 'true')
987 libgio = dependency('gio-2.0',
988 required : want_glib == 'true')
989 have = libglib.found() and libgobject.found() and libgio.found()
996 conf.set10('HAVE_GLIB', have)
998 want_dbus = get_option('dbus')
999 if want_dbus != 'false'
1000 libdbus = dependency('dbus-1',
1001 version : '>= 1.3.2',
1002 required : want_dbus == 'true')
1003 have = libdbus.found()
1008 conf.set10('HAVE_DBUS', have)
1010 default_dnssec = get_option('default-dnssec')
1011 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1012 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1013 default_dnssec = 'no'
1015 conf.set('DEFAULT_DNSSEC_MODE',
1016 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1017 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1019 want_importd = get_option('importd')
1020 if want_importd != 'false'
1021 have = (conf.get('HAVE_LIBCURL') == 1 and
1022 conf.get('HAVE_ZLIB') == 1 and
1023 conf.get('HAVE_BZIP2') == 1 and
1024 conf.get('HAVE_XZ') == 1 and
1025 conf.get('HAVE_GCRYPT') == 1)
1026 if want_importd == 'true' and not have
1027 error('importd support was requested, but dependencies are not available')
1032 conf.set10('ENABLE_IMPORTD', have)
1034 want_remote = get_option('remote')
1035 if want_remote != 'false'
1036 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1037 conf.get('HAVE_LIBCURL') == 1]
1038 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1039 # it's possible to build one without the other. Complain only if
1040 # support was explictly requested. The auxiliary files like sysusers
1041 # config should be installed when any of the programs are built.
1042 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1043 error('remote support was requested, but dependencies are not available')
1045 have = have_deps[0] or have_deps[1]
1049 conf.set10('ENABLE_REMOTE', have)
1051 foreach term : ['utmp',
1082 have = get_option(term)
1083 name = 'ENABLE_' + term.underscorify().to_upper()
1084 conf.set10(name, have)
1085 m4_defines += have ? ['-D' + name] : []
1088 want_tests = get_option('tests')
1089 install_tests = get_option('install-tests')
1092 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1094 #####################################################################
1096 if get_option('efi')
1097 efi_arch = host_machine.cpu_family()
1099 if efi_arch == 'x86'
1100 EFI_MACHINE_TYPE_NAME = 'ia32'
1101 gnu_efi_arch = 'ia32'
1102 elif efi_arch == 'x86_64'
1103 EFI_MACHINE_TYPE_NAME = 'x64'
1104 gnu_efi_arch = 'x86_64'
1105 elif efi_arch == 'arm'
1106 EFI_MACHINE_TYPE_NAME = 'arm'
1107 gnu_efi_arch = 'arm'
1108 elif efi_arch == 'aarch64'
1109 EFI_MACHINE_TYPE_NAME = 'aa64'
1110 gnu_efi_arch = 'aarch64'
1112 EFI_MACHINE_TYPE_NAME = ''
1117 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1119 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1123 conf.set10('ENABLE_EFI', have)
1125 #####################################################################
1127 config_h = configure_file(
1128 output : 'config.h',
1129 configuration : conf)
1131 includes = include_directories('src/basic',
1141 'src/libsystemd/sd-bus',
1142 'src/libsystemd/sd-device',
1143 'src/libsystemd/sd-hwdb',
1144 'src/libsystemd/sd-id128',
1145 'src/libsystemd/sd-netlink',
1146 'src/libsystemd/sd-network',
1147 'src/libsystemd-network',
1151 add_project_arguments('-include', 'config.h', language : 'c')
1153 gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1154 'src/shared/gcrypt-util.c')
1158 subdir('src/systemd')
1160 subdir('src/libsystemd')
1161 subdir('src/libsystemd-network')
1162 subdir('src/journal')
1165 libjournal_core = static_library(
1167 libjournal_core_sources,
1169 include_directories : includes,
1172 libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1173 libsystemd = shared_library(
1175 libsystemd_internal_sources,
1176 journal_internal_sources,
1177 version : libsystemd_version,
1178 include_directories : includes,
1179 link_args : ['-shared',
1180 '-Wl,--version-script=' + libsystemd_sym_path],
1181 link_with : [libbasic],
1182 dependencies : [threads,
1187 link_depends : libsystemd_sym,
1189 install_dir : rootlibdir)
1191 ############################################################
1193 # binaries that have --help and are intended for use by humans,
1194 # usually, but not always, installed in /bin.
1195 public_programs = []
1197 subdir('src/libudev')
1198 subdir('src/shared')
1201 subdir('src/network')
1203 subdir('src/analyze')
1204 subdir('src/journal-remote')
1205 subdir('src/coredump')
1206 subdir('src/hostname')
1207 subdir('src/import')
1208 subdir('src/kernel-install')
1209 subdir('src/locale')
1210 subdir('src/machine')
1211 subdir('src/nspawn')
1212 subdir('src/resolve')
1213 subdir('src/timedate')
1214 subdir('src/timesync')
1215 subdir('src/vconsole')
1216 subdir('src/sulogin-shell')
1217 subdir('src/boot/efi')
1222 ############################################################
1224 # only static linking apart from libdl, to make sure that the
1225 # module is linked to all libraries that it uses.
1226 test_dlopen = executable(
1229 include_directories : includes,
1230 link_with : [libbasic],
1231 dependencies : [libdl])
1233 foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1234 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1235 ['mymachines', 'ENABLE_MACHINED'],
1236 ['resolve', 'ENABLE_RESOLVE']]
1238 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1242 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1243 version_script_arg = join_paths(meson.current_source_dir(), sym)
1245 nss = shared_library(
1247 'src/nss-@0@/nss-@0@.c'.format(module),
1249 include_directories : includes,
1250 link_args : ['-shared',
1251 '-Wl,--version-script=' + version_script_arg,
1253 link_with : [libsystemd_internal,
1255 dependencies : [threads,
1259 install_dir : rootlibdir)
1261 # We cannot use shared_module because it does not support version suffix.
1262 # Unfortunately shared_library insists on creating the symlink…
1263 meson.add_install_script('sh', '-c',
1264 'rm $DESTDIR@0@/libnss_@1@.so'
1265 .format(rootlibdir, module))
1267 test('dlopen-nss_' + module,
1269 args : [nss.full_path()]) # path to dlopen must include a slash
1273 ############################################################
1275 executable('systemd',
1277 include_directories : includes,
1278 link_with : [libcore,
1280 dependencies : [threads,
1286 install_rpath : rootlibexecdir,
1288 install_dir : rootlibexecdir)
1290 exe = executable('systemd-analyze',
1291 systemd_analyze_sources,
1292 include_directories : includes,
1293 link_with : [libcore,
1295 dependencies : [threads,
1301 install_rpath : rootlibexecdir,
1303 public_programs += [exe]
1305 executable('systemd-journald',
1306 systemd_journald_sources,
1307 include_directories : includes,
1308 link_with : [libjournal_core,
1310 dependencies : [threads,
1314 install_rpath : rootlibexecdir,
1316 install_dir : rootlibexecdir)
1318 exe = executable('systemd-cat',
1319 systemd_cat_sources,
1320 include_directories : includes,
1321 link_with : [libjournal_core,
1323 dependencies : [threads],
1324 install_rpath : rootlibexecdir,
1326 public_programs += [exe]
1328 exe = executable('journalctl',
1330 include_directories : includes,
1331 link_with : [libshared],
1332 dependencies : [threads,
1336 install_rpath : rootlibexecdir,
1338 install_dir : rootbindir)
1339 public_programs += [exe]
1341 executable('systemd-getty-generator',
1342 'src/getty-generator/getty-generator.c',
1343 include_directories : includes,
1344 link_with : [libshared],
1345 install_rpath : rootlibexecdir,
1347 install_dir : systemgeneratordir)
1349 executable('systemd-debug-generator',
1350 'src/debug-generator/debug-generator.c',
1351 include_directories : includes,
1352 link_with : [libshared],
1353 install_rpath : rootlibexecdir,
1355 install_dir : systemgeneratordir)
1357 executable('systemd-fstab-generator',
1358 'src/fstab-generator/fstab-generator.c',
1359 'src/core/mount-setup.c',
1360 include_directories : includes,
1361 link_with : [libshared],
1362 install_rpath : rootlibexecdir,
1364 install_dir : systemgeneratordir)
1366 if conf.get('ENABLE_ENVIRONMENT_D') == 1
1367 executable('30-systemd-environment-d-generator',
1368 'src/environment-d-generator/environment-d-generator.c',
1369 include_directories : includes,
1370 link_with : [libshared],
1371 install_rpath : rootlibexecdir,
1373 install_dir : userenvgeneratordir)
1375 meson.add_install_script(meson_make_symlink,
1376 join_paths(sysconfdir, 'environment'),
1377 join_paths(environmentdir, '99-environment.conf'))
1380 if conf.get('ENABLE_HIBERNATE') == 1
1381 executable('systemd-hibernate-resume-generator',
1382 'src/hibernate-resume/hibernate-resume-generator.c',
1383 include_directories : includes,
1384 link_with : [libshared],
1385 install_rpath : rootlibexecdir,
1387 install_dir : systemgeneratordir)
1389 executable('systemd-hibernate-resume',
1390 'src/hibernate-resume/hibernate-resume.c',
1391 include_directories : includes,
1392 link_with : [libshared],
1393 install_rpath : rootlibexecdir,
1395 install_dir : rootlibexecdir)
1398 if conf.get('HAVE_BLKID') == 1
1399 executable('systemd-gpt-auto-generator',
1400 'src/gpt-auto-generator/gpt-auto-generator.c',
1401 'src/basic/blkid-util.h',
1402 include_directories : includes,
1403 link_with : [libshared],
1404 dependencies : libblkid,
1405 install_rpath : rootlibexecdir,
1407 install_dir : systemgeneratordir)
1409 exe = executable('systemd-dissect',
1410 'src/dissect/dissect.c',
1411 include_directories : includes,
1412 link_with : [libshared],
1413 install_rpath : rootlibexecdir,
1415 install_dir : rootlibexecdir)
1416 public_programs += [exe]
1419 if conf.get('ENABLE_RESOLVE') == 1
1420 executable('systemd-resolved',
1421 systemd_resolved_sources,
1422 gcrypt_util_sources,
1423 include_directories : includes,
1424 link_with : [libshared],
1425 dependencies : [threads,
1430 install_rpath : rootlibexecdir,
1432 install_dir : rootlibexecdir)
1434 exe = executable('systemd-resolve',
1435 systemd_resolve_sources,
1436 gcrypt_util_sources,
1437 include_directories : includes,
1438 link_with : [libshared],
1439 dependencies : [threads,
1444 install_rpath : rootlibexecdir,
1446 public_programs += [exe]
1449 if conf.get('ENABLE_LOGIND') == 1
1450 executable('systemd-logind',
1451 systemd_logind_sources,
1452 include_directories : includes,
1453 link_with : [liblogind_core,
1455 dependencies : [threads,
1457 install_rpath : rootlibexecdir,
1459 install_dir : rootlibexecdir)
1461 exe = executable('loginctl',
1463 include_directories : includes,
1464 link_with : [libshared],
1465 dependencies : [threads,
1468 install_rpath : rootlibexecdir,
1470 install_dir : rootbindir)
1471 public_programs += [exe]
1473 exe = executable('systemd-inhibit',
1474 'src/login/inhibit.c',
1475 include_directories : includes,
1476 link_with : [libshared],
1477 install_rpath : rootlibexecdir,
1479 install_dir : rootbindir)
1480 public_programs += [exe]
1482 if conf.get('HAVE_PAM') == 1
1483 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1484 pam_systemd = shared_library(
1488 include_directories : includes,
1489 link_args : ['-shared',
1490 '-Wl,--version-script=' + version_script_arg],
1491 link_with : [libsystemd_internal,
1493 dependencies : [threads,
1496 link_depends : pam_systemd_sym,
1498 install_dir : pamlibdir)
1500 test('dlopen-pam_systemd',
1502 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1506 if conf.get('HAVE_PAM') == 1
1507 executable('systemd-user-sessions',
1508 'src/user-sessions/user-sessions.c',
1509 include_directories : includes,
1510 link_with : [libshared],
1511 install_rpath : rootlibexecdir,
1513 install_dir : rootlibexecdir)
1516 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1517 exe = executable('bootctl',
1518 'src/boot/bootctl.c',
1519 include_directories : includes,
1520 link_with : [libshared],
1521 dependencies : [libblkid],
1522 install_rpath : rootlibexecdir,
1524 public_programs += [exe]
1527 exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1528 include_directories : includes,
1529 link_with : [libshared],
1530 dependencies : [threads],
1531 install_rpath : rootlibexecdir,
1533 public_programs += [exe]
1535 exe = executable('systemctl', 'src/systemctl/systemctl.c',
1536 include_directories : includes,
1537 link_with : [libshared],
1538 dependencies : [threads,
1543 install_rpath : rootlibexecdir,
1545 install_dir : rootbindir)
1546 public_programs += [exe]
1548 if conf.get('ENABLE_BACKLIGHT') == 1
1549 executable('systemd-backlight',
1550 'src/backlight/backlight.c',
1551 include_directories : includes,
1552 link_with : [libshared],
1553 install_rpath : rootlibexecdir,
1555 install_dir : rootlibexecdir)
1558 if conf.get('ENABLE_RFKILL') == 1
1559 executable('systemd-rfkill',
1560 'src/rfkill/rfkill.c',
1561 include_directories : includes,
1562 link_with : [libshared],
1563 install_rpath : rootlibexecdir,
1565 install_dir : rootlibexecdir)
1568 executable('systemd-system-update-generator',
1569 'src/system-update-generator/system-update-generator.c',
1570 include_directories : includes,
1571 link_with : [libshared],
1572 install_rpath : rootlibexecdir,
1574 install_dir : systemgeneratordir)
1576 if conf.get('HAVE_LIBCRYPTSETUP') == 1
1577 executable('systemd-cryptsetup',
1578 'src/cryptsetup/cryptsetup.c',
1579 include_directories : includes,
1580 link_with : [libshared],
1581 dependencies : [libcryptsetup],
1582 install_rpath : rootlibexecdir,
1584 install_dir : rootlibexecdir)
1586 executable('systemd-cryptsetup-generator',
1587 'src/cryptsetup/cryptsetup-generator.c',
1588 include_directories : includes,
1589 link_with : [libshared],
1590 dependencies : [libcryptsetup],
1591 install_rpath : rootlibexecdir,
1593 install_dir : systemgeneratordir)
1595 executable('systemd-veritysetup',
1596 'src/veritysetup/veritysetup.c',
1597 include_directories : includes,
1598 link_with : [libshared],
1599 dependencies : [libcryptsetup],
1600 install_rpath : rootlibexecdir,
1602 install_dir : rootlibexecdir)
1604 executable('systemd-veritysetup-generator',
1605 'src/veritysetup/veritysetup-generator.c',
1606 include_directories : includes,
1607 link_with : [libshared],
1608 dependencies : [libcryptsetup],
1609 install_rpath : rootlibexecdir,
1611 install_dir : systemgeneratordir)
1614 if conf.get('HAVE_SYSV_COMPAT') == 1
1615 executable('systemd-sysv-generator',
1616 'src/sysv-generator/sysv-generator.c',
1617 include_directories : includes,
1618 link_with : [libshared],
1619 install_rpath : rootlibexecdir,
1621 install_dir : systemgeneratordir)
1623 executable('systemd-rc-local-generator',
1624 'src/rc-local-generator/rc-local-generator.c',
1625 include_directories : includes,
1626 link_with : [libshared],
1627 install_rpath : rootlibexecdir,
1629 install_dir : systemgeneratordir)
1632 if conf.get('ENABLE_HOSTNAMED') == 1
1633 executable('systemd-hostnamed',
1634 'src/hostname/hostnamed.c',
1635 include_directories : includes,
1636 link_with : [libshared],
1637 install_rpath : rootlibexecdir,
1639 install_dir : rootlibexecdir)
1641 exe = executable('hostnamectl',
1642 'src/hostname/hostnamectl.c',
1643 include_directories : includes,
1644 link_with : [libshared],
1645 install_rpath : rootlibexecdir,
1647 public_programs += [exe]
1650 if conf.get('ENABLE_LOCALED') == 1
1651 if conf.get('HAVE_XKBCOMMON') == 1
1652 # logind will load libxkbcommon.so dynamically on its own
1658 executable('systemd-localed',
1659 systemd_localed_sources,
1660 include_directories : includes,
1661 link_with : [libshared],
1662 dependencies : deps,
1663 install_rpath : rootlibexecdir,
1665 install_dir : rootlibexecdir)
1667 exe = executable('localectl',
1669 include_directories : includes,
1670 link_with : [libshared],
1671 install_rpath : rootlibexecdir,
1673 public_programs += [exe]
1676 if conf.get('ENABLE_TIMEDATED') == 1
1677 executable('systemd-timedated',
1678 'src/timedate/timedated.c',
1679 include_directories : includes,
1680 link_with : [libshared],
1681 install_rpath : rootlibexecdir,
1683 install_dir : rootlibexecdir)
1685 exe = executable('timedatectl',
1686 'src/timedate/timedatectl.c',
1687 include_directories : includes,
1688 install_rpath : rootlibexecdir,
1689 link_with : [libshared],
1691 public_programs += [exe]
1694 if conf.get('ENABLE_TIMESYNCD') == 1
1695 executable('systemd-timesyncd',
1696 systemd_timesyncd_sources,
1697 include_directories : includes,
1698 link_with : [libshared],
1699 dependencies : [threads,
1701 install_rpath : rootlibexecdir,
1703 install_dir : rootlibexecdir)
1706 if conf.get('ENABLE_MACHINED') == 1
1707 executable('systemd-machined',
1708 systemd_machined_sources,
1709 include_directories : includes,
1710 link_with : [libmachine_core,
1712 install_rpath : rootlibexecdir,
1714 install_dir : rootlibexecdir)
1716 exe = executable('machinectl',
1717 'src/machine/machinectl.c',
1718 include_directories : includes,
1719 link_with : [libshared],
1720 dependencies : [threads,
1723 install_rpath : rootlibexecdir,
1725 install_dir : rootbindir)
1726 public_programs += [exe]
1729 if conf.get('ENABLE_IMPORTD') == 1
1730 executable('systemd-importd',
1731 systemd_importd_sources,
1732 include_directories : includes,
1733 link_with : [libshared],
1734 dependencies : [threads],
1735 install_rpath : rootlibexecdir,
1737 install_dir : rootlibexecdir)
1739 systemd_pull = executable('systemd-pull',
1740 systemd_pull_sources,
1741 include_directories : includes,
1742 link_with : [libshared],
1743 dependencies : [libcurl,
1748 install_rpath : rootlibexecdir,
1750 install_dir : rootlibexecdir)
1752 systemd_import = executable('systemd-import',
1753 systemd_import_sources,
1754 include_directories : includes,
1755 link_with : [libshared],
1756 dependencies : [libcurl,
1760 install_rpath : rootlibexecdir,
1762 install_dir : rootlibexecdir)
1764 systemd_export = executable('systemd-export',
1765 systemd_export_sources,
1766 include_directories : includes,
1767 link_with : [libshared],
1768 dependencies : [libcurl,
1772 install_rpath : rootlibexecdir,
1774 install_dir : rootlibexecdir)
1775 public_programs += [systemd_pull, systemd_import, systemd_export]
1778 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
1779 exe = executable('systemd-journal-upload',
1780 systemd_journal_upload_sources,
1781 include_directories : includes,
1782 link_with : [libshared],
1783 dependencies : [threads,
1788 install_rpath : rootlibexecdir,
1790 install_dir : rootlibexecdir)
1791 public_programs += [exe]
1794 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
1795 s_j_remote = executable('systemd-journal-remote',
1796 systemd_journal_remote_sources,
1797 include_directories : includes,
1798 link_with : [libshared],
1799 dependencies : [threads,
1804 install_rpath : rootlibexecdir,
1806 install_dir : rootlibexecdir)
1808 s_j_gatewayd = executable('systemd-journal-gatewayd',
1809 systemd_journal_gatewayd_sources,
1810 include_directories : includes,
1811 link_with : [libshared],
1812 dependencies : [threads,
1817 install_rpath : rootlibexecdir,
1819 install_dir : rootlibexecdir)
1820 public_programs += [s_j_remote, s_j_gatewayd]
1823 if conf.get('ENABLE_COREDUMP') == 1
1824 executable('systemd-coredump',
1825 systemd_coredump_sources,
1826 include_directories : includes,
1827 link_with : [libshared],
1828 dependencies : [threads,
1833 install_rpath : rootlibexecdir,
1835 install_dir : rootlibexecdir)
1837 exe = executable('coredumpctl',
1838 coredumpctl_sources,
1839 include_directories : includes,
1840 link_with : [libshared],
1841 dependencies : [threads,
1844 install_rpath : rootlibexecdir,
1846 public_programs += [exe]
1849 if conf.get('ENABLE_BINFMT') == 1
1850 exe = executable('systemd-binfmt',
1851 'src/binfmt/binfmt.c',
1852 include_directories : includes,
1853 link_with : [libshared],
1854 install_rpath : rootlibexecdir,
1856 install_dir : rootlibexecdir)
1857 public_programs += [exe]
1859 meson.add_install_script('sh', '-c',
1860 mkdir_p.format(binfmtdir))
1861 meson.add_install_script('sh', '-c',
1862 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1865 if conf.get('ENABLE_VCONSOLE') == 1
1866 executable('systemd-vconsole-setup',
1867 'src/vconsole/vconsole-setup.c',
1868 include_directories : includes,
1869 link_with : [libshared],
1870 install_rpath : rootlibexecdir,
1872 install_dir : rootlibexecdir)
1875 if conf.get('ENABLE_RANDOMSEED') == 1
1876 executable('systemd-random-seed',
1877 'src/random-seed/random-seed.c',
1878 include_directories : includes,
1879 link_with : [libshared],
1880 install_rpath : rootlibexecdir,
1882 install_dir : rootlibexecdir)
1885 if conf.get('ENABLE_FIRSTBOOT') == 1
1886 executable('systemd-firstboot',
1887 'src/firstboot/firstboot.c',
1888 include_directories : includes,
1889 link_with : [libshared],
1890 dependencies : [libcrypt],
1891 install_rpath : rootlibexecdir,
1893 install_dir : rootbindir)
1896 executable('systemd-remount-fs',
1897 'src/remount-fs/remount-fs.c',
1898 'src/core/mount-setup.c',
1899 'src/core/mount-setup.h',
1900 include_directories : includes,
1901 link_with : [libshared],
1902 install_rpath : rootlibexecdir,
1904 install_dir : rootlibexecdir)
1906 executable('systemd-machine-id-setup',
1907 'src/machine-id-setup/machine-id-setup-main.c',
1908 'src/core/machine-id-setup.c',
1909 'src/core/machine-id-setup.h',
1910 include_directories : includes,
1911 link_with : [libshared],
1912 install_rpath : rootlibexecdir,
1914 install_dir : rootbindir)
1916 executable('systemd-fsck',
1918 include_directories : includes,
1919 link_with : [libshared],
1920 install_rpath : rootlibexecdir,
1922 install_dir : rootlibexecdir)
1924 executable('systemd-sleep',
1925 'src/sleep/sleep.c',
1926 include_directories : includes,
1927 link_with : [libshared],
1928 install_rpath : rootlibexecdir,
1930 install_dir : rootlibexecdir)
1932 exe = executable('systemd-sysctl',
1933 'src/sysctl/sysctl.c',
1934 include_directories : includes,
1935 link_with : [libshared],
1936 install_rpath : rootlibexecdir,
1938 install_dir : rootlibexecdir)
1939 public_programs += [exe]
1941 executable('systemd-ac-power',
1942 'src/ac-power/ac-power.c',
1943 include_directories : includes,
1944 link_with : [libshared],
1945 install_rpath : rootlibexecdir,
1947 install_dir : rootlibexecdir)
1949 exe = executable('systemd-detect-virt',
1950 'src/detect-virt/detect-virt.c',
1951 include_directories : includes,
1952 link_with : [libshared],
1953 install_rpath : rootlibexecdir,
1955 public_programs += [exe]
1957 exe = executable('systemd-delta',
1958 'src/delta/delta.c',
1959 include_directories : includes,
1960 link_with : [libshared],
1961 install_rpath : rootlibexecdir,
1963 public_programs += [exe]
1965 exe = executable('systemd-escape',
1966 'src/escape/escape.c',
1967 include_directories : includes,
1968 link_with : [libshared],
1969 install_rpath : rootlibexecdir,
1971 install_dir : rootbindir)
1972 public_programs += [exe]
1974 exe = executable('systemd-notify',
1975 'src/notify/notify.c',
1976 include_directories : includes,
1977 link_with : [libshared],
1978 install_rpath : rootlibexecdir,
1980 install_dir : rootbindir)
1981 public_programs += [exe]
1983 executable('systemd-volatile-root',
1984 'src/volatile-root/volatile-root.c',
1985 include_directories : includes,
1986 link_with : [libshared],
1987 install_rpath : rootlibexecdir,
1989 install_dir : rootlibexecdir)
1991 executable('systemd-cgroups-agent',
1992 'src/cgroups-agent/cgroups-agent.c',
1993 include_directories : includes,
1994 link_with : [libshared],
1995 install_rpath : rootlibexecdir,
1997 install_dir : rootlibexecdir)
1999 exe = executable('systemd-path',
2001 include_directories : includes,
2002 link_with : [libshared],
2003 install_rpath : rootlibexecdir,
2005 public_programs += [exe]
2007 exe = executable('systemd-ask-password',
2008 'src/ask-password/ask-password.c',
2009 include_directories : includes,
2010 link_with : [libshared],
2011 install_rpath : rootlibexecdir,
2013 install_dir : rootbindir)
2014 public_programs += [exe]
2016 executable('systemd-reply-password',
2017 'src/reply-password/reply-password.c',
2018 include_directories : includes,
2019 link_with : [libshared],
2020 install_rpath : rootlibexecdir,
2022 install_dir : rootlibexecdir)
2024 exe = executable('systemd-tty-ask-password-agent',
2025 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2026 include_directories : includes,
2027 link_with : [libshared],
2028 install_rpath : rootlibexecdir,
2030 install_dir : rootbindir)
2031 public_programs += [exe]
2033 exe = executable('systemd-cgls',
2035 include_directories : includes,
2036 link_with : [libshared],
2037 install_rpath : rootlibexecdir,
2039 public_programs += [exe]
2041 exe = executable('systemd-cgtop',
2042 'src/cgtop/cgtop.c',
2043 include_directories : includes,
2044 link_with : [libshared],
2045 install_rpath : rootlibexecdir,
2047 public_programs += [exe]
2049 executable('systemd-initctl',
2050 'src/initctl/initctl.c',
2051 include_directories : includes,
2052 link_with : [libshared],
2053 install_rpath : rootlibexecdir,
2055 install_dir : rootlibexecdir)
2057 exe = executable('systemd-mount',
2058 'src/mount/mount-tool.c',
2059 include_directories : includes,
2060 link_with : [libshared],
2061 install_rpath : rootlibexecdir,
2063 public_programs += [exe]
2065 meson.add_install_script(meson_make_symlink,
2066 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2068 exe = executable('systemd-run',
2070 include_directories : includes,
2071 link_with : [libshared],
2072 install_rpath : rootlibexecdir,
2074 public_programs += [exe]
2076 exe = executable('systemd-stdio-bridge',
2077 'src/stdio-bridge/stdio-bridge.c',
2078 include_directories : includes,
2079 link_with : [libshared],
2080 install_rpath : rootlibexecdir,
2082 public_programs += [exe]
2084 exe = executable('busctl',
2085 'src/busctl/busctl.c',
2086 'src/busctl/busctl-introspect.c',
2087 'src/busctl/busctl-introspect.h',
2088 include_directories : includes,
2089 link_with : [libshared],
2090 install_rpath : rootlibexecdir,
2092 public_programs += [exe]
2094 if conf.get('ENABLE_SYSUSERS') == 1
2095 exe = executable('systemd-sysusers',
2096 'src/sysusers/sysusers.c',
2097 include_directories : includes,
2098 link_with : [libshared],
2099 install_rpath : rootlibexecdir,
2101 install_dir : rootbindir)
2102 public_programs += [exe]
2105 if conf.get('ENABLE_TMPFILES') == 1
2106 exe = executable('systemd-tmpfiles',
2107 'src/tmpfiles/tmpfiles.c',
2108 include_directories : includes,
2109 link_with : [libshared],
2110 dependencies : [libacl],
2111 install_rpath : rootlibexecdir,
2113 install_dir : rootbindir)
2114 public_programs += [exe]
2117 if conf.get('ENABLE_HWDB') == 1
2118 exe = executable('systemd-hwdb',
2120 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2121 include_directories : includes,
2122 link_with : [libudev_internal],
2123 install_rpath : udev_rpath,
2125 install_dir : rootbindir)
2126 public_programs += [exe]
2129 if conf.get('ENABLE_QUOTACHECK') == 1
2130 executable('systemd-quotacheck',
2131 'src/quotacheck/quotacheck.c',
2132 include_directories : includes,
2133 link_with : [libshared],
2134 install_rpath : rootlibexecdir,
2136 install_dir : rootlibexecdir)
2139 exe = executable('systemd-socket-proxyd',
2140 'src/socket-proxy/socket-proxyd.c',
2141 include_directories : includes,
2142 link_with : [libshared],
2143 dependencies : [threads],
2144 install_rpath : rootlibexecdir,
2146 install_dir : rootlibexecdir)
2147 public_programs += [exe]
2149 exe = executable('systemd-udevd',
2150 systemd_udevd_sources,
2151 include_directories : includes,
2152 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2153 link_with : [libudev_core,
2156 dependencies : [threads,
2161 install_rpath : udev_rpath,
2163 install_dir : rootlibexecdir)
2164 public_programs += [exe]
2166 exe = executable('udevadm',
2168 include_directories : includes,
2169 link_with : [libudev_core,
2172 dependencies : [threads,
2177 install_rpath : udev_rpath,
2179 install_dir : rootbindir)
2180 public_programs += [exe]
2182 executable('systemd-shutdown',
2183 systemd_shutdown_sources,
2184 include_directories : includes,
2185 link_with : [libshared],
2186 install_rpath : rootlibexecdir,
2188 install_dir : rootlibexecdir)
2190 executable('systemd-update-done',
2191 'src/update-done/update-done.c',
2192 include_directories : includes,
2193 link_with : [libshared],
2194 install_rpath : rootlibexecdir,
2196 install_dir : rootlibexecdir)
2198 executable('systemd-update-utmp',
2199 'src/update-utmp/update-utmp.c',
2200 include_directories : includes,
2201 link_with : [libshared],
2202 dependencies : [libaudit],
2203 install_rpath : rootlibexecdir,
2205 install_dir : rootlibexecdir)
2207 if conf.get('HAVE_KMOD') == 1
2208 executable('systemd-modules-load',
2209 'src/modules-load/modules-load.c',
2210 include_directories : includes,
2211 link_with : [libshared],
2212 dependencies : [libkmod],
2213 install_rpath : rootlibexecdir,
2215 install_dir : rootlibexecdir)
2217 meson.add_install_script('sh', '-c',
2218 mkdir_p.format(modulesloaddir))
2219 meson.add_install_script('sh', '-c',
2220 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2223 exe = executable('systemd-nspawn',
2224 systemd_nspawn_sources,
2225 'src/core/mount-setup.c', # FIXME: use a variable?
2226 'src/core/mount-setup.h',
2227 'src/core/loopback-setup.c',
2228 'src/core/loopback-setup.h',
2229 include_directories : [includes, include_directories('src/nspawn')],
2230 link_with : [libshared],
2231 dependencies : [libacl,
2235 install_rpath : rootlibexecdir,
2237 public_programs += [exe]
2239 if conf.get('ENABLE_NETWORKD') == 1
2240 executable('systemd-networkd',
2241 systemd_networkd_sources,
2242 include_directories : includes,
2243 link_with : [libnetworkd_core,
2247 dependencies : [threads],
2248 install_rpath : rootlibexecdir,
2250 install_dir : rootlibexecdir)
2252 executable('systemd-networkd-wait-online',
2253 systemd_networkd_wait_online_sources,
2254 include_directories : includes,
2255 link_with : [libnetworkd_core,
2257 install_rpath : rootlibexecdir,
2259 install_dir : rootlibexecdir)
2261 exe = executable('networkctl',
2263 include_directories : includes,
2264 link_with : [libsystemd_network,
2266 install_rpath : rootlibexecdir,
2268 install_dir : rootbindir)
2269 public_programs += [exe]
2271 ############################################################
2273 foreach tuple : tests
2275 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2276 dependencies = tuple[2]
2277 condition = tuple.length() >= 4 ? tuple[3] : ''
2278 type = tuple.length() >= 5 ? tuple[4] : ''
2279 defs = tuple.length() >= 6 ? tuple[5] : []
2280 incs = tuple.length() >= 7 ? tuple[6] : includes
2283 name = sources[0].split('/')[-1].split('.')[0]
2284 if type.startswith('timeout=')
2285 timeout = type.split('=')[1].to_int()
2289 if condition == '' or conf.get(condition) == 1
2293 include_directories : incs,
2294 link_with : link_with,
2295 dependencies : dependencies,
2297 install_rpath : rootlibexecdir,
2298 install : install_tests,
2299 install_dir : join_paths(testsdir, type))
2302 message('@0@ is a manual test'.format(name))
2303 elif type == 'unsafe' and want_tests != 'unsafe'
2304 message('@0@ is an unsafe test'.format(name))
2311 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2315 test_libsystemd_sym = executable(
2316 'test-libsystemd-sym',
2317 test_libsystemd_sym_c,
2318 include_directories : includes,
2319 link_with : [libsystemd],
2320 install : install_tests,
2321 install_dir : testsdir)
2322 test('test-libsystemd-sym',
2323 test_libsystemd_sym)
2325 test_libudev_sym = executable(
2328 include_directories : includes,
2329 c_args : ['-Wno-deprecated-declarations'],
2330 link_with : [libudev],
2331 install : install_tests,
2332 install_dir : testsdir)
2333 test('test-libudev-sym',
2336 ############################################################
2338 make_directive_index_py = find_program('tools/make-directive-index.py')
2339 make_man_index_py = find_program('tools/make-man-index.py')
2340 xml_helper_py = find_program('tools/xml_helper.py')
2341 hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2345 subdir('sysusers.d')
2346 subdir('tmpfiles.d')
2351 subdir('shell-completion/bash')
2352 subdir('shell-completion/zsh')
2353 subdir('docs/sysvinit')
2354 subdir('docs/var-log')
2356 # FIXME: figure out if the warning is true:
2357 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2358 install_subdir('factory/etc',
2359 install_dir : factorydir)
2362 install_data('xorg/50-systemd-user.sh',
2363 install_dir : xinitrcdir)
2364 install_data('system-preset/90-systemd.preset',
2365 install_dir : systempresetdir)
2366 install_data('modprobe.d/systemd.conf',
2367 install_dir : modprobedir)
2368 install_data('README',
2375 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2376 install_dir : docdir)
2378 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2379 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2381 ############################################################
2383 meson_check_help = find_program('tools/meson-check-help.sh')
2385 foreach exec : public_programs
2386 name = exec.full_path().split('/')[-1]
2387 test('check-help-' + name,
2389 args : [exec.full_path()])
2392 ############################################################
2395 all_files = run_command(
2397 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2400 all_files = files(all_files.stdout().split())
2405 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2409 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2413 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2416 command : [meson_git_contrib_sh])
2420 git_head = run_command(
2422 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2423 'rev-parse', 'HEAD']).stdout().strip()
2424 git_head_short = run_command(
2426 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2427 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2431 command : ['git', 'archive',
2432 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2434 '--prefix', 'systemd-@0@/'.format(git_head),
2438 ############################################################
2441 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2443 'prefix: @0@'.format(prefixdir),
2444 'rootprefix: @0@'.format(rootprefixdir),
2445 'sysconf dir: @0@'.format(sysconfdir),
2446 'includedir: @0@'.format(includedir),
2447 'lib dir: @0@'.format(libdir),
2448 'rootlib dir: @0@'.format(rootlibdir),
2449 'SysV init scripts: @0@'.format(sysvinit_path),
2450 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2451 'PAM modules dir: @0@'.format(pamlibdir),
2452 'PAM configuration dir: @0@'.format(pamconfdir),
2453 'RPM macros dir: @0@'.format(rpmmacrosdir),
2454 'modprobe.d dir: @0@'.format(modprobedir),
2455 'D-Bus policy dir: @0@'.format(dbuspolicydir),
2456 'D-Bus session dir: @0@'.format(dbussessionservicedir),
2457 'D-Bus system dir: @0@'.format(dbussystemservicedir),
2458 'bash completions dir: @0@'.format(bashcompletiondir),
2459 'zsh completions dir: @0@'.format(zshcompletiondir),
2460 'extra start script: @0@'.format(get_option('rc-local')),
2461 'extra stop script: @0@'.format(get_option('halt-local')),
2462 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2463 get_option('debug-tty')),
2464 'TTY GID: @0@'.format(tty_gid),
2465 'maximum system UID: @0@'.format(system_uid_max),
2466 'maximum system GID: @0@'.format(system_gid_max),
2467 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2468 'render group access mode: @0@'.format(get_option('group-render-mode')),
2469 'certificate root: @0@'.format(get_option('certificate-root')),
2470 'support URL: @0@'.format(support_url),
2471 'nobody user name: @0@'.format(get_option('nobody-user')),
2472 'nobody group name: @0@'.format(get_option('nobody-group')),
2473 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2474 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
2476 'default DNSSEC mode: @0@'.format(default_dnssec),
2477 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2478 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2480 alt_dns_servers = '\n '.join(dns_servers.split(' '))
2481 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2483 'default DNS servers: @0@'.format(alt_dns_servers),
2484 'default NTP servers: @0@'.format(alt_ntp_servers)]
2486 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2487 '@@0@'.format(time_epoch)).stdout().strip()
2489 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2492 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2493 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2494 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2496 if conf.get('ENABLE_EFI') == 1
2498 'efi arch: @0@'.format(efi_arch)]
2502 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2503 'EFI CC @0@'.format(efi_cc),
2504 'EFI libdir: @0@'.format(efi_libdir),
2505 'EFI ldsdir: @0@'.format(efi_ldsdir),
2506 'EFI includedir: @0@'.format(efi_incdir)]
2559 ['legacy pkla', install_polkit_pkla],
2561 ['gnu-efi', have_gnu_efi],
2567 ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
2570 ['man pages', want_man],
2571 ['html pages', want_html],
2572 ['man page indices', want_man and have_lxml],
2573 ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
2578 ['adm group', get_option('adm-group')],
2579 ['wheel group', get_option('wheel-group')],
2582 ['debug mmap cache'],
2585 cond = tuple.get(1, '')
2587 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2588 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2589 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
2594 missing += [tuple[0]]
2600 'enabled features: @0@'.format(', '.join(found)),
2602 'disabled features: @0@'.format(', '.join(missing)),
2604 message('\n '.join(status))