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