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