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