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