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.21.0'
31 libudev_version = '1.6.9'
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 split_usr = get_option('split-usr')
58 conf.set10('HAVE_SPLIT_USR', split_usr)
60 rootprefixdir = get_option('rootprefix')
61 # Unusual rootprefixdir values are used by some distros
62 # (see https://github.com/systemd/systemd/pull/7461).
63 rootprefix_default = get_option('split-usr') ? '/' : '/usr'
64 if rootprefixdir == ''
65 rootprefixdir = rootprefix_default
68 sysvinit_path = get_option('sysvinit-path')
69 sysvrcnd_path = get_option('sysvrcnd-path')
70 have = sysvinit_path != '' and sysvrcnd_path != ''
71 conf.set10('HAVE_SYSV_COMPAT', have,
72 description : 'SysV init scripts and rcN.d links are supported')
73 m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
75 # join_paths ignore the preceding arguments if an absolute component is
76 # encountered, so this should canonicalize various paths when they are
77 # absolute or relative.
78 prefixdir = get_option('prefix')
79 if not prefixdir.startswith('/')
80 error('Prefix is not absolute: "@0@"'.format(prefixdir))
82 bindir = join_paths(prefixdir, get_option('bindir'))
83 libdir = join_paths(prefixdir, get_option('libdir'))
84 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
85 includedir = join_paths(prefixdir, get_option('includedir'))
86 datadir = join_paths(prefixdir, get_option('datadir'))
87 localstatedir = join_paths('/', get_option('localstatedir'))
89 rootbindir = join_paths(rootprefixdir, 'bin')
90 rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
92 rootlibdir = get_option('rootlibdir')
94 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
97 # Dirs of external packages
98 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
99 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
100 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
101 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
102 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
103 varlogdir = join_paths(localstatedir, 'log')
104 xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
105 rpmmacrosdir = get_option('rpmmacrosdir')
106 if rpmmacrosdir != 'no'
107 rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
109 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
112 pkgdatadir = join_paths(datadir, 'systemd')
113 environmentdir = join_paths(prefixdir, 'lib/environment.d')
114 pkgsysconfdir = join_paths(sysconfdir, 'systemd')
115 userunitdir = join_paths(prefixdir, 'lib/systemd/user')
116 userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
117 tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
118 sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
119 sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
120 binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
121 modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
122 networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
123 pkgincludedir = join_paths(includedir, 'systemd')
124 systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
125 usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
126 systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
127 userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
128 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
129 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
130 systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
131 systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
132 udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
133 udevhomedir = udevlibexecdir
134 udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
135 udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
136 catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
137 kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
138 factorydir = join_paths(datadir, 'factory')
139 docdir = join_paths(datadir, 'doc/systemd')
140 bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
141 testsdir = join_paths(prefixdir, 'lib/systemd/tests')
142 systemdstatedir = join_paths(localstatedir, 'lib/systemd')
143 catalogstatedir = join_paths(systemdstatedir, 'catalog')
144 randomseeddir = join_paths(localstatedir, 'lib/systemd')
146 dbuspolicydir = get_option('dbuspolicydir')
147 if dbuspolicydir == ''
148 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
151 dbussessionservicedir = get_option('dbussessionservicedir')
152 if dbussessionservicedir == ''
153 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
156 dbussystemservicedir = get_option('dbussystemservicedir')
157 if dbussystemservicedir == ''
158 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
161 pamlibdir = get_option('pamlibdir')
163 pamlibdir = join_paths(rootlibdir, 'security')
166 pamconfdir = get_option('pamconfdir')
168 pamconfdir = join_paths(sysconfdir, 'pam.d')
171 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
172 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
173 conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
174 conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
175 conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
176 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
177 conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
178 conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
179 conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
180 conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
181 conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
182 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
183 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
184 conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
185 conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
186 conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
187 conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
188 conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
189 conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
190 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
191 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
192 conf.set_quoted('ROOTPREFIX', rootprefixdir)
193 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
194 conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
195 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
196 conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
197 conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
198 conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
199 conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
200 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
201 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
202 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
203 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
204 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
205 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
206 conf.set_quoted('LIBDIR', libdir)
207 conf.set_quoted('ROOTLIBDIR', rootlibdir)
208 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
209 conf.set_quoted('BOOTLIBDIR', bootlibdir)
210 conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
211 conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
212 conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
213 conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
214 conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
215 conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
217 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
218 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
220 substs.set('prefix', prefixdir)
221 substs.set('exec_prefix', prefixdir)
222 substs.set('libdir', libdir)
223 substs.set('rootlibdir', rootlibdir)
224 substs.set('includedir', includedir)
225 substs.set('pkgsysconfdir', pkgsysconfdir)
226 substs.set('bindir', bindir)
227 substs.set('rootbindir', rootbindir)
228 substs.set('rootlibexecdir', rootlibexecdir)
229 substs.set('systemunitdir', systemunitdir)
230 substs.set('userunitdir', userunitdir)
231 substs.set('systempresetdir', systempresetdir)
232 substs.set('userpresetdir', userpresetdir)
233 substs.set('udevhwdbdir', udevhwdbdir)
234 substs.set('udevrulesdir', udevrulesdir)
235 substs.set('udevlibexecdir', udevlibexecdir)
236 substs.set('catalogdir', catalogdir)
237 substs.set('tmpfilesdir', tmpfilesdir)
238 substs.set('sysusersdir', sysusersdir)
239 substs.set('sysctldir', sysctldir)
240 substs.set('binfmtdir', binfmtdir)
241 substs.set('modulesloaddir', modulesloaddir)
242 substs.set('systemgeneratordir', systemgeneratordir)
243 substs.set('usergeneratordir', usergeneratordir)
244 substs.set('systemenvgeneratordir', systemenvgeneratordir)
245 substs.set('userenvgeneratordir', userenvgeneratordir)
246 substs.set('systemshutdowndir', systemshutdowndir)
247 substs.set('systemsleepdir', systemsleepdir)
248 substs.set('VARLOGDIR', varlogdir)
249 substs.set('CERTIFICATEROOT', get_option('certificate-root'))
250 substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
251 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
252 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
253 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
254 substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
255 substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
257 #####################################################################
259 cc = meson.get_compiler('c')
260 pkgconfig = import('pkgconfig')
261 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
263 if get_option('tests') != 'false'
264 cxx = find_program('c++', required : false)
266 # Used only for tests
271 want_ossfuzz = get_option('oss-fuzz')
272 want_libfuzzer = get_option('llvm-fuzz')
273 fuzzer_build = want_ossfuzz or want_libfuzzer
274 if want_ossfuzz and want_libfuzzer
275 error('only one of oss-fuzz and llvm-fuzz can be specified')
278 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
281 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
284 foreach arg : ['-Wextra',
287 '-Wmissing-include-dirs',
288 '-Wold-style-definition',
291 '-Wdeclaration-after-statement',
293 '-Wsuggest-attribute=noreturn',
294 '-Werror=missing-prototypes',
295 '-Werror=implicit-function-declaration',
296 '-Werror=missing-declarations',
297 '-Werror=return-type',
298 '-Werror=incompatible-pointer-types',
300 '-Wstrict-prototypes',
302 '-Wmissing-noreturn',
303 '-Wimplicit-fallthrough=5',
306 '-Wstrict-aliasing=2',
313 '-fdiagnostics-show-option',
314 '-fno-strict-aliasing',
315 '-fvisibility=hidden',
317 '-fstack-protector-strong',
318 '--param=ssp-buffer-size=4',
320 if cc.has_argument(arg)
321 add_project_arguments(arg, language : 'c')
325 # the oss-fuzz fuzzers are not built with -fPIE, so don't
326 # enable it when we are linking against them
328 if cc.has_argument('-fPIE')
329 add_project_arguments('-fPIE', language : 'c')
333 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
334 # arguments, just emits a warnings. So test for the "positive" version instead.
335 foreach arg : ['unused-parameter',
336 'missing-field-initializers',
339 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
341 if cc.has_argument('-W' + arg)
342 add_project_arguments('-Wno-' + arg, language : 'c')
348 #include <inttypes.h>
349 typedef uint64_t usec_t;
350 usec_t now(clockid_t clock);
355 ', name : '-Werror=shadow with local shadowing')
356 add_project_arguments('-Werror=shadow', language : 'c')
359 if cc.get_id() == 'clang'
360 foreach arg : ['-Wno-typedef-redefinition',
361 '-Wno-gnu-variable-sized-type-not-at-end',
363 if cc.has_argument(arg,
364 name : '@0@ is supported'.format(arg))
365 add_project_arguments(arg, language : 'c')
370 link_test_c = files('tools/meson-link-test.c')
372 # --as-needed and --no-undefined are provided by meson by default,
373 # run mesonconf to see what is enabled
374 foreach arg : ['-Wl,-z,relro',
379 have = run_command(check_compilation_sh,
380 cc.cmd_array(), '-x', 'c', arg,
381 '-include', link_test_c).returncode() == 0
382 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
383 if have and (arg != '-pie' or not fuzzer_build)
384 add_project_link_arguments(arg, language : 'c')
388 if get_option('buildtype') != 'debug'
389 foreach arg : ['-ffunction-sections',
391 if cc.has_argument(arg,
392 name : '@0@ is supported'.format(arg))
393 add_project_arguments(arg, language : 'c')
397 foreach arg : ['-Wl,--gc-sections']
398 have = run_command(check_compilation_sh,
399 cc.cmd_array(), '-x', 'c', arg,
400 '-include', link_test_c).returncode() == 0
401 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
403 add_project_link_arguments(arg, language : 'c')
408 cpp = ' '.join(cc.cmd_array()) + ' -E'
410 #####################################################################
411 # compilation result tests
413 conf.set('_GNU_SOURCE', true)
414 conf.set('__SANE_USERSPACE_TYPES__', true)
416 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
417 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
418 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
419 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
420 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
421 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
422 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
426 #include <linux/ethtool.h>
427 #include <linux/fib_rules.h>
429 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
431 foreach decl : ['char16_t',
434 'struct ethtool_link_settings',
435 'struct fib_rule_uid_range',
438 # We get -1 if the size cannot be determined
439 have = cc.sizeof(decl, prefix : decl_headers) > 0
440 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
443 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
444 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
445 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
446 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
447 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
448 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
449 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
450 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
451 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
452 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
453 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
454 # if_tunnel.h is buggy and cannot be included on its own
455 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
456 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
457 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
458 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
459 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
460 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
461 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
462 ['IPVLAN_F_PRIVATE', 'linux/if_link.h'],
463 ['NDA_IFINDEX', 'linux/neighbour.h'],
464 ['IFA_FLAGS', 'linux/if_addr.h'],
465 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
466 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
467 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
469 prefix = decl.length() > 2 ? decl[2] : ''
470 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
471 conf.set10('HAVE_' + decl[0], have)
474 foreach ident : ['secure_getenv', '__secure_getenv']
475 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
479 ['memfd_create', '''#include <sys/mman.h>'''],
480 ['gettid', '''#include <sys/types.h>
481 #include <unistd.h>'''],
482 ['pivot_root', '''#include <stdlib.h>
483 #include <unistd.h>'''], # no known header declares pivot_root
484 ['name_to_handle_at', '''#include <sys/types.h>
485 #include <sys/stat.h>
486 #include <fcntl.h>'''],
487 ['setns', '''#include <sched.h>'''],
488 ['renameat2', '''#include <stdio.h>
489 #include <fcntl.h>'''],
490 ['kcmp', '''#include <linux/kcmp.h>'''],
491 ['keyctl', '''#include <sys/types.h>
492 #include <keyutils.h>'''],
493 ['copy_file_range', '''#include <sys/syscall.h>
494 #include <unistd.h>'''],
495 ['bpf', '''#include <sys/syscall.h>
496 #include <unistd.h>'''],
497 ['explicit_bzero' , '''#include <string.h>'''],
500 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
501 conf.set10('HAVE_' + ident[0].to_upper(), have)
504 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
505 conf.set10('USE_SYS_RANDOM_H', true)
506 conf.set10('HAVE_GETRANDOM', true)
508 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
509 conf.set10('USE_SYS_RANDOM_H', false)
510 conf.set10('HAVE_GETRANDOM', have)
513 #####################################################################
515 sed = find_program('sed')
516 awk = find_program('awk')
517 m4 = find_program('m4')
518 stat = find_program('stat')
519 git = find_program('git', required : false)
521 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
522 mkdir_p = 'mkdir -p $DESTDIR/@0@'
523 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
524 splash_bmp = files('test/splash.bmp')
526 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
527 # /usr/sbin, /sbin, and fall back to the default from middle column.
528 progs = [['quotaon', '/usr/sbin/quotaon' ],
529 ['quotacheck', '/usr/sbin/quotacheck' ],
530 ['kill', '/usr/bin/kill' ],
531 ['kmod', '/usr/bin/kmod' ],
532 ['kexec', '/usr/sbin/kexec' ],
533 ['sulogin', '/usr/sbin/sulogin' ],
534 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
535 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
536 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
537 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
540 path = get_option(prog[0] + '-path')
542 message('Using @1@ for @0@'.format(prog[0], path))
544 exe = find_program(prog[0],
545 '/usr/sbin/' + prog[0],
548 path = exe.found() ? exe.path() : prog[1]
550 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
551 conf.set_quoted(name, path)
552 substs.set(name, path)
555 conf.set_quoted('TELINIT', get_option('telinit-path'))
557 if run_command('ln', '--relative', '--help').returncode() != 0
558 error('ln does not support --relative')
561 ############################################################
563 gperf = find_program('gperf')
565 gperf_test_format = '''
567 const char * in_word_set(const char *, @0@);
570 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
571 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
572 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
573 if cc.compiles(gperf_test)
574 gperf_len_type = 'size_t'
576 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
577 if cc.compiles(gperf_test)
578 gperf_len_type = 'unsigned'
580 error('unable to determine gperf len type')
583 message('gperf len type is @0@'.format(gperf_len_type))
584 conf.set('GPERF_LEN_TYPE', gperf_len_type,
585 description : 'The type of gperf "len" parameter')
587 ############################################################
589 if not cc.has_header('sys/capability.h')
590 error('POSIX caps headers not found')
592 foreach header : ['crypt.h',
595 'linux/vm_sockets.h',
597 'valgrind/memcheck.h',
598 'valgrind/valgrind.h',
601 conf.set10('HAVE_' + header.underscorify().to_upper(),
602 cc.has_header(header))
605 ############################################################
607 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
608 conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
609 gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
611 default_hierarchy = get_option('default-hierarchy')
612 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
613 description : 'default cgroup hierarchy as string')
614 if default_hierarchy == 'legacy'
615 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
616 elif default_hierarchy == 'hybrid'
617 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
619 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
622 time_epoch = get_option('time-epoch')
625 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
627 time_epoch = time_epoch.to_int()
628 conf.set('TIME_EPOCH', time_epoch)
630 system_uid_max = get_option('system-uid-max')
631 if system_uid_max == ''
632 system_uid_max = run_command(
634 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
635 '/etc/login.defs').stdout()
637 system_uid_max = system_uid_max.to_int()
638 conf.set('SYSTEM_UID_MAX', system_uid_max)
639 substs.set('systemuidmax', system_uid_max)
640 message('maximum system UID is @0@'.format(system_uid_max))
642 system_gid_max = get_option('system-gid-max')
643 if system_gid_max == ''
644 system_gid_max = run_command(
646 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
647 '/etc/login.defs').stdout()
649 system_gid_max = system_gid_max.to_int()
650 conf.set('SYSTEM_GID_MAX', system_gid_max)
651 substs.set('systemgidmax', system_gid_max)
652 message('maximum system GID is @0@'.format(system_gid_max))
654 dynamic_uid_min = get_option('dynamic-uid-min').to_int()
655 dynamic_uid_max = get_option('dynamic-uid-max').to_int()
656 conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
657 conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
658 substs.set('dynamicuidmin', dynamic_uid_min)
659 substs.set('dynamicuidmax', dynamic_uid_max)
661 container_uid_base_min = get_option('container-uid-base-min').to_int()
662 container_uid_base_max = get_option('container-uid-base-max').to_int()
663 conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
664 conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
665 substs.set('containeruidbasemin', container_uid_base_min)
666 substs.set('containeruidbasemax', container_uid_base_max)
668 nobody_user = get_option('nobody-user')
669 nobody_group = get_option('nobody-group')
671 getent_result = run_command('getent', 'passwd', '65534')
672 if getent_result.returncode() == 0
673 name = getent_result.stdout().split(':')[0]
674 if name != nobody_user
675 message('WARNING:\n' +
676 ' 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) +
677 ' Your build will result in an user table setup that is incompatible with the local system.')
680 id_result = run_command('id', '-u', nobody_user)
681 if id_result.returncode() == 0
682 id = id_result.stdout().to_int()
684 message('WARNING:\n' +
685 ' 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) +
686 ' Your build will result in an user table setup that is incompatible with the local system.')
690 getent_result = run_command('getent', 'group', '65534')
691 if getent_result.returncode() == 0
692 name = getent_result.stdout().split(':')[0]
693 if name != nobody_group
694 message('WARNING:\n' +
695 ' 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) +
696 ' Your build will result in an group table setup that is incompatible with the local system.')
699 id_result = run_command('id', '-g', nobody_group)
700 if id_result.returncode() == 0
701 id = id_result.stdout().to_int()
703 message('WARNING:\n' +
704 ' 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) +
705 ' Your build will result in an group table setup that is incompatible with the local system.')
708 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
709 message('WARNING:\n' +
710 ' The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
711 ' Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
714 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
715 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
716 substs.set('NOBODY_USER_NAME', nobody_user)
717 substs.set('NOBODY_GROUP_NAME', nobody_group)
719 tty_gid = get_option('tty-gid')
720 conf.set('TTY_GID', tty_gid)
721 substs.set('TTY_GID', tty_gid)
723 # Ensure provided GID argument is numeric, otherwise fallback to default assignment
724 if get_option('users-gid') != ''
725 users_gid = get_option('users-gid').to_int()
729 substs.set('USERS_GID', users_gid)
731 if get_option('adm-group')
732 m4_defines += ['-DENABLE_ADM_GROUP']
735 if get_option('wheel-group')
736 m4_defines += ['-DENABLE_WHEEL_GROUP']
739 substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
740 substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
742 kill_user_processes = get_option('default-kill-user-processes')
743 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
744 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
746 dns_servers = get_option('dns-servers')
747 conf.set_quoted('DNS_SERVERS', dns_servers)
748 substs.set('DNS_SERVERS', dns_servers)
750 ntp_servers = get_option('ntp-servers')
751 conf.set_quoted('NTP_SERVERS', ntp_servers)
752 substs.set('NTP_SERVERS', ntp_servers)
754 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
756 substs.set('SUSHELL', get_option('debug-shell'))
757 substs.set('DEBUGTTY', get_option('debug-tty'))
759 debug = get_option('debug')
760 enable_debug_hashmap = false
761 enable_debug_mmap_cache = false
763 foreach name : debug.split(',')
765 enable_debug_hashmap = true
766 elif name == 'mmap-cache'
767 enable_debug_mmap_cache = true
769 message('unknown debug option "@0@", ignoring'.format(name))
773 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
774 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
776 #####################################################################
778 threads = dependency('threads')
779 librt = cc.find_library('rt')
780 libm = cc.find_library('m')
781 libdl = cc.find_library('dl')
782 libcrypt = cc.find_library('crypt')
784 libcap = dependency('libcap', required : false)
785 if not libcap.found()
786 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
787 libcap = cc.find_library('cap')
790 libmount = dependency('mount',
792 required : not fuzzer_build)
794 want_seccomp = get_option('seccomp')
795 if want_seccomp != 'false' and not fuzzer_build
796 libseccomp = dependency('libseccomp',
797 version : '>= 2.3.1',
798 required : want_seccomp == 'true')
799 have = libseccomp.found()
804 conf.set10('HAVE_SECCOMP', have)
805 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
807 want_selinux = get_option('selinux')
808 if want_selinux != 'false' and not fuzzer_build
809 libselinux = dependency('libselinux',
810 version : '>= 2.1.9',
811 required : want_selinux == 'true')
812 have = libselinux.found()
817 conf.set10('HAVE_SELINUX', have)
818 m4_defines += have ? ['-DHAVE_SELINUX'] : []
820 want_apparmor = get_option('apparmor')
821 if want_apparmor != 'false' and not fuzzer_build
822 libapparmor = dependency('libapparmor',
823 required : want_apparmor == 'true')
824 have = libapparmor.found()
829 conf.set10('HAVE_APPARMOR', have)
830 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
832 smack_run_label = get_option('smack-run-label')
833 if smack_run_label != ''
834 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
835 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
838 want_polkit = get_option('polkit')
839 install_polkit = false
840 install_polkit_pkla = false
841 if want_polkit != 'false' and not fuzzer_build
842 install_polkit = true
844 libpolkit = dependency('polkit-gobject-1',
846 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
847 message('Old polkit detected, will install pkla files')
848 install_polkit_pkla = true
851 conf.set10('ENABLE_POLKIT', install_polkit)
853 want_acl = get_option('acl')
854 if want_acl != 'false' and not fuzzer_build
855 libacl = cc.find_library('acl', required : want_acl == 'true')
856 have = libacl.found()
861 conf.set10('HAVE_ACL', have)
862 m4_defines += have ? ['-DHAVE_ACL'] : []
864 want_audit = get_option('audit')
865 if want_audit != 'false' and not fuzzer_build
866 libaudit = dependency('audit', required : want_audit == 'true')
867 have = libaudit.found()
872 conf.set10('HAVE_AUDIT', have)
874 want_blkid = get_option('blkid')
875 if want_blkid != 'false' and not fuzzer_build
876 libblkid = dependency('blkid', required : want_blkid == 'true')
877 have = libblkid.found()
882 conf.set10('HAVE_BLKID', have)
884 want_kmod = get_option('kmod')
885 if want_kmod != 'false' and not fuzzer_build
886 libkmod = dependency('libkmod',
888 required : want_kmod == 'true')
889 have = libkmod.found()
894 conf.set10('HAVE_KMOD', have)
896 want_pam = get_option('pam')
897 if want_pam != 'false' and not fuzzer_build
898 libpam = cc.find_library('pam', required : want_pam == 'true')
899 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
900 have = libpam.found() and libpam_misc.found()
906 conf.set10('HAVE_PAM', have)
907 m4_defines += have ? ['-DHAVE_PAM'] : []
909 want_microhttpd = get_option('microhttpd')
910 if want_microhttpd != 'false' and not fuzzer_build
911 libmicrohttpd = dependency('libmicrohttpd',
912 version : '>= 0.9.33',
913 required : want_microhttpd == 'true')
914 have = libmicrohttpd.found()
919 conf.set10('HAVE_MICROHTTPD', have)
920 m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
922 want_libcryptsetup = get_option('libcryptsetup')
923 if want_libcryptsetup != 'false' and not fuzzer_build
924 libcryptsetup = dependency('libcryptsetup',
925 version : '>= 1.6.0',
926 required : want_libcryptsetup == 'true')
927 have = libcryptsetup.found()
932 conf.set10('HAVE_LIBCRYPTSETUP', have)
934 want_libcurl = get_option('libcurl')
935 if want_libcurl != 'false' and not fuzzer_build
936 libcurl = dependency('libcurl',
937 version : '>= 7.32.0',
938 required : want_libcurl == 'true')
939 have = libcurl.found()
944 conf.set10('HAVE_LIBCURL', have)
945 m4_defines += have ? ['-DHAVE_LIBCURL'] : []
947 want_libidn = get_option('libidn')
948 want_libidn2 = get_option('libidn2')
949 if want_libidn == 'true' and want_libidn2 == 'true'
950 error('libidn and libidn2 cannot be requested simultaneously')
953 if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
954 libidn = dependency('libidn',
955 required : want_libidn == 'true')
956 have = libidn.found()
961 conf.set10('HAVE_LIBIDN', have)
962 m4_defines += have ? ['-DHAVE_LIBIDN'] : []
963 if not have and want_libidn2 != 'false' and not fuzzer_build
964 # libidn is used for both libidn and libidn2 objects
965 libidn = dependency('libidn2',
966 required : want_libidn2 == 'true')
967 have = libidn.found()
971 conf.set10('HAVE_LIBIDN2', have)
972 m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
974 want_libiptc = get_option('libiptc')
975 if want_libiptc != 'false' and not fuzzer_build
976 libiptc = dependency('libiptc',
977 required : want_libiptc == 'true')
978 have = libiptc.found()
983 conf.set10('HAVE_LIBIPTC', have)
984 m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
986 want_qrencode = get_option('qrencode')
987 if want_qrencode != 'false' and not fuzzer_build
988 libqrencode = dependency('libqrencode',
989 required : want_qrencode == 'true')
990 have = libqrencode.found()
995 conf.set10('HAVE_QRENCODE', have)
997 want_gcrypt = get_option('gcrypt')
998 if want_gcrypt != 'false' and not fuzzer_build
999 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1000 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1001 have = libgcrypt.found() and libgpg_error.found()
1006 # link to neither of the libs if one is not found
1010 conf.set10('HAVE_GCRYPT', have)
1012 want_gnutls = get_option('gnutls')
1013 if want_gnutls != 'false' and not fuzzer_build
1014 libgnutls = dependency('gnutls',
1015 version : '>= 3.1.4',
1016 required : want_gnutls == 'true')
1017 have = libgnutls.found()
1022 conf.set10('HAVE_GNUTLS', have)
1024 want_elfutils = get_option('elfutils')
1025 if want_elfutils != 'false' and not fuzzer_build
1026 libdw = dependency('libdw',
1027 required : want_elfutils == 'true')
1028 have = libdw.found()
1033 conf.set10('HAVE_ELFUTILS', have)
1035 want_zlib = get_option('zlib')
1036 if want_zlib != 'false' and not fuzzer_build
1037 libz = dependency('zlib',
1038 required : want_zlib == 'true')
1044 conf.set10('HAVE_ZLIB', have)
1046 want_bzip2 = get_option('bzip2')
1047 if want_bzip2 != 'false' and not fuzzer_build
1048 libbzip2 = cc.find_library('bz2',
1049 required : want_bzip2 == 'true')
1050 have = libbzip2.found()
1055 conf.set10('HAVE_BZIP2', have)
1057 want_xz = get_option('xz')
1058 if want_xz != 'false' and not fuzzer_build
1059 libxz = dependency('liblzma',
1060 required : want_xz == 'true')
1061 have = libxz.found()
1066 conf.set10('HAVE_XZ', have)
1068 want_lz4 = get_option('lz4')
1069 if want_lz4 != 'false' and not fuzzer_build
1070 liblz4 = dependency('liblz4',
1071 required : want_lz4 == 'true')
1072 have = liblz4.found()
1077 conf.set10('HAVE_LZ4', have)
1079 want_xkbcommon = get_option('xkbcommon')
1080 if want_xkbcommon != 'false' and not fuzzer_build
1081 libxkbcommon = dependency('xkbcommon',
1082 version : '>= 0.3.0',
1083 required : want_xkbcommon == 'true')
1084 have = libxkbcommon.found()
1089 conf.set10('HAVE_XKBCOMMON', have)
1091 want_glib = get_option('glib')
1092 if want_glib != 'false' and not fuzzer_build
1093 libglib = dependency('glib-2.0',
1094 version : '>= 2.22.0',
1095 required : want_glib == 'true')
1096 libgobject = dependency('gobject-2.0',
1097 version : '>= 2.22.0',
1098 required : want_glib == 'true')
1099 libgio = dependency('gio-2.0',
1100 required : want_glib == 'true')
1101 have = libglib.found() and libgobject.found() and libgio.found()
1108 conf.set10('HAVE_GLIB', have)
1110 want_dbus = get_option('dbus')
1111 if want_dbus != 'false' and not fuzzer_build
1112 libdbus = dependency('dbus-1',
1113 version : '>= 1.3.2',
1114 required : want_dbus == 'true')
1115 have = libdbus.found()
1120 conf.set10('HAVE_DBUS', have)
1122 default_dnssec = get_option('default-dnssec')
1124 default_dnssec = 'no'
1126 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1127 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1128 default_dnssec = 'no'
1130 conf.set('DEFAULT_DNSSEC_MODE',
1131 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1132 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1134 want_importd = get_option('importd')
1135 if want_importd != 'false'
1136 have = (conf.get('HAVE_LIBCURL') == 1 and
1137 conf.get('HAVE_ZLIB') == 1 and
1138 conf.get('HAVE_BZIP2') == 1 and
1139 conf.get('HAVE_XZ') == 1 and
1140 conf.get('HAVE_GCRYPT') == 1)
1141 if want_importd == 'true' and not have
1142 error('importd support was requested, but dependencies are not available')
1147 conf.set10('ENABLE_IMPORTD', have)
1149 want_remote = get_option('remote')
1150 if want_remote != 'false'
1151 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1152 conf.get('HAVE_LIBCURL') == 1]
1153 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1154 # it's possible to build one without the other. Complain only if
1155 # support was explictly requested. The auxiliary files like sysusers
1156 # config should be installed when any of the programs are built.
1157 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1158 error('remote support was requested, but dependencies are not available')
1160 have = have_deps[0] or have_deps[1]
1164 conf.set10('ENABLE_REMOTE', have)
1166 foreach term : ['utmp',
1197 have = get_option(term)
1198 name = 'ENABLE_' + term.underscorify().to_upper()
1199 conf.set10(name, have)
1200 m4_defines += have ? ['-D' + name] : []
1203 want_tests = get_option('tests')
1204 install_tests = get_option('install-tests')
1208 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1210 #####################################################################
1212 if get_option('efi')
1213 efi_arch = host_machine.cpu_family()
1215 if efi_arch == 'x86'
1216 EFI_MACHINE_TYPE_NAME = 'ia32'
1217 gnu_efi_arch = 'ia32'
1218 elif efi_arch == 'x86_64'
1219 EFI_MACHINE_TYPE_NAME = 'x64'
1220 gnu_efi_arch = 'x86_64'
1221 elif efi_arch == 'arm'
1222 EFI_MACHINE_TYPE_NAME = 'arm'
1223 gnu_efi_arch = 'arm'
1224 elif efi_arch == 'aarch64'
1225 EFI_MACHINE_TYPE_NAME = 'aa64'
1226 gnu_efi_arch = 'aarch64'
1228 EFI_MACHINE_TYPE_NAME = ''
1233 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1235 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1239 conf.set10('ENABLE_EFI', have)
1241 #####################################################################
1243 config_h = configure_file(
1244 output : 'config.h',
1245 configuration : conf)
1247 includes = include_directories('src/basic',
1257 'src/libsystemd/sd-bus',
1258 'src/libsystemd/sd-device',
1259 'src/libsystemd/sd-hwdb',
1260 'src/libsystemd/sd-id128',
1261 'src/libsystemd/sd-netlink',
1262 'src/libsystemd/sd-network',
1263 'src/libsystemd-network',
1266 add_project_arguments('-include', 'config.h', language : 'c')
1270 subdir('src/systemd')
1272 subdir('src/libsystemd')
1273 subdir('src/libsystemd-network')
1274 subdir('src/journal')
1277 libjournal_core = static_library(
1279 libjournal_core_sources,
1281 include_directories : includes,
1284 libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1285 libsystemd = shared_library(
1287 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
1288 version : libsystemd_version,
1289 include_directories : includes,
1290 link_args : ['-shared',
1291 '-Wl,--version-script=' + libsystemd_sym_path],
1292 link_with : [libbasic,
1294 link_whole : [libsystemd_static,
1296 dependencies : [threads,
1300 link_depends : libsystemd_sym,
1302 install_dir : rootlibdir)
1304 ############################################################
1306 # binaries that have --help and are intended for use by humans,
1307 # usually, but not always, installed in /bin.
1308 public_programs = []
1310 subdir('src/libudev')
1311 subdir('src/shared')
1314 subdir('src/network')
1316 subdir('src/analyze')
1317 subdir('src/journal-remote')
1318 subdir('src/coredump')
1319 subdir('src/hostname')
1320 subdir('src/import')
1321 subdir('src/kernel-install')
1322 subdir('src/locale')
1323 subdir('src/machine')
1324 subdir('src/nspawn')
1325 subdir('src/resolve')
1326 subdir('src/timedate')
1327 subdir('src/timesync')
1328 subdir('src/vconsole')
1329 subdir('src/boot/efi')
1336 ############################################################
1338 # only static linking apart from libdl, to make sure that the
1339 # module is linked to all libraries that it uses.
1340 test_dlopen = executable(
1343 include_directories : includes,
1344 link_with : [libbasic],
1345 dependencies : [libdl])
1347 foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1348 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1349 ['mymachines', 'ENABLE_MACHINED'],
1350 ['resolve', 'ENABLE_RESOLVE']]
1352 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1356 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1357 version_script_arg = join_paths(meson.current_source_dir(), sym)
1359 nss = shared_library(
1361 'src/nss-@0@/nss-@0@.c'.format(module),
1363 include_directories : includes,
1364 # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1365 link_args : ['-Wl,-z,nodelete',
1367 '-Wl,--version-script=' + version_script_arg,
1369 link_with : [libsystemd_static,
1371 dependencies : [threads,
1375 install_dir : rootlibdir)
1377 # We cannot use shared_module because it does not support version suffix.
1378 # Unfortunately shared_library insists on creating the symlink…
1379 meson.add_install_script('sh', '-c',
1380 'rm $DESTDIR@0@/libnss_@1@.so'
1381 .format(rootlibdir, module))
1383 test('dlopen-nss_' + module,
1385 args : [nss.full_path()]) # path to dlopen must include a slash
1389 ############################################################
1391 executable('systemd',
1393 include_directories : includes,
1394 link_with : [libcore,
1396 dependencies : [threads,
1402 install_rpath : rootlibexecdir,
1404 install_dir : rootlibexecdir)
1406 exe = executable('systemd-analyze',
1407 systemd_analyze_sources,
1408 include_directories : includes,
1409 link_with : [libcore,
1411 dependencies : [threads,
1417 install_rpath : rootlibexecdir,
1419 public_programs += [exe]
1421 executable('systemd-journald',
1422 systemd_journald_sources,
1423 include_directories : includes,
1424 link_with : [libjournal_core,
1426 dependencies : [threads,
1430 install_rpath : rootlibexecdir,
1432 install_dir : rootlibexecdir)
1434 exe = executable('systemd-cat',
1435 systemd_cat_sources,
1436 include_directories : includes,
1437 link_with : [libjournal_core,
1439 dependencies : [threads],
1440 install_rpath : rootlibexecdir,
1442 public_programs += [exe]
1444 exe = executable('journalctl',
1446 include_directories : includes,
1447 link_with : [libshared],
1448 dependencies : [threads,
1452 install_rpath : rootlibexecdir,
1454 install_dir : rootbindir)
1455 public_programs += [exe]
1457 executable('systemd-getty-generator',
1458 'src/getty-generator/getty-generator.c',
1459 include_directories : includes,
1460 link_with : [libshared],
1461 install_rpath : rootlibexecdir,
1463 install_dir : systemgeneratordir)
1465 executable('systemd-debug-generator',
1466 'src/debug-generator/debug-generator.c',
1467 include_directories : includes,
1468 link_with : [libshared],
1469 install_rpath : rootlibexecdir,
1471 install_dir : systemgeneratordir)
1473 executable('systemd-fstab-generator',
1474 'src/fstab-generator/fstab-generator.c',
1475 'src/core/mount-setup.c',
1476 include_directories : includes,
1477 link_with : [libshared],
1478 install_rpath : rootlibexecdir,
1480 install_dir : systemgeneratordir)
1482 if conf.get('ENABLE_ENVIRONMENT_D') == 1
1483 executable('30-systemd-environment-d-generator',
1484 'src/environment-d-generator/environment-d-generator.c',
1485 include_directories : includes,
1486 link_with : [libshared],
1487 install_rpath : rootlibexecdir,
1489 install_dir : userenvgeneratordir)
1491 meson.add_install_script(meson_make_symlink,
1492 join_paths(sysconfdir, 'environment'),
1493 join_paths(environmentdir, '99-environment.conf'))
1496 if conf.get('ENABLE_HIBERNATE') == 1
1497 executable('systemd-hibernate-resume-generator',
1498 'src/hibernate-resume/hibernate-resume-generator.c',
1499 include_directories : includes,
1500 link_with : [libshared],
1501 install_rpath : rootlibexecdir,
1503 install_dir : systemgeneratordir)
1505 executable('systemd-hibernate-resume',
1506 'src/hibernate-resume/hibernate-resume.c',
1507 include_directories : includes,
1508 link_with : [libshared],
1509 install_rpath : rootlibexecdir,
1511 install_dir : rootlibexecdir)
1514 if conf.get('HAVE_BLKID') == 1
1515 executable('systemd-gpt-auto-generator',
1516 'src/gpt-auto-generator/gpt-auto-generator.c',
1517 'src/basic/blkid-util.h',
1518 include_directories : includes,
1519 link_with : [libshared],
1520 dependencies : libblkid,
1521 install_rpath : rootlibexecdir,
1523 install_dir : systemgeneratordir)
1525 exe = executable('systemd-dissect',
1526 'src/dissect/dissect.c',
1527 include_directories : includes,
1528 link_with : [libshared],
1529 install_rpath : rootlibexecdir,
1531 install_dir : rootlibexecdir)
1532 public_programs += [exe]
1535 if conf.get('ENABLE_RESOLVE') == 1
1536 executable('systemd-resolved',
1537 systemd_resolved_sources,
1538 include_directories : includes,
1539 link_with : [libshared,
1541 libsystemd_resolve_core],
1542 dependencies : [threads,
1546 install_rpath : rootlibexecdir,
1548 install_dir : rootlibexecdir)
1550 exe = executable('systemd-resolve',
1551 systemd_resolve_sources,
1552 include_directories : includes,
1553 link_with : [libshared,
1555 libsystemd_resolve_core],
1556 dependencies : [threads,
1560 install_rpath : rootlibexecdir,
1562 public_programs += [exe]
1565 if conf.get('ENABLE_LOGIND') == 1
1566 executable('systemd-logind',
1567 systemd_logind_sources,
1568 include_directories : includes,
1569 link_with : [liblogind_core,
1571 dependencies : [threads,
1573 install_rpath : rootlibexecdir,
1575 install_dir : rootlibexecdir)
1577 exe = executable('loginctl',
1579 include_directories : includes,
1580 link_with : [libshared],
1581 dependencies : [threads,
1584 install_rpath : rootlibexecdir,
1586 install_dir : rootbindir)
1587 public_programs += [exe]
1589 exe = executable('systemd-inhibit',
1590 'src/login/inhibit.c',
1591 include_directories : includes,
1592 link_with : [libshared],
1593 install_rpath : rootlibexecdir,
1595 install_dir : rootbindir)
1596 public_programs += [exe]
1598 if conf.get('HAVE_PAM') == 1
1599 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1600 pam_systemd = shared_library(
1604 include_directories : includes,
1605 link_args : ['-shared',
1606 '-Wl,--version-script=' + version_script_arg],
1607 link_with : [libsystemd_static,
1609 dependencies : [threads,
1612 link_depends : pam_systemd_sym,
1614 install_dir : pamlibdir)
1616 test('dlopen-pam_systemd',
1618 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1622 if conf.get('HAVE_PAM') == 1
1623 executable('systemd-user-sessions',
1624 'src/user-sessions/user-sessions.c',
1625 include_directories : includes,
1626 link_with : [libshared],
1627 install_rpath : rootlibexecdir,
1629 install_dir : rootlibexecdir)
1632 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1633 exe = executable('bootctl',
1634 'src/boot/bootctl.c',
1635 include_directories : includes,
1636 link_with : [libshared],
1637 dependencies : [libblkid],
1638 install_rpath : rootlibexecdir,
1640 public_programs += [exe]
1643 exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1644 include_directories : includes,
1645 link_with : [libshared],
1646 dependencies : [threads],
1647 install_rpath : rootlibexecdir,
1649 public_programs += [exe]
1651 exe = executable('systemctl', 'src/systemctl/systemctl.c',
1652 include_directories : includes,
1653 link_with : [libshared],
1654 dependencies : [threads,
1659 install_rpath : rootlibexecdir,
1661 install_dir : rootbindir)
1662 public_programs += [exe]
1664 if conf.get('ENABLE_BACKLIGHT') == 1
1665 executable('systemd-backlight',
1666 'src/backlight/backlight.c',
1667 include_directories : includes,
1668 link_with : [libshared],
1669 install_rpath : rootlibexecdir,
1671 install_dir : rootlibexecdir)
1674 if conf.get('ENABLE_RFKILL') == 1
1675 executable('systemd-rfkill',
1676 'src/rfkill/rfkill.c',
1677 include_directories : includes,
1678 link_with : [libshared],
1679 install_rpath : rootlibexecdir,
1681 install_dir : rootlibexecdir)
1684 executable('systemd-system-update-generator',
1685 'src/system-update-generator/system-update-generator.c',
1686 include_directories : includes,
1687 link_with : [libshared],
1688 install_rpath : rootlibexecdir,
1690 install_dir : systemgeneratordir)
1692 if conf.get('HAVE_LIBCRYPTSETUP') == 1
1693 executable('systemd-cryptsetup',
1694 'src/cryptsetup/cryptsetup.c',
1695 include_directories : includes,
1696 link_with : [libshared],
1697 dependencies : [libcryptsetup],
1698 install_rpath : rootlibexecdir,
1700 install_dir : rootlibexecdir)
1702 executable('systemd-cryptsetup-generator',
1703 'src/cryptsetup/cryptsetup-generator.c',
1704 include_directories : includes,
1705 link_with : [libshared],
1706 dependencies : [libcryptsetup],
1707 install_rpath : rootlibexecdir,
1709 install_dir : systemgeneratordir)
1711 executable('systemd-veritysetup',
1712 'src/veritysetup/veritysetup.c',
1713 include_directories : includes,
1714 link_with : [libshared],
1715 dependencies : [libcryptsetup],
1716 install_rpath : rootlibexecdir,
1718 install_dir : rootlibexecdir)
1720 executable('systemd-veritysetup-generator',
1721 'src/veritysetup/veritysetup-generator.c',
1722 include_directories : includes,
1723 link_with : [libshared],
1724 dependencies : [libcryptsetup],
1725 install_rpath : rootlibexecdir,
1727 install_dir : systemgeneratordir)
1730 if conf.get('HAVE_SYSV_COMPAT') == 1
1731 executable('systemd-sysv-generator',
1732 'src/sysv-generator/sysv-generator.c',
1733 include_directories : includes,
1734 link_with : [libshared],
1735 install_rpath : rootlibexecdir,
1737 install_dir : systemgeneratordir)
1739 executable('systemd-rc-local-generator',
1740 'src/rc-local-generator/rc-local-generator.c',
1741 include_directories : includes,
1742 link_with : [libshared],
1743 install_rpath : rootlibexecdir,
1745 install_dir : systemgeneratordir)
1748 if conf.get('ENABLE_HOSTNAMED') == 1
1749 executable('systemd-hostnamed',
1750 'src/hostname/hostnamed.c',
1751 include_directories : includes,
1752 link_with : [libshared],
1753 install_rpath : rootlibexecdir,
1755 install_dir : rootlibexecdir)
1757 exe = executable('hostnamectl',
1758 'src/hostname/hostnamectl.c',
1759 include_directories : includes,
1760 link_with : [libshared],
1761 install_rpath : rootlibexecdir,
1763 public_programs += [exe]
1766 if conf.get('ENABLE_LOCALED') == 1
1767 if conf.get('HAVE_XKBCOMMON') == 1
1768 # logind will load libxkbcommon.so dynamically on its own
1774 executable('systemd-localed',
1775 systemd_localed_sources,
1776 include_directories : includes,
1777 link_with : [libshared],
1778 dependencies : deps,
1779 install_rpath : rootlibexecdir,
1781 install_dir : rootlibexecdir)
1783 exe = executable('localectl',
1785 include_directories : includes,
1786 link_with : [libshared],
1787 install_rpath : rootlibexecdir,
1789 public_programs += [exe]
1792 if conf.get('ENABLE_TIMEDATED') == 1
1793 executable('systemd-timedated',
1794 'src/timedate/timedated.c',
1795 include_directories : includes,
1796 link_with : [libshared],
1797 install_rpath : rootlibexecdir,
1799 install_dir : rootlibexecdir)
1801 exe = executable('timedatectl',
1802 'src/timedate/timedatectl.c',
1803 include_directories : includes,
1804 install_rpath : rootlibexecdir,
1805 link_with : [libshared],
1807 public_programs += [exe]
1810 if conf.get('ENABLE_TIMESYNCD') == 1
1811 executable('systemd-timesyncd',
1812 systemd_timesyncd_sources,
1813 include_directories : includes,
1814 link_with : [libshared],
1815 dependencies : [threads,
1817 install_rpath : rootlibexecdir,
1819 install_dir : rootlibexecdir)
1822 if conf.get('ENABLE_MACHINED') == 1
1823 executable('systemd-machined',
1824 systemd_machined_sources,
1825 include_directories : includes,
1826 link_with : [libmachine_core,
1828 install_rpath : rootlibexecdir,
1830 install_dir : rootlibexecdir)
1832 exe = executable('machinectl',
1833 'src/machine/machinectl.c',
1834 include_directories : includes,
1835 link_with : [libshared],
1836 dependencies : [threads,
1839 install_rpath : rootlibexecdir,
1841 install_dir : rootbindir)
1842 public_programs += [exe]
1845 if conf.get('ENABLE_IMPORTD') == 1
1846 executable('systemd-importd',
1847 systemd_importd_sources,
1848 include_directories : includes,
1849 link_with : [libshared],
1850 dependencies : [threads],
1851 install_rpath : rootlibexecdir,
1853 install_dir : rootlibexecdir)
1855 systemd_pull = executable('systemd-pull',
1856 systemd_pull_sources,
1857 include_directories : includes,
1858 link_with : [libshared],
1859 dependencies : [libcurl,
1864 install_rpath : rootlibexecdir,
1866 install_dir : rootlibexecdir)
1868 systemd_import = executable('systemd-import',
1869 systemd_import_sources,
1870 include_directories : includes,
1871 link_with : [libshared],
1872 dependencies : [libcurl,
1876 install_rpath : rootlibexecdir,
1878 install_dir : rootlibexecdir)
1880 systemd_export = executable('systemd-export',
1881 systemd_export_sources,
1882 include_directories : includes,
1883 link_with : [libshared],
1884 dependencies : [libcurl,
1888 install_rpath : rootlibexecdir,
1890 install_dir : rootlibexecdir)
1891 public_programs += [systemd_pull, systemd_import, systemd_export]
1894 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
1895 exe = executable('systemd-journal-upload',
1896 systemd_journal_upload_sources,
1897 include_directories : includes,
1898 link_with : [libshared],
1899 dependencies : [threads,
1904 install_rpath : rootlibexecdir,
1906 install_dir : rootlibexecdir)
1907 public_programs += [exe]
1910 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
1911 s_j_remote = executable('systemd-journal-remote',
1912 systemd_journal_remote_sources,
1913 include_directories : includes,
1914 link_with : [libshared],
1915 dependencies : [threads,
1920 install_rpath : rootlibexecdir,
1922 install_dir : rootlibexecdir)
1924 s_j_gatewayd = executable('systemd-journal-gatewayd',
1925 systemd_journal_gatewayd_sources,
1926 include_directories : includes,
1927 link_with : [libshared],
1928 dependencies : [threads,
1933 install_rpath : rootlibexecdir,
1935 install_dir : rootlibexecdir)
1936 public_programs += [s_j_remote, s_j_gatewayd]
1939 if conf.get('ENABLE_COREDUMP') == 1
1940 executable('systemd-coredump',
1941 systemd_coredump_sources,
1942 include_directories : includes,
1943 link_with : [libshared],
1944 dependencies : [threads,
1949 install_rpath : rootlibexecdir,
1951 install_dir : rootlibexecdir)
1953 exe = executable('coredumpctl',
1954 coredumpctl_sources,
1955 include_directories : includes,
1956 link_with : [libshared],
1957 dependencies : [threads,
1960 install_rpath : rootlibexecdir,
1962 public_programs += [exe]
1965 if conf.get('ENABLE_BINFMT') == 1
1966 exe = executable('systemd-binfmt',
1967 'src/binfmt/binfmt.c',
1968 include_directories : includes,
1969 link_with : [libshared],
1970 install_rpath : rootlibexecdir,
1972 install_dir : rootlibexecdir)
1973 public_programs += [exe]
1975 meson.add_install_script('sh', '-c',
1976 mkdir_p.format(binfmtdir))
1977 meson.add_install_script('sh', '-c',
1978 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1981 if conf.get('ENABLE_VCONSOLE') == 1
1982 executable('systemd-vconsole-setup',
1983 'src/vconsole/vconsole-setup.c',
1984 include_directories : includes,
1985 link_with : [libshared],
1986 install_rpath : rootlibexecdir,
1988 install_dir : rootlibexecdir)
1991 if conf.get('ENABLE_RANDOMSEED') == 1
1992 executable('systemd-random-seed',
1993 'src/random-seed/random-seed.c',
1994 include_directories : includes,
1995 link_with : [libshared],
1996 install_rpath : rootlibexecdir,
1998 install_dir : rootlibexecdir)
2001 if conf.get('ENABLE_FIRSTBOOT') == 1
2002 executable('systemd-firstboot',
2003 'src/firstboot/firstboot.c',
2004 include_directories : includes,
2005 link_with : [libshared],
2006 dependencies : [libcrypt],
2007 install_rpath : rootlibexecdir,
2009 install_dir : rootbindir)
2012 executable('systemd-remount-fs',
2013 'src/remount-fs/remount-fs.c',
2014 'src/core/mount-setup.c',
2015 'src/core/mount-setup.h',
2016 include_directories : includes,
2017 link_with : [libshared],
2018 install_rpath : rootlibexecdir,
2020 install_dir : rootlibexecdir)
2022 executable('systemd-machine-id-setup',
2023 'src/machine-id-setup/machine-id-setup-main.c',
2024 'src/core/machine-id-setup.c',
2025 'src/core/machine-id-setup.h',
2026 include_directories : includes,
2027 link_with : [libshared],
2028 install_rpath : rootlibexecdir,
2030 install_dir : rootbindir)
2032 executable('systemd-fsck',
2034 include_directories : includes,
2035 link_with : [libshared],
2036 install_rpath : rootlibexecdir,
2038 install_dir : rootlibexecdir)
2040 executable('systemd-growfs',
2041 'src/partition/growfs.c',
2042 include_directories : includes,
2043 link_with : [libshared],
2044 dependencies : [libcryptsetup],
2045 install_rpath : rootlibexecdir,
2047 install_dir : rootlibexecdir)
2049 executable('systemd-makefs',
2050 'src/partition/makefs.c',
2051 include_directories : includes,
2052 link_with : [libshared],
2053 install_rpath : rootlibexecdir,
2055 install_dir : rootlibexecdir)
2057 executable('systemd-sleep',
2058 'src/sleep/sleep.c',
2059 include_directories : includes,
2060 link_with : [libshared],
2061 install_rpath : rootlibexecdir,
2063 install_dir : rootlibexecdir)
2065 exe = executable('systemd-sysctl',
2066 'src/sysctl/sysctl.c',
2067 include_directories : includes,
2068 link_with : [libshared],
2069 install_rpath : rootlibexecdir,
2071 install_dir : rootlibexecdir)
2072 public_programs += [exe]
2074 executable('systemd-ac-power',
2075 'src/ac-power/ac-power.c',
2076 include_directories : includes,
2077 link_with : [libshared],
2078 install_rpath : rootlibexecdir,
2080 install_dir : rootlibexecdir)
2082 exe = executable('systemd-detect-virt',
2083 'src/detect-virt/detect-virt.c',
2084 include_directories : includes,
2085 link_with : [libshared],
2086 install_rpath : rootlibexecdir,
2088 public_programs += [exe]
2090 exe = executable('systemd-delta',
2091 'src/delta/delta.c',
2092 include_directories : includes,
2093 link_with : [libshared],
2094 install_rpath : rootlibexecdir,
2096 public_programs += [exe]
2098 exe = executable('systemd-escape',
2099 'src/escape/escape.c',
2100 include_directories : includes,
2101 link_with : [libshared],
2102 install_rpath : rootlibexecdir,
2104 install_dir : rootbindir)
2105 public_programs += [exe]
2107 exe = executable('systemd-notify',
2108 'src/notify/notify.c',
2109 include_directories : includes,
2110 link_with : [libshared],
2111 install_rpath : rootlibexecdir,
2113 install_dir : rootbindir)
2114 public_programs += [exe]
2116 executable('systemd-volatile-root',
2117 'src/volatile-root/volatile-root.c',
2118 include_directories : includes,
2119 link_with : [libshared],
2120 install_rpath : rootlibexecdir,
2122 install_dir : rootlibexecdir)
2124 executable('systemd-cgroups-agent',
2125 'src/cgroups-agent/cgroups-agent.c',
2126 include_directories : includes,
2127 link_with : [libshared],
2128 install_rpath : rootlibexecdir,
2130 install_dir : rootlibexecdir)
2132 exe = executable('systemd-path',
2134 include_directories : includes,
2135 link_with : [libshared],
2136 install_rpath : rootlibexecdir,
2138 public_programs += [exe]
2140 exe = executable('systemd-ask-password',
2141 'src/ask-password/ask-password.c',
2142 include_directories : includes,
2143 link_with : [libshared],
2144 install_rpath : rootlibexecdir,
2146 install_dir : rootbindir)
2147 public_programs += [exe]
2149 executable('systemd-reply-password',
2150 'src/reply-password/reply-password.c',
2151 include_directories : includes,
2152 link_with : [libshared],
2153 install_rpath : rootlibexecdir,
2155 install_dir : rootlibexecdir)
2157 exe = executable('systemd-tty-ask-password-agent',
2158 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2159 include_directories : includes,
2160 link_with : [libshared],
2161 install_rpath : rootlibexecdir,
2163 install_dir : rootbindir)
2164 public_programs += [exe]
2166 exe = executable('systemd-cgls',
2168 include_directories : includes,
2169 link_with : [libshared],
2170 install_rpath : rootlibexecdir,
2172 public_programs += [exe]
2174 exe = executable('systemd-cgtop',
2175 'src/cgtop/cgtop.c',
2176 include_directories : includes,
2177 link_with : [libshared],
2178 install_rpath : rootlibexecdir,
2180 public_programs += [exe]
2182 executable('systemd-initctl',
2183 'src/initctl/initctl.c',
2184 include_directories : includes,
2185 link_with : [libshared],
2186 install_rpath : rootlibexecdir,
2188 install_dir : rootlibexecdir)
2190 exe = executable('systemd-mount',
2191 'src/mount/mount-tool.c',
2192 include_directories : includes,
2193 link_with : [libshared],
2194 install_rpath : rootlibexecdir,
2196 public_programs += [exe]
2198 meson.add_install_script(meson_make_symlink,
2199 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2201 exe = executable('systemd-run',
2203 include_directories : includes,
2204 link_with : [libshared],
2205 install_rpath : rootlibexecdir,
2207 public_programs += [exe]
2209 exe = executable('systemd-stdio-bridge',
2210 'src/stdio-bridge/stdio-bridge.c',
2211 include_directories : includes,
2212 link_with : [libshared],
2213 install_rpath : rootlibexecdir,
2215 public_programs += [exe]
2217 exe = executable('busctl',
2218 'src/busctl/busctl.c',
2219 'src/busctl/busctl-introspect.c',
2220 'src/busctl/busctl-introspect.h',
2221 include_directories : includes,
2222 link_with : [libshared],
2223 install_rpath : rootlibexecdir,
2225 public_programs += [exe]
2227 if conf.get('ENABLE_SYSUSERS') == 1
2228 exe = executable('systemd-sysusers',
2229 'src/sysusers/sysusers.c',
2230 include_directories : includes,
2231 link_with : [libshared],
2232 install_rpath : rootlibexecdir,
2234 install_dir : rootbindir)
2235 public_programs += [exe]
2238 if conf.get('ENABLE_TMPFILES') == 1
2239 exe = executable('systemd-tmpfiles',
2240 'src/tmpfiles/tmpfiles.c',
2241 include_directories : includes,
2242 link_with : [libshared],
2243 dependencies : [libacl],
2244 install_rpath : rootlibexecdir,
2246 install_dir : rootbindir)
2247 public_programs += [exe]
2249 test('test-systemd-tmpfiles',
2250 test_systemd_tmpfiles_py,
2251 args : exe.full_path())
2252 # https://github.com/mesonbuild/meson/issues/2681
2255 if conf.get('ENABLE_HWDB') == 1
2256 exe = executable('systemd-hwdb',
2258 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2259 include_directories : includes,
2260 link_with : [libudev_static],
2261 install_rpath : udev_rpath,
2263 install_dir : rootbindir)
2264 public_programs += [exe]
2267 if conf.get('ENABLE_QUOTACHECK') == 1
2268 executable('systemd-quotacheck',
2269 'src/quotacheck/quotacheck.c',
2270 include_directories : includes,
2271 link_with : [libshared],
2272 install_rpath : rootlibexecdir,
2274 install_dir : rootlibexecdir)
2277 exe = executable('systemd-socket-proxyd',
2278 'src/socket-proxy/socket-proxyd.c',
2279 include_directories : includes,
2280 link_with : [libshared],
2281 dependencies : [threads],
2282 install_rpath : rootlibexecdir,
2284 install_dir : rootlibexecdir)
2285 public_programs += [exe]
2287 exe = executable('systemd-udevd',
2288 systemd_udevd_sources,
2289 include_directories : includes,
2290 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2291 link_with : [libudev_core,
2294 dependencies : [threads,
2299 install_rpath : udev_rpath,
2301 install_dir : rootlibexecdir)
2302 public_programs += [exe]
2304 exe = executable('udevadm',
2306 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2307 include_directories : includes,
2308 link_with : [libudev_core,
2311 dependencies : [threads,
2316 install_rpath : udev_rpath,
2318 install_dir : rootbindir)
2319 public_programs += [exe]
2321 executable('systemd-shutdown',
2322 systemd_shutdown_sources,
2323 include_directories : includes,
2324 link_with : [libshared],
2325 install_rpath : rootlibexecdir,
2327 install_dir : rootlibexecdir)
2329 executable('systemd-update-done',
2330 'src/update-done/update-done.c',
2331 include_directories : includes,
2332 link_with : [libshared],
2333 install_rpath : rootlibexecdir,
2335 install_dir : rootlibexecdir)
2337 executable('systemd-update-utmp',
2338 'src/update-utmp/update-utmp.c',
2339 include_directories : includes,
2340 link_with : [libshared],
2341 dependencies : [libaudit],
2342 install_rpath : rootlibexecdir,
2344 install_dir : rootlibexecdir)
2346 if conf.get('HAVE_KMOD') == 1
2347 executable('systemd-modules-load',
2348 'src/modules-load/modules-load.c',
2349 include_directories : includes,
2350 link_with : [libshared],
2351 dependencies : [libkmod],
2352 install_rpath : rootlibexecdir,
2354 install_dir : rootlibexecdir)
2356 meson.add_install_script('sh', '-c',
2357 mkdir_p.format(modulesloaddir))
2358 meson.add_install_script('sh', '-c',
2359 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2362 exe = executable('systemd-nspawn',
2363 systemd_nspawn_sources,
2364 'src/core/mount-setup.c', # FIXME: use a variable?
2365 'src/core/mount-setup.h',
2366 'src/core/loopback-setup.c',
2367 'src/core/loopback-setup.h',
2368 include_directories : [includes, include_directories('src/nspawn')],
2369 link_with : [libshared],
2370 dependencies : [libacl,
2374 install_rpath : rootlibexecdir,
2376 public_programs += [exe]
2378 if conf.get('ENABLE_NETWORKD') == 1
2379 executable('systemd-networkd',
2380 systemd_networkd_sources,
2381 include_directories : includes,
2382 link_with : [libnetworkd_core,
2386 dependencies : [threads],
2387 install_rpath : rootlibexecdir,
2389 install_dir : rootlibexecdir)
2391 executable('systemd-networkd-wait-online',
2392 systemd_networkd_wait_online_sources,
2393 include_directories : includes,
2394 link_with : [libnetworkd_core,
2396 install_rpath : rootlibexecdir,
2398 install_dir : rootlibexecdir)
2400 exe = executable('networkctl',
2402 include_directories : includes,
2403 link_with : [libsystemd_network,
2405 install_rpath : rootlibexecdir,
2407 install_dir : rootbindir)
2408 public_programs += [exe]
2411 executable('systemd-sulogin-shell',
2412 ['src/sulogin-shell/sulogin-shell.c'],
2413 include_directories : includes,
2414 link_with : [libshared],
2415 install_rpath : rootlibexecdir,
2417 install_dir : rootlibexecdir)
2419 ############################################################
2421 foreach tuple : tests
2423 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2424 dependencies = tuple[2]
2425 condition = tuple.length() >= 4 ? tuple[3] : ''
2426 type = tuple.length() >= 5 ? tuple[4] : ''
2427 defs = tuple.length() >= 6 ? tuple[5] : []
2428 incs = tuple.length() >= 7 ? tuple[6] : includes
2431 name = sources[0].split('/')[-1].split('.')[0]
2432 if type.startswith('timeout=')
2433 timeout = type.split('=')[1].to_int()
2436 if want_tests == 'false'
2437 message('Not compiling @0@ because tests is set to false'.format(name))
2438 elif condition == '' or conf.get(condition) == 1
2442 include_directories : incs,
2443 link_with : link_with,
2444 dependencies : dependencies,
2446 install_rpath : rootlibexecdir,
2447 install : install_tests,
2448 install_dir : join_paths(testsdir, type))
2451 message('@0@ is a manual test'.format(name))
2452 elif type == 'unsafe' and want_tests != 'unsafe'
2453 message('@0@ is an unsafe test'.format(name))
2460 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2464 test_libsystemd_sym = executable(
2465 'test-libsystemd-sym',
2466 test_libsystemd_sym_c,
2467 include_directories : includes,
2468 link_with : [libsystemd],
2469 install : install_tests,
2470 install_dir : testsdir)
2471 test('test-libsystemd-sym',
2472 test_libsystemd_sym)
2474 test_libudev_sym = executable(
2477 include_directories : includes,
2478 c_args : ['-Wno-deprecated-declarations'],
2479 link_with : [libudev],
2480 install : install_tests,
2481 install_dir : testsdir)
2482 test('test-libudev-sym',
2485 ############################################################
2489 foreach tuple : fuzzers
2491 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2492 dependencies = tuple[2]
2493 defs = tuple.length() >= 4 ? tuple[3] : []
2494 incs = tuple.length() >= 5 ? tuple[4] : includes
2497 dependencies += fuzzing_engine
2499 sources += 'src/fuzz/fuzz-main.c'
2502 name = sources[0].split('/')[-1].split('.')[0]
2504 fuzzer_exes += executable(
2507 include_directories : [incs, include_directories('src/fuzz')],
2508 link_with : link_with,
2509 dependencies : dependencies,
2514 run_target('fuzzers',
2515 depends : fuzzer_exes,
2518 ############################################################
2520 make_directive_index_py = find_program('tools/make-directive-index.py')
2521 make_man_index_py = find_program('tools/make-man-index.py')
2522 xml_helper_py = find_program('tools/xml_helper.py')
2523 hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2527 subdir('sysusers.d')
2528 subdir('tmpfiles.d')
2533 subdir('shell-completion/bash')
2534 subdir('shell-completion/zsh')
2535 subdir('docs/sysvinit')
2536 subdir('docs/var-log')
2538 # FIXME: figure out if the warning is true:
2539 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2540 install_subdir('factory/etc',
2541 install_dir : factorydir)
2544 install_data('xorg/50-systemd-user.sh',
2545 install_dir : xinitrcdir)
2546 install_data('modprobe.d/systemd.conf',
2547 install_dir : modprobedir)
2548 install_data('README',
2555 'TRANSIENT-SETTINGS.md',
2557 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2558 install_dir : docdir)
2560 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2561 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2563 ############################################################
2565 meson_check_help = find_program('tools/meson-check-help.sh')
2567 foreach exec : public_programs
2568 name = exec.full_path().split('/')[-1]
2569 test('check-help-' + name,
2571 args : [exec.full_path()])
2574 ############################################################
2577 all_files = run_command(
2579 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2582 all_files = files(all_files.stdout().split())
2587 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2591 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2595 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2598 command : [meson_git_contrib_sh])
2602 git_head = run_command(
2604 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2605 'rev-parse', 'HEAD']).stdout().strip()
2606 git_head_short = run_command(
2608 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2609 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2613 command : ['git', 'archive',
2614 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2616 '--prefix', 'systemd-@0@/'.format(git_head),
2620 ############################################################
2622 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
2625 depends : [man, libsystemd, libudev],
2626 command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
2628 ############################################################
2631 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2633 'prefix directory: @0@'.format(prefixdir),
2634 'rootprefix directory: @0@'.format(rootprefixdir),
2635 'sysconf directory: @0@'.format(sysconfdir),
2636 'include directory: @0@'.format(includedir),
2637 'lib directory: @0@'.format(libdir),
2638 'rootlib directory: @0@'.format(rootlibdir),
2639 'SysV init scripts: @0@'.format(sysvinit_path),
2640 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2641 'PAM modules directory: @0@'.format(pamlibdir),
2642 'PAM configuration directory: @0@'.format(pamconfdir),
2643 'RPM macros directory: @0@'.format(rpmmacrosdir),
2644 'modprobe.d directory: @0@'.format(modprobedir),
2645 'D-Bus policy directory: @0@'.format(dbuspolicydir),
2646 'D-Bus session directory: @0@'.format(dbussessionservicedir),
2647 'D-Bus system directory: @0@'.format(dbussystemservicedir),
2648 'bash completions directory: @0@'.format(bashcompletiondir),
2649 'zsh completions directory: @0@'.format(zshcompletiondir),
2650 'extra start script: @0@'.format(get_option('rc-local')),
2651 'extra stop script: @0@'.format(get_option('halt-local')),
2652 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2653 get_option('debug-tty')),
2654 'TTY GID: @0@'.format(tty_gid),
2655 'users GID: @0@'.format(users_gid),
2656 'maximum system UID: @0@'.format(system_uid_max),
2657 'maximum system GID: @0@'.format(system_gid_max),
2658 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
2659 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
2660 'minimum container UID base: @0@'.format(container_uid_base_min),
2661 'maximum container UID base: @0@'.format(container_uid_base_max),
2662 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2663 'render group access mode: @0@'.format(get_option('group-render-mode')),
2664 'certificate root directory: @0@'.format(get_option('certificate-root')),
2665 'support URL: @0@'.format(support_url),
2666 'nobody user name: @0@'.format(nobody_user),
2667 'nobody group name: @0@'.format(nobody_group),
2668 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2669 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
2671 'default DNSSEC mode: @0@'.format(default_dnssec),
2672 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2673 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2675 alt_dns_servers = '\n '.join(dns_servers.split(' '))
2676 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2678 'default DNS servers: @0@'.format(alt_dns_servers),
2679 'default NTP servers: @0@'.format(alt_ntp_servers)]
2681 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2682 '@@0@'.format(time_epoch)).stdout().strip()
2684 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2687 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2688 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2689 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2691 if conf.get('ENABLE_EFI') == 1
2693 'efi arch: @0@'.format(efi_arch)]
2697 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2698 'EFI CC @0@'.format(efi_cc),
2699 'EFI lib directory: @0@'.format(efi_libdir),
2700 'EFI lds directory: @0@'.format(efi_ldsdir),
2701 'EFI include directory: @0@'.format(efi_incdir)]
2754 ['legacy pkla', install_polkit_pkla],
2756 ['gnu-efi', have_gnu_efi],
2762 ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
2765 ['man pages', want_man],
2766 ['html pages', want_html],
2767 ['man page indices', want_man and have_lxml],
2768 ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
2773 ['adm group', get_option('adm-group')],
2774 ['wheel group', get_option('wheel-group')],
2777 ['debug mmap cache'],
2780 cond = tuple.get(1, '')
2782 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2783 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2784 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
2789 missing += [tuple[0]]
2795 'enabled features: @0@'.format(', '.join(found)),
2797 'disabled features: @0@'.format(', '.join(missing)),
2799 message('\n '.join(status))
2801 if rootprefixdir != rootprefix_default
2802 message('WARNING:\n' +
2803 ' Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
2804 ' systemd used fixed names for unit file directories and other paths, so anything\n' +
2805 ' except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))