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