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 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 != '' or 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_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
187 conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
188 conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
189 conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
190 conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
191 conf.set_quoted('ROOTPREFIX', rootprefixdir)
192 conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
193 conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
194 conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
195 conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
196 conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
197 conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
198 conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
199 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
200 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
201 conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
202 conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
203 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
204 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
205 conf.set_quoted('LIBDIR', libdir)
206 conf.set_quoted('ROOTLIBDIR', rootlibdir)
207 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
208 conf.set_quoted('BOOTLIBDIR', bootlibdir)
209 conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
210 conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
211 conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
212 conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
213 conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
214 conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
216 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
217 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
219 substs.set('prefix', prefixdir)
220 substs.set('exec_prefix', prefixdir)
221 substs.set('libdir', libdir)
222 substs.set('rootlibdir', rootlibdir)
223 substs.set('includedir', includedir)
224 substs.set('pkgsysconfdir', pkgsysconfdir)
225 substs.set('bindir', bindir)
226 substs.set('rootbindir', rootbindir)
227 substs.set('rootlibexecdir', rootlibexecdir)
228 substs.set('systemunitdir', systemunitdir)
229 substs.set('userunitdir', userunitdir)
230 substs.set('systempresetdir', systempresetdir)
231 substs.set('userpresetdir', userpresetdir)
232 substs.set('udevhwdbdir', udevhwdbdir)
233 substs.set('udevrulesdir', udevrulesdir)
234 substs.set('udevlibexecdir', udevlibexecdir)
235 substs.set('catalogdir', catalogdir)
236 substs.set('tmpfilesdir', tmpfilesdir)
237 substs.set('sysusersdir', sysusersdir)
238 substs.set('sysctldir', sysctldir)
239 substs.set('binfmtdir', binfmtdir)
240 substs.set('modulesloaddir', modulesloaddir)
241 substs.set('systemgeneratordir', systemgeneratordir)
242 substs.set('usergeneratordir', usergeneratordir)
243 substs.set('systemenvgeneratordir', systemenvgeneratordir)
244 substs.set('userenvgeneratordir', userenvgeneratordir)
245 substs.set('systemshutdowndir', systemshutdowndir)
246 substs.set('systemsleepdir', systemsleepdir)
247 substs.set('VARLOGDIR', varlogdir)
248 substs.set('CERTIFICATEROOT', get_option('certificate-root'))
249 substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
250 substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
251 substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
252 substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
253 substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
254 substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
256 #####################################################################
258 cc = meson.get_compiler('c')
259 pkgconfig = import('pkgconfig')
260 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
262 cxx = find_program('c++', required : false)
264 # Used only for tests
268 foreach arg : ['-Wextra',
271 '-Wmissing-include-dirs',
272 '-Wold-style-definition',
275 '-Wdeclaration-after-statement',
277 '-Wsuggest-attribute=noreturn',
278 '-Werror=missing-prototypes',
279 '-Werror=implicit-function-declaration',
280 '-Werror=missing-declarations',
281 '-Werror=return-type',
282 '-Werror=incompatible-pointer-types',
284 '-Wstrict-prototypes',
286 '-Wmissing-noreturn',
287 '-Wimplicit-fallthrough=5',
290 '-Wstrict-aliasing=2',
297 '-fdiagnostics-show-option',
298 '-fno-strict-aliasing',
299 '-fvisibility=hidden',
301 '-fstack-protector-strong',
303 '--param=ssp-buffer-size=4',
305 if cc.has_argument(arg)
306 add_project_arguments(arg, language : 'c')
310 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
311 # arguments, just emits a warnings. So test for the "positive" version instead.
312 foreach arg : ['unused-parameter',
313 'missing-field-initializers',
316 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
318 if cc.has_argument('-W' + arg)
319 add_project_arguments('-Wno-' + arg, language : 'c')
325 #include <inttypes.h>
326 typedef uint64_t usec_t;
327 usec_t now(clockid_t clock);
332 ', name : '-Werror=shadow with local shadowing')
333 add_project_arguments('-Werror=shadow', language : 'c')
336 if cc.get_id() == 'clang'
337 foreach arg : ['-Wno-typedef-redefinition',
338 '-Wno-gnu-variable-sized-type-not-at-end',
340 if cc.has_argument(arg,
341 name : '@0@ is supported'.format(arg))
342 add_project_arguments(arg, language : 'c')
347 link_test_c = files('tools/meson-link-test.c')
349 # --as-needed and --no-undefined are provided by meson by default,
350 # run mesonconf to see what is enabled
351 foreach arg : ['-Wl,-z,relro',
356 have = run_command(check_compilation_sh,
357 cc.cmd_array(), '-x', 'c', arg,
358 '-include', link_test_c).returncode() == 0
359 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
361 add_project_link_arguments(arg, language : 'c')
365 if get_option('buildtype') != 'debug'
366 foreach arg : ['-ffunction-sections',
368 if cc.has_argument(arg,
369 name : '@0@ is supported'.format(arg))
370 add_project_arguments(arg, language : 'c')
374 foreach arg : ['-Wl,--gc-sections']
375 have = run_command(check_compilation_sh,
376 cc.cmd_array(), '-x', 'c', arg,
377 '-include', link_test_c).returncode() == 0
378 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
380 add_project_link_arguments(arg, language : 'c')
385 cpp = ' '.join(cc.cmd_array()) + ' -E'
387 #####################################################################
388 # compilation result tests
390 conf.set('_GNU_SOURCE', true)
391 conf.set('__SANE_USERSPACE_TYPES__', true)
393 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
394 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
395 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
396 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
397 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
398 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
399 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
403 #include <linux/ethtool.h>
404 #include <linux/fib_rules.h>
406 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
408 foreach decl : ['char16_t',
411 'struct ethtool_link_settings',
412 'struct fib_rule_uid_range',
415 # We get -1 if the size cannot be determined
416 have = cc.sizeof(decl, prefix : decl_headers) > 0
417 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
420 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
421 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
422 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
423 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
424 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
425 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
426 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
427 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
428 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
429 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
430 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
431 # if_tunnel.h is buggy and cannot be included on its own
432 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
433 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
434 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
435 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
436 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
437 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
438 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
439 ['NDA_IFINDEX', 'linux/neighbour.h'],
440 ['IFA_FLAGS', 'linux/if_addr.h'],
441 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
442 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
443 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
445 prefix = decl.length() > 2 ? decl[2] : ''
446 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
447 conf.set10('HAVE_' + decl[0], have)
450 foreach ident : ['secure_getenv', '__secure_getenv']
451 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
455 ['memfd_create', '''#define _GNU_SOURCE
456 #include <sys/mman.h>'''],
457 ['gettid', '''#include <sys/types.h>'''],
458 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
459 ['name_to_handle_at', '''#define _GNU_SOURCE
460 #include <sys/types.h>
461 #include <sys/stat.h>
462 #include <fcntl.h>'''],
463 ['setns', '''#define _GNU_SOURCE
464 #include <sched.h>'''],
465 ['renameat2', '''#include <stdio.h>'''],
466 ['kcmp', '''#include <linux/kcmp.h>'''],
467 ['keyctl', '''#include <sys/types.h>
468 #include <keyutils.h>'''],
469 ['copy_file_range', '''#include <sys/syscall.h>
470 #include <unistd.h>'''],
471 ['bpf', '''#include <sys/syscall.h>
472 #include <unistd.h>'''],
473 ['explicit_bzero' , '''#include <string.h>'''],
476 have = cc.has_function(ident[0], prefix : ident[1])
477 conf.set10('HAVE_' + ident[0].to_upper(), have)
480 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
481 conf.set10('USE_SYS_RANDOM_H', true)
482 conf.set10('HAVE_GETRANDOM', true)
484 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
485 conf.set10('USE_SYS_RANDOM_H', false)
486 conf.set10('HAVE_GETRANDOM', have)
489 #####################################################################
491 sed = find_program('sed')
492 awk = find_program('awk')
493 m4 = find_program('m4')
494 stat = find_program('stat')
495 git = find_program('git', required : false)
497 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
498 mkdir_p = 'mkdir -p $DESTDIR/@0@'
499 test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
500 splash_bmp = files('test/splash.bmp')
502 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
503 # /usr/sbin, /sbin, and fall back to the default from middle column.
504 progs = [['telinit', '/lib/sysvinit/telinit'],
505 ['quotaon', '/usr/sbin/quotaon' ],
506 ['quotacheck', '/usr/sbin/quotacheck' ],
507 ['kill', '/usr/bin/kill' ],
508 ['kmod', '/usr/bin/kmod' ],
509 ['kexec', '/usr/sbin/kexec' ],
510 ['sulogin', '/usr/sbin/sulogin' ],
511 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
512 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
513 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
514 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
517 path = get_option(prog[0] + '-path')
519 message('Using @1@ for @0@'.format(prog[0], path))
521 exe = find_program(prog[0],
522 '/usr/sbin/' + prog[0],
525 path = exe.found() ? exe.path() : prog[1]
527 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
528 conf.set_quoted(name, path)
529 substs.set(name, path)
532 if run_command('ln', '--relative', '--help').returncode() != 0
533 error('ln does not support --relative')
536 ############################################################
538 gperf = find_program('gperf')
540 gperf_test_format = '''
542 const char * in_word_set(const char *, @0@);
545 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
546 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
547 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
548 if cc.compiles(gperf_test)
549 gperf_len_type = 'size_t'
551 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
552 if cc.compiles(gperf_test)
553 gperf_len_type = 'unsigned'
555 error('unable to determine gperf len type')
558 message('gperf len type is @0@'.format(gperf_len_type))
559 conf.set('GPERF_LEN_TYPE', gperf_len_type,
560 description : 'The type of gperf "len" parameter')
562 ############################################################
564 if not cc.has_header('sys/capability.h')
565 error('POSIX caps headers not found')
567 foreach header : ['linux/btrfs.h',
569 'linux/vm_sockets.h',
571 'valgrind/memcheck.h',
572 'valgrind/valgrind.h',
575 conf.set10('HAVE_' + header.underscorify().to_upper(),
576 cc.has_header(header))
579 ############################################################
581 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
582 conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
583 gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
585 default_hierarchy = get_option('default-hierarchy')
586 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
587 description : 'default cgroup hierarchy as string')
588 if default_hierarchy == 'legacy'
589 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
590 elif default_hierarchy == 'hybrid'
591 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
593 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
596 time_epoch = get_option('time-epoch')
599 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
601 time_epoch = time_epoch.to_int()
602 conf.set('TIME_EPOCH', time_epoch)
604 system_uid_max = get_option('system-uid-max')
605 if system_uid_max == ''
606 system_uid_max = run_command(
608 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
609 '/etc/login.defs').stdout()
611 system_uid_max = system_uid_max.to_int()
612 conf.set('SYSTEM_UID_MAX', system_uid_max)
613 substs.set('systemuidmax', system_uid_max)
614 message('maximum system UID is @0@'.format(system_uid_max))
616 conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
617 conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
619 system_gid_max = get_option('system-gid-max')
620 if system_gid_max == ''
621 system_gid_max = run_command(
623 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
624 '/etc/login.defs').stdout()
626 system_gid_max = system_gid_max.to_int()
627 conf.set('SYSTEM_GID_MAX', system_gid_max)
628 substs.set('systemgidmax', system_gid_max)
629 message('maximum system GID is @0@'.format(system_gid_max))
631 tty_gid = get_option('tty-gid')
632 conf.set('TTY_GID', tty_gid)
633 substs.set('TTY_GID', tty_gid)
635 if get_option('adm-group')
636 m4_defines += ['-DENABLE_ADM_GROUP']
639 if get_option('wheel-group')
640 m4_defines += ['-DENABLE_WHEEL_GROUP']
643 substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
644 substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
646 kill_user_processes = get_option('default-kill-user-processes')
647 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
648 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
650 dns_servers = get_option('dns-servers')
651 conf.set_quoted('DNS_SERVERS', dns_servers)
652 substs.set('DNS_SERVERS', dns_servers)
654 ntp_servers = get_option('ntp-servers')
655 conf.set_quoted('NTP_SERVERS', ntp_servers)
656 substs.set('NTP_SERVERS', ntp_servers)
658 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
660 substs.set('SUSHELL', get_option('debug-shell'))
661 substs.set('DEBUGTTY', get_option('debug-tty'))
663 debug = get_option('debug')
664 enable_debug_hashmap = false
665 enable_debug_mmap_cache = false
667 foreach name : debug.split(',')
669 enable_debug_hashmap = true
670 elif name == 'mmap-cache'
671 enable_debug_mmap_cache = true
673 message('unknown debug option "@0@", ignoring'.format(name))
677 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
678 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
680 #####################################################################
682 threads = dependency('threads')
683 librt = cc.find_library('rt')
684 libm = cc.find_library('m')
685 libdl = cc.find_library('dl')
686 libcrypt = cc.find_library('crypt')
688 libcap = dependency('libcap', required : false)
689 if not libcap.found()
690 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
691 libcap = cc.find_library('cap')
694 libmount = dependency('mount',
697 want_seccomp = get_option('seccomp')
698 if want_seccomp != 'false'
699 libseccomp = dependency('libseccomp',
700 version : '>= 2.3.1',
701 required : want_seccomp == 'true')
702 have = libseccomp.found()
707 conf.set10('HAVE_SECCOMP', have)
708 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
710 want_selinux = get_option('selinux')
711 if want_selinux != 'false'
712 libselinux = dependency('libselinux',
713 version : '>= 2.1.9',
714 required : want_selinux == 'true')
715 have = libselinux.found()
720 conf.set10('HAVE_SELINUX', have)
721 m4_defines += have ? ['-DHAVE_SELINUX'] : []
723 want_apparmor = get_option('apparmor')
724 if want_apparmor != 'false'
725 libapparmor = dependency('libapparmor',
726 required : want_apparmor == 'true')
727 have = libapparmor.found()
732 conf.set10('HAVE_APPARMOR', have)
733 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
735 smack_run_label = get_option('smack-run-label')
736 if smack_run_label != ''
737 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
738 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
741 want_polkit = get_option('polkit')
742 install_polkit = false
743 install_polkit_pkla = false
744 if want_polkit != 'false'
745 install_polkit = true
747 libpolkit = dependency('polkit-gobject-1',
749 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
750 message('Old polkit detected, will install pkla files')
751 install_polkit_pkla = true
754 conf.set10('ENABLE_POLKIT', install_polkit)
756 want_acl = get_option('acl')
757 if want_acl != 'false'
758 libacl = cc.find_library('acl', required : want_acl == 'true')
759 have = libacl.found()
764 conf.set10('HAVE_ACL', have)
765 m4_defines += have ? ['-DHAVE_ACL'] : []
767 want_audit = get_option('audit')
768 if want_audit != 'false'
769 libaudit = dependency('audit', required : want_audit == 'true')
770 have = libaudit.found()
775 conf.set10('HAVE_AUDIT', have)
777 want_blkid = get_option('blkid')
778 if want_blkid != 'false'
779 libblkid = dependency('blkid', required : want_blkid == 'true')
780 have = libblkid.found()
785 conf.set10('HAVE_BLKID', have)
787 want_kmod = get_option('kmod')
788 if want_kmod != 'false'
789 libkmod = dependency('libkmod',
791 required : want_kmod == 'true')
792 have = libkmod.found()
797 conf.set10('HAVE_KMOD', have)
799 want_pam = get_option('pam')
800 if want_pam != 'false'
801 libpam = cc.find_library('pam', required : want_pam == 'true')
802 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
803 have = libpam.found() and libpam_misc.found()
809 conf.set10('HAVE_PAM', have)
810 m4_defines += have ? ['-DHAVE_PAM'] : []
812 want_microhttpd = get_option('microhttpd')
813 if want_microhttpd != 'false'
814 libmicrohttpd = dependency('libmicrohttpd',
815 version : '>= 0.9.33',
816 required : want_microhttpd == 'true')
817 have = libmicrohttpd.found()
822 conf.set10('HAVE_MICROHTTPD', have)
823 m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
825 want_libcryptsetup = get_option('libcryptsetup')
826 if want_libcryptsetup != 'false'
827 libcryptsetup = dependency('libcryptsetup',
828 version : '>= 1.6.0',
829 required : want_libcryptsetup == 'true')
830 have = libcryptsetup.found()
835 conf.set10('HAVE_LIBCRYPTSETUP', have)
837 want_libcurl = get_option('libcurl')
838 if want_libcurl != 'false'
839 libcurl = dependency('libcurl',
840 version : '>= 7.32.0',
841 required : want_libcurl == 'true')
842 have = libcurl.found()
847 conf.set10('HAVE_LIBCURL', have)
848 m4_defines += have ? ['-DHAVE_LIBCURL'] : []
850 want_libidn = get_option('libidn')
851 want_libidn2 = get_option('libidn2')
852 if want_libidn == 'true' and want_libidn2 == 'true'
853 error('libidn and libidn2 cannot be requested simultaneously')
856 if want_libidn != 'false' and want_libidn2 != 'true'
857 libidn = dependency('libidn',
858 required : want_libidn == 'true')
859 have = libidn.found()
864 conf.set10('HAVE_LIBIDN', have)
865 m4_defines += have ? ['-DHAVE_LIBIDN'] : []
866 if not have and want_libidn2 != 'false'
867 # libidn is used for both libidn and libidn2 objects
868 libidn = dependency('libidn2',
869 required : want_libidn2 == 'true')
870 have = libidn.found()
874 conf.set10('HAVE_LIBIDN2', have)
875 m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
877 want_libiptc = get_option('libiptc')
878 if want_libiptc != 'false'
879 libiptc = dependency('libiptc',
880 required : want_libiptc == 'true')
881 have = libiptc.found()
886 conf.set10('HAVE_LIBIPTC', have)
887 m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
889 want_qrencode = get_option('qrencode')
890 if want_qrencode != 'false'
891 libqrencode = dependency('libqrencode',
892 required : want_qrencode == 'true')
893 have = libqrencode.found()
898 conf.set10('HAVE_QRENCODE', have)
900 want_gcrypt = get_option('gcrypt')
901 if want_gcrypt != 'false'
902 libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
903 libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
904 have = libgcrypt.found() and libgpg_error.found()
909 # link to neither of the libs if one is not found
913 conf.set10('HAVE_GCRYPT', have)
915 want_gnutls = get_option('gnutls')
916 if want_gnutls != 'false'
917 libgnutls = dependency('gnutls',
918 version : '>= 3.1.4',
919 required : want_gnutls == 'true')
920 have = libgnutls.found()
925 conf.set10('HAVE_GNUTLS', have)
927 want_elfutils = get_option('elfutils')
928 if want_elfutils != 'false'
929 libdw = dependency('libdw',
930 required : want_elfutils == 'true')
936 conf.set10('HAVE_ELFUTILS', have)
938 want_zlib = get_option('zlib')
939 if want_zlib != 'false'
940 libz = dependency('zlib',
941 required : want_zlib == 'true')
947 conf.set10('HAVE_ZLIB', have)
949 want_bzip2 = get_option('bzip2')
950 if want_bzip2 != 'false'
951 libbzip2 = cc.find_library('bz2',
952 required : want_bzip2 == 'true')
953 have = libbzip2.found()
958 conf.set10('HAVE_BZIP2', have)
960 want_xz = get_option('xz')
961 if want_xz != 'false'
962 libxz = dependency('liblzma',
963 required : want_xz == 'true')
969 conf.set10('HAVE_XZ', have)
971 want_lz4 = get_option('lz4')
972 if want_lz4 != 'false'
973 liblz4 = dependency('liblz4',
974 required : want_lz4 == 'true')
975 have = liblz4.found()
980 conf.set10('HAVE_LZ4', have)
982 want_xkbcommon = get_option('xkbcommon')
983 if want_xkbcommon != 'false'
984 libxkbcommon = dependency('xkbcommon',
985 version : '>= 0.3.0',
986 required : want_xkbcommon == 'true')
987 have = libxkbcommon.found()
992 conf.set10('HAVE_XKBCOMMON', have)
994 want_glib = get_option('glib')
995 if want_glib != 'false'
996 libglib = dependency('glib-2.0',
997 version : '>= 2.22.0',
998 required : want_glib == 'true')
999 libgobject = dependency('gobject-2.0',
1000 version : '>= 2.22.0',
1001 required : want_glib == 'true')
1002 libgio = dependency('gio-2.0',
1003 required : want_glib == 'true')
1004 have = libglib.found() and libgobject.found() and libgio.found()
1011 conf.set10('HAVE_GLIB', have)
1013 want_dbus = get_option('dbus')
1014 if want_dbus != 'false'
1015 libdbus = dependency('dbus-1',
1016 version : '>= 1.3.2',
1017 required : want_dbus == 'true')
1018 have = libdbus.found()
1023 conf.set10('HAVE_DBUS', have)
1025 default_dnssec = get_option('default-dnssec')
1026 if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1027 message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1028 default_dnssec = 'no'
1030 conf.set('DEFAULT_DNSSEC_MODE',
1031 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1032 substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1034 want_importd = get_option('importd')
1035 if want_importd != 'false'
1036 have = (conf.get('HAVE_LIBCURL') == 1 and
1037 conf.get('HAVE_ZLIB') == 1 and
1038 conf.get('HAVE_BZIP2') == 1 and
1039 conf.get('HAVE_XZ') == 1 and
1040 conf.get('HAVE_GCRYPT') == 1)
1041 if want_importd == 'true' and not have
1042 error('importd support was requested, but dependencies are not available')
1047 conf.set10('ENABLE_IMPORTD', have)
1049 want_remote = get_option('remote')
1050 if want_remote != 'false'
1051 have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1052 conf.get('HAVE_LIBCURL') == 1]
1053 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1054 # it's possible to build one without the other. Complain only if
1055 # support was explictly requested. The auxiliary files like sysusers
1056 # config should be installed when any of the programs are built.
1057 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1058 error('remote support was requested, but dependencies are not available')
1060 have = have_deps[0] or have_deps[1]
1064 conf.set10('ENABLE_REMOTE', have)
1066 foreach term : ['utmp',
1097 have = get_option(term)
1098 name = 'ENABLE_' + term.underscorify().to_upper()
1099 conf.set10(name, have)
1100 m4_defines += have ? ['-D' + name] : []
1103 want_tests = get_option('tests')
1104 install_tests = get_option('install-tests')
1107 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', get_option('slow-tests'))
1109 #####################################################################
1111 if get_option('efi')
1112 efi_arch = host_machine.cpu_family()
1114 if efi_arch == 'x86'
1115 EFI_MACHINE_TYPE_NAME = 'ia32'
1116 gnu_efi_arch = 'ia32'
1117 elif efi_arch == 'x86_64'
1118 EFI_MACHINE_TYPE_NAME = 'x64'
1119 gnu_efi_arch = 'x86_64'
1120 elif efi_arch == 'arm'
1121 EFI_MACHINE_TYPE_NAME = 'arm'
1122 gnu_efi_arch = 'arm'
1123 elif efi_arch == 'aarch64'
1124 EFI_MACHINE_TYPE_NAME = 'aa64'
1125 gnu_efi_arch = 'aarch64'
1127 EFI_MACHINE_TYPE_NAME = ''
1132 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1134 conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1138 conf.set10('ENABLE_EFI', have)
1140 #####################################################################
1142 config_h = configure_file(
1143 output : 'config.h',
1144 configuration : conf)
1146 includes = include_directories('src/basic',
1156 'src/libsystemd/sd-bus',
1157 'src/libsystemd/sd-device',
1158 'src/libsystemd/sd-hwdb',
1159 'src/libsystemd/sd-id128',
1160 'src/libsystemd/sd-netlink',
1161 'src/libsystemd/sd-network',
1162 'src/libsystemd-network',
1166 add_project_arguments('-include', 'config.h', language : 'c')
1168 gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1169 'src/shared/gcrypt-util.c')
1173 subdir('src/systemd')
1175 subdir('src/libsystemd')
1176 subdir('src/libsystemd-network')
1177 subdir('src/journal')
1180 libjournal_core = static_library(
1182 libjournal_core_sources,
1184 include_directories : includes,
1187 libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1188 libsystemd = shared_library(
1190 libsystemd_internal_sources,
1191 journal_internal_sources,
1192 version : libsystemd_version,
1193 include_directories : includes,
1194 link_args : ['-shared',
1195 '-Wl,--version-script=' + libsystemd_sym_path],
1196 link_with : [libbasic],
1197 dependencies : [threads,
1202 link_depends : libsystemd_sym,
1204 install_dir : rootlibdir)
1206 ############################################################
1208 # binaries that have --help and are intended for use by humans,
1209 # usually, but not always, installed in /bin.
1210 public_programs = []
1212 subdir('src/libudev')
1213 subdir('src/shared')
1216 subdir('src/network')
1218 subdir('src/analyze')
1219 subdir('src/journal-remote')
1220 subdir('src/coredump')
1221 subdir('src/hostname')
1222 subdir('src/import')
1223 subdir('src/kernel-install')
1224 subdir('src/locale')
1225 subdir('src/machine')
1226 subdir('src/nspawn')
1227 subdir('src/resolve')
1228 subdir('src/timedate')
1229 subdir('src/timesync')
1230 subdir('src/vconsole')
1231 subdir('src/sulogin-shell')
1232 subdir('src/boot/efi')
1238 ############################################################
1240 # only static linking apart from libdl, to make sure that the
1241 # module is linked to all libraries that it uses.
1242 test_dlopen = executable(
1245 include_directories : includes,
1246 link_with : [libbasic],
1247 dependencies : [libdl])
1249 foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1250 ['systemd', 'ENABLE_NSS_SYSTEMD'],
1251 ['mymachines', 'ENABLE_MACHINED'],
1252 ['resolve', 'ENABLE_RESOLVE']]
1254 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1258 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1259 version_script_arg = join_paths(meson.current_source_dir(), sym)
1261 nss = shared_library(
1263 'src/nss-@0@/nss-@0@.c'.format(module),
1265 include_directories : includes,
1266 link_args : ['-shared',
1267 '-Wl,--version-script=' + version_script_arg,
1269 link_with : [libsystemd_internal,
1271 dependencies : [threads,
1275 install_dir : rootlibdir)
1277 # We cannot use shared_module because it does not support version suffix.
1278 # Unfortunately shared_library insists on creating the symlink…
1279 meson.add_install_script('sh', '-c',
1280 'rm $DESTDIR@0@/libnss_@1@.so'
1281 .format(rootlibdir, module))
1283 test('dlopen-nss_' + module,
1285 args : [nss.full_path()]) # path to dlopen must include a slash
1289 ############################################################
1291 executable('systemd',
1293 include_directories : includes,
1294 link_with : [libcore,
1296 dependencies : [threads,
1302 install_rpath : rootlibexecdir,
1304 install_dir : rootlibexecdir)
1306 exe = executable('systemd-analyze',
1307 systemd_analyze_sources,
1308 include_directories : includes,
1309 link_with : [libcore,
1311 dependencies : [threads,
1317 install_rpath : rootlibexecdir,
1319 public_programs += [exe]
1321 executable('systemd-journald',
1322 systemd_journald_sources,
1323 include_directories : includes,
1324 link_with : [libjournal_core,
1326 dependencies : [threads,
1330 install_rpath : rootlibexecdir,
1332 install_dir : rootlibexecdir)
1334 exe = executable('systemd-cat',
1335 systemd_cat_sources,
1336 include_directories : includes,
1337 link_with : [libjournal_core,
1339 dependencies : [threads],
1340 install_rpath : rootlibexecdir,
1342 public_programs += [exe]
1344 exe = executable('journalctl',
1346 include_directories : includes,
1347 link_with : [libshared],
1348 dependencies : [threads,
1352 install_rpath : rootlibexecdir,
1354 install_dir : rootbindir)
1355 public_programs += [exe]
1357 executable('systemd-getty-generator',
1358 'src/getty-generator/getty-generator.c',
1359 include_directories : includes,
1360 link_with : [libshared],
1361 install_rpath : rootlibexecdir,
1363 install_dir : systemgeneratordir)
1365 executable('systemd-debug-generator',
1366 'src/debug-generator/debug-generator.c',
1367 include_directories : includes,
1368 link_with : [libshared],
1369 install_rpath : rootlibexecdir,
1371 install_dir : systemgeneratordir)
1373 executable('systemd-fstab-generator',
1374 'src/fstab-generator/fstab-generator.c',
1375 'src/core/mount-setup.c',
1376 include_directories : includes,
1377 link_with : [libshared],
1378 install_rpath : rootlibexecdir,
1380 install_dir : systemgeneratordir)
1382 if conf.get('ENABLE_ENVIRONMENT_D') == 1
1383 executable('30-systemd-environment-d-generator',
1384 'src/environment-d-generator/environment-d-generator.c',
1385 include_directories : includes,
1386 link_with : [libshared],
1387 install_rpath : rootlibexecdir,
1389 install_dir : userenvgeneratordir)
1391 meson.add_install_script(meson_make_symlink,
1392 join_paths(sysconfdir, 'environment'),
1393 join_paths(environmentdir, '99-environment.conf'))
1396 if conf.get('ENABLE_HIBERNATE') == 1
1397 executable('systemd-hibernate-resume-generator',
1398 'src/hibernate-resume/hibernate-resume-generator.c',
1399 include_directories : includes,
1400 link_with : [libshared],
1401 install_rpath : rootlibexecdir,
1403 install_dir : systemgeneratordir)
1405 executable('systemd-hibernate-resume',
1406 'src/hibernate-resume/hibernate-resume.c',
1407 include_directories : includes,
1408 link_with : [libshared],
1409 install_rpath : rootlibexecdir,
1411 install_dir : rootlibexecdir)
1414 if conf.get('HAVE_BLKID') == 1
1415 executable('systemd-gpt-auto-generator',
1416 'src/gpt-auto-generator/gpt-auto-generator.c',
1417 'src/basic/blkid-util.h',
1418 include_directories : includes,
1419 link_with : [libshared],
1420 dependencies : libblkid,
1421 install_rpath : rootlibexecdir,
1423 install_dir : systemgeneratordir)
1425 exe = executable('systemd-dissect',
1426 'src/dissect/dissect.c',
1427 include_directories : includes,
1428 link_with : [libshared],
1429 install_rpath : rootlibexecdir,
1431 install_dir : rootlibexecdir)
1432 public_programs += [exe]
1435 if conf.get('ENABLE_RESOLVE') == 1
1436 executable('systemd-resolved',
1437 systemd_resolved_sources,
1438 gcrypt_util_sources,
1439 include_directories : includes,
1440 link_with : [libshared],
1441 dependencies : [threads,
1446 install_rpath : rootlibexecdir,
1448 install_dir : rootlibexecdir)
1450 exe = executable('systemd-resolve',
1451 systemd_resolve_sources,
1452 gcrypt_util_sources,
1453 include_directories : includes,
1454 link_with : [libshared],
1455 dependencies : [threads,
1460 install_rpath : rootlibexecdir,
1462 public_programs += [exe]
1465 if conf.get('ENABLE_LOGIND') == 1
1466 executable('systemd-logind',
1467 systemd_logind_sources,
1468 include_directories : includes,
1469 link_with : [liblogind_core,
1471 dependencies : [threads,
1473 install_rpath : rootlibexecdir,
1475 install_dir : rootlibexecdir)
1477 exe = executable('loginctl',
1479 include_directories : includes,
1480 link_with : [libshared],
1481 dependencies : [threads,
1484 install_rpath : rootlibexecdir,
1486 install_dir : rootbindir)
1487 public_programs += [exe]
1489 exe = executable('systemd-inhibit',
1490 'src/login/inhibit.c',
1491 include_directories : includes,
1492 link_with : [libshared],
1493 install_rpath : rootlibexecdir,
1495 install_dir : rootbindir)
1496 public_programs += [exe]
1498 if conf.get('HAVE_PAM') == 1
1499 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1500 pam_systemd = shared_library(
1504 include_directories : includes,
1505 link_args : ['-shared',
1506 '-Wl,--version-script=' + version_script_arg],
1507 link_with : [libsystemd_internal,
1509 dependencies : [threads,
1512 link_depends : pam_systemd_sym,
1514 install_dir : pamlibdir)
1516 test('dlopen-pam_systemd',
1518 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1522 if conf.get('HAVE_PAM') == 1
1523 executable('systemd-user-sessions',
1524 'src/user-sessions/user-sessions.c',
1525 include_directories : includes,
1526 link_with : [libshared],
1527 install_rpath : rootlibexecdir,
1529 install_dir : rootlibexecdir)
1532 if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1533 exe = executable('bootctl',
1534 'src/boot/bootctl.c',
1535 include_directories : includes,
1536 link_with : [libshared],
1537 dependencies : [libblkid],
1538 install_rpath : rootlibexecdir,
1540 public_programs += [exe]
1543 exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1544 include_directories : includes,
1545 link_with : [libshared],
1546 dependencies : [threads],
1547 install_rpath : rootlibexecdir,
1549 public_programs += [exe]
1551 exe = executable('systemctl', 'src/systemctl/systemctl.c',
1552 include_directories : includes,
1553 link_with : [libshared],
1554 dependencies : [threads,
1559 install_rpath : rootlibexecdir,
1561 install_dir : rootbindir)
1562 public_programs += [exe]
1564 if conf.get('ENABLE_BACKLIGHT') == 1
1565 executable('systemd-backlight',
1566 'src/backlight/backlight.c',
1567 include_directories : includes,
1568 link_with : [libshared],
1569 install_rpath : rootlibexecdir,
1571 install_dir : rootlibexecdir)
1574 if conf.get('ENABLE_RFKILL') == 1
1575 executable('systemd-rfkill',
1576 'src/rfkill/rfkill.c',
1577 include_directories : includes,
1578 link_with : [libshared],
1579 install_rpath : rootlibexecdir,
1581 install_dir : rootlibexecdir)
1584 executable('systemd-system-update-generator',
1585 'src/system-update-generator/system-update-generator.c',
1586 include_directories : includes,
1587 link_with : [libshared],
1588 install_rpath : rootlibexecdir,
1590 install_dir : systemgeneratordir)
1592 if conf.get('HAVE_LIBCRYPTSETUP') == 1
1593 executable('systemd-cryptsetup',
1594 'src/cryptsetup/cryptsetup.c',
1595 include_directories : includes,
1596 link_with : [libshared],
1597 dependencies : [libcryptsetup],
1598 install_rpath : rootlibexecdir,
1600 install_dir : rootlibexecdir)
1602 executable('systemd-cryptsetup-generator',
1603 'src/cryptsetup/cryptsetup-generator.c',
1604 include_directories : includes,
1605 link_with : [libshared],
1606 dependencies : [libcryptsetup],
1607 install_rpath : rootlibexecdir,
1609 install_dir : systemgeneratordir)
1611 executable('systemd-veritysetup',
1612 'src/veritysetup/veritysetup.c',
1613 include_directories : includes,
1614 link_with : [libshared],
1615 dependencies : [libcryptsetup],
1616 install_rpath : rootlibexecdir,
1618 install_dir : rootlibexecdir)
1620 executable('systemd-veritysetup-generator',
1621 'src/veritysetup/veritysetup-generator.c',
1622 include_directories : includes,
1623 link_with : [libshared],
1624 dependencies : [libcryptsetup],
1625 install_rpath : rootlibexecdir,
1627 install_dir : systemgeneratordir)
1630 if conf.get('HAVE_SYSV_COMPAT') == 1
1631 executable('systemd-sysv-generator',
1632 'src/sysv-generator/sysv-generator.c',
1633 include_directories : includes,
1634 link_with : [libshared],
1635 install_rpath : rootlibexecdir,
1637 install_dir : systemgeneratordir)
1639 executable('systemd-rc-local-generator',
1640 'src/rc-local-generator/rc-local-generator.c',
1641 include_directories : includes,
1642 link_with : [libshared],
1643 install_rpath : rootlibexecdir,
1645 install_dir : systemgeneratordir)
1648 if conf.get('ENABLE_HOSTNAMED') == 1
1649 executable('systemd-hostnamed',
1650 'src/hostname/hostnamed.c',
1651 include_directories : includes,
1652 link_with : [libshared],
1653 install_rpath : rootlibexecdir,
1655 install_dir : rootlibexecdir)
1657 exe = executable('hostnamectl',
1658 'src/hostname/hostnamectl.c',
1659 include_directories : includes,
1660 link_with : [libshared],
1661 install_rpath : rootlibexecdir,
1663 public_programs += [exe]
1666 if conf.get('ENABLE_LOCALED') == 1
1667 if conf.get('HAVE_XKBCOMMON') == 1
1668 # logind will load libxkbcommon.so dynamically on its own
1674 executable('systemd-localed',
1675 systemd_localed_sources,
1676 include_directories : includes,
1677 link_with : [libshared],
1678 dependencies : deps,
1679 install_rpath : rootlibexecdir,
1681 install_dir : rootlibexecdir)
1683 exe = executable('localectl',
1685 include_directories : includes,
1686 link_with : [libshared],
1687 install_rpath : rootlibexecdir,
1689 public_programs += [exe]
1692 if conf.get('ENABLE_TIMEDATED') == 1
1693 executable('systemd-timedated',
1694 'src/timedate/timedated.c',
1695 include_directories : includes,
1696 link_with : [libshared],
1697 install_rpath : rootlibexecdir,
1699 install_dir : rootlibexecdir)
1701 exe = executable('timedatectl',
1702 'src/timedate/timedatectl.c',
1703 include_directories : includes,
1704 install_rpath : rootlibexecdir,
1705 link_with : [libshared],
1707 public_programs += [exe]
1710 if conf.get('ENABLE_TIMESYNCD') == 1
1711 executable('systemd-timesyncd',
1712 systemd_timesyncd_sources,
1713 include_directories : includes,
1714 link_with : [libshared],
1715 dependencies : [threads,
1717 install_rpath : rootlibexecdir,
1719 install_dir : rootlibexecdir)
1722 if conf.get('ENABLE_MACHINED') == 1
1723 executable('systemd-machined',
1724 systemd_machined_sources,
1725 include_directories : includes,
1726 link_with : [libmachine_core,
1728 install_rpath : rootlibexecdir,
1730 install_dir : rootlibexecdir)
1732 exe = executable('machinectl',
1733 'src/machine/machinectl.c',
1734 include_directories : includes,
1735 link_with : [libshared],
1736 dependencies : [threads,
1739 install_rpath : rootlibexecdir,
1741 install_dir : rootbindir)
1742 public_programs += [exe]
1745 if conf.get('ENABLE_IMPORTD') == 1
1746 executable('systemd-importd',
1747 systemd_importd_sources,
1748 include_directories : includes,
1749 link_with : [libshared],
1750 dependencies : [threads],
1751 install_rpath : rootlibexecdir,
1753 install_dir : rootlibexecdir)
1755 systemd_pull = executable('systemd-pull',
1756 systemd_pull_sources,
1757 include_directories : includes,
1758 link_with : [libshared],
1759 dependencies : [libcurl,
1764 install_rpath : rootlibexecdir,
1766 install_dir : rootlibexecdir)
1768 systemd_import = executable('systemd-import',
1769 systemd_import_sources,
1770 include_directories : includes,
1771 link_with : [libshared],
1772 dependencies : [libcurl,
1776 install_rpath : rootlibexecdir,
1778 install_dir : rootlibexecdir)
1780 systemd_export = executable('systemd-export',
1781 systemd_export_sources,
1782 include_directories : includes,
1783 link_with : [libshared],
1784 dependencies : [libcurl,
1788 install_rpath : rootlibexecdir,
1790 install_dir : rootlibexecdir)
1791 public_programs += [systemd_pull, systemd_import, systemd_export]
1794 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
1795 exe = executable('systemd-journal-upload',
1796 systemd_journal_upload_sources,
1797 include_directories : includes,
1798 link_with : [libshared],
1799 dependencies : [threads,
1804 install_rpath : rootlibexecdir,
1806 install_dir : rootlibexecdir)
1807 public_programs += [exe]
1810 if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
1811 s_j_remote = executable('systemd-journal-remote',
1812 systemd_journal_remote_sources,
1813 include_directories : includes,
1814 link_with : [libshared],
1815 dependencies : [threads,
1820 install_rpath : rootlibexecdir,
1822 install_dir : rootlibexecdir)
1824 s_j_gatewayd = executable('systemd-journal-gatewayd',
1825 systemd_journal_gatewayd_sources,
1826 include_directories : includes,
1827 link_with : [libshared],
1828 dependencies : [threads,
1833 install_rpath : rootlibexecdir,
1835 install_dir : rootlibexecdir)
1836 public_programs += [s_j_remote, s_j_gatewayd]
1839 if conf.get('ENABLE_COREDUMP') == 1
1840 executable('systemd-coredump',
1841 systemd_coredump_sources,
1842 include_directories : includes,
1843 link_with : [libshared],
1844 dependencies : [threads,
1849 install_rpath : rootlibexecdir,
1851 install_dir : rootlibexecdir)
1853 exe = executable('coredumpctl',
1854 coredumpctl_sources,
1855 include_directories : includes,
1856 link_with : [libshared],
1857 dependencies : [threads,
1860 install_rpath : rootlibexecdir,
1862 public_programs += [exe]
1865 if conf.get('ENABLE_BINFMT') == 1
1866 exe = executable('systemd-binfmt',
1867 'src/binfmt/binfmt.c',
1868 include_directories : includes,
1869 link_with : [libshared],
1870 install_rpath : rootlibexecdir,
1872 install_dir : rootlibexecdir)
1873 public_programs += [exe]
1875 meson.add_install_script('sh', '-c',
1876 mkdir_p.format(binfmtdir))
1877 meson.add_install_script('sh', '-c',
1878 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1881 if conf.get('ENABLE_VCONSOLE') == 1
1882 executable('systemd-vconsole-setup',
1883 'src/vconsole/vconsole-setup.c',
1884 include_directories : includes,
1885 link_with : [libshared],
1886 install_rpath : rootlibexecdir,
1888 install_dir : rootlibexecdir)
1891 if conf.get('ENABLE_RANDOMSEED') == 1
1892 executable('systemd-random-seed',
1893 'src/random-seed/random-seed.c',
1894 include_directories : includes,
1895 link_with : [libshared],
1896 install_rpath : rootlibexecdir,
1898 install_dir : rootlibexecdir)
1901 if conf.get('ENABLE_FIRSTBOOT') == 1
1902 executable('systemd-firstboot',
1903 'src/firstboot/firstboot.c',
1904 include_directories : includes,
1905 link_with : [libshared],
1906 dependencies : [libcrypt],
1907 install_rpath : rootlibexecdir,
1909 install_dir : rootbindir)
1912 executable('systemd-remount-fs',
1913 'src/remount-fs/remount-fs.c',
1914 'src/core/mount-setup.c',
1915 'src/core/mount-setup.h',
1916 include_directories : includes,
1917 link_with : [libshared],
1918 install_rpath : rootlibexecdir,
1920 install_dir : rootlibexecdir)
1922 executable('systemd-machine-id-setup',
1923 'src/machine-id-setup/machine-id-setup-main.c',
1924 'src/core/machine-id-setup.c',
1925 'src/core/machine-id-setup.h',
1926 include_directories : includes,
1927 link_with : [libshared],
1928 install_rpath : rootlibexecdir,
1930 install_dir : rootbindir)
1932 executable('systemd-fsck',
1934 include_directories : includes,
1935 link_with : [libshared],
1936 install_rpath : rootlibexecdir,
1938 install_dir : rootlibexecdir)
1940 executable('systemd-growfs',
1941 'src/partition/growfs.c',
1942 include_directories : includes,
1943 link_with : [libshared],
1944 dependencies : [libcryptsetup],
1945 install_rpath : rootlibexecdir,
1947 install_dir : rootlibexecdir)
1949 executable('systemd-makefs',
1950 'src/partition/makefs.c',
1951 include_directories : includes,
1952 link_with : [libshared],
1953 install_rpath : rootlibexecdir,
1955 install_dir : rootlibexecdir)
1957 executable('systemd-sleep',
1958 'src/sleep/sleep.c',
1959 include_directories : includes,
1960 link_with : [libshared],
1961 install_rpath : rootlibexecdir,
1963 install_dir : rootlibexecdir)
1965 exe = executable('systemd-sysctl',
1966 'src/sysctl/sysctl.c',
1967 include_directories : includes,
1968 link_with : [libshared],
1969 install_rpath : rootlibexecdir,
1971 install_dir : rootlibexecdir)
1972 public_programs += [exe]
1974 executable('systemd-ac-power',
1975 'src/ac-power/ac-power.c',
1976 include_directories : includes,
1977 link_with : [libshared],
1978 install_rpath : rootlibexecdir,
1980 install_dir : rootlibexecdir)
1982 exe = executable('systemd-detect-virt',
1983 'src/detect-virt/detect-virt.c',
1984 include_directories : includes,
1985 link_with : [libshared],
1986 install_rpath : rootlibexecdir,
1988 public_programs += [exe]
1990 exe = executable('systemd-delta',
1991 'src/delta/delta.c',
1992 include_directories : includes,
1993 link_with : [libshared],
1994 install_rpath : rootlibexecdir,
1996 public_programs += [exe]
1998 exe = executable('systemd-escape',
1999 'src/escape/escape.c',
2000 include_directories : includes,
2001 link_with : [libshared],
2002 install_rpath : rootlibexecdir,
2004 install_dir : rootbindir)
2005 public_programs += [exe]
2007 exe = executable('systemd-notify',
2008 'src/notify/notify.c',
2009 include_directories : includes,
2010 link_with : [libshared],
2011 install_rpath : rootlibexecdir,
2013 install_dir : rootbindir)
2014 public_programs += [exe]
2016 executable('systemd-volatile-root',
2017 'src/volatile-root/volatile-root.c',
2018 include_directories : includes,
2019 link_with : [libshared],
2020 install_rpath : rootlibexecdir,
2022 install_dir : rootlibexecdir)
2024 executable('systemd-cgroups-agent',
2025 'src/cgroups-agent/cgroups-agent.c',
2026 include_directories : includes,
2027 link_with : [libshared],
2028 install_rpath : rootlibexecdir,
2030 install_dir : rootlibexecdir)
2032 exe = executable('systemd-path',
2034 include_directories : includes,
2035 link_with : [libshared],
2036 install_rpath : rootlibexecdir,
2038 public_programs += [exe]
2040 exe = executable('systemd-ask-password',
2041 'src/ask-password/ask-password.c',
2042 include_directories : includes,
2043 link_with : [libshared],
2044 install_rpath : rootlibexecdir,
2046 install_dir : rootbindir)
2047 public_programs += [exe]
2049 executable('systemd-reply-password',
2050 'src/reply-password/reply-password.c',
2051 include_directories : includes,
2052 link_with : [libshared],
2053 install_rpath : rootlibexecdir,
2055 install_dir : rootlibexecdir)
2057 exe = executable('systemd-tty-ask-password-agent',
2058 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2059 include_directories : includes,
2060 link_with : [libshared],
2061 install_rpath : rootlibexecdir,
2063 install_dir : rootbindir)
2064 public_programs += [exe]
2066 exe = executable('systemd-cgls',
2068 include_directories : includes,
2069 link_with : [libshared],
2070 install_rpath : rootlibexecdir,
2072 public_programs += [exe]
2074 exe = executable('systemd-cgtop',
2075 'src/cgtop/cgtop.c',
2076 include_directories : includes,
2077 link_with : [libshared],
2078 install_rpath : rootlibexecdir,
2080 public_programs += [exe]
2082 executable('systemd-initctl',
2083 'src/initctl/initctl.c',
2084 include_directories : includes,
2085 link_with : [libshared],
2086 install_rpath : rootlibexecdir,
2088 install_dir : rootlibexecdir)
2090 exe = executable('systemd-mount',
2091 'src/mount/mount-tool.c',
2092 include_directories : includes,
2093 link_with : [libshared],
2094 install_rpath : rootlibexecdir,
2096 public_programs += [exe]
2098 meson.add_install_script(meson_make_symlink,
2099 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2101 exe = executable('systemd-run',
2103 include_directories : includes,
2104 link_with : [libshared],
2105 install_rpath : rootlibexecdir,
2107 public_programs += [exe]
2109 exe = executable('systemd-stdio-bridge',
2110 'src/stdio-bridge/stdio-bridge.c',
2111 include_directories : includes,
2112 link_with : [libshared],
2113 install_rpath : rootlibexecdir,
2115 public_programs += [exe]
2117 exe = executable('busctl',
2118 'src/busctl/busctl.c',
2119 'src/busctl/busctl-introspect.c',
2120 'src/busctl/busctl-introspect.h',
2121 include_directories : includes,
2122 link_with : [libshared],
2123 install_rpath : rootlibexecdir,
2125 public_programs += [exe]
2127 if conf.get('ENABLE_SYSUSERS') == 1
2128 exe = executable('systemd-sysusers',
2129 'src/sysusers/sysusers.c',
2130 include_directories : includes,
2131 link_with : [libshared],
2132 install_rpath : rootlibexecdir,
2134 install_dir : rootbindir)
2135 public_programs += [exe]
2138 if conf.get('ENABLE_TMPFILES') == 1
2139 exe = executable('systemd-tmpfiles',
2140 'src/tmpfiles/tmpfiles.c',
2141 include_directories : includes,
2142 link_with : [libshared],
2143 dependencies : [libacl],
2144 install_rpath : rootlibexecdir,
2146 install_dir : rootbindir)
2147 public_programs += [exe]
2150 if conf.get('ENABLE_HWDB') == 1
2151 exe = executable('systemd-hwdb',
2153 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2154 include_directories : includes,
2155 link_with : [libudev_internal],
2156 install_rpath : udev_rpath,
2158 install_dir : rootbindir)
2159 public_programs += [exe]
2162 if conf.get('ENABLE_QUOTACHECK') == 1
2163 executable('systemd-quotacheck',
2164 'src/quotacheck/quotacheck.c',
2165 include_directories : includes,
2166 link_with : [libshared],
2167 install_rpath : rootlibexecdir,
2169 install_dir : rootlibexecdir)
2172 exe = executable('systemd-socket-proxyd',
2173 'src/socket-proxy/socket-proxyd.c',
2174 include_directories : includes,
2175 link_with : [libshared],
2176 dependencies : [threads],
2177 install_rpath : rootlibexecdir,
2179 install_dir : rootlibexecdir)
2180 public_programs += [exe]
2182 exe = executable('systemd-udevd',
2183 systemd_udevd_sources,
2184 include_directories : includes,
2185 c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2186 link_with : [libudev_core,
2189 dependencies : [threads,
2194 install_rpath : udev_rpath,
2196 install_dir : rootlibexecdir)
2197 public_programs += [exe]
2199 exe = executable('udevadm',
2201 include_directories : includes,
2202 link_with : [libudev_core,
2205 dependencies : [threads,
2210 install_rpath : udev_rpath,
2212 install_dir : rootbindir)
2213 public_programs += [exe]
2215 executable('systemd-shutdown',
2216 systemd_shutdown_sources,
2217 include_directories : includes,
2218 link_with : [libshared],
2219 install_rpath : rootlibexecdir,
2221 install_dir : rootlibexecdir)
2223 executable('systemd-update-done',
2224 'src/update-done/update-done.c',
2225 include_directories : includes,
2226 link_with : [libshared],
2227 install_rpath : rootlibexecdir,
2229 install_dir : rootlibexecdir)
2231 executable('systemd-update-utmp',
2232 'src/update-utmp/update-utmp.c',
2233 include_directories : includes,
2234 link_with : [libshared],
2235 dependencies : [libaudit],
2236 install_rpath : rootlibexecdir,
2238 install_dir : rootlibexecdir)
2240 if conf.get('HAVE_KMOD') == 1
2241 executable('systemd-modules-load',
2242 'src/modules-load/modules-load.c',
2243 include_directories : includes,
2244 link_with : [libshared],
2245 dependencies : [libkmod],
2246 install_rpath : rootlibexecdir,
2248 install_dir : rootlibexecdir)
2250 meson.add_install_script('sh', '-c',
2251 mkdir_p.format(modulesloaddir))
2252 meson.add_install_script('sh', '-c',
2253 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2256 exe = executable('systemd-nspawn',
2257 systemd_nspawn_sources,
2258 'src/core/mount-setup.c', # FIXME: use a variable?
2259 'src/core/mount-setup.h',
2260 'src/core/loopback-setup.c',
2261 'src/core/loopback-setup.h',
2262 include_directories : [includes, include_directories('src/nspawn')],
2263 link_with : [libshared],
2264 dependencies : [libacl,
2268 install_rpath : rootlibexecdir,
2270 public_programs += [exe]
2272 if conf.get('ENABLE_NETWORKD') == 1
2273 executable('systemd-networkd',
2274 systemd_networkd_sources,
2275 include_directories : includes,
2276 link_with : [libnetworkd_core,
2280 dependencies : [threads],
2281 install_rpath : rootlibexecdir,
2283 install_dir : rootlibexecdir)
2285 executable('systemd-networkd-wait-online',
2286 systemd_networkd_wait_online_sources,
2287 include_directories : includes,
2288 link_with : [libnetworkd_core,
2290 install_rpath : rootlibexecdir,
2292 install_dir : rootlibexecdir)
2294 exe = executable('networkctl',
2296 include_directories : includes,
2297 link_with : [libsystemd_network,
2299 install_rpath : rootlibexecdir,
2301 install_dir : rootbindir)
2302 public_programs += [exe]
2304 ############################################################
2306 foreach tuple : tests
2308 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2309 dependencies = tuple[2]
2310 condition = tuple.length() >= 4 ? tuple[3] : ''
2311 type = tuple.length() >= 5 ? tuple[4] : ''
2312 defs = tuple.length() >= 6 ? tuple[5] : []
2313 incs = tuple.length() >= 7 ? tuple[6] : includes
2316 name = sources[0].split('/')[-1].split('.')[0]
2317 if type.startswith('timeout=')
2318 timeout = type.split('=')[1].to_int()
2322 if condition == '' or conf.get(condition) == 1
2326 include_directories : incs,
2327 link_with : link_with,
2328 dependencies : dependencies,
2330 install_rpath : rootlibexecdir,
2331 install : install_tests,
2332 install_dir : join_paths(testsdir, type))
2335 message('@0@ is a manual test'.format(name))
2336 elif type == 'unsafe' and want_tests != 'unsafe'
2337 message('@0@ is an unsafe test'.format(name))
2344 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2348 test_libsystemd_sym = executable(
2349 'test-libsystemd-sym',
2350 test_libsystemd_sym_c,
2351 include_directories : includes,
2352 link_with : [libsystemd],
2353 install : install_tests,
2354 install_dir : testsdir)
2355 test('test-libsystemd-sym',
2356 test_libsystemd_sym)
2358 test_libudev_sym = executable(
2361 include_directories : includes,
2362 c_args : ['-Wno-deprecated-declarations'],
2363 link_with : [libudev],
2364 install : install_tests,
2365 install_dir : testsdir)
2366 test('test-libudev-sym',
2369 ############################################################
2371 make_directive_index_py = find_program('tools/make-directive-index.py')
2372 make_man_index_py = find_program('tools/make-man-index.py')
2373 xml_helper_py = find_program('tools/xml_helper.py')
2374 hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2378 subdir('sysusers.d')
2379 subdir('tmpfiles.d')
2383 subdir('shell-completion/bash')
2384 subdir('shell-completion/zsh')
2385 subdir('docs/sysvinit')
2386 subdir('docs/var-log')
2388 # FIXME: figure out if the warning is true:
2389 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2390 install_subdir('factory/etc',
2391 install_dir : factorydir)
2394 install_data('xorg/50-systemd-user.sh',
2395 install_dir : xinitrcdir)
2396 install_data('system-preset/90-systemd.preset',
2397 install_dir : systempresetdir)
2398 install_data('modprobe.d/systemd.conf',
2399 install_dir : modprobedir)
2400 install_data('README',
2407 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2408 install_dir : docdir)
2410 meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2411 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2413 ############################################################
2415 meson_check_help = find_program('tools/meson-check-help.sh')
2417 foreach exec : public_programs
2418 name = exec.full_path().split('/')[-1]
2419 test('check-help-' + name,
2421 args : [exec.full_path()])
2424 ############################################################
2427 all_files = run_command(
2429 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2432 all_files = files(all_files.stdout().split())
2437 command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2441 command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2445 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2448 command : [meson_git_contrib_sh])
2452 git_head = run_command(
2454 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2455 'rev-parse', 'HEAD']).stdout().strip()
2456 git_head_short = run_command(
2458 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2459 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
2463 command : ['git', 'archive',
2464 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
2466 '--prefix', 'systemd-@0@/'.format(git_head),
2470 ############################################################
2473 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
2475 'prefix directory: @0@'.format(prefixdir),
2476 'rootprefix directory: @0@'.format(rootprefixdir),
2477 'sysconf directory: @0@'.format(sysconfdir),
2478 'include directory: @0@'.format(includedir),
2479 'lib directory: @0@'.format(libdir),
2480 'rootlib directory: @0@'.format(rootlibdir),
2481 'SysV init scripts: @0@'.format(sysvinit_path),
2482 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
2483 'PAM modules directory: @0@'.format(pamlibdir),
2484 'PAM configuration directory: @0@'.format(pamconfdir),
2485 'RPM macros directory: @0@'.format(rpmmacrosdir),
2486 'modprobe.d directory: @0@'.format(modprobedir),
2487 'D-Bus policy directory: @0@'.format(dbuspolicydir),
2488 'D-Bus session directory: @0@'.format(dbussessionservicedir),
2489 'D-Bus system directory: @0@'.format(dbussystemservicedir),
2490 'bash completions directory: @0@'.format(bashcompletiondir),
2491 'zsh completions directory: @0@'.format(zshcompletiondir),
2492 'extra start script: @0@'.format(get_option('rc-local')),
2493 'extra stop script: @0@'.format(get_option('halt-local')),
2494 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
2495 get_option('debug-tty')),
2496 'TTY GID: @0@'.format(tty_gid),
2497 'maximum system UID: @0@'.format(system_uid_max),
2498 'maximum system GID: @0@'.format(system_gid_max),
2499 '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
2500 'render group access mode: @0@'.format(get_option('group-render-mode')),
2501 'certificate root directory: @0@'.format(get_option('certificate-root')),
2502 'support URL: @0@'.format(support_url),
2503 'nobody user name: @0@'.format(get_option('nobody-user')),
2504 'nobody group name: @0@'.format(get_option('nobody-group')),
2505 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
2506 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
2508 'default DNSSEC mode: @0@'.format(default_dnssec),
2509 'default cgroup hierarchy: @0@'.format(default_hierarchy),
2510 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
2512 alt_dns_servers = '\n '.join(dns_servers.split(' '))
2513 alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
2515 'default DNS servers: @0@'.format(alt_dns_servers),
2516 'default NTP servers: @0@'.format(alt_ntp_servers)]
2518 alt_time_epoch = run_command('date', '-Is', '-u', '-d',
2519 '@@0@'.format(time_epoch)).stdout().strip()
2521 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
2524 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
2525 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
2526 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
2528 if conf.get('ENABLE_EFI') == 1
2530 'efi arch: @0@'.format(efi_arch)]
2534 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
2535 'EFI CC @0@'.format(efi_cc),
2536 'EFI lib directory: @0@'.format(efi_libdir),
2537 'EFI lds directory: @0@'.format(efi_ldsdir),
2538 'EFI include directory: @0@'.format(efi_incdir)]
2591 ['legacy pkla', install_polkit_pkla],
2593 ['gnu-efi', have_gnu_efi],
2599 ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
2602 ['man pages', want_man],
2603 ['html pages', want_html],
2604 ['man page indices', want_man and have_lxml],
2605 ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
2610 ['adm group', get_option('adm-group')],
2611 ['wheel group', get_option('wheel-group')],
2614 ['debug mmap cache'],
2617 cond = tuple.get(1, '')
2619 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
2620 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
2621 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
2626 missing += [tuple[0]]
2632 'enabled features: @0@'.format(', '.join(found)),
2634 'disabled features: @0@'.format(', '.join(missing)),
2636 message('\n '.join(status))
2638 if rootprefixdir != rootprefix_default
2639 message('WARNING:\n' +
2640 ' Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
2641 ' systemd used fixed names for unit file directories and other paths, so anything\n' +
2642 ' except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))