]> git.ipfire.org Git - thirdparty/systemd.git/blame - meson.build
meson: specify rpath on all executables linking to libshared
[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],
b2fc5836 1065 install_rpath : '$ORIGIN',
5c23128d
ZJS
1066 install : true,
1067 install_dir : rootlibexecdir)
1068
1069executable('systemd-analyze',
1070 systemd_analyze_sources,
1071 include_directories : includes,
1072 link_with : [libcore,
826472ce
ZJS
1073 libudev,
1074 libsystemd_internal,
5c23128d
ZJS
1075 libshared],
1076 dependencies : [threads,
1077 librt,
1078 libseccomp,
1079 libselinux,
f4ee10a2
ZJS
1080 libmount,
1081 libblkid],
b2fc5836 1082 install_rpath : '$ORIGIN',
5c23128d
ZJS
1083 install : true)
1084
1085executable('systemd-journald',
1086 systemd_journald_sources,
1087 include_directories : includes,
1088 link_with : [libsystemd_journal_internal,
1089 libjournal_core,
1090 libshared,
1091 libudev],
1092 dependencies : [threads,
1093 libxz,
1094 liblz4],
b2fc5836 1095 install_rpath : '$ORIGIN',
5c23128d
ZJS
1096 install : true,
1097 install_dir : rootlibexecdir)
1098
1099executable('systemd-cat',
1100 systemd_cat_sources,
1101 include_directories : includes,
1102 link_with : [libjournal_core,
1103 libshared,
1104 libudev],
1105 dependencies : [threads],
b2fc5836 1106 install_rpath : rootlibexecdir,
5c23128d
ZJS
1107 install : true)
1108
1109executable('journalctl',
1110 journalctl_sources,
1111 include_directories : includes,
826472ce
ZJS
1112 link_with : [libsystemd_journal_internal,
1113 libshared,
1114 libudev,
1115 libsystemd_internal],
5c23128d
ZJS
1116 dependencies : [threads,
1117 libqrencode,
1118 libxz,
1119 liblz4],
b2fc5836 1120 install_rpath : rootlibexecdir,
5c23128d
ZJS
1121 install : true,
1122 install_dir : rootbindir)
1123
1124executable('systemd-getty-generator',
1125 'src/getty-generator/getty-generator.c',
5c23128d 1126 include_directories : includes,
b2fc5836
ZJS
1127 link_with : [libshared],
1128 install_rpath : rootlibexecdir,
1129 install : true,
1130 install_dir : systemgeneratordir)
5c23128d
ZJS
1131
1132executable('systemd-debug-generator',
1133 'src/debug-generator/debug-generator.c',
5c23128d 1134 include_directories : includes,
b2fc5836
ZJS
1135 link_with : [libshared],
1136 install_rpath : rootlibexecdir,
1137 install : true,
1138 install_dir : systemgeneratordir)
5c23128d
ZJS
1139
1140executable('systemd-fstab-generator',
1141 'src/fstab-generator/fstab-generator.c',
1142 'src/core/mount-setup.c',
5c23128d 1143 include_directories : includes,
b2fc5836
ZJS
1144 link_with : [libshared],
1145 install_rpath : rootlibexecdir,
1146 install : true,
1147 install_dir : systemgeneratordir)
5c23128d
ZJS
1148
1149if conf.get('ENABLE_ENVIRONMENT_D', 0) == 1
1150 executable('30-systemd-environment-d-generator',
1151 'src/environment-d-generator/environment-d-generator.c',
5c23128d 1152 include_directories : includes,
826472ce 1153 link_with : [libshared,
b2fc5836
ZJS
1154 libsystemd_internal],
1155 install_rpath : rootlibexecdir,
1156 install : true,
1157 install_dir : userenvgeneratordir)
7b76fce1
ZJS
1158
1159 meson.add_install_script(meson_make_symlink,
1160 sysconfdir + '/environment',
1161 environmentdir + '/99-environment.conf')
5c23128d
ZJS
1162endif
1163
1164if conf.get('ENABLE_HIBERNATE', 0) == 1
1165 executable('systemd-hibernate-resume-generator',
1166 'src/hibernate-resume/hibernate-resume-generator.c',
1167 include_directories : includes,
1168 link_with : [libshared],
b2fc5836 1169 install_rpath : rootlibexecdir,
5c23128d
ZJS
1170 install : true,
1171 install_dir : systemgeneratordir)
1172
1173 executable('systemd-hibernate-resume',
1174 'src/hibernate-resume/hibernate-resume.c',
1175 include_directories : includes,
1176 link_with : [libshared],
b2fc5836 1177 install_rpath : rootlibexecdir,
5c23128d
ZJS
1178 install : true,
1179 install_dir : rootlibexecdir)
1180endif
1181
1182if conf.get('HAVE_BLKID', 0) == 1
1183 executable('systemd-gpt-auto-generator',
1184 'src/gpt-auto-generator/gpt-auto-generator.c',
1185 'src/basic/blkid-util.h',
5c23128d 1186 include_directories : includes,
826472ce
ZJS
1187 link_with : [libsystemd_internal,
1188 libshared,
1189 libudev],
b2fc5836
ZJS
1190 dependencies : libblkid,
1191 install_rpath : rootlibexecdir,
1192 install : true,
1193 install_dir : systemgeneratordir)
5c23128d
ZJS
1194
1195 executable('systemd-dissect',
1196 'src/dissect/dissect.c',
1197 include_directories : includes,
1198 link_with : [libshared],
b2fc5836 1199 install_rpath : '$ORIGIN',
5c23128d
ZJS
1200 install : true,
1201 install_dir : rootlibexecdir)
1202endif
1203
1204if conf.get('ENABLE_RESOLVED', 0) == 1
1205 executable('systemd-resolved',
1206 systemd_resolved_sources,
1207 include_directories : includes,
1208 link_with : [libshared,
826472ce 1209 libsystemd_internal],
5c23128d
ZJS
1210 dependencies : [threads,
1211 libm,
1212 libidn],
b2fc5836 1213 install_rpath : '$ORIGIN',
5c23128d
ZJS
1214 install : true,
1215 install_dir : rootlibexecdir)
1216
1217 executable('systemd-resolve',
1218 systemd_resolve_sources,
1219 include_directories : includes,
1220 link_with : [libshared,
826472ce 1221 libsystemd_internal],
5c23128d
ZJS
1222 dependencies : [threads,
1223 libm,
1224 libidn],
b2fc5836 1225 install_rpath : rootlibexecdir,
5c23128d
ZJS
1226 install : true)
1227endif
1228
1229if conf.get('ENABLE_LOGIND', 0) == 1
1230 executable('systemd-logind',
1231 systemd_logind_sources,
1232 include_directories : includes,
1233 link_with : [liblogind_core,
826472ce
ZJS
1234 libudev,
1235 libshared,
1236 libsystemd_internal],
5c23128d
ZJS
1237 dependencies : [threads,
1238 libacl],
b2fc5836 1239 install_rpath : '$ORIGIN',
5c23128d
ZJS
1240 install : true,
1241 install_dir : rootlibexecdir)
1242
1243 executable('loginctl',
1244 loginctl_sources,
1245 include_directories : includes,
826472ce
ZJS
1246 link_with : [libshared,
1247 libudev,
1248 libsystemd_internal],
5c23128d
ZJS
1249 dependencies : [threads,
1250 liblz4,
1251 libxz],
b2fc5836 1252 install_rpath : rootlibexecdir,
5c23128d
ZJS
1253 install : true,
1254 install_dir : rootbindir)
1255
1256 executable('systemd-inhibit',
1257 'src/login/inhibit.c',
1258 include_directories : includes,
826472ce
ZJS
1259 link_with : [libshared,
1260 libsystemd_internal],
b2fc5836 1261 install_rpath : rootlibexecdir,
5c23128d
ZJS
1262 install : true,
1263 install_dir : rootbindir)
1264
1265 if conf.get('HAVE_PAM', 0) == 1
6b30f280 1266 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
5c23128d
ZJS
1267 shared_library(
1268 'pam_systemd',
1269 pam_systemd_c,
1270 name_prefix : '',
1271 include_directories : includes,
1272 link_args : ['-shared',
6b30f280 1273 '-Wl,--version-script=' + version_script_arg],
826472ce
ZJS
1274 link_with : [libsystemd_internal,
1275 libshared_static],
1276 dependencies : [threads,
1277 libpam,
5c23128d 1278 libpam_misc],
6b30f280 1279 link_depends : pam_systemd_sym,
5c23128d
ZJS
1280 install : true,
1281 install_dir : pamlibdir)
1282 endif
1283endif
1284
1285if conf.get('HAVE_PAM', 0) == 1
1286 executable('systemd-user-sessions',
1287 'src/user-sessions/user-sessions.c',
1288 include_directories : includes,
1289 link_with : [libshared],
b2fc5836 1290 install_rpath : '$ORIGIN',
5c23128d
ZJS
1291 install : true,
1292 install_dir : rootlibexecdir)
1293endif
1294
1295if conf.get('ENABLE_EFI', 0) == 1
1296 executable('bootctl',
1297 'src/boot/bootctl.c',
1298 include_directories : includes,
1299 link_with : [libshared],
1300 dependencies : [libblkid],
b2fc5836 1301 install_rpath : rootlibexecdir,
5c23128d
ZJS
1302 install : true)
1303endif
1304
1305executable('systemd-socket-activate', 'src/activate/activate.c',
1306 include_directories : includes,
1307 link_with : [libshared],
1308 dependencies : [threads],
b2fc5836 1309 install_rpath : rootlibexecdir,
5c23128d
ZJS
1310 install : true)
1311
1312executable('systemctl', 'src/systemctl/systemctl.c',
1313 include_directories : includes,
826472ce
ZJS
1314 link_with : [libshared,
1315 libsystemd_internal],
5c23128d
ZJS
1316 dependencies : [threads,
1317 libcap,
1318 libselinux,
1319 libxz,
1320 liblz4],
b2fc5836 1321 install_rpath : rootlibexecdir,
5c23128d
ZJS
1322 install : true,
1323 install_dir : rootbindir)
1324
1325if conf.get('ENABLE_BACKLIGHT', 0) == 1
1326 executable('systemd-backlight',
1327 'src/backlight/backlight.c',
1328 include_directories : includes,
826472ce
ZJS
1329 link_with : [libshared,
1330 libudev],
b2fc5836 1331 install_rpath : '$ORIGIN',
5c23128d
ZJS
1332 install : true,
1333 install_dir : rootlibexecdir)
1334endif
1335
1336if conf.get('ENABLE_RFKILL', 0) == 1
1337 executable('systemd-rfkill',
1338 'src/rfkill/rfkill.c',
1339 include_directories : includes,
826472ce
ZJS
1340 link_with : [libshared,
1341 libudev],
b2fc5836 1342 install_rpath : '$ORIGIN',
5c23128d
ZJS
1343 install : true,
1344 install_dir : rootlibexecdir)
1345endif
1346
1347executable('systemd-system-update-generator',
1348 'src/system-update-generator/system-update-generator.c',
1349 include_directories : includes,
1350 link_with : [libshared],
b2fc5836 1351 install_rpath : rootlibexecdir,
5c23128d
ZJS
1352 install : true,
1353 install_dir : systemgeneratordir)
1354
1355if conf.get('HAVE_LIBCRYPTSETUP', 0) == 1
1356 executable('systemd-cryptsetup',
1357 'src/cryptsetup/cryptsetup.c',
1358 include_directories : includes,
826472ce
ZJS
1359 link_with : [libshared,
1360 libsystemd_internal],
5c23128d 1361 dependencies : [libcryptsetup],
b2fc5836 1362 install_rpath : '$ORIGIN',
5c23128d
ZJS
1363 install : true,
1364 install_dir : rootlibexecdir)
1365
1366 executable('systemd-cryptsetup-generator',
1367 'src/cryptsetup/cryptsetup-generator.c',
1368 include_directories : includes,
1369 link_with : [libshared],
1370 dependencies : [libcryptsetup],
b2fc5836 1371 install_rpath : rootlibexecdir,
5c23128d
ZJS
1372 install : true,
1373 install_dir : systemgeneratordir)
1374
1375 executable('systemd-veritysetup',
1376 'src/veritysetup/veritysetup.c',
1377 include_directories : includes,
1378 link_with : [libshared],
1379 dependencies : [libcryptsetup],
b2fc5836 1380 install_rpath : '$ORIGIN',
5c23128d
ZJS
1381 install : true,
1382 install_dir : rootlibexecdir)
1383
1384 executable('systemd-veritysetup-generator',
1385 'src/veritysetup/veritysetup-generator.c',
1386 include_directories : includes,
826472ce
ZJS
1387 link_with : [libshared,
1388 libsystemd_internal],
5c23128d 1389 dependencies : [libcryptsetup],
b2fc5836 1390 install_rpath : rootlibexecdir,
5c23128d
ZJS
1391 install : true,
1392 install_dir : systemgeneratordir)
1393endif
1394
1395if conf.get('HAVE_SYSV_COMPAT', 0) == 1
1396 executable('systemd-sysv-generator',
1397 'src/sysv-generator/sysv-generator.c',
1398 include_directories : includes,
1399 link_with : [libshared],
b2fc5836 1400 install_rpath : rootlibexecdir,
5c23128d
ZJS
1401 install : true,
1402 install_dir : systemgeneratordir)
1403
1404 executable('systemd-rc-local-generator',
1405 'src/rc-local-generator/rc-local-generator.c',
1406 include_directories : includes,
1407 link_with : [libshared],
b2fc5836 1408 install_rpath : rootlibexecdir,
5c23128d
ZJS
1409 install : true,
1410 install_dir : systemgeneratordir)
1411endif
1412
1413if conf.get('ENABLE_HOSTNAMED', 0) == 1
1414 executable('systemd-hostnamed',
1415 'src/hostname/hostnamed.c',
1416 include_directories : includes,
1417 link_with : [libshared],
b2fc5836 1418 install_rpath : '$ORIGIN',
5c23128d
ZJS
1419 install : true,
1420 install_dir : rootlibexecdir)
1421
1422 executable('hostnamectl',
1423 'src/hostname/hostnamectl.c',
1424 include_directories : includes,
826472ce
ZJS
1425 link_with : [libshared,
1426 libsystemd_internal],
b2fc5836 1427 install_rpath : rootlibexecdir,
5c23128d
ZJS
1428 install : true)
1429endif
1430
1431if conf.get('ENABLE_LOCALED', 0) == 1
1432 executable('systemd-localed',
1433 systemd_localed_sources,
1434 include_directories : includes,
826472ce
ZJS
1435 link_with : [libshared,
1436 libsystemd_internal],
5c23128d 1437 dependencies : [libdl],
b2fc5836 1438 install_rpath : '$ORIGIN',
5c23128d
ZJS
1439 install : true,
1440 install_dir : rootlibexecdir)
1441
1442 executable('localectl',
1443 localectl_sources,
1444 include_directories : includes,
826472ce
ZJS
1445 link_with : [libshared,
1446 libsystemd_internal],
b2fc5836 1447 install_rpath : rootlibexecdir,
5c23128d
ZJS
1448 install : true)
1449endif
1450
1451if conf.get('ENABLE_TIMEDATED', 0) == 1
1452 executable('systemd-timedated',
1453 'src/timedate/timedated.c',
1454 include_directories : includes,
826472ce
ZJS
1455 link_with : [libshared,
1456 libsystemd_internal],
b2fc5836 1457 install_rpath : rootlibexecdir,
5c23128d
ZJS
1458 install : true,
1459 install_dir : rootlibexecdir)
1460
1461 executable('timedatectl',
1462 'src/timedate/timedatectl.c',
1463 include_directories : includes,
b2fc5836 1464 install_rpath : rootlibexecdir,
826472ce
ZJS
1465 link_with : [libshared,
1466 libsystemd_internal],
5c23128d
ZJS
1467 install : true)
1468endif
1469
1470if conf.get('ENABLE_TIMESYNCD', 0) == 1
1471 executable('systemd-timesyncd',
1472 systemd_timesyncd_sources,
1473 include_directories : includes,
826472ce
ZJS
1474 link_with : [libshared,
1475 libsystemd_internal],
5c23128d
ZJS
1476 dependencies : [threads,
1477 libm],
b2fc5836 1478 install_rpath : '$ORIGIN',
5c23128d
ZJS
1479 install : true,
1480 install_dir : rootlibexecdir)
1481endif
1482
1483if conf.get('ENABLE_MACHINED', 0) == 1
1484 executable('systemd-machined',
1485 systemd_machined_sources,
1486 include_directories : includes,
1487 link_with : [libmachine_core,
826472ce
ZJS
1488 libshared,
1489 libsystemd_internal],
b2fc5836 1490 install_rpath : '$ORIGIN',
5c23128d
ZJS
1491 install : true,
1492 install_dir : rootlibexecdir)
1493
1494 executable('machinectl',
1495 'src/machine/machinectl.c',
1496 include_directories : includes,
826472ce
ZJS
1497 link_with : [libshared,
1498 libsystemd_internal],
5c23128d
ZJS
1499 dependencies : [threads,
1500 libxz,
1501 liblz4],
b2fc5836 1502 install_rpath : rootlibexecdir,
5c23128d
ZJS
1503 install : true,
1504 install_dir : rootbindir)
1505endif
1506
1507if conf.get('ENABLE_IMPORTD', 0) == 1
1508 executable('systemd-importd',
1509 systemd_importd_sources,
1510 include_directories : includes,
826472ce
ZJS
1511 link_with : [libsystemd_internal,
1512 libshared],
1513 dependencies : [threads],
b2fc5836 1514 install_rpath : '$ORIGIN',
5c23128d
ZJS
1515 install : true,
1516 install_dir : rootlibexecdir)
1517
1518 executable('systemd-pull',
1519 systemd_pull_sources,
1520 include_directories : includes,
1521 link_with : [libshared],
1522 dependencies : [libcurl,
1523 libz,
1524 libbzip2,
1525 libxz,
1526 libgcrypt],
b2fc5836 1527 install_rpath : '$ORIGIN',
5c23128d
ZJS
1528 install : true,
1529 install_dir : rootlibexecdir)
1530
1531 executable('systemd-import',
1532 systemd_import_sources,
1533 include_directories : includes,
1534 link_with : [libshared],
1535 dependencies : [libcurl,
1536 libz,
1537 libbzip2,
1538 libxz],
b2fc5836 1539 install_rpath : '$ORIGIN',
5c23128d
ZJS
1540 install : true,
1541 install_dir : rootlibexecdir)
1542
1543 executable('systemd-export',
1544 systemd_export_sources,
1545 include_directories : includes,
1546 link_with : [libshared],
1547 dependencies : [libcurl,
1548 libz,
1549 libbzip2,
1550 libxz],
b2fc5836 1551 install_rpath : '$ORIGIN',
5c23128d
ZJS
1552 install : true,
1553 install_dir : rootlibexecdir)
1554endif
1555
1556if conf.get('ENABLE_REMOTE', 0) == 1 and conf.get('HAVE_LIBCURL', 0) == 1
1557 executable('systemd-journal-upload',
1558 systemd_journal_upload_sources,
1559 include_directories : includes,
826472ce
ZJS
1560 link_with : [libsystemd_journal_internal,
1561 libshared],
5c23128d
ZJS
1562 dependencies : [threads,
1563 libcurl,
1564 libgnutls,
1565 libxz,
1566 liblz4],
b2fc5836 1567 install_rpath : '$ORIGIN',
5c23128d
ZJS
1568 install : true,
1569 install_dir : rootlibexecdir)
1570endif
1571
1572if conf.get('ENABLE_REMOTE', 0) == 1 and conf.get('HAVE_MICROHTTPD', 0) == 1
1573 executable('systemd-journal-remote',
1574 systemd_journal_remote_sources,
1575 include_directories : includes,
826472ce
ZJS
1576 link_with : [libsystemd_journal_internal,
1577 libshared],
5c23128d
ZJS
1578 dependencies : [threads,
1579 libmicrohttpd,
1580 libgnutls,
1581 libxz,
1582 liblz4],
b2fc5836 1583 install_rpath : '$ORIGIN',
5c23128d
ZJS
1584 install : true,
1585 install_dir : rootlibexecdir)
1586
1587 executable('systemd-journal-gatewayd',
1588 systemd_journal_gatewayd_sources,
1589 include_directories : includes,
826472ce
ZJS
1590 link_with : [libsystemd_journal_internal,
1591 libshared],
5c23128d
ZJS
1592 dependencies : [threads,
1593 libmicrohttpd,
1594 libgnutls,
1595 libxz,
1596 liblz4],
b2fc5836 1597 install_rpath : '$ORIGIN',
5c23128d
ZJS
1598 install : true,
1599 install_dir : rootlibexecdir)
1600endif
1601
1602if conf.get('ENABLE_COREDUMP', 0) == 1
1603 executable('systemd-coredump',
1604 systemd_coredump_sources,
1605 include_directories : includes,
826472ce
ZJS
1606 link_with : [libsystemd_journal_internal,
1607 libshared,
1608 libsystemd],
5c23128d
ZJS
1609 dependencies : [threads,
1610 libacl,
1611 libdw,
1612 libxz,
1613 liblz4],
b2fc5836 1614 install_rpath : '$ORIGIN',
5c23128d
ZJS
1615 install : true,
1616 install_dir : rootlibexecdir)
1617
1618 executable('coredumpctl',
1619 coredumpctl_sources,
1620 include_directories : includes,
826472ce
ZJS
1621 link_with : [libsystemd_journal_internal,
1622 libshared,
1623 libsystemd_internal],
5c23128d
ZJS
1624 dependencies : [threads,
1625 libxz,
1626 liblz4],
b2fc5836 1627 install_rpath : rootlibexecdir,
5c23128d
ZJS
1628 install : true)
1629endif
1630
1631if conf.get('ENABLE_BINFMT', 0) == 1
1632 executable('systemd-binfmt',
1633 'src/binfmt/binfmt.c',
1634 include_directories : includes,
1635 link_with : [libshared],
b2fc5836 1636 install_rpath : '$ORIGIN',
5c23128d
ZJS
1637 install : true,
1638 install_dir : rootlibexecdir)
94e75a54
ZJS
1639
1640 meson.add_install_script('sh', '-c',
1641 mkdir_p.format(binfmtdir))
1642 meson.add_install_script('sh', '-c',
1643 mkdir_p.format(sysconfdir + '/binfmt.d'))
5c23128d
ZJS
1644endif
1645
1646if conf.get('ENABLE_VCONSOLE', 0) == 1
1647 executable('systemd-vconsole-setup',
1648 'src/vconsole/vconsole-setup.c',
1649 include_directories : includes,
1650 link_with : [libshared],
b2fc5836 1651 install_rpath : '$ORIGIN',
5c23128d
ZJS
1652 install : true,
1653 install_dir : rootlibexecdir)
1654endif
1655
1656if conf.get('ENABLE_RANDOMSEED', 0) == 1
1657 executable('systemd-random-seed',
1658 'src/random-seed/random-seed.c',
1659 include_directories : includes,
1660 link_with : [libshared],
b2fc5836 1661 install_rpath : '$ORIGIN',
5c23128d
ZJS
1662 install : true,
1663 install_dir : rootlibexecdir)
1664endif
1665
1666if conf.get('ENABLE_FIRSTBOOT', 0) == 1
1667 executable('systemd-firstboot',
1668 'src/firstboot/firstboot.c',
1669 include_directories : includes,
1670 link_with : [libshared],
1671 dependencies : [libcrypt],
b2fc5836 1672 install_rpath : rootlibexecdir,
5c23128d
ZJS
1673 install : true,
1674 install_dir : rootbindir)
1675endif
1676
1677executable('systemd-remount-fs',
1678 'src/remount-fs/remount-fs.c',
1679 'src/core/mount-setup.c',
1680 'src/core/mount-setup.h',
1681 include_directories : includes,
1682 link_with : [libshared],
b2fc5836 1683 install_rpath : rootlibexecdir,
5c23128d
ZJS
1684 install : true,
1685 install_dir : rootlibexecdir)
1686
1687executable('systemd-machine-id-setup',
1688 'src/machine-id-setup/machine-id-setup-main.c',
1689 'src/core/machine-id-setup.c',
1690 'src/core/machine-id-setup.h',
1691 include_directories : includes,
826472ce
ZJS
1692 link_with : [libshared,
1693 libsystemd_internal],
b2fc5836 1694 install_rpath : rootlibexecdir,
5c23128d
ZJS
1695 install : true,
1696 install_dir : rootbindir)
1697
1698executable('systemd-fsck',
1699 'src/fsck/fsck.c',
1700 include_directories : includes,
826472ce
ZJS
1701 link_with : [libshared,
1702 libsystemd_internal],
b2fc5836 1703 install_rpath : '$ORIGIN',
5c23128d
ZJS
1704 install : true,
1705 install_dir : rootlibexecdir)
1706
1707executable('systemd-sleep',
1708 'src/sleep/sleep.c',
1709 include_directories : includes,
1710 link_with : [libshared],
b2fc5836 1711 install_rpath : '$ORIGIN',
5c23128d
ZJS
1712 install : true,
1713 install_dir : rootlibexecdir)
1714
1715executable('systemd-sysctl',
1716 'src/sysctl/sysctl.c',
1717 include_directories : includes,
1718 link_with : [libshared],
b2fc5836 1719 install_rpath : '$ORIGIN',
5c23128d
ZJS
1720 install : true,
1721 install_dir : rootlibexecdir)
1722
1723executable('systemd-ac-power',
1724 'src/ac-power/ac-power.c',
1725 include_directories : includes,
1726 link_with : [libshared],
b2fc5836 1727 install_rpath : '$ORIGIN',
5c23128d
ZJS
1728 install : true,
1729 install_dir : rootlibexecdir)
1730
1731executable('systemd-detect-virt',
1732 'src/detect-virt/detect-virt.c',
1733 include_directories : includes,
1734 link_with : [libshared],
b2fc5836 1735 install_rpath : rootlibexecdir,
5c23128d
ZJS
1736 install : true)
1737
1738executable('systemd-delta',
1739 'src/delta/delta.c',
1740 include_directories : includes,
1741 link_with : [libshared],
b2fc5836 1742 install_rpath : rootlibexecdir,
5c23128d
ZJS
1743 install : true)
1744
1745executable('systemd-escape',
1746 'src/escape/escape.c',
1747 include_directories : includes,
1748 link_with : [libshared],
b2fc5836 1749 install_rpath : rootlibexecdir,
5c23128d
ZJS
1750 install : true,
1751 install_dir : rootbindir)
1752
1753executable('systemd-notify',
1754 'src/notify/notify.c',
1755 include_directories : includes,
1756 link_with : [libshared],
b2fc5836 1757 install_rpath : rootlibexecdir,
5c23128d
ZJS
1758 install : true,
1759 install_dir : rootbindir)
1760
1761executable('systemd-volatile-root',
1762 'src/volatile-root/volatile-root.c',
1763 include_directories : includes,
1764 link_with : [libshared],
b2fc5836 1765 install_rpath : '$ORIGIN',
5c23128d
ZJS
1766 install : true,
1767 install_dir : rootlibexecdir)
1768
1769executable('systemd-cgroups-agent',
1770 'src/cgroups-agent/cgroups-agent.c',
1771 include_directories : includes,
1772 link_with : [libshared],
b2fc5836 1773 install_rpath : '$ORIGIN',
5c23128d
ZJS
1774 install : true,
1775 install_dir : rootlibexecdir)
1776
1777executable('systemd-path',
1778 'src/path/path.c',
1779 include_directories : includes,
826472ce
ZJS
1780 link_with : [libsystemd_internal,
1781 libshared],
b2fc5836 1782 install_rpath : rootlibexecdir,
5c23128d
ZJS
1783 install : true)
1784
1785executable('systemd-ask-password',
1786 'src/ask-password/ask-password.c',
1787 include_directories : includes,
826472ce
ZJS
1788 link_with : [libshared,
1789 libsystemd_internal],
b2fc5836 1790 install_rpath : rootlibexecdir,
5c23128d
ZJS
1791 install : true,
1792 install_dir : rootbindir)
1793
1794executable('systemd-reply-password',
1795 'src/reply-password/reply-password.c',
1796 include_directories : includes,
826472ce
ZJS
1797 link_with : [libshared,
1798 libsystemd_internal],
b2fc5836 1799 install_rpath : '$ORIGIN',
5c23128d
ZJS
1800 install : true,
1801 install_dir : rootlibexecdir)
1802
1803executable('systemd-tty-ask-password-agent',
1804 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1805 include_directories : includes,
826472ce
ZJS
1806 link_with : [libshared,
1807 libsystemd_internal],
b2fc5836 1808 install_rpath : rootlibexecdir,
5c23128d
ZJS
1809 install : true,
1810 install_dir : rootbindir)
1811
1812executable('systemd-cgls',
1813 'src/cgls/cgls.c',
1814 include_directories : includes,
826472ce
ZJS
1815 link_with : [libshared,
1816 libsystemd_internal],
b2fc5836 1817 install_rpath : rootlibexecdir,
5c23128d
ZJS
1818 install : true)
1819
1820executable('systemd-cgtop',
1821 'src/cgtop/cgtop.c',
1822 include_directories : includes,
826472ce
ZJS
1823 link_with : [libshared,
1824 libsystemd_internal],
b2fc5836 1825 install_rpath : rootlibexecdir,
5c23128d
ZJS
1826 install : true)
1827
1828executable('systemd-initctl',
1829 'src/initctl/initctl.c',
1830 include_directories : includes,
826472ce
ZJS
1831 link_with : [libshared,
1832 libsystemd_internal],
b2fc5836 1833 install_rpath : '$ORIGIN',
5c23128d
ZJS
1834 install : true,
1835 install_dir : rootlibexecdir)
1836
1837executable('systemd-mount',
1838 'src/mount/mount-tool.c',
1839 include_directories : includes,
826472ce
ZJS
1840 link_with : [libshared,
1841 libsystemd_internal,
1842 libudev],
b2fc5836 1843 install_rpath : rootlibexecdir,
5c23128d
ZJS
1844 install : true)
1845
7b76fce1
ZJS
1846meson.add_install_script(meson_make_symlink,
1847 'systemd-mount', bindir + '/systemd-umount')
1848
5c23128d
ZJS
1849executable('systemd-run',
1850 'src/run/run.c',
1851 include_directories : includes,
826472ce
ZJS
1852 link_with : [libshared,
1853 libsystemd_internal],
b2fc5836 1854 install_rpath : rootlibexecdir,
5c23128d
ZJS
1855 install : true)
1856
1857executable('systemd-stdio-bridge',
1858 'src/stdio-bridge/stdio-bridge.c',
1859 include_directories : includes,
826472ce
ZJS
1860 link_with : [libshared,
1861 libsystemd_internal],
b2fc5836 1862 install_rpath : rootlibexecdir,
5c23128d
ZJS
1863 install : true)
1864
1865executable('busctl',
1866 'src/busctl/busctl.c',
1867 'src/busctl/busctl-introspect.c',
1868 'src/busctl/busctl-introspect.h',
1869 include_directories : includes,
826472ce
ZJS
1870 link_with : [libshared,
1871 libsystemd_internal],
b2fc5836 1872 install_rpath : rootlibexecdir,
5c23128d
ZJS
1873 install : true)
1874
1875if conf.get('ENABLE_SYSUSERS', 0) == 1
1876 executable('systemd-sysusers',
1877 'src/sysusers/sysusers.c',
1878 include_directories : includes,
1879 link_with : [libshared],
b2fc5836 1880 install_rpath : rootlibexecdir,
5c23128d
ZJS
1881 install : true,
1882 install_dir : rootbindir)
1883endif
1884
1885if conf.get('ENABLE_TMPFILES', 0) == 1
1886 executable('systemd-tmpfiles',
1887 'src/tmpfiles/tmpfiles.c',
1888 include_directories : includes,
1889 link_with : [libshared],
1890 dependencies : [libacl],
b2fc5836 1891 install_rpath : rootlibexecdir,
5c23128d
ZJS
1892 install : true,
1893 install_dir : rootbindir)
1894endif
1895
1896if conf.get('ENABLE_HWDB', 0) == 1
1897 executable('systemd-hwdb',
1898 'src/hwdb/hwdb.c',
1899 'src/libsystemd/sd-hwdb/hwdb-internal.h',
1900 include_directories : includes,
826472ce
ZJS
1901 link_with : [libshared,
1902 libsystemd_internal],
b2fc5836 1903 install_rpath : rootlibexecdir,
5c23128d
ZJS
1904 install : true,
1905 install_dir : rootbindir)
1906endif
1907
1908if conf.get('ENABLE_QUOTACHECK', 0) == 1
1909 executable('systemd-quotacheck',
1910 'src/quotacheck/quotacheck.c',
1911 include_directories : includes,
1912 link_with : [libshared],
b2fc5836 1913 install_rpath : '$ORIGIN',
5c23128d
ZJS
1914 install : true,
1915 install_dir : rootlibexecdir)
1916endif
1917
1918executable('systemd-socket-proxyd',
1919 'src/socket-proxy/socket-proxyd.c',
1920 include_directories : includes,
1921 link_with : [libshared,
826472ce 1922 libsystemd_internal],
5c23128d 1923 dependencies : [threads],
b2fc5836 1924 install_rpath : '$ORIGIN',
5c23128d
ZJS
1925 install : true,
1926 install_dir : rootlibexecdir)
1927
1928executable('systemd-udevd',
1929 systemd_udevd_sources,
1930 include_directories : includes,
1931 link_with : [libudev_core,
1932 libudev_internal,
1933 libsystemd_network,
826472ce 1934 libsystemd_internal,
5c23128d
ZJS
1935 libshared],
1936 dependencies : [libkmod,
1937 libidn,
1938 libacl],
b2fc5836 1939 install_rpath : '$ORIGIN',
5c23128d
ZJS
1940 install : true,
1941 install_dir : rootlibexecdir)
1942
1943executable('udevadm',
1944 udevadm_sources,
1945 include_directories : includes,
1946 link_with : [libudev_core,
1947 libudev_internal,
1948 libsystemd_network,
826472ce
ZJS
1949 libshared,
1950 libsystemd_internal],
5c23128d
ZJS
1951 dependencies : [libkmod,
1952 libidn,
1953 libacl],
b2fc5836 1954 install_rpath : rootlibexecdir,
5c23128d
ZJS
1955 install : true,
1956 install_dir : rootbindir)
1957
1958executable('systemd-shutdown',
1959 systemd_shutdown_sources,
1960 include_directories : includes,
826472ce
ZJS
1961 link_with : [libshared,
1962 libudev],
b2fc5836 1963 install_rpath : '$ORIGIN',
5c23128d
ZJS
1964 install : true,
1965 install_dir : rootlibexecdir)
1966
1967executable('systemd-update-done',
1968 'src/update-done/update-done.c',
1969 include_directories : includes,
1970 link_with : [libshared],
b2fc5836 1971 install_rpath : '$ORIGIN',
5c23128d
ZJS
1972 install : true,
1973 install_dir : rootlibexecdir)
1974
1975executable('systemd-update-utmp',
1976 'src/update-utmp/update-utmp.c',
1977 include_directories : includes,
826472ce
ZJS
1978 link_with : [libshared,
1979 libsystemd_internal],
5c23128d 1980 dependencies : [libaudit],
b2fc5836 1981 install_rpath : '$ORIGIN',
5c23128d
ZJS
1982 install : true,
1983 install_dir : rootlibexecdir)
1984
1985if conf.get('HAVE_KMOD', 0) == 1
1986 executable('systemd-modules-load',
1987 'src/modules-load/modules-load.c',
1988 include_directories : includes,
1989 link_with : [libshared],
1990 dependencies : [libkmod],
b2fc5836 1991 install_rpath : '$ORIGIN',
5c23128d
ZJS
1992 install : true,
1993 install_dir : rootlibexecdir)
94e75a54
ZJS
1994
1995 meson.add_install_script('sh', '-c',
1996 mkdir_p.format(modulesloaddir))
1997 meson.add_install_script('sh', '-c',
1998 mkdir_p.format(sysconfdir + '/modules-load.d'))
5c23128d
ZJS
1999endif
2000
2001executable('systemd-nspawn',
2002 systemd_nspawn_sources,
2003 'src/core/mount-setup.c', # FIXME: use a variable?
2004 'src/core/mount-setup.h',
2005 'src/core/loopback-setup.c',
2006 'src/core/loopback-setup.h',
2007 include_directories : [includes, include_directories('src/nspawn')],
2008 link_with : [libfirewall,
826472ce
ZJS
2009 libshared,
2010 libudev,
2011 libsystemd_internal],
5c23128d
ZJS
2012 dependencies : [libacl,
2013 libblkid,
2014 libseccomp,
2015 libselinux],
b2fc5836 2016 install_rpath : rootlibexecdir,
5c23128d
ZJS
2017 install : true)
2018
2019executable('systemd-networkd',
2020 systemd_networkd_sources,
2021 include_directories : includes,
2022 link_with : [libnetworkd_core,
2023 libfirewall,
2024 libsystemd_network,
2025 libudev_internal,
826472ce
ZJS
2026 libshared,
2027 libsystemd_internal],
b2fc5836 2028 install_rpath : '$ORIGIN',
5c23128d
ZJS
2029 install : true,
2030 install_dir : rootlibexecdir)
2031
2032executable('systemd-networkd-wait-online',
2033 systemd_networkd_wait_online_sources,
2034 include_directories : includes,
2035 link_with : [libnetworkd_core,
826472ce
ZJS
2036 libshared,
2037 libsystemd_internal],
b2fc5836 2038 install_rpath : '$ORIGIN',
5c23128d
ZJS
2039 install : true,
2040 install_dir : rootlibexecdir)
2041
2042executable('networkctl',
2043 networkctl_sources,
2044 include_directories : includes,
2045 link_with : [libsystemd_network,
826472ce
ZJS
2046 libshared,
2047 libsystemd_internal],
b2fc5836 2048 install_rpath : '$ORIGIN',
5c23128d
ZJS
2049 install : true,
2050 install_dir : rootbindir)
2051
69e96427
ZJS
2052############################################################
2053
2054foreach tuple : tests
2055 sources = tuple[0]
2056 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2057 dependencies = tuple[2]
2058 condition = tuple.length() >= 4 ? tuple[3] : ''
2059 type = tuple.length() >= 5 ? tuple[4] : ''
2060 defs = tuple.length() >= 6 ? tuple[5] : []
2061 incs = tuple.length() >= 7 ? tuple[6] : includes
2062
2063 name = sources[0].split('/')[-1].split('.')[0]
2064
2065 if condition == '' or conf.get(condition, 0) == 1
572baca1
ZJS
2066 install = install_tests and type == ''
2067
69e96427
ZJS
2068 exe = executable(
2069 name,
2070 sources,
2071 include_directories : incs,
2072 link_with : link_with,
2073 dependencies : dependencies,
572baca1 2074 c_args : defs,
b2fc5836 2075 install_rpath : rootlibexecdir,
572baca1
ZJS
2076 install : install,
2077 install_dir : testsdir)
2078
69e96427
ZJS
2079 if type == 'manual'
2080 message('@0@ is a manual test'.format(name))
2081 elif type == 'unsafe' and want_tests != 'unsafe'
2082 message('@0@ is an unsafe test'.format(name))
2083 else
2084 test(name, exe, env : test_env)
2085 endif
2086 else
2087 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2088 endif
2089endforeach
2090
37ab1a25
ZJS
2091test_libsystemd_sym = executable(
2092 'test-libsystemd-sym',
2093 test_libsystemd_sym_c,
2094 include_directories : includes,
ef0221bc 2095 link_with : [libsystemd],
37ab1a25
ZJS
2096 install : install_tests,
2097 install_dir : testsdir)
2098test('test-libsystemd-sym',
2099 test_libsystemd_sym)
2100
e0bec52f
ZJS
2101test_libudev_sym = executable(
2102 'test-libudev-sym',
2103 test_libudev_sym_c,
2104 include_directories : includes,
2105 c_args : ['-Wno-deprecated-declarations'],
ef0221bc 2106 link_with : [libudev],
e0bec52f
ZJS
2107 install : install_tests,
2108 install_dir : testsdir)
2109test('test-libudev-sym',
2110 test_libudev_sym)
2111
69e96427 2112############################################################
5c23128d
ZJS
2113
2114make_directive_index_py = find_program('tools/make-directive-index.py')
2115make_man_index_py = find_program('tools/make-man-index.py')
2116
2117subdir('units')
2118subdir('sysctl.d')
2119subdir('sysusers.d')
2120subdir('tmpfiles.d')
2121subdir('rules')
2122subdir('hwdb')
2123subdir('network')
2124subdir('man')
2125subdir('shell-completion/bash')
2126subdir('shell-completion/zsh')
2127subdir('docs/sysvinit')
2128subdir('docs/var-log')
2129
2130# FIXME: figure out if the warning is true:
2131# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2132install_subdir('factory/etc',
2133 install_dir : factorydir)
2134
2135
2136install_data('xorg/50-systemd-user.sh',
2137 install_dir : xinitrcdir)
2138install_data('system-preset/90-systemd.preset',
2139 install_dir : systempresetdir)
2140install_data('README',
2141 'NEWS',
2142 'CODING_STYLE',
2143 'DISTRO_PORTING',
2144 'ENVIRONMENT.md',
2145 'LICENSE.GPL2',
2146 'LICENSE.LGPL2.1',
2147 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2148 install_dir : docdir)
d68b342b 2149
94e75a54
ZJS
2150meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2151meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2152
d68b342b
ZJS
2153############################################################
2154
2155if git.found() and etags.found()
2156 all_files = run_command(
2157 git,
2158 ['--git-dir=@0@/.git'.format(meson.source_root()),
2159 'ls-files',
2160 ':/*.[ch]'])
2161 all_files = files(all_files.stdout().split())
2162
2163 custom_target(
2164 'TAGS',
2165 output : 'TAGS',
2166 input : all_files,
2167 command : [etags, '-o', '@OUTPUT@'] + all_files)
2168endif