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