]> git.ipfire.org Git - thirdparty/systemd.git/blame_incremental - meson.build
meson: add option to disable libacl support
[thirdparty/systemd.git] / meson.build
... / ...
CommitLineData
1project('systemd', 'c',
2 version : '233',
3 license : 'LGPLv2+',
4 default_options: [
5 'c_std=gnu99',
6 'prefix=/usr',
7 'sysconfdir=/etc',
8 'localstatedir=/var',
9 ],
10 meson_version : '>= 0.39.1',
11 )
12
13# We need the same data in three different formats, ugh!
14# Also, for hysterical reasons, we use different variable
15# names, sometimes. Not all variables are included in every
16# set. Ugh, ugh, ugh!
17conf = configuration_data()
18conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
19conf.set_quoted('PACKAGE_VERSION', meson.project_version())
20
21substs = configuration_data()
22substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
23substs.set('PACKAGE_VERSION', meson.project_version())
24
25m4_defines = []
26
27#####################################################################
28
29rootprefixdir = get_option('rootprefix')
30if get_option('split-usr')
31 conf.set('HAVE_SPLIT_USR', 1)
32 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/'
33else
34 rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr'
35endif
36
37sysvinit_path = get_option('sysvinit-path')
38sysvrcnd_path = get_option('sysvrcnd-path')
39if sysvinit_path != '' or sysvrcnd_path != ''
40 conf.set('HAVE_SYSV_COMPAT', 1,
41 description : 'SysV init scripts and rcN.d links are supported')
42 m4_defines += ['-DHAVE_SYSV_COMPAT']
43endif
44
45# join_paths ignore the preceding arguments if an absolute component is
46# encountered, so this should canonicalize various paths when they are
47# absolute or relative.
48prefixdir = get_option('prefix')
49if not prefixdir.startswith('/')
50 error('Prefix is not absolute: "@0@"'.format(prefixdir))
51endif
52bindir = join_paths(prefixdir, get_option('bindir'))
53libdir = join_paths(prefixdir, get_option('libdir'))
54sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
55includedir = join_paths(prefixdir, get_option('includedir'))
56datadir = join_paths(prefixdir, get_option('datadir'))
57localstatedir = join_paths('/', get_option('localstatedir'))
58
59rootbindir = join_paths(rootprefixdir, 'bin')
60rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
61
62rootlibdir = get_option('rootlibdir')
63if rootlibdir == ''
64 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
65endif
66
67# Dirs of external packages
68pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
69pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
70polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
71polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
72polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
73varlogdir = join_paths(localstatedir, 'log')
74xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
75rpmmacrosdir = get_option('rpmmacrosdir')
76
77# Our own paths
78pkgdatadir = join_paths(datadir, 'systemd')
79environmentdir = join_paths(prefixdir, 'lib/environment.d')
80pkgsysconfdir = join_paths(sysconfdir, 'systemd')
81userunitdir = join_paths(prefixdir, 'lib/systemd/user')
82userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
83tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
84sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
85sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
86binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
87modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
88networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
89pkgincludedir = join_paths(includedir, 'systemd')
90systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
91usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
92systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
93userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
94systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
95systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
96systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
97systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
98udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
99udevhomedir = udevlibexecdir
100udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
101udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
102catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
103kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
104factorydir = join_paths(datadir, 'factory')
105docdir = join_paths(datadir, 'doc/systemd')
106bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
107testsdir = join_paths(prefixdir, 'lib/systemd/tests')
108systemdstatedir = join_paths(localstatedir, 'lib/systemd')
109catalogstatedir = join_paths(systemdstatedir, 'catalog')
110randomseeddir = join_paths(localstatedir, 'lib/systemd')
111
112dbuspolicydir = get_option('dbuspolicydir')
113if dbuspolicydir == ''
114 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
115endif
116
117dbussessionservicedir = get_option('dbussessionservicedir')
118if dbussessionservicedir == ''
119 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
120endif
121
122dbussystemservicedir = get_option('dbussystemservicedir')
123if dbussystemservicedir == ''
124 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
125endif
126
127pamlibdir = get_option('pamlibdir')
128if pamlibdir == ''
129 pamlibdir = join_paths(rootlibdir, 'security')
130endif
131
132pamconfdir = get_option('pamconfdir')
133if pamconfdir == ''
134 pamconfdir = join_paths(sysconfdir, 'pam.d')
135endif
136
137conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
138conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
139conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
140conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
141conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
142conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
143conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
144conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
145conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
146conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
147conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
148conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
149conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
150conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
151conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
152conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
153conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
154conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
155conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
156conf.set_quoted('ROOTPREFIX', rootprefixdir)
157conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
158conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
159conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
160conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
161conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
162conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
163conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
164conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
165conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
166conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
167conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
168conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
169conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
170conf.set_quoted('LIBDIR', libdir)
171conf.set_quoted('ROOTLIBDIR', rootlibdir)
172conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
173conf.set_quoted('BOOTLIBDIR', bootlibdir)
174conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
175conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
176conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
177conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
178conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
179conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
180
181conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
182conf.set_quoted('ABS_SRC_DIR', meson.source_root())
183
184substs.set('prefix', prefixdir)
185substs.set('exec_prefix', prefixdir)
186substs.set('libdir', libdir)
187substs.set('rootlibdir', rootlibdir)
188substs.set('includedir', includedir)
189substs.set('pkgsysconfdir', pkgsysconfdir)
190substs.set('bindir', bindir)
191substs.set('rootbindir', rootbindir)
192substs.set('rootlibexecdir', rootlibexecdir)
193substs.set('systemunitdir', systemunitdir)
194substs.set('userunitdir', userunitdir)
195substs.set('systempresetdir', systempresetdir)
196substs.set('userpresetdir', userpresetdir)
197substs.set('udevhwdbdir', udevhwdbdir)
198substs.set('udevrulesdir', udevrulesdir)
199substs.set('udevlibexecdir', udevlibexecdir)
200substs.set('catalogdir', catalogdir)
201substs.set('tmpfilesdir', tmpfilesdir)
202substs.set('sysusersdir', sysusersdir)
203substs.set('sysctldir', sysctldir)
204substs.set('binfmtdir', binfmtdir)
205substs.set('modulesloaddir', modulesloaddir)
206substs.set('systemgeneratordir', systemgeneratordir)
207substs.set('usergeneratordir', usergeneratordir)
208substs.set('systemenvgeneratordir', systemenvgeneratordir)
209substs.set('userenvgeneratordir', userenvgeneratordir)
210substs.set('systemshutdowndir', systemshutdowndir)
211substs.set('systemsleepdir', systemsleepdir)
212substs.set('VARLOGDIR', varlogdir)
213substs.set('CERTIFICATEROOT', get_option('certificate-root'))
214substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
215substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
216substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
217substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
218substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
219substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
220
221#####################################################################
222
223cc = meson.get_compiler('c')
224pkgconfig = import('pkgconfig')
225
226foreach arg : ['-Wundef',
227 '-Wlogical-op',
228 '-Wmissing-include-dirs',
229 '-Wold-style-definition',
230 '-Wpointer-arith',
231 '-Winit-self',
232 '-Wdeclaration-after-statement',
233 '-Wfloat-equal',
234 '-Wsuggest-attribute=noreturn',
235 '-Werror=missing-prototypes',
236 '-Werror=implicit-function-declaration',
237 '-Werror=missing-declarations',
238 '-Werror=return-type',
239 '-Werror=incompatible-pointer-types',
240 '-Werror=format=2',
241 '-Wstrict-prototypes',
242 '-Wredundant-decls',
243 '-Wmissing-noreturn',
244 '-Wshadow',
245 '-Wendif-labels',
246 '-Wstrict-aliasing=2',
247 '-Wwrite-strings',
248 '-Wno-unused-parameter',
249 '-Wno-missing-field-initializers',
250 '-Wno-unused-result',
251 '-Wno-format-signedness',
252 '-Werror=overflow',
253 '-Wdate-time',
254 '-Wnested-externs',
255 '-ffast-math',
256 '-fno-common',
257 '-fdiagnostics-show-option',
258 '-fno-strict-aliasing',
259 '-fvisibility=hidden',
260 '-fstack-protector',
261 '-fstack-protector-strong',
262 '-fPIE',
263 '--param=ssp-buffer-size=4',
264 ]
265 if cc.has_argument(arg)
266 add_project_arguments(arg, language : 'c')
267 endif
268endforeach
269
270if cc.compiles('
271 #include <time.h>
272 #include <inttypes.h>
273 typedef uint64_t usec_t;
274 usec_t now(clockid_t clock);
275 int main(void) {
276 struct timespec now;
277 return 0;
278 }
279')
280 # TODO: message?
281 add_project_arguments('-Werror=shadow', language : 'c')
282endif
283
284if cc.get_id() == 'clang'
285 foreach arg : ['-Wno-typedef-redefinition',
286 '-Wno-gnu-variable-sized-type-not-at-end',
287 ]
288 if cc.has_argument(arg)
289 add_project_arguments(arg, language : 'c')
290 endif
291 endforeach
292endif
293
294# --as-needed and --no-undefined are provided by meson by default,
295# run mesonconf to see what is enabled
296foreach arg : ['-Wl,-z,relro',
297 '-Wl,-z,now',
298 '-pie',
299 '-Wl,-fuse-ld=gold',
300 ]
301 if cc.has_argument(arg)
302 add_project_link_arguments(arg, language : 'c')
303 endif
304endforeach
305
306cpp = ' '.join(cc.cmd_array()) + ' -E'
307
308#####################################################################
309# compilation result tests
310
311conf.set('_GNU_SOURCE', 1)
312conf.set('__SANE_USERSPACE_TYPES__', 1)
313
314conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
315conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
316conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
317conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
318conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
319conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
320conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
321
322decl_headers = '''
323#include <uchar.h>
324#include <linux/ethtool.h>
325'''
326# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
327
328foreach decl : ['char16_t',
329 'char32_t',
330 'key_serial_t',
331 'struct ethtool_link_settings',
332 ]
333 if cc.sizeof(decl, prefix : decl_headers) > 0
334 # We get -1 if the size cannot be determined
335 conf.set('HAVE_' + decl.underscorify().to_upper(), 1)
336 endif
337endforeach
338
339foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
340 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
341 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
342 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
343 ['IFLA_IPVLAN_MODE', 'linux/if_link.h'],
344 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
345 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
346 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
347 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
348 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
349 # if_tunnel.h is buggy and cannot be included on its own
350 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
351 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
352 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
353 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
354 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
355 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
356 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
357 ['NDA_IFINDEX', 'linux/neighbour.h'],
358 ['IFA_FLAGS', 'linux/if_addr.h'],
359 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
360 ]
361 prefix = decl.length() > 2 ? decl[2] : ''
362 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
363 conf.set10('HAVE_DECL_' + decl[0], have)
364endforeach
365
366skip = false
367foreach ident : ['secure_getenv', '__secure_getenv']
368 if not skip and cc.has_function(ident)
369 conf.set('HAVE_' + ident.to_upper(), 1)
370 skip = true
371 endif
372endforeach
373
374foreach ident : [
375 ['memfd_create', '''#include <sys/memfd.h>'''],
376 ['gettid', '''#include <sys/types.h>'''],
377 ['pivot_root', '''#include <stdlib.h>'''], # no known header declares pivot_root
378 ['name_to_handle_at', '''#define _GNU_SOURCE
379 #include <sys/types.h>
380 #include <sys/stat.h>
381 #include <fcntl.h>'''],
382 ['setns', '''#define _GNU_SOURCE
383 #include <sched.h>'''],
384 ['renameat2', '''#include <stdio.h>'''],
385 ['kcmp', '''#include <linux/kcmp.h>'''],
386 ['keyctl', '''#include <sys/types.h>
387 #include <keyutils.h>'''],
388 ['copy_file_range', '''#include <sys/syscall.h>
389 #include <unistd.h>'''],
390 ['explicit_bzero' , '''#include <string.h>'''],
391]
392
393 have = cc.has_function(ident[0], prefix : ident[1])
394 conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
395endforeach
396
397if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
398 conf.set('USE_SYS_RANDOM_H', 1)
399 conf.set10('HAVE_DECL_GETRANDOM', 1)
400else
401 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
402 conf.set10('HAVE_DECL_GETRANDOM', have)
403endif
404
405#####################################################################
406
407sed = find_program('sed')
408grep = find_program('grep')
409awk = find_program('awk')
410m4 = find_program('/usr/bin/m4')
411stat = find_program('stat')
412git = find_program('git', required : false)
413etags = find_program('etags', required : false)
414
415meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
416mkdir_p = 'mkdir -p $DESTDIR/@0@'
417check_compilation_sh = find_program('tools/meson-check-compilation.sh')
418test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
419splash_bmp = files('test/splash.bmp')
420
421# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
422# /usr/sbin, /sbin, and fall back to the default from middle column.
423progs = [['telinit', '/lib/sysvinit/telinit'],
424 ['quotaon', '/usr/sbin/quotaon' ],
425 ['quotacheck', '/usr/sbin/quotacheck' ],
426 ['kill', '/usr/bin/kill' ],
427 ['kmod', '/usr/bin/kmod' ],
428 ['kexec', '/usr/sbin/kexec' ],
429 ['sulogin', '/usr/sbin/sulogin' ],
430 ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
431 ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
432 ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
433 ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
434 ]
435foreach prog : progs
436 path = get_option(prog[0] + '-path')
437 if path != ''
438 message('Using @1@ for @0@'.format(prog[0], path))
439 else
440 exe = find_program(prog[0],
441 '/usr/sbin/' + prog[0],
442 '/sbin/' + prog[0],
443 required: false)
444 path = exe.found() ? exe.path() : prog[1]
445 endif
446 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
447 conf.set_quoted(name, path)
448 substs.set(name, path)
449endforeach
450
451if run_command('ln', '--relative', '--help').returncode() != 0
452 error('ln does not support --relative')
453endif
454
455############################################################
456
457gperf = find_program('gperf')
458
459gperf_test_format = '''
460#include <string.h>
461const char * in_word_set(const char *, @0@);
462@1@
463'''
464gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
465gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
466gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
467if cc.compiles(gperf_test)
468 gperf_len_type = 'size_t'
469else
470 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
471 if cc.compiles(gperf_test)
472 gperf_len_type = 'unsigned'
473 else
474 error('unable to determine gperf len type')
475 endif
476endif
477message('gperf len type is @0@'.format(gperf_len_type))
478conf.set('GPERF_LEN_TYPE', gperf_len_type,
479 description : 'The type of gperf "len" parameter')
480
481############################################################
482
483if not cc.has_header('sys/capability.h')
484 error('POSIX caps headers not found')
485endif
486foreach header : ['linux/btrfs.h',
487 'linux/memfd.h',
488 'linux/vm_sockets.h',
489 'valgrind/memcheck.h',
490 'valgrind/valgrind.h',
491 ]
492 if cc.has_header(header)
493 conf.set('HAVE_' + header.underscorify().to_upper(), 1)
494 endif
495endforeach
496
497############################################################
498
499conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
500
501default_hierarchy = get_option('default-hierarchy')
502conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
503 description : 'default cgroup hierarchy as string')
504if default_hierarchy == 'legacy'
505 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
506elif default_hierarchy == 'hybrid'
507 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
508else
509 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
510endif
511
512time_epoch = get_option('time-epoch')
513if time_epoch == ''
514 NEWS = files('NEWS')
515 time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
516endif
517time_epoch = time_epoch.to_int()
518conf.set('TIME_EPOCH', time_epoch)
519
520system_uid_max = get_option('system-uid-max')
521if system_uid_max == ''
522 system_uid_max = run_command(
523 awk,
524 'BEGIN { uid=999 } /^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
525 '/etc/login.defs').stdout()
526endif
527system_uid_max = system_uid_max.to_int()
528conf.set('SYSTEM_UID_MAX', system_uid_max)
529substs.set('systemuidmax', system_uid_max)
530message('Maximum system UID is @0@'.format(system_uid_max))
531
532conf.set_quoted('NOBODY_USER_NAME', get_option('nobody-user'))
533conf.set_quoted('NOBODY_GROUP_NAME', get_option('nobody-group'))
534
535system_gid_max = get_option('system-gid-max')
536if system_gid_max == ''
537 system_gid_max = run_command(
538 awk,
539 'BEGIN { gid=999 } /^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
540 '/etc/login.defs').stdout()
541endif
542system_gid_max = system_gid_max.to_int()
543conf.set('SYSTEM_GID_MAX', system_gid_max)
544substs.set('systemgidmax', system_gid_max)
545message('Maximum system GID is @0@'.format(system_gid_max))
546
547tty_gid = get_option('tty-gid')
548conf.set('TTY_GID', tty_gid)
549substs.set('TTY_GID', tty_gid)
550
551if get_option('adm-group')
552 m4_defines += ['-DENABLE_ADM_GROUP']
553endif
554
555if get_option('wheel-group')
556 m4_defines += ['-DENABLE_WHEEL_GROUP']
557endif
558
559substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
560
561kill_user_processes = get_option('default-kill-user-processes')
562conf.set10('KILL_USER_PROCESSES', kill_user_processes)
563substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
564
565default_dnssec = get_option('default-dnssec')
566conf.set('DEFAULT_DNSSEC_MODE',
567 'DNSSEC_' + default_dnssec.underscorify().to_upper())
568substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
569
570conf.set_quoted('DNS_SERVERS', get_option('dns-servers'))
571substs.set('DNS_SERVERS', get_option('dns-servers'))
572
573conf.set_quoted('NTP_SERVERS', get_option('ntp-servers'))
574substs.set('NTP_SERVERS', get_option('ntp-servers'))
575
576conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
577
578substs.set('SUSHELL', get_option('debug-shell'))
579substs.set('DEBUGTTY', get_option('debug-tty'))
580
581#####################################################################
582
583threads = dependency('threads')
584librt = cc.find_library('rt')
585libm = cc.find_library('m')
586libdl = cc.find_library('dl')
587libcrypt = cc.find_library('crypt')
588
589libcap = dependency('libcap')
590libmount = dependency('mount',
591 version : '>= 2.27')
592
593want_seccomp = get_option('seccomp')
594if want_seccomp != 'false'
595 libseccomp = dependency('libseccomp',
596 required : want_seccomp == 'true')
597 if libseccomp.found()
598 conf.set('HAVE_SECCOMP', 1)
599 m4_defines += ['-DHAVE_SECCOMP']
600 endif
601else
602 libseccomp = []
603endif
604
605want_selinux = get_option('selinux')
606if want_selinux != 'false'
607 libselinux = dependency('libselinux',
608 version : '>= 2.1.9',
609 required : want_selinux == 'true')
610 if libselinux.found()
611 conf.set('HAVE_SELINUX', 1)
612 m4_defines += ['-DHAVE_SELINUX']
613 endif
614else
615 libselinux = []
616endif
617
618want_apparmor = get_option('apparmor')
619if want_apparmor != 'false'
620 libapparmor = dependency('libapparmor',
621 required : want_apparmor == 'true')
622 if libapparmor.found()
623 conf.set('HAVE_APPARMOR', 1)
624 m4_defines += ['-DHAVE_APPARMOR']
625 endif
626else
627 libapparmor = []
628endif
629
630want_smack = get_option('smack')
631if want_smack != 'false'
632 libsmack = dependency('libsmack',
633 required : want_smack == 'true')
634 if libsmack.found()
635 conf.set('HAVE_SMACK', 1)
636 m4_defines += ['-DHAVE_SMACK']
637 endif
638else
639 libsmack = []
640endif
641
642smack_run_label = get_option('smack-run-label')
643if smack_run_label != ''
644 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
645 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
646endif
647
648want_polkit = get_option('polkit')
649install_polkit = false
650install_polkit_pkla = false
651if want_polkit != 'false'
652 conf.set('ENABLE_POLKIT', 1)
653 install_polkit = true
654
655 libpolkit = dependency('polkit-gobject-1',
656 required : false)
657 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
658 message('Old polkit detected, will install pkla files')
659 install_polkit_pkla = true
660 endif
661endif
662
663want_acl = get_option('acl')
664if want_acl != 'false'
665 libacl = cc.find_library('acl', required : want_acl == 'true')
666 if libacl.found()
667 conf.set('HAVE_ACL', 1)
668 m4_defines += ['-DHAVE_ACL']
669 endif
670else
671 libacl = []
672endif
673
674want_audit = get_option('audit')
675if want_audit != 'false'
676 libaudit = dependency('audit', required : want_audit == 'true')
677 if libaudit.found()
678 conf.set('HAVE_AUDIT', 1)
679 endif
680else
681 libaudit = []
682endif
683
684want_blkid = get_option('blkid')
685if want_blkid != 'false'
686 libblkid = dependency('blkid', required : want_blkid == 'true')
687 if libblkid.found()
688 conf.set('HAVE_BLKID', 1)
689 endif
690else
691 libblkid = []
692endif
693
694want_kmod = get_option('kmod')
695if want_kmod != 'false'
696 libkmod = dependency('libkmod',
697 version : '>= 15',
698 required : want_kmod == 'true')
699 if libkmod.found()
700 conf.set('HAVE_KMOD', 1)
701 endif
702else
703 libkmod = []
704endif
705
706want_pam = get_option('pam')
707if want_pam != 'false'
708 libpam = cc.find_library('pam', required : want_pam == 'true')
709 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
710 if libpam.found() and libpam_misc.found()
711 conf.set('HAVE_PAM', 1)
712 m4_defines += ['-DHAVE_PAM']
713 endif
714else
715 libpam = []
716 libpam_misc = []
717endif
718
719want_microhttpd = get_option('microhttpd')
720if want_microhttpd != 'false'
721 libmicrohttpd = dependency('libmicrohttpd',
722 version : '>= 0.9.33',
723 required : want_microhttpd == 'true')
724 if libmicrohttpd.found()
725 conf.set('HAVE_MICROHTTPD', 1)
726 m4_defines += ['-DHAVE_MICROHTTPD']
727 endif
728else
729 libmicrohttpd = []
730endif
731
732want_libcryptsetup = get_option('libcryptsetup')
733if want_libcryptsetup != 'false'
734 libcryptsetup = dependency('libcryptsetup',
735 version : '>= 1.6.0',
736 required : want_libcryptsetup == 'true')
737 if libcryptsetup.found()
738 conf.set('HAVE_LIBCRYPTSETUP', 1)
739 endif
740else
741 libcryptsetup = []
742endif
743
744want_libcurl = get_option('libcurl')
745if want_libcurl != 'false'
746 libcurl = dependency('libcurl',
747 version : '>= 7.32.0',
748 required : want_libcurl == 'true')
749 if libcurl.found()
750 conf.set('HAVE_LIBCURL', 1)
751 m4_defines += ['-DHAVE_LIBCURL']
752 endif
753else
754 libcurl = []
755endif
756
757want_libidn = get_option('libidn')
758if want_libidn != 'false'
759 libidn = dependency('libidn',
760 required : want_libidn == 'true')
761 if libidn.found()
762 conf.set('HAVE_LIBIDN', 1)
763 m4_defines += ['-DHAVE_LIBIDN']
764 endif
765else
766 libidn = []
767endif
768
769want_libiptc = get_option('libiptc')
770if want_libiptc != 'false'
771 libiptc = dependency('libiptc',
772 required : want_libiptc == 'true')
773 if libiptc.found()
774 conf.set('HAVE_LIBIPTC', 1)
775 m4_defines += ['-DHAVE_LIBIPTC']
776 endif
777else
778 libiptc = []
779endif
780
781want_qrencode = get_option('qrencode')
782if want_qrencode != 'false'
783 libqrencode = dependency('libqrencode',
784 required : want_qrencode == 'true')
785 if libqrencode.found()
786 conf.set('HAVE_QRENCODE', 1)
787 endif
788else
789 libqrencode = []
790endif
791
792want_gnutls = get_option('gnutls')
793if want_gnutls != 'false'
794 libgnutls = dependency('gnutls',
795 version : '>= 3.1.4',
796 required : want_gnutls == 'true')
797 if libgnutls.found()
798 conf.set('HAVE_GNUTLS', 1)
799 endif
800else
801 libgnutls = []
802endif
803
804want_elfutils = get_option('elfutils')
805if want_elfutils != 'false'
806 libdw = dependency('libdw',
807 required : want_elfutils == 'true')
808 if libdw.found()
809 conf.set('HAVE_ELFUTILS', 1)
810 endif
811else
812 libdw = []
813endif
814
815want_zlib = get_option('zlib')
816if want_zlib != 'false'
817 libz = dependency('zlib',
818 required : want_zlib == 'true')
819 if libz.found()
820 conf.set('HAVE_ZLIB', 1)
821 endif
822else
823 libz = []
824endif
825
826want_bzip2 = get_option('bzip2')
827if want_bzip2 != 'false'
828 libbzip2 = cc.find_library('bz2',
829 required : want_bzip2 == 'true')
830 if libbzip2.found()
831 conf.set('HAVE_BZIP2', 1)
832 endif
833else
834 libbzip2 = []
835endif
836
837want_xz = get_option('xz')
838if want_xz != 'false'
839 libxz = dependency('liblzma',
840 required : want_xz == 'true')
841 if libxz.found()
842 conf.set('HAVE_XZ', 1)
843 endif
844else
845 libxz = []
846endif
847
848want_lz4 = get_option('lz4')
849if want_lz4 != 'false'
850 liblz4 = dependency('liblz4',
851 required : want_lz4 == 'true')
852 if liblz4.found()
853 conf.set('HAVE_LZ4', 1)
854 endif
855else
856 liblz4 = []
857endif
858
859want_glib = get_option('glib')
860if want_glib != 'false'
861 libglib = dependency('glib-2.0',
862 version : '>= 2.22.0',
863 required : want_glib == 'true')
864 libgobject = dependency('gobject-2.0',
865 version : '>= 2.22.0',
866 required : want_glib == 'true')
867 libgio = dependency('gio-2.0',
868 required : want_glib == 'true')
869 if libglib.found() and libgobject.found() and libgio.found()
870 conf.set('HAVE_GLIB', 1)
871 endif
872else
873 libglib = []
874 libgobject = []
875 libgio = []
876endif
877
878want_xkbcommon = get_option('xkbcommon')
879if want_xkbcommon != 'false'
880 libxkbcommon = dependency('xkbcommon',
881 version : '>= 0.3.0',
882 required : want_xkbcommon == 'true')
883 if libxkbcommon.found()
884 conf.set('HAVE_XKBCOMMON', 1)
885 endif
886else
887 libxkbcommon = []
888endif
889
890want_dbus = get_option('dbus')
891if want_dbus != 'false'
892 libdbus = dependency('dbus-1',
893 version : '>= 1.3.2',
894 required : want_dbus == 'true')
895 if libdbus.found()
896 conf.set('HAVE_DBUS', 1)
897 endif
898else
899 libdbus = []
900endif
901
902want_libgcrypt = get_option('libgcrypt')
903if want_libgcrypt != 'false'
904 libgcrypt = cc.find_library('gcrypt', required : want_libgcrypt == 'true')
905 if libgcrypt.found()
906 conf.set('HAVE_LIBGCRYPT', 1)
907 endif
908else
909 libgcrypt = []
910endif
911
912want_importd = get_option('importd')
913if want_importd != 'false'
914 have_deps = (conf.get('HAVE_LIBCURL', 0) == 1 and
915 conf.get('HAVE_ZLIB', 0) == 1 and
916 conf.get('HAVE_BZIP2', 0) == 1 and
917 conf.get('HAVE_XZ', 0) == 1 and
918 conf.get('HAVE_LIBGCRYPT', 0) == 1)
919 if have_deps
920 conf.set('ENABLE_IMPORTD', 1)
921 elif want_importd == 'true'
922 error('importd support was requested, but dependencies are not available')
923 endif
924endif
925
926want_remote = get_option('remote')
927if want_remote != 'false'
928 have_deps = [conf.get('HAVE_MICROHTTPD', 0) == 1,
929 conf.get('HAVE_LIBCURL', 0) == 1]
930 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
931 # it's possible to build one without the other. Complain only if
932 # support was explictly requested. The auxiliary files like sysusers
933 # config should be installed when any of the programs are built.
934 if want_remote == 'true' and not (have_deps[0] and have_deps[1])
935 error('remote support was requested, but dependencies are not available')
936 endif
937 if have_deps[0] or have_deps[1]
938 conf.set('ENABLE_REMOTE', 1)
939 endif
940endif
941
942foreach pair : [['utmp', 'HAVE_UTMP'],
943 ['hibernate', 'ENABLE_HIBERNATE'],
944 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
945 ['binfmt', 'ENABLE_BINFMT'],
946 ['coredump', 'ENABLE_COREDUMP'],
947 ['resolve', 'ENABLE_RESOLVED'],
948 ['logind', 'ENABLE_LOGIND'],
949 ['hostnamed', 'ENABLE_HOSTNAMED'],
950 ['localed', 'ENABLE_LOCALED'],
951 ['machined', 'ENABLE_MACHINED'],
952 ['networkd', 'ENABLE_NETWORKD'],
953 ['timedated', 'ENABLE_TIMEDATED'],
954 ['timesyncd', 'ENABLE_TIMESYNCD'],
955 ['myhostname', 'HAVE_MYHOSTNAME'],
956 ['firstboot', 'ENABLE_FIRSTBOOT'],
957 ['randomseed', 'ENABLE_RANDOMSEED'],
958 ['backlight', 'ENABLE_BACKLIGHT'],
959 ['vconsole', 'ENABLE_VCONSOLE'],
960 ['quotacheck', 'ENABLE_QUOTACHECK'],
961 ['sysusers', 'ENABLE_SYSUSERS'],
962 ['tmpfiles', 'ENABLE_TMPFILES'],
963 ['hwdb', 'ENABLE_HWDB'],
964 ['rfkill', 'ENABLE_RFKILL'],
965 ['ldconfig', 'ENABLE_LDCONFIG'],
966 ['efi', 'ENABLE_EFI'],
967 ['ima', 'HAVE_IMA'],
968 ]
969
970 if get_option(pair[0])
971 conf.set(pair[1], 1)
972 m4_defines += ['-D' + pair[1]]
973 endif
974endforeach
975
976want_tests = get_option('tests')
977install_tests = get_option('install-tests')
978tests = []
979
980#####################################################################
981
982if get_option('efi')
983 efi_arch = host_machine.cpu_family()
984
985 if efi_arch == 'x86'
986 EFI_MACHINE_TYPE_NAME = 'ia32'
987 gnu_efi_arch = 'ia32'
988 elif efi_arch == 'x86_64'
989 EFI_MACHINE_TYPE_NAME = 'x64'
990 gnu_efi_arch = 'x86_64'
991 elif efi_arch == 'arm'
992 EFI_MACHINE_TYPE_NAME = 'arm'
993 gnu_efi_arch = 'arm'
994 elif efi_arch == 'aarch64'
995 EFI_MACHINE_TYPE_NAME = 'aa64'
996 gnu_efi_arch = 'aarch64'
997 else
998 EFI_MACHINE_TYPE_NAME = ''
999 gnu_efi_arch = ''
1000 endif
1001
1002 conf.set('ENABLE_EFI', 1)
1003 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1004endif
1005
1006#####################################################################
1007
1008config_h = configure_file(
1009 output : 'config.h',
1010 configuration : conf)
1011
1012includes = include_directories('src/basic',
1013 'src/shared',
1014 'src/systemd',
1015 'src/journal',
1016 'src/resolve',
1017 'src/timesync',
1018 'src/login',
1019 'src/udev',
1020 'src/libudev',
1021 'src/core',
1022 'src/libsystemd/sd-bus',
1023 'src/libsystemd/sd-device',
1024 'src/libsystemd/sd-hwdb',
1025 'src/libsystemd/sd-id128',
1026 'src/libsystemd/sd-netlink',
1027 'src/libsystemd/sd-network',
1028 'src/libsystemd-network',
1029 )
1030
1031add_project_arguments('-include', 'config.h', language : 'c')
1032
1033gcrypt_util_sources = files('src/shared/gcrypt-util.h',
1034 'src/shared/gcrypt-util.c')
1035
1036subdir('po')
1037subdir('catalog')
1038subdir('src/systemd')
1039subdir('src/basic')
1040subdir('src/libsystemd')
1041subdir('src/libsystemd-network')
1042subdir('src/journal')
1043subdir('src/login')
1044
1045libjournal_core = static_library(
1046 'journal-core',
1047 libjournal_core_sources,
1048 journald_gperf_c,
1049 include_directories : includes,
1050 install : false)
1051
1052libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1053libsystemd = shared_library(
1054 'systemd',
1055 libsystemd_internal_sources,
1056 journal_internal_sources,
1057 version : '0.18.0',
1058 include_directories : includes,
1059 link_args : ['-shared',
1060 '-Wl,--version-script=' + libsystemd_sym_path],
1061 link_with : [libbasic],
1062 dependencies : [threads,
1063 librt,
1064 libxz,
1065 liblz4],
1066 link_depends : libsystemd_sym,
1067 install : true,
1068 install_dir : rootlibdir)
1069
1070############################################################
1071
1072# binaries that have --help and are intended for use by humans,
1073# usually, but not always, installed in /bin.
1074public_programs = []
1075
1076subdir('src/libudev')
1077subdir('src/shared')
1078subdir('src/core')
1079subdir('src/udev')
1080subdir('src/network')
1081
1082subdir('src/analyze')
1083subdir('src/journal-remote')
1084subdir('src/coredump')
1085subdir('src/hostname')
1086subdir('src/import')
1087subdir('src/kernel-install')
1088subdir('src/locale')
1089subdir('src/machine')
1090subdir('src/nspawn')
1091subdir('src/resolve')
1092subdir('src/timedate')
1093subdir('src/timesync')
1094subdir('src/vconsole')
1095subdir('src/sulogin-shell')
1096subdir('src/boot/efi')
1097
1098subdir('src/test')
1099subdir('test')
1100
1101############################################################
1102
1103# only static linking apart from libdl, to make sure that the
1104# module is linked to all libraries that it uses.
1105test_dlopen = executable(
1106 'test-dlopen',
1107 test_dlopen_c,
1108 include_directories : includes,
1109 link_with : [libbasic],
1110 dependencies : [libdl])
1111
1112foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME', []],
1113 ['systemd', '', []],
1114 ['mymachines', 'ENABLE_MACHINED', []],
1115 ['resolve', 'ENABLE_RESOLVED', [libdl]]]
1116
1117 condition = tuple[1] == '' or conf.get(tuple[1], 0) == 1
1118 if condition
1119 module = tuple[0]
1120 extra_deps = tuple[2]
1121
1122 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1123 version_script_arg = join_paths(meson.current_source_dir(), sym)
1124
1125 nss = shared_library(
1126 'nss_' + module,
1127 'src/nss-@0@/nss-@0@.c'.format(module),
1128 version : '2',
1129 include_directories : includes,
1130 link_args : ['-shared',
1131 '-Wl,--version-script=' + version_script_arg,
1132 '-Wl,--undefined'],
1133 link_with : [libsystemd_internal,
1134 libbasic],
1135 dependencies : [threads,
1136 librt] + extra_deps,
1137 link_depends : sym,
1138 install : true,
1139 install_dir : rootlibdir)
1140
1141 # We cannot use shared_module because it does not support version suffix.
1142 # Unfortunately shared_library insists on creating the symlink…
1143 meson.add_install_script('sh', '-c',
1144 'rm $DESTDIR@0@/libnss_@1@.so'
1145 .format(rootlibdir, module))
1146
1147 test('dlopen-nss_' + module,
1148 test_dlopen,
1149 args : [nss.full_path()]) # path to dlopen must include a slash
1150 endif
1151endforeach
1152
1153############################################################
1154
1155executable('systemd',
1156 systemd_sources,
1157 include_directories : includes,
1158 link_with : [libcore,
1159 libshared,
1160 libudev],
1161 dependencies : [threads,
1162 librt,
1163 libseccomp,
1164 libselinux,
1165 libmount,
1166 libblkid],
1167 install_rpath : rootlibexecdir,
1168 install : true,
1169 install_dir : rootlibexecdir)
1170
1171exe = executable('systemd-analyze',
1172 systemd_analyze_sources,
1173 include_directories : includes,
1174 link_with : [libcore,
1175 libudev,
1176 libshared],
1177 dependencies : [threads,
1178 librt,
1179 libseccomp,
1180 libselinux,
1181 libmount,
1182 libblkid],
1183 install_rpath : rootlibexecdir,
1184 install : true)
1185public_programs += [exe]
1186
1187executable('systemd-journald',
1188 systemd_journald_sources,
1189 include_directories : includes,
1190 link_with : [libjournal_core,
1191 libshared,
1192 libudev],
1193 dependencies : [threads,
1194 libxz,
1195 liblz4,
1196 libselinux],
1197 install_rpath : rootlibexecdir,
1198 install : true,
1199 install_dir : rootlibexecdir)
1200
1201exe = executable('systemd-cat',
1202 systemd_cat_sources,
1203 include_directories : includes,
1204 link_with : [libjournal_core,
1205 libshared,
1206 libudev],
1207 dependencies : [threads],
1208 install_rpath : rootlibexecdir,
1209 install : true)
1210public_programs += [exe]
1211
1212exe = executable('journalctl',
1213 journalctl_sources,
1214 include_directories : includes,
1215 link_with : [libshared,
1216 libudev],
1217 dependencies : [threads,
1218 libqrencode,
1219 libxz,
1220 liblz4],
1221 install_rpath : rootlibexecdir,
1222 install : true,
1223 install_dir : rootbindir)
1224public_programs += [exe]
1225
1226executable('systemd-getty-generator',
1227 'src/getty-generator/getty-generator.c',
1228 include_directories : includes,
1229 link_with : [libshared],
1230 install_rpath : rootlibexecdir,
1231 install : true,
1232 install_dir : systemgeneratordir)
1233
1234executable('systemd-debug-generator',
1235 'src/debug-generator/debug-generator.c',
1236 include_directories : includes,
1237 link_with : [libshared],
1238 install_rpath : rootlibexecdir,
1239 install : true,
1240 install_dir : systemgeneratordir)
1241
1242executable('systemd-fstab-generator',
1243 'src/fstab-generator/fstab-generator.c',
1244 'src/core/mount-setup.c',
1245 include_directories : includes,
1246 link_with : [libshared],
1247 install_rpath : rootlibexecdir,
1248 install : true,
1249 install_dir : systemgeneratordir)
1250
1251if conf.get('ENABLE_ENVIRONMENT_D', 0) == 1
1252 executable('30-systemd-environment-d-generator',
1253 'src/environment-d-generator/environment-d-generator.c',
1254 include_directories : includes,
1255 link_with : [libshared],
1256 install_rpath : rootlibexecdir,
1257 install : true,
1258 install_dir : userenvgeneratordir)
1259
1260 meson.add_install_script(meson_make_symlink,
1261 join_paths(sysconfdir, 'environment'),
1262 join_paths(environmentdir, '99-environment.conf'))
1263endif
1264
1265if conf.get('ENABLE_HIBERNATE', 0) == 1
1266 executable('systemd-hibernate-resume-generator',
1267 'src/hibernate-resume/hibernate-resume-generator.c',
1268 include_directories : includes,
1269 link_with : [libshared],
1270 install_rpath : rootlibexecdir,
1271 install : true,
1272 install_dir : systemgeneratordir)
1273
1274 executable('systemd-hibernate-resume',
1275 'src/hibernate-resume/hibernate-resume.c',
1276 include_directories : includes,
1277 link_with : [libshared],
1278 install_rpath : rootlibexecdir,
1279 install : true,
1280 install_dir : rootlibexecdir)
1281endif
1282
1283if conf.get('HAVE_BLKID', 0) == 1
1284 executable('systemd-gpt-auto-generator',
1285 'src/gpt-auto-generator/gpt-auto-generator.c',
1286 'src/basic/blkid-util.h',
1287 include_directories : includes,
1288 link_with : [libshared,
1289 libudev],
1290 dependencies : libblkid,
1291 install_rpath : rootlibexecdir,
1292 install : true,
1293 install_dir : systemgeneratordir)
1294
1295 exe = executable('systemd-dissect',
1296 'src/dissect/dissect.c',
1297 include_directories : includes,
1298 link_with : [libshared],
1299 install_rpath : rootlibexecdir,
1300 install : true,
1301 install_dir : rootlibexecdir)
1302 public_programs += [exe]
1303endif
1304
1305if conf.get('ENABLE_RESOLVED', 0) == 1
1306 executable('systemd-resolved',
1307 systemd_resolved_sources,
1308 include_directories : includes,
1309 link_with : [libshared],
1310 dependencies : [threads,
1311 libm,
1312 libidn],
1313 install_rpath : rootlibexecdir,
1314 install : true,
1315 install_dir : rootlibexecdir)
1316
1317 exe = executable('systemd-resolve',
1318 systemd_resolve_sources,
1319 include_directories : includes,
1320 link_with : [libshared],
1321 dependencies : [threads,
1322 libm,
1323 libidn],
1324 install_rpath : rootlibexecdir,
1325 install : true)
1326 public_programs += [exe]
1327endif
1328
1329if conf.get('ENABLE_LOGIND', 0) == 1
1330 executable('systemd-logind',
1331 systemd_logind_sources,
1332 include_directories : includes,
1333 link_with : [liblogind_core,
1334 libshared,
1335 libudev],
1336 dependencies : [threads,
1337 libacl],
1338 install_rpath : rootlibexecdir,
1339 install : true,
1340 install_dir : rootlibexecdir)
1341
1342 exe = executable('loginctl',
1343 loginctl_sources,
1344 include_directories : includes,
1345 link_with : [libshared,
1346 libudev],
1347 dependencies : [threads,
1348 liblz4,
1349 libxz],
1350 install_rpath : rootlibexecdir,
1351 install : true,
1352 install_dir : rootbindir)
1353 public_programs += [exe]
1354
1355 exe = executable('systemd-inhibit',
1356 'src/login/inhibit.c',
1357 include_directories : includes,
1358 link_with : [libshared],
1359 install_rpath : rootlibexecdir,
1360 install : true,
1361 install_dir : rootbindir)
1362 public_programs += [exe]
1363
1364 if conf.get('HAVE_PAM', 0) == 1
1365 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1366 pam_systemd = shared_library(
1367 'pam_systemd',
1368 pam_systemd_c,
1369 name_prefix : '',
1370 include_directories : includes,
1371 link_args : ['-shared',
1372 '-Wl,--version-script=' + version_script_arg],
1373 link_with : [libsystemd_internal,
1374 libshared_static],
1375 dependencies : [threads,
1376 libpam,
1377 libpam_misc],
1378 link_depends : pam_systemd_sym,
1379 install : true,
1380 install_dir : pamlibdir)
1381
1382 test('dlopen-pam_systemd',
1383 test_dlopen,
1384 args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1385 endif
1386endif
1387
1388if conf.get('HAVE_PAM', 0) == 1
1389 executable('systemd-user-sessions',
1390 'src/user-sessions/user-sessions.c',
1391 include_directories : includes,
1392 link_with : [libshared],
1393 install_rpath : rootlibexecdir,
1394 install : true,
1395 install_dir : rootlibexecdir)
1396endif
1397
1398if conf.get('ENABLE_EFI', 0) == 1 and conf.get('HAVE_BLKID', 0) == 1
1399 exe = executable('bootctl',
1400 'src/boot/bootctl.c',
1401 include_directories : includes,
1402 link_with : [libshared],
1403 dependencies : [libblkid],
1404 install_rpath : rootlibexecdir,
1405 install : true)
1406 public_programs += [exe]
1407endif
1408
1409exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1410 include_directories : includes,
1411 link_with : [libshared],
1412 dependencies : [threads],
1413 install_rpath : rootlibexecdir,
1414 install : true)
1415public_programs += [exe]
1416
1417exe = executable('systemctl', 'src/systemctl/systemctl.c',
1418 include_directories : includes,
1419 link_with : [libshared],
1420 dependencies : [threads,
1421 libcap,
1422 libselinux,
1423 libxz,
1424 liblz4],
1425 install_rpath : rootlibexecdir,
1426 install : true,
1427 install_dir : rootbindir)
1428public_programs += [exe]
1429
1430if conf.get('ENABLE_BACKLIGHT', 0) == 1
1431 executable('systemd-backlight',
1432 'src/backlight/backlight.c',
1433 include_directories : includes,
1434 link_with : [libshared,
1435 libudev],
1436 install_rpath : rootlibexecdir,
1437 install : true,
1438 install_dir : rootlibexecdir)
1439endif
1440
1441if conf.get('ENABLE_RFKILL', 0) == 1
1442 executable('systemd-rfkill',
1443 'src/rfkill/rfkill.c',
1444 include_directories : includes,
1445 link_with : [libshared,
1446 libudev],
1447 install_rpath : rootlibexecdir,
1448 install : true,
1449 install_dir : rootlibexecdir)
1450endif
1451
1452executable('systemd-system-update-generator',
1453 'src/system-update-generator/system-update-generator.c',
1454 include_directories : includes,
1455 link_with : [libshared],
1456 install_rpath : rootlibexecdir,
1457 install : true,
1458 install_dir : systemgeneratordir)
1459
1460if conf.get('HAVE_LIBCRYPTSETUP', 0) == 1
1461 executable('systemd-cryptsetup',
1462 'src/cryptsetup/cryptsetup.c',
1463 include_directories : includes,
1464 link_with : [libshared],
1465 dependencies : [libcryptsetup],
1466 install_rpath : rootlibexecdir,
1467 install : true,
1468 install_dir : rootlibexecdir)
1469
1470 executable('systemd-cryptsetup-generator',
1471 'src/cryptsetup/cryptsetup-generator.c',
1472 include_directories : includes,
1473 link_with : [libshared],
1474 dependencies : [libcryptsetup],
1475 install_rpath : rootlibexecdir,
1476 install : true,
1477 install_dir : systemgeneratordir)
1478
1479 executable('systemd-veritysetup',
1480 'src/veritysetup/veritysetup.c',
1481 include_directories : includes,
1482 link_with : [libshared],
1483 dependencies : [libcryptsetup],
1484 install_rpath : rootlibexecdir,
1485 install : true,
1486 install_dir : rootlibexecdir)
1487
1488 executable('systemd-veritysetup-generator',
1489 'src/veritysetup/veritysetup-generator.c',
1490 include_directories : includes,
1491 link_with : [libshared],
1492 dependencies : [libcryptsetup],
1493 install_rpath : rootlibexecdir,
1494 install : true,
1495 install_dir : systemgeneratordir)
1496endif
1497
1498if conf.get('HAVE_SYSV_COMPAT', 0) == 1
1499 executable('systemd-sysv-generator',
1500 'src/sysv-generator/sysv-generator.c',
1501 include_directories : includes,
1502 link_with : [libshared],
1503 install_rpath : rootlibexecdir,
1504 install : true,
1505 install_dir : systemgeneratordir)
1506
1507 executable('systemd-rc-local-generator',
1508 'src/rc-local-generator/rc-local-generator.c',
1509 include_directories : includes,
1510 link_with : [libshared],
1511 install_rpath : rootlibexecdir,
1512 install : true,
1513 install_dir : systemgeneratordir)
1514endif
1515
1516if conf.get('ENABLE_HOSTNAMED', 0) == 1
1517 executable('systemd-hostnamed',
1518 'src/hostname/hostnamed.c',
1519 include_directories : includes,
1520 link_with : [libshared],
1521 install_rpath : rootlibexecdir,
1522 install : true,
1523 install_dir : rootlibexecdir)
1524
1525 exe = executable('hostnamectl',
1526 'src/hostname/hostnamectl.c',
1527 include_directories : includes,
1528 link_with : [libshared],
1529 install_rpath : rootlibexecdir,
1530 install : true)
1531 public_programs += [exe]
1532endif
1533
1534if conf.get('ENABLE_LOCALED', 0) == 1
1535 if conf.get('HAVE_XKBCOMMON', 0) == 1
1536 # logind will load libxkbcommon.so dynamically on its own
1537 deps = [libdl]
1538 else
1539 deps = []
1540 endif
1541
1542 executable('systemd-localed',
1543 systemd_localed_sources,
1544 include_directories : includes,
1545 link_with : [libshared],
1546 dependencies : deps,
1547 install_rpath : rootlibexecdir,
1548 install : true,
1549 install_dir : rootlibexecdir)
1550
1551 exe = executable('localectl',
1552 localectl_sources,
1553 include_directories : includes,
1554 link_with : [libshared],
1555 install_rpath : rootlibexecdir,
1556 install : true)
1557 public_programs += [exe]
1558endif
1559
1560if conf.get('ENABLE_TIMEDATED', 0) == 1
1561 executable('systemd-timedated',
1562 'src/timedate/timedated.c',
1563 include_directories : includes,
1564 link_with : [libshared],
1565 install_rpath : rootlibexecdir,
1566 install : true,
1567 install_dir : rootlibexecdir)
1568
1569 exe = executable('timedatectl',
1570 'src/timedate/timedatectl.c',
1571 include_directories : includes,
1572 install_rpath : rootlibexecdir,
1573 link_with : [libshared],
1574 install : true)
1575 public_programs += [exe]
1576endif
1577
1578if conf.get('ENABLE_TIMESYNCD', 0) == 1
1579 executable('systemd-timesyncd',
1580 systemd_timesyncd_sources,
1581 include_directories : includes,
1582 link_with : [libshared],
1583 dependencies : [threads,
1584 libm],
1585 install_rpath : rootlibexecdir,
1586 install : true,
1587 install_dir : rootlibexecdir)
1588endif
1589
1590if conf.get('ENABLE_MACHINED', 0) == 1
1591 executable('systemd-machined',
1592 systemd_machined_sources,
1593 include_directories : includes,
1594 link_with : [libmachine_core,
1595 libshared],
1596 install_rpath : rootlibexecdir,
1597 install : true,
1598 install_dir : rootlibexecdir)
1599
1600 exe = executable('machinectl',
1601 'src/machine/machinectl.c',
1602 include_directories : includes,
1603 link_with : [libshared],
1604 dependencies : [threads,
1605 libxz,
1606 liblz4],
1607 install_rpath : rootlibexecdir,
1608 install : true,
1609 install_dir : rootbindir)
1610 public_programs += [exe]
1611endif
1612
1613if conf.get('ENABLE_IMPORTD', 0) == 1
1614 executable('systemd-importd',
1615 systemd_importd_sources,
1616 include_directories : includes,
1617 link_with : [libshared],
1618 dependencies : [threads],
1619 install_rpath : rootlibexecdir,
1620 install : true,
1621 install_dir : rootlibexecdir)
1622
1623 systemd_pull = executable('systemd-pull',
1624 systemd_pull_sources,
1625 include_directories : includes,
1626 link_with : [libshared],
1627 dependencies : [libcurl,
1628 libz,
1629 libbzip2,
1630 libxz,
1631 libgcrypt],
1632 install_rpath : rootlibexecdir,
1633 install : true,
1634 install_dir : rootlibexecdir)
1635
1636 systemd_import = executable('systemd-import',
1637 systemd_import_sources,
1638 include_directories : includes,
1639 link_with : [libshared],
1640 dependencies : [libcurl,
1641 libz,
1642 libbzip2,
1643 libxz],
1644 install_rpath : rootlibexecdir,
1645 install : true,
1646 install_dir : rootlibexecdir)
1647
1648 systemd_export = executable('systemd-export',
1649 systemd_export_sources,
1650 include_directories : includes,
1651 link_with : [libshared],
1652 dependencies : [libcurl,
1653 libz,
1654 libbzip2,
1655 libxz],
1656 install_rpath : rootlibexecdir,
1657 install : true,
1658 install_dir : rootlibexecdir)
1659 public_programs += [systemd_pull, systemd_import, systemd_export]
1660endif
1661
1662if conf.get('ENABLE_REMOTE', 0) == 1 and conf.get('HAVE_LIBCURL', 0) == 1
1663 exe = executable('systemd-journal-upload',
1664 systemd_journal_upload_sources,
1665 include_directories : includes,
1666 link_with : [libshared],
1667 dependencies : [threads,
1668 libcurl,
1669 libgnutls,
1670 libxz,
1671 liblz4],
1672 install_rpath : rootlibexecdir,
1673 install : true,
1674 install_dir : rootlibexecdir)
1675 public_programs += [exe]
1676endif
1677
1678if conf.get('ENABLE_REMOTE', 0) == 1 and conf.get('HAVE_MICROHTTPD', 0) == 1
1679 s_j_remote = executable('systemd-journal-remote',
1680 systemd_journal_remote_sources,
1681 include_directories : includes,
1682 link_with : [libshared],
1683 dependencies : [threads,
1684 libmicrohttpd,
1685 libgnutls,
1686 libxz,
1687 liblz4],
1688 install_rpath : rootlibexecdir,
1689 install : true,
1690 install_dir : rootlibexecdir)
1691
1692 s_j_gatewayd = executable('systemd-journal-gatewayd',
1693 systemd_journal_gatewayd_sources,
1694 include_directories : includes,
1695 link_with : [libshared],
1696 dependencies : [threads,
1697 libmicrohttpd,
1698 libgnutls,
1699 libxz,
1700 liblz4],
1701 install_rpath : rootlibexecdir,
1702 install : true,
1703 install_dir : rootlibexecdir)
1704 public_programs += [s_j_remote, s_j_gatewayd]
1705endif
1706
1707if conf.get('ENABLE_COREDUMP', 0) == 1
1708 executable('systemd-coredump',
1709 systemd_coredump_sources,
1710 include_directories : includes,
1711 link_with : [libshared],
1712 dependencies : [threads,
1713 libacl,
1714 libdw,
1715 libxz,
1716 liblz4],
1717 install_rpath : rootlibexecdir,
1718 install : true,
1719 install_dir : rootlibexecdir)
1720
1721 exe = executable('coredumpctl',
1722 coredumpctl_sources,
1723 include_directories : includes,
1724 link_with : [libshared],
1725 dependencies : [threads,
1726 libxz,
1727 liblz4],
1728 install_rpath : rootlibexecdir,
1729 install : true)
1730 public_programs += [exe]
1731endif
1732
1733if conf.get('ENABLE_BINFMT', 0) == 1
1734 exe = executable('systemd-binfmt',
1735 'src/binfmt/binfmt.c',
1736 include_directories : includes,
1737 link_with : [libshared],
1738 install_rpath : rootlibexecdir,
1739 install : true,
1740 install_dir : rootlibexecdir)
1741 public_programs += [exe]
1742
1743 meson.add_install_script('sh', '-c',
1744 mkdir_p.format(binfmtdir))
1745 meson.add_install_script('sh', '-c',
1746 mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
1747endif
1748
1749if conf.get('ENABLE_VCONSOLE', 0) == 1
1750 executable('systemd-vconsole-setup',
1751 'src/vconsole/vconsole-setup.c',
1752 include_directories : includes,
1753 link_with : [libshared],
1754 install_rpath : rootlibexecdir,
1755 install : true,
1756 install_dir : rootlibexecdir)
1757endif
1758
1759if conf.get('ENABLE_RANDOMSEED', 0) == 1
1760 executable('systemd-random-seed',
1761 'src/random-seed/random-seed.c',
1762 include_directories : includes,
1763 link_with : [libshared],
1764 install_rpath : rootlibexecdir,
1765 install : true,
1766 install_dir : rootlibexecdir)
1767endif
1768
1769if conf.get('ENABLE_FIRSTBOOT', 0) == 1
1770 executable('systemd-firstboot',
1771 'src/firstboot/firstboot.c',
1772 include_directories : includes,
1773 link_with : [libshared],
1774 dependencies : [libcrypt],
1775 install_rpath : rootlibexecdir,
1776 install : true,
1777 install_dir : rootbindir)
1778endif
1779
1780executable('systemd-remount-fs',
1781 'src/remount-fs/remount-fs.c',
1782 'src/core/mount-setup.c',
1783 'src/core/mount-setup.h',
1784 include_directories : includes,
1785 link_with : [libshared],
1786 install_rpath : rootlibexecdir,
1787 install : true,
1788 install_dir : rootlibexecdir)
1789
1790executable('systemd-machine-id-setup',
1791 'src/machine-id-setup/machine-id-setup-main.c',
1792 'src/core/machine-id-setup.c',
1793 'src/core/machine-id-setup.h',
1794 include_directories : includes,
1795 link_with : [libshared],
1796 install_rpath : rootlibexecdir,
1797 install : true,
1798 install_dir : rootbindir)
1799
1800executable('systemd-fsck',
1801 'src/fsck/fsck.c',
1802 include_directories : includes,
1803 link_with : [libshared],
1804 install_rpath : rootlibexecdir,
1805 install : true,
1806 install_dir : rootlibexecdir)
1807
1808executable('systemd-sleep',
1809 'src/sleep/sleep.c',
1810 include_directories : includes,
1811 link_with : [libshared],
1812 install_rpath : rootlibexecdir,
1813 install : true,
1814 install_dir : rootlibexecdir)
1815
1816exe = executable('systemd-sysctl',
1817 'src/sysctl/sysctl.c',
1818 include_directories : includes,
1819 link_with : [libshared],
1820 install_rpath : rootlibexecdir,
1821 install : true,
1822 install_dir : rootlibexecdir)
1823public_programs += [exe]
1824
1825executable('systemd-ac-power',
1826 'src/ac-power/ac-power.c',
1827 include_directories : includes,
1828 link_with : [libshared],
1829 install_rpath : rootlibexecdir,
1830 install : true,
1831 install_dir : rootlibexecdir)
1832
1833exe = executable('systemd-detect-virt',
1834 'src/detect-virt/detect-virt.c',
1835 include_directories : includes,
1836 link_with : [libshared],
1837 install_rpath : rootlibexecdir,
1838 install : true)
1839public_programs += [exe]
1840
1841exe = executable('systemd-delta',
1842 'src/delta/delta.c',
1843 include_directories : includes,
1844 link_with : [libshared],
1845 install_rpath : rootlibexecdir,
1846 install : true)
1847public_programs += [exe]
1848
1849exe = executable('systemd-escape',
1850 'src/escape/escape.c',
1851 include_directories : includes,
1852 link_with : [libshared],
1853 install_rpath : rootlibexecdir,
1854 install : true,
1855 install_dir : rootbindir)
1856public_programs += [exe]
1857
1858exe = executable('systemd-notify',
1859 'src/notify/notify.c',
1860 include_directories : includes,
1861 link_with : [libshared],
1862 install_rpath : rootlibexecdir,
1863 install : true,
1864 install_dir : rootbindir)
1865public_programs += [exe]
1866
1867executable('systemd-volatile-root',
1868 'src/volatile-root/volatile-root.c',
1869 include_directories : includes,
1870 link_with : [libshared],
1871 install_rpath : rootlibexecdir,
1872 install : true,
1873 install_dir : rootlibexecdir)
1874
1875executable('systemd-cgroups-agent',
1876 'src/cgroups-agent/cgroups-agent.c',
1877 include_directories : includes,
1878 link_with : [libshared],
1879 install_rpath : rootlibexecdir,
1880 install : true,
1881 install_dir : rootlibexecdir)
1882
1883exe = executable('systemd-path',
1884 'src/path/path.c',
1885 include_directories : includes,
1886 link_with : [libshared],
1887 install_rpath : rootlibexecdir,
1888 install : true)
1889public_programs += [exe]
1890
1891exe = executable('systemd-ask-password',
1892 'src/ask-password/ask-password.c',
1893 include_directories : includes,
1894 link_with : [libshared],
1895 install_rpath : rootlibexecdir,
1896 install : true,
1897 install_dir : rootbindir)
1898public_programs += [exe]
1899
1900executable('systemd-reply-password',
1901 'src/reply-password/reply-password.c',
1902 include_directories : includes,
1903 link_with : [libshared],
1904 install_rpath : rootlibexecdir,
1905 install : true,
1906 install_dir : rootlibexecdir)
1907
1908exe = executable('systemd-tty-ask-password-agent',
1909 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1910 include_directories : includes,
1911 link_with : [libshared],
1912 install_rpath : rootlibexecdir,
1913 install : true,
1914 install_dir : rootbindir)
1915public_programs += [exe]
1916
1917exe = executable('systemd-cgls',
1918 'src/cgls/cgls.c',
1919 include_directories : includes,
1920 link_with : [libshared],
1921 install_rpath : rootlibexecdir,
1922 install : true)
1923public_programs += [exe]
1924
1925exe = executable('systemd-cgtop',
1926 'src/cgtop/cgtop.c',
1927 include_directories : includes,
1928 link_with : [libshared],
1929 install_rpath : rootlibexecdir,
1930 install : true)
1931public_programs += [exe]
1932
1933executable('systemd-initctl',
1934 'src/initctl/initctl.c',
1935 include_directories : includes,
1936 link_with : [libshared],
1937 install_rpath : rootlibexecdir,
1938 install : true,
1939 install_dir : rootlibexecdir)
1940
1941exe = executable('systemd-mount',
1942 'src/mount/mount-tool.c',
1943 include_directories : includes,
1944 link_with : [libshared,
1945 libudev],
1946 install_rpath : rootlibexecdir,
1947 install : true)
1948public_programs += [exe]
1949
1950meson.add_install_script(meson_make_symlink,
1951 'systemd-mount', join_paths(bindir, 'systemd-umount'))
1952
1953exe = executable('systemd-run',
1954 'src/run/run.c',
1955 include_directories : includes,
1956 link_with : [libshared],
1957 install_rpath : rootlibexecdir,
1958 install : true)
1959public_programs += [exe]
1960
1961exe = executable('systemd-stdio-bridge',
1962 'src/stdio-bridge/stdio-bridge.c',
1963 include_directories : includes,
1964 link_with : [libshared],
1965 install_rpath : rootlibexecdir,
1966 install : true)
1967public_programs += [exe]
1968
1969exe = executable('busctl',
1970 'src/busctl/busctl.c',
1971 'src/busctl/busctl-introspect.c',
1972 'src/busctl/busctl-introspect.h',
1973 include_directories : includes,
1974 link_with : [libshared],
1975 install_rpath : rootlibexecdir,
1976 install : true)
1977public_programs += [exe]
1978
1979if conf.get('ENABLE_SYSUSERS', 0) == 1
1980 exe = executable('systemd-sysusers',
1981 'src/sysusers/sysusers.c',
1982 include_directories : includes,
1983 link_with : [libshared],
1984 install_rpath : rootlibexecdir,
1985 install : true,
1986 install_dir : rootbindir)
1987 public_programs += [exe]
1988endif
1989
1990if conf.get('ENABLE_TMPFILES', 0) == 1
1991 exe = executable('systemd-tmpfiles',
1992 'src/tmpfiles/tmpfiles.c',
1993 include_directories : includes,
1994 link_with : [libshared],
1995 dependencies : [libacl],
1996 install_rpath : rootlibexecdir,
1997 install : true,
1998 install_dir : rootbindir)
1999 public_programs += [exe]
2000endif
2001
2002if conf.get('ENABLE_HWDB', 0) == 1
2003 exe = executable('systemd-hwdb',
2004 'src/hwdb/hwdb.c',
2005 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2006 include_directories : includes,
2007 link_with : [libshared],
2008 install_rpath : rootlibexecdir,
2009 install : true,
2010 install_dir : rootbindir)
2011 public_programs += [exe]
2012endif
2013
2014if conf.get('ENABLE_QUOTACHECK', 0) == 1
2015 executable('systemd-quotacheck',
2016 'src/quotacheck/quotacheck.c',
2017 include_directories : includes,
2018 link_with : [libshared],
2019 install_rpath : rootlibexecdir,
2020 install : true,
2021 install_dir : rootlibexecdir)
2022endif
2023
2024exe = executable('systemd-socket-proxyd',
2025 'src/socket-proxy/socket-proxyd.c',
2026 include_directories : includes,
2027 link_with : [libshared],
2028 dependencies : [threads],
2029 install_rpath : rootlibexecdir,
2030 install : true,
2031 install_dir : rootlibexecdir)
2032public_programs += [exe]
2033
2034exe = executable('systemd-udevd',
2035 systemd_udevd_sources,
2036 include_directories : includes,
2037 link_with : [libudev_core,
2038 libsystemd_network,
2039 libudev_internal],
2040 dependencies : [threads,
2041 libkmod,
2042 libidn,
2043 libacl,
2044 libblkid],
2045 install_rpath : udev_rpath,
2046 install : true,
2047 install_dir : rootlibexecdir)
2048public_programs += [exe]
2049
2050exe = executable('udevadm',
2051 udevadm_sources,
2052 include_directories : includes,
2053 link_with : [libudev_core,
2054 libsystemd_network,
2055 libudev_internal],
2056 dependencies : [threads,
2057 libkmod,
2058 libidn,
2059 libacl,
2060 libblkid],
2061 install_rpath : udev_rpath,
2062 install : true,
2063 install_dir : rootbindir)
2064public_programs += [exe]
2065
2066executable('systemd-shutdown',
2067 systemd_shutdown_sources,
2068 include_directories : includes,
2069 link_with : [libshared,
2070 libudev],
2071 install_rpath : rootlibexecdir,
2072 install : true,
2073 install_dir : rootlibexecdir)
2074
2075executable('systemd-update-done',
2076 'src/update-done/update-done.c',
2077 include_directories : includes,
2078 link_with : [libshared],
2079 install_rpath : rootlibexecdir,
2080 install : true,
2081 install_dir : rootlibexecdir)
2082
2083executable('systemd-update-utmp',
2084 'src/update-utmp/update-utmp.c',
2085 include_directories : includes,
2086 link_with : [libshared],
2087 dependencies : [libaudit],
2088 install_rpath : rootlibexecdir,
2089 install : true,
2090 install_dir : rootlibexecdir)
2091
2092if conf.get('HAVE_KMOD', 0) == 1
2093 executable('systemd-modules-load',
2094 'src/modules-load/modules-load.c',
2095 include_directories : includes,
2096 link_with : [libshared],
2097 dependencies : [libkmod],
2098 install_rpath : rootlibexecdir,
2099 install : true,
2100 install_dir : rootlibexecdir)
2101
2102 meson.add_install_script('sh', '-c',
2103 mkdir_p.format(modulesloaddir))
2104 meson.add_install_script('sh', '-c',
2105 mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2106endif
2107
2108exe = executable('systemd-nspawn',
2109 systemd_nspawn_sources,
2110 'src/core/mount-setup.c', # FIXME: use a variable?
2111 'src/core/mount-setup.h',
2112 'src/core/loopback-setup.c',
2113 'src/core/loopback-setup.h',
2114 include_directories : [includes, include_directories('src/nspawn')],
2115 link_with : [libfirewall,
2116 libshared,
2117 libudev],
2118 dependencies : [libacl,
2119 libblkid,
2120 libseccomp,
2121 libselinux],
2122 install_rpath : rootlibexecdir,
2123 install : true)
2124public_programs += [exe]
2125
2126if conf.get('ENABLE_NETWORKD', 0) == 1
2127 executable('systemd-networkd',
2128 systemd_networkd_sources,
2129 include_directories : includes,
2130 link_with : [libnetworkd_core,
2131 libfirewall,
2132 libsystemd_network,
2133 libudev_internal,
2134 libshared],
2135 install_rpath : rootlibexecdir,
2136 install : true,
2137 install_dir : rootlibexecdir)
2138
2139 executable('systemd-networkd-wait-online',
2140 systemd_networkd_wait_online_sources,
2141 include_directories : includes,
2142 link_with : [libnetworkd_core,
2143 libshared],
2144 install_rpath : rootlibexecdir,
2145 install : true,
2146 install_dir : rootlibexecdir)
2147endif
2148
2149exe = executable('networkctl',
2150 networkctl_sources,
2151 include_directories : includes,
2152 link_with : [libsystemd_network,
2153 libshared],
2154 install_rpath : rootlibexecdir,
2155 install : true,
2156 install_dir : rootbindir)
2157public_programs += [exe]
2158
2159############################################################
2160
2161foreach tuple : tests
2162 sources = tuple[0]
2163 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2164 dependencies = tuple[2]
2165 condition = tuple.length() >= 4 ? tuple[3] : ''
2166 type = tuple.length() >= 5 ? tuple[4] : ''
2167 defs = tuple.length() >= 6 ? tuple[5] : []
2168 incs = tuple.length() >= 7 ? tuple[6] : includes
2169 timeout = 30
2170
2171 name = sources[0].split('/')[-1].split('.')[0]
2172 if type.startswith('timeout=')
2173 timeout = type.split('=')[1].to_int()
2174 type = ''
2175 endif
2176
2177 if condition == '' or conf.get(condition, 0) == 1
2178 install = install_tests and type == ''
2179
2180 exe = executable(
2181 name,
2182 sources,
2183 include_directories : incs,
2184 link_with : link_with,
2185 dependencies : dependencies,
2186 c_args : defs,
2187 install_rpath : rootlibexecdir,
2188 install : install,
2189 install_dir : testsdir)
2190
2191 if type == 'manual'
2192 message('@0@ is a manual test'.format(name))
2193 elif type == 'unsafe' and want_tests != 'unsafe'
2194 message('@0@ is an unsafe test'.format(name))
2195 else
2196 test(name, exe,
2197 env : test_env,
2198 timeout : timeout)
2199 endif
2200 else
2201 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2202 endif
2203endforeach
2204
2205test_libsystemd_sym = executable(
2206 'test-libsystemd-sym',
2207 test_libsystemd_sym_c,
2208 include_directories : includes,
2209 link_with : [libsystemd],
2210 install : install_tests,
2211 install_dir : testsdir)
2212test('test-libsystemd-sym',
2213 test_libsystemd_sym)
2214
2215test_libudev_sym = executable(
2216 'test-libudev-sym',
2217 test_libudev_sym_c,
2218 include_directories : includes,
2219 c_args : ['-Wno-deprecated-declarations'],
2220 link_with : [libudev],
2221 install : install_tests,
2222 install_dir : testsdir)
2223test('test-libudev-sym',
2224 test_libudev_sym)
2225
2226############################################################
2227
2228make_directive_index_py = find_program('tools/make-directive-index.py')
2229make_man_index_py = find_program('tools/make-man-index.py')
2230xml_helper_py = find_program('tools/xml_helper.py')
2231hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2232
2233subdir('units')
2234subdir('sysctl.d')
2235subdir('sysusers.d')
2236subdir('tmpfiles.d')
2237subdir('rules')
2238subdir('hwdb')
2239subdir('network')
2240subdir('man')
2241subdir('shell-completion/bash')
2242subdir('shell-completion/zsh')
2243subdir('docs/sysvinit')
2244subdir('docs/var-log')
2245
2246# FIXME: figure out if the warning is true:
2247# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2248install_subdir('factory/etc',
2249 install_dir : factorydir)
2250
2251
2252install_data('xorg/50-systemd-user.sh',
2253 install_dir : xinitrcdir)
2254install_data('system-preset/90-systemd.preset',
2255 install_dir : systempresetdir)
2256install_data('README',
2257 'NEWS',
2258 'CODING_STYLE',
2259 'DISTRO_PORTING',
2260 'ENVIRONMENT.md',
2261 'LICENSE.GPL2',
2262 'LICENSE.LGPL2.1',
2263 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2264 install_dir : docdir)
2265
2266meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2267meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2268
2269############################################################
2270
2271meson_check_help = find_program('tools/meson-check-help.sh')
2272
2273foreach exec : public_programs
2274 name = exec.full_path().split('/')[-1]
2275 test('check-help-' + name,
2276 meson_check_help,
2277 args : [exec.full_path()])
2278endforeach
2279
2280############################################################
2281
2282if git.found() and etags.found()
2283 all_files = run_command(
2284 git,
2285 ['--git-dir=@0@/.git'.format(meson.source_root()),
2286 'ls-files',
2287 ':/*.[ch]'])
2288 all_files = files(all_files.stdout().split())
2289
2290 custom_target(
2291 'TAGS',
2292 output : 'TAGS',
2293 input : all_files,
2294 command : [etags, '-o', '@OUTPUT@'] + all_files)
2295endif
2296
2297if git.found()
2298 meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2299 run_target(
2300 'git-contrib',
2301 command : [meson_git_contrib_sh])
2302endif