]> git.ipfire.org Git - thirdparty/systemd.git/blame - meson.build
meson: properly conditionalize polkit installation
[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
3ca0cb73
ZJS
620want_polkit = get_option('polkit')
621install_polkit = false
622install_polkit_pkla = false
623if want_polkit != 'no'
624 conf.set('ENABLE_POLKIT', 1)
625 install_polkit = true
626
627 libpolkit = dependency('polkit-gobject-1',
628 required : false)
629 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
630 message('Old polkit detected, will install pkla files')
631 install_polkit_pkla = true
632 endif
633endif
634
5c23128d
ZJS
635want_audit = get_option('audit')
636if want_audit != 'no'
637 libaudit = dependency('audit', required : want_audit == 'yes')
638 if libaudit.found()
639 conf.set('HAVE_AUDIT', 1)
640 endif
641else
642 libaudit = []
643endif
644
645want_blkid = get_option('blkid')
646if want_blkid != 'no'
647 libblkid = dependency('blkid', required : want_blkid == 'yes')
648 if libblkid.found()
649 conf.set('HAVE_BLKID', 1)
650 endif
651else
652 libblkid = []
653endif
654
655want_kmod = get_option('kmod')
656if want_kmod != 'no'
657 libkmod = dependency('libkmod',
658 version : '>= 15',
659 required : want_kmod == 'yes')
660 if libkmod.found()
661 conf.set('HAVE_KMOD', 1)
662 endif
663else
664 libkmod = []
665endif
666
667want_pam = get_option('pam')
668if want_pam != 'no'
669 libpam = cc.find_library('pam', required : want_pam == 'yes')
670 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'yes')
671 if libpam.found() and libpam_misc.found()
672 conf.set('HAVE_PAM', 1)
673 m4_defines += ['-DHAVE_PAM']
674 endif
675else
676 libpam = []
677 libpam_misc = []
678endif
679
680want_microhttpd = get_option('microhttpd')
681if want_microhttpd != 'no'
682 libmicrohttpd = dependency('libmicrohttpd',
683 version : '>= 0.9.33',
684 required : want_microhttpd == 'yes')
685 if libmicrohttpd.found()
686 conf.set('HAVE_MICROHTTPD', 1)
687 m4_defines += ['-DHAVE_MICROHTTPD']
688 endif
689else
690 libmicrohttpd = []
691endif
692
693want_libcryptsetup = get_option('libcryptsetup')
694if want_libcryptsetup != 'no'
695 libcryptsetup = dependency('libcryptsetup',
696 version : '>= 1.6.0',
697 required : want_libcryptsetup == 'yes')
698 if libcryptsetup.found()
699 conf.set('HAVE_LIBCRYPTSETUP', 1)
700 endif
701else
702 libcryptsetup = []
703endif
704
705want_libcurl = get_option('libcurl')
706if want_libcurl != 'no'
707 libcurl = dependency('libcurl',
708 version : '>= 7.32.0',
709 required : want_libcurl == 'yes')
710 if libcurl.found()
711 conf.set('HAVE_LIBCURL', 1)
712 m4_defines += ['-DHAVE_LIBCURL']
713 endif
714else
715 libcurl = []
716endif
717
718want_libidn = get_option('libidn')
719if want_libidn != 'no'
720 libidn = dependency('libidn',
721 required : want_libidn == 'yes')
722 if libidn.found()
723 conf.set('HAVE_LIBIDN', 1)
724 m4_defines += ['-DHAVE_LIBIDN']
725 endif
726else
727 libidn = []
728endif
729
730want_libiptc = get_option('libiptc')
731if want_libiptc != 'no'
732 libiptc = dependency('libiptc',
733 required : want_libiptc == 'yes')
734 if libiptc.found()
735 conf.set('HAVE_LIBIPTC', 1)
736 m4_defines += ['-DHAVE_LIBIPTC']
737 endif
738else
739 libiptc = []
740endif
741
742want_qrencode = get_option('qrencode')
743if want_qrencode != 'no'
744 libqrencode = dependency('libqrencode',
745 required : want_qrencode == 'yes')
746 if libqrencode.found()
747 conf.set('HAVE_QRENCODE', 1)
748 endif
749else
750 libqrencode = []
751endif
752
753want_gnutls = get_option('gnutls')
754if want_gnutls != 'no'
755 libgnutls = dependency('gnutls',
756 version : '>= 3.1.4',
757 required : want_gnutls == 'yes')
758 if libgnutls.found()
759 conf.set('HAVE_GNUTLS', 1)
760 endif
761else
762 libgnutls = []
763endif
764
765want_elfutils = get_option('elfutils')
766if want_elfutils != 'no'
767 libdw = dependency('libdw',
768 required : want_elfutils == 'yes')
769 if libdw.found()
770 conf.set('HAVE_ELFUTILS', 1)
771 endif
772else
773 libdw = []
774endif
775
776want_zlib = get_option('zlib')
777if want_zlib != 'no'
778 libz = dependency('zlib',
779 required : want_zlib == 'yes')
780 if libz.found()
781 conf.set('HAVE_ZLIB', 1)
782 endif
783else
784 libz = []
785endif
786
787want_bzip2 = get_option('bzip2')
788if want_bzip2 != 'no'
789 libbzip2 = cc.find_library('bz2',
790 required : want_bzip2 == 'yes')
791 if libbzip2.found()
792 conf.set('HAVE_BZIP2', 1)
793 endif
794else
795 libbzip2 = []
796endif
797
798want_xz = get_option('xz')
799if want_xz != 'no'
800 libxz = dependency('liblzma',
801 required : want_xz == 'yes')
802 if libxz.found()
803 conf.set('HAVE_XZ', 1)
804 endif
805else
806 libxz = []
807endif
808
809want_lz4 = get_option('lz4')
810if want_lz4 != 'no'
811 liblz4 = dependency('liblz4',
812 required : want_lz4 == 'yes')
813 if liblz4.found()
814 conf.set('HAVE_LZ4', 1)
815 endif
816else
817 liblz4 = []
818endif
819
820libacl = cc.find_library('acl', required : false)
821if libacl.found()
822 conf.set('HAVE_ACL', 1)
823 m4_defines += ['-DHAVE_ACL']
824endif
825
69e96427
ZJS
826want_glib = get_option('glib')
827if want_glib != 'no'
828 libglib = dependency('glib-2.0',
829 version : '>= 2.22.0',
830 required : want_glib == 'yes')
831 libgobject = dependency('gobject-2.0',
832 version : '>= 2.22.0',
833 required : want_glib == 'yes')
834 libgio = dependency('gio-2.0',
835 required : want_glib == 'yes')
836 if libglib.found() and libgobject.found() and libgio.found()
837 conf.set('HAVE_GLIB', 1)
838 endif
839else
840 libglib = []
841 libgobject = []
842 libgio = []
843endif
844
845want_dbus = get_option('dbus')
846if want_dbus != 'no'
847 libdbus = dependency('dbus-1',
848 version : '>= 1.3.2',
849 required : want_dbus == 'yes')
850 if libdbus.found()
851 conf.set('HAVE_DBUS', 1)
852 endif
853else
854 libdbus = []
855endif
856
5c23128d
ZJS
857want_libgcrypt = get_option('libgcrypt')
858if want_libgcrypt != 'no'
859 libgcrypt = cc.find_library('gcrypt', required : want_libgcrypt == 'yes')
860 if libgcrypt.found()
861 conf.set('HAVE_LIBGCRYPT', 1)
862 endif
863else
864 libgcrypt = []
865endif
866
867want_importd = get_option('importd')
868if want_importd != 'no'
869 have_deps = (conf.get('HAVE_LIBCURL', 0) == 1 and
870 conf.get('HAVE_ZLIB', 0) == 1 and
871 conf.get('HAVE_BZIP2', 0) == 1 and
872 conf.get('HAVE_XZ', 0) == 1 and
f0bd7cc7 873 conf.get('HAVE_LIBGCRYPT', 0) == 1)
5c23128d
ZJS
874 if have_deps
875 conf.set('ENABLE_IMPORTD', 1)
876 elif want_importd == 'yes'
877 error('importd support was requested, but dependencies are not available')
878 endif
879endif
880
881want_remote = get_option('remote')
882if want_remote != 'no'
883 have_deps = [conf.get('HAVE_MICROHTTPD', 0) == 1,
884 conf.get('HAVE_LIBCURL', 0) == 1]
885 # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
886 # it's possible to build one without the other. Complain only if
887 # support was explictly requested. The auxiliary files like sysusers
888 # config should be installed when any of the programs are built.
889 if want_remote == 'yes' and not (have_deps[0] and have_deps[1])
890 error('remote support was requested, but dependencies are not available')
891 endif
892 if have_deps[0] or have_deps[1]
893 conf.set('ENABLE_REMOTE', 1)
894 endif
895endif
896
897foreach pair : [['utmp', 'HAVE_UTMP'],
898 ['hibernate', 'ENABLE_HIBERNATE'],
899 ['environment-d', 'ENABLE_ENVIRONMENT_D'],
900 ['binfmt', 'ENABLE_BINFMT'],
901 ['coredump', 'ENABLE_COREDUMP'],
902 ['resolve', 'ENABLE_RESOLVED'],
903 ['logind', 'ENABLE_LOGIND'],
904 ['hostnamed', 'ENABLE_HOSTNAMED'],
905 ['localed', 'ENABLE_LOCALED'],
906 ['machined', 'ENABLE_MACHINED'],
907 ['networkd', 'ENABLE_NETWORKD'],
908 ['timedated', 'ENABLE_TIMEDATED'],
909 ['timesyncd', 'ENABLE_TIMESYNCD'],
910 ['myhostname', 'HAVE_MYHOSTNAME'],
911 ['firstboot', 'ENABLE_FIRSTBOOT'],
912 ['randomseed', 'ENABLE_RANDOMSEED'],
913 ['backlight', 'ENABLE_BACKLIGHT'],
914 ['vconsole', 'ENABLE_VCONSOLE'],
915 ['quotacheck', 'ENABLE_QUOTACHECK'],
916 ['sysusers', 'ENABLE_SYSUSERS'],
917 ['tmpfiles', 'ENABLE_TMPFILES'],
918 ['hwdb', 'ENABLE_HWDB'],
919 ['rfkill', 'ENABLE_RFKILL'],
920 ['ldconfig', 'ENABLE_LDCONFIG'],
b710072d 921 ['efi', 'ENABLE_EFI'],
5c23128d
ZJS
922 ]
923
924 if get_option(pair[0])
925 conf.set(pair[1], 1)
926 endif
927endforeach
928
69e96427 929want_tests = get_option('tests')
572baca1 930install_tests = get_option('install-tests')
69e96427
ZJS
931tests = []
932
5c23128d
ZJS
933#####################################################################
934
935if get_option('efi')
b710072d
ZJS
936 efi_arch = host_machine.cpu_family()
937
5c23128d
ZJS
938 if efi_arch == 'ia32'
939 EFI_MACHINE_TYPE_NAME = 'ia32'
940 elif efi_arch == 'x86_64'
941 EFI_MACHINE_TYPE_NAME = 'x64'
b710072d
ZJS
942 elif efi_arch == 'arm'
943 EFI_MACHINE_TYPE_NAME = 'arm'
5c23128d 944 elif efi_arch == 'aarch64'
b710072d 945 EFI_MACHINE_TYPE_NAME = 'aa64'
5c23128d 946 else
b710072d 947 EFI_MACHINE_TYPE_NAME = ''
5c23128d
ZJS
948 endif
949
950 conf.set('ENABLE_EFI', 1)
951 conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
952endif
953
954#####################################################################
955
956config_h = configure_file(
957 output : 'config.h',
958 configuration : conf)
959
960includes = include_directories('src/basic',
961 'src/shared',
962 'src/systemd',
963 'src/journal',
964 'src/resolve',
965 'src/timesync',
966 'src/login',
967 'src/udev',
968 'src/libudev',
969 'src/core',
970 'src/libsystemd/sd-bus',
971 'src/libsystemd/sd-device',
972 'src/libsystemd/sd-hwdb',
973 'src/libsystemd/sd-id128',
974 'src/libsystemd/sd-netlink',
975 'src/libsystemd/sd-network',
976 'src/libsystemd-network',
977 )
978
979add_project_arguments('-include', 'config.h', language : 'c')
980
981gcrypt_util_sources = files('src/shared/gcrypt-util.h',
982 'src/shared/gcrypt-util.c')
983
984subdir('po')
985subdir('catalog')
986subdir('src/systemd')
987subdir('src/basic')
988subdir('src/libsystemd')
989subdir('src/libsystemd-network')
5c23128d 990subdir('src/journal')
5c23128d 991subdir('src/login')
5c23128d
ZJS
992
993libjournal_core = static_library(
994 'journal-core',
995 libjournal_core_sources,
996 journald_gperf_c,
997 include_directories : includes,
998 link_with : [libbasic,
999 libsystemd_internal,
1000 libsystemd_journal_internal],
1001 install : false)
1002
37ab1a25 1003libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
5c23128d
ZJS
1004libsystemd = shared_library(
1005 'systemd',
1006 libsystemd_internal_sources,
37ab1a25 1007 libsystemd_journal_internal_sources,
5c23128d
ZJS
1008 version : '0.18.0',
1009 include_directories : includes,
1010 link_args : ['-shared',
37ab1a25
ZJS
1011 '-Wl,--version-script=' + libsystemd_sym_path],
1012 link_with : [libbasic],
1013 dependencies : [threads,
1014 librt,
1015 libxz,
1016 liblz4],
6b30f280 1017 link_depends : libsystemd_sym,
5c23128d
ZJS
1018 install : true,
1019 install_dir : rootlibdir)
1020
1021############################################################
1022
1023foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME', []],
1024 ['systemd', '', []],
1025 ['mymachines', 'ENABLE_MACHINED', []],
1026 ['resolve', 'ENABLE_RESOLVED', [libdl]]]
1027
1028 condition = tuple[1] == '' or conf.get(tuple[1], 0) == 1
1029 if condition
1030 module = tuple[0]
1031 extra_deps = tuple[2]
1032
6b30f280
ZJS
1033 sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1034 version_script_arg = join_paths(meson.current_source_dir(), sym)
5c23128d
ZJS
1035
1036 shared_library(
1037 'nss_' + module,
1038 'src/nss-@0@/nss-@0@.c'.format(module),
1039 version : '2',
1040 include_directories : includes,
1041 link_args : ['-shared',
6b30f280 1042 '-Wl,--version-script=' + version_script_arg,
5c23128d
ZJS
1043 '-Wl,--undefined'],
1044 link_with : [libsystemd_internal,
1045 libbasic],
1046 dependencies : [threads,
1047 librt] + extra_deps,
6b30f280 1048 link_depends : sym,
5c23128d
ZJS
1049 install : true,
1050 install_dir : rootlibdir)
d7148676
ZJS
1051
1052 # We cannot use shared_module because it does not support version suffix.
1053 # Unfortunately shared_library insists on creating the symlink…
1054 meson.add_install_script('sh', '-c',
1055 'rm $DESTDIR@0@/libnss_@1@.so'
1056 .format(rootlibdir, module))
5c23128d
ZJS
1057 endif
1058endforeach
1059
1060############################################################
1061
1062subdir('src/libudev')
1063subdir('src/shared')
1064subdir('src/core')
1065subdir('src/udev')
1066subdir('src/network')
1067
69e96427
ZJS
1068subdir('src/analyze')
1069subdir('src/journal-remote')
1070subdir('src/coredump')
1071subdir('src/hostname')
1072subdir('src/import')
1073subdir('src/kernel-install')
1074subdir('src/locale')
1075subdir('src/machine')
1076subdir('src/nspawn')
1077subdir('src/resolve')
1078subdir('src/timedate')
1079subdir('src/timesync')
1080subdir('src/vconsole')
4e4ab1c3 1081subdir('src/sulogin-shell')
b710072d 1082subdir('src/boot/efi')
69e96427
ZJS
1083
1084subdir('src/test')
1085
5c23128d
ZJS
1086executable('systemd',
1087 systemd_sources,
1088 include_directories : includes,
1089 link_with : [libcore,
826472ce
ZJS
1090 libshared,
1091 libudev,
1092 libsystemd_internal],
5c23128d
ZJS
1093 dependencies : [threads,
1094 librt,
1095 libseccomp,
1096 libselinux,
f4ee10a2
ZJS
1097 libmount,
1098 libblkid],
421f0012 1099 install_rpath : rootlibexecdir,
5c23128d
ZJS
1100 install : true,
1101 install_dir : rootlibexecdir)
1102
1103executable('systemd-analyze',
1104 systemd_analyze_sources,
1105 include_directories : includes,
1106 link_with : [libcore,
826472ce
ZJS
1107 libudev,
1108 libsystemd_internal,
5c23128d
ZJS
1109 libshared],
1110 dependencies : [threads,
1111 librt,
1112 libseccomp,
1113 libselinux,
f4ee10a2
ZJS
1114 libmount,
1115 libblkid],
421f0012 1116 install_rpath : rootlibexecdir,
5c23128d
ZJS
1117 install : true)
1118
1119executable('systemd-journald',
1120 systemd_journald_sources,
1121 include_directories : includes,
1122 link_with : [libsystemd_journal_internal,
1123 libjournal_core,
1124 libshared,
1125 libudev],
1126 dependencies : [threads,
1127 libxz,
1128 liblz4],
421f0012 1129 install_rpath : rootlibexecdir,
5c23128d
ZJS
1130 install : true,
1131 install_dir : rootlibexecdir)
1132
1133executable('systemd-cat',
1134 systemd_cat_sources,
1135 include_directories : includes,
1136 link_with : [libjournal_core,
1137 libshared,
1138 libudev],
1139 dependencies : [threads],
b2fc5836 1140 install_rpath : rootlibexecdir,
5c23128d
ZJS
1141 install : true)
1142
1143executable('journalctl',
1144 journalctl_sources,
1145 include_directories : includes,
826472ce
ZJS
1146 link_with : [libsystemd_journal_internal,
1147 libshared,
1148 libudev,
1149 libsystemd_internal],
5c23128d
ZJS
1150 dependencies : [threads,
1151 libqrencode,
1152 libxz,
1153 liblz4],
b2fc5836 1154 install_rpath : rootlibexecdir,
5c23128d
ZJS
1155 install : true,
1156 install_dir : rootbindir)
1157
1158executable('systemd-getty-generator',
1159 'src/getty-generator/getty-generator.c',
5c23128d 1160 include_directories : includes,
b2fc5836
ZJS
1161 link_with : [libshared],
1162 install_rpath : rootlibexecdir,
1163 install : true,
1164 install_dir : systemgeneratordir)
5c23128d
ZJS
1165
1166executable('systemd-debug-generator',
1167 'src/debug-generator/debug-generator.c',
5c23128d 1168 include_directories : includes,
b2fc5836
ZJS
1169 link_with : [libshared],
1170 install_rpath : rootlibexecdir,
1171 install : true,
1172 install_dir : systemgeneratordir)
5c23128d
ZJS
1173
1174executable('systemd-fstab-generator',
1175 'src/fstab-generator/fstab-generator.c',
1176 'src/core/mount-setup.c',
5c23128d 1177 include_directories : includes,
b2fc5836
ZJS
1178 link_with : [libshared],
1179 install_rpath : rootlibexecdir,
1180 install : true,
1181 install_dir : systemgeneratordir)
5c23128d
ZJS
1182
1183if conf.get('ENABLE_ENVIRONMENT_D', 0) == 1
1184 executable('30-systemd-environment-d-generator',
1185 'src/environment-d-generator/environment-d-generator.c',
5c23128d 1186 include_directories : includes,
826472ce 1187 link_with : [libshared,
b2fc5836
ZJS
1188 libsystemd_internal],
1189 install_rpath : rootlibexecdir,
1190 install : true,
1191 install_dir : userenvgeneratordir)
7b76fce1
ZJS
1192
1193 meson.add_install_script(meson_make_symlink,
1194 sysconfdir + '/environment',
1195 environmentdir + '/99-environment.conf')
5c23128d
ZJS
1196endif
1197
1198if conf.get('ENABLE_HIBERNATE', 0) == 1
1199 executable('systemd-hibernate-resume-generator',
1200 'src/hibernate-resume/hibernate-resume-generator.c',
1201 include_directories : includes,
1202 link_with : [libshared],
b2fc5836 1203 install_rpath : rootlibexecdir,
5c23128d
ZJS
1204 install : true,
1205 install_dir : systemgeneratordir)
1206
1207 executable('systemd-hibernate-resume',
1208 'src/hibernate-resume/hibernate-resume.c',
1209 include_directories : includes,
1210 link_with : [libshared],
b2fc5836 1211 install_rpath : rootlibexecdir,
5c23128d
ZJS
1212 install : true,
1213 install_dir : rootlibexecdir)
1214endif
1215
1216if conf.get('HAVE_BLKID', 0) == 1
1217 executable('systemd-gpt-auto-generator',
1218 'src/gpt-auto-generator/gpt-auto-generator.c',
1219 'src/basic/blkid-util.h',
5c23128d 1220 include_directories : includes,
826472ce
ZJS
1221 link_with : [libsystemd_internal,
1222 libshared,
1223 libudev],
b2fc5836
ZJS
1224 dependencies : libblkid,
1225 install_rpath : rootlibexecdir,
1226 install : true,
1227 install_dir : systemgeneratordir)
5c23128d
ZJS
1228
1229 executable('systemd-dissect',
1230 'src/dissect/dissect.c',
1231 include_directories : includes,
1232 link_with : [libshared],
421f0012 1233 install_rpath : rootlibexecdir,
5c23128d
ZJS
1234 install : true,
1235 install_dir : rootlibexecdir)
1236endif
1237
1238if conf.get('ENABLE_RESOLVED', 0) == 1
1239 executable('systemd-resolved',
1240 systemd_resolved_sources,
1241 include_directories : includes,
1242 link_with : [libshared,
826472ce 1243 libsystemd_internal],
5c23128d
ZJS
1244 dependencies : [threads,
1245 libm,
1246 libidn],
421f0012 1247 install_rpath : rootlibexecdir,
5c23128d
ZJS
1248 install : true,
1249 install_dir : rootlibexecdir)
1250
1251 executable('systemd-resolve',
1252 systemd_resolve_sources,
1253 include_directories : includes,
1254 link_with : [libshared,
826472ce 1255 libsystemd_internal],
5c23128d
ZJS
1256 dependencies : [threads,
1257 libm,
1258 libidn],
b2fc5836 1259 install_rpath : rootlibexecdir,
5c23128d
ZJS
1260 install : true)
1261endif
1262
1263if conf.get('ENABLE_LOGIND', 0) == 1
1264 executable('systemd-logind',
1265 systemd_logind_sources,
1266 include_directories : includes,
1267 link_with : [liblogind_core,
826472ce
ZJS
1268 libudev,
1269 libshared,
1270 libsystemd_internal],
5c23128d
ZJS
1271 dependencies : [threads,
1272 libacl],
421f0012 1273 install_rpath : rootlibexecdir,
5c23128d
ZJS
1274 install : true,
1275 install_dir : rootlibexecdir)
1276
1277 executable('loginctl',
1278 loginctl_sources,
1279 include_directories : includes,
826472ce
ZJS
1280 link_with : [libshared,
1281 libudev,
1282 libsystemd_internal],
5c23128d
ZJS
1283 dependencies : [threads,
1284 liblz4,
1285 libxz],
b2fc5836 1286 install_rpath : rootlibexecdir,
5c23128d
ZJS
1287 install : true,
1288 install_dir : rootbindir)
1289
1290 executable('systemd-inhibit',
1291 'src/login/inhibit.c',
1292 include_directories : includes,
826472ce
ZJS
1293 link_with : [libshared,
1294 libsystemd_internal],
b2fc5836 1295 install_rpath : rootlibexecdir,
5c23128d
ZJS
1296 install : true,
1297 install_dir : rootbindir)
1298
1299 if conf.get('HAVE_PAM', 0) == 1
6b30f280 1300 version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
5c23128d
ZJS
1301 shared_library(
1302 'pam_systemd',
1303 pam_systemd_c,
1304 name_prefix : '',
1305 include_directories : includes,
1306 link_args : ['-shared',
6b30f280 1307 '-Wl,--version-script=' + version_script_arg],
826472ce
ZJS
1308 link_with : [libsystemd_internal,
1309 libshared_static],
1310 dependencies : [threads,
1311 libpam,
5c23128d 1312 libpam_misc],
6b30f280 1313 link_depends : pam_systemd_sym,
5c23128d
ZJS
1314 install : true,
1315 install_dir : pamlibdir)
1316 endif
1317endif
1318
1319if conf.get('HAVE_PAM', 0) == 1
1320 executable('systemd-user-sessions',
1321 'src/user-sessions/user-sessions.c',
1322 include_directories : includes,
1323 link_with : [libshared],
421f0012 1324 install_rpath : rootlibexecdir,
5c23128d
ZJS
1325 install : true,
1326 install_dir : rootlibexecdir)
1327endif
1328
8191c594 1329if conf.get('ENABLE_EFI', 0) == 1 and conf.get('HAVE_BLKID', 0) == 1
5c23128d
ZJS
1330 executable('bootctl',
1331 'src/boot/bootctl.c',
1332 include_directories : includes,
1333 link_with : [libshared],
1334 dependencies : [libblkid],
b2fc5836 1335 install_rpath : rootlibexecdir,
5c23128d
ZJS
1336 install : true)
1337endif
1338
1339executable('systemd-socket-activate', 'src/activate/activate.c',
1340 include_directories : includes,
1341 link_with : [libshared],
1342 dependencies : [threads],
b2fc5836 1343 install_rpath : rootlibexecdir,
5c23128d
ZJS
1344 install : true)
1345
1346executable('systemctl', 'src/systemctl/systemctl.c',
1347 include_directories : includes,
826472ce
ZJS
1348 link_with : [libshared,
1349 libsystemd_internal],
5c23128d
ZJS
1350 dependencies : [threads,
1351 libcap,
1352 libselinux,
1353 libxz,
1354 liblz4],
b2fc5836 1355 install_rpath : rootlibexecdir,
5c23128d
ZJS
1356 install : true,
1357 install_dir : rootbindir)
1358
1359if conf.get('ENABLE_BACKLIGHT', 0) == 1
1360 executable('systemd-backlight',
1361 'src/backlight/backlight.c',
1362 include_directories : includes,
826472ce
ZJS
1363 link_with : [libshared,
1364 libudev],
421f0012 1365 install_rpath : rootlibexecdir,
5c23128d
ZJS
1366 install : true,
1367 install_dir : rootlibexecdir)
1368endif
1369
1370if conf.get('ENABLE_RFKILL', 0) == 1
1371 executable('systemd-rfkill',
1372 'src/rfkill/rfkill.c',
1373 include_directories : includes,
826472ce
ZJS
1374 link_with : [libshared,
1375 libudev],
421f0012 1376 install_rpath : rootlibexecdir,
5c23128d
ZJS
1377 install : true,
1378 install_dir : rootlibexecdir)
1379endif
1380
1381executable('systemd-system-update-generator',
1382 'src/system-update-generator/system-update-generator.c',
1383 include_directories : includes,
1384 link_with : [libshared],
b2fc5836 1385 install_rpath : rootlibexecdir,
5c23128d
ZJS
1386 install : true,
1387 install_dir : systemgeneratordir)
1388
1389if conf.get('HAVE_LIBCRYPTSETUP', 0) == 1
1390 executable('systemd-cryptsetup',
1391 'src/cryptsetup/cryptsetup.c',
1392 include_directories : includes,
826472ce
ZJS
1393 link_with : [libshared,
1394 libsystemd_internal],
5c23128d 1395 dependencies : [libcryptsetup],
421f0012 1396 install_rpath : rootlibexecdir,
5c23128d
ZJS
1397 install : true,
1398 install_dir : rootlibexecdir)
1399
1400 executable('systemd-cryptsetup-generator',
1401 'src/cryptsetup/cryptsetup-generator.c',
1402 include_directories : includes,
1403 link_with : [libshared],
1404 dependencies : [libcryptsetup],
b2fc5836 1405 install_rpath : rootlibexecdir,
5c23128d
ZJS
1406 install : true,
1407 install_dir : systemgeneratordir)
1408
1409 executable('systemd-veritysetup',
1410 'src/veritysetup/veritysetup.c',
1411 include_directories : includes,
1412 link_with : [libshared],
1413 dependencies : [libcryptsetup],
421f0012 1414 install_rpath : rootlibexecdir,
5c23128d
ZJS
1415 install : true,
1416 install_dir : rootlibexecdir)
1417
1418 executable('systemd-veritysetup-generator',
1419 'src/veritysetup/veritysetup-generator.c',
1420 include_directories : includes,
826472ce
ZJS
1421 link_with : [libshared,
1422 libsystemd_internal],
5c23128d 1423 dependencies : [libcryptsetup],
b2fc5836 1424 install_rpath : rootlibexecdir,
5c23128d
ZJS
1425 install : true,
1426 install_dir : systemgeneratordir)
1427endif
1428
1429if conf.get('HAVE_SYSV_COMPAT', 0) == 1
1430 executable('systemd-sysv-generator',
1431 'src/sysv-generator/sysv-generator.c',
1432 include_directories : includes,
1433 link_with : [libshared],
b2fc5836 1434 install_rpath : rootlibexecdir,
5c23128d
ZJS
1435 install : true,
1436 install_dir : systemgeneratordir)
1437
1438 executable('systemd-rc-local-generator',
1439 'src/rc-local-generator/rc-local-generator.c',
1440 include_directories : includes,
1441 link_with : [libshared],
b2fc5836 1442 install_rpath : rootlibexecdir,
5c23128d
ZJS
1443 install : true,
1444 install_dir : systemgeneratordir)
1445endif
1446
1447if conf.get('ENABLE_HOSTNAMED', 0) == 1
1448 executable('systemd-hostnamed',
1449 'src/hostname/hostnamed.c',
1450 include_directories : includes,
1451 link_with : [libshared],
421f0012 1452 install_rpath : rootlibexecdir,
5c23128d
ZJS
1453 install : true,
1454 install_dir : rootlibexecdir)
1455
1456 executable('hostnamectl',
1457 'src/hostname/hostnamectl.c',
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_LOCALED', 0) == 1
1466 executable('systemd-localed',
1467 systemd_localed_sources,
1468 include_directories : includes,
826472ce
ZJS
1469 link_with : [libshared,
1470 libsystemd_internal],
5c23128d 1471 dependencies : [libdl],
421f0012 1472 install_rpath : rootlibexecdir,
5c23128d
ZJS
1473 install : true,
1474 install_dir : rootlibexecdir)
1475
1476 executable('localectl',
1477 localectl_sources,
1478 include_directories : includes,
826472ce
ZJS
1479 link_with : [libshared,
1480 libsystemd_internal],
b2fc5836 1481 install_rpath : rootlibexecdir,
5c23128d
ZJS
1482 install : true)
1483endif
1484
1485if conf.get('ENABLE_TIMEDATED', 0) == 1
1486 executable('systemd-timedated',
1487 'src/timedate/timedated.c',
1488 include_directories : includes,
826472ce
ZJS
1489 link_with : [libshared,
1490 libsystemd_internal],
b2fc5836 1491 install_rpath : rootlibexecdir,
5c23128d
ZJS
1492 install : true,
1493 install_dir : rootlibexecdir)
1494
1495 executable('timedatectl',
1496 'src/timedate/timedatectl.c',
1497 include_directories : includes,
b2fc5836 1498 install_rpath : rootlibexecdir,
826472ce
ZJS
1499 link_with : [libshared,
1500 libsystemd_internal],
5c23128d
ZJS
1501 install : true)
1502endif
1503
1504if conf.get('ENABLE_TIMESYNCD', 0) == 1
1505 executable('systemd-timesyncd',
1506 systemd_timesyncd_sources,
1507 include_directories : includes,
826472ce
ZJS
1508 link_with : [libshared,
1509 libsystemd_internal],
5c23128d
ZJS
1510 dependencies : [threads,
1511 libm],
421f0012 1512 install_rpath : rootlibexecdir,
5c23128d
ZJS
1513 install : true,
1514 install_dir : rootlibexecdir)
1515endif
1516
1517if conf.get('ENABLE_MACHINED', 0) == 1
1518 executable('systemd-machined',
1519 systemd_machined_sources,
1520 include_directories : includes,
1521 link_with : [libmachine_core,
826472ce
ZJS
1522 libshared,
1523 libsystemd_internal],
421f0012 1524 install_rpath : rootlibexecdir,
5c23128d
ZJS
1525 install : true,
1526 install_dir : rootlibexecdir)
1527
1528 executable('machinectl',
1529 'src/machine/machinectl.c',
1530 include_directories : includes,
826472ce
ZJS
1531 link_with : [libshared,
1532 libsystemd_internal],
5c23128d
ZJS
1533 dependencies : [threads,
1534 libxz,
1535 liblz4],
b2fc5836 1536 install_rpath : rootlibexecdir,
5c23128d
ZJS
1537 install : true,
1538 install_dir : rootbindir)
1539endif
1540
1541if conf.get('ENABLE_IMPORTD', 0) == 1
1542 executable('systemd-importd',
1543 systemd_importd_sources,
1544 include_directories : includes,
826472ce
ZJS
1545 link_with : [libsystemd_internal,
1546 libshared],
1547 dependencies : [threads],
421f0012 1548 install_rpath : rootlibexecdir,
5c23128d
ZJS
1549 install : true,
1550 install_dir : rootlibexecdir)
1551
1552 executable('systemd-pull',
1553 systemd_pull_sources,
1554 include_directories : includes,
1555 link_with : [libshared],
1556 dependencies : [libcurl,
1557 libz,
1558 libbzip2,
1559 libxz,
1560 libgcrypt],
421f0012 1561 install_rpath : rootlibexecdir,
5c23128d
ZJS
1562 install : true,
1563 install_dir : rootlibexecdir)
1564
1565 executable('systemd-import',
1566 systemd_import_sources,
1567 include_directories : includes,
1568 link_with : [libshared],
1569 dependencies : [libcurl,
1570 libz,
1571 libbzip2,
1572 libxz],
421f0012 1573 install_rpath : rootlibexecdir,
5c23128d
ZJS
1574 install : true,
1575 install_dir : rootlibexecdir)
1576
1577 executable('systemd-export',
1578 systemd_export_sources,
1579 include_directories : includes,
1580 link_with : [libshared],
1581 dependencies : [libcurl,
1582 libz,
1583 libbzip2,
1584 libxz],
421f0012 1585 install_rpath : rootlibexecdir,
5c23128d
ZJS
1586 install : true,
1587 install_dir : rootlibexecdir)
1588endif
1589
1590if conf.get('ENABLE_REMOTE', 0) == 1 and conf.get('HAVE_LIBCURL', 0) == 1
1591 executable('systemd-journal-upload',
1592 systemd_journal_upload_sources,
1593 include_directories : includes,
826472ce
ZJS
1594 link_with : [libsystemd_journal_internal,
1595 libshared],
5c23128d
ZJS
1596 dependencies : [threads,
1597 libcurl,
1598 libgnutls,
1599 libxz,
1600 liblz4],
421f0012 1601 install_rpath : rootlibexecdir,
5c23128d
ZJS
1602 install : true,
1603 install_dir : rootlibexecdir)
1604endif
1605
1606if conf.get('ENABLE_REMOTE', 0) == 1 and conf.get('HAVE_MICROHTTPD', 0) == 1
1607 executable('systemd-journal-remote',
1608 systemd_journal_remote_sources,
1609 include_directories : includes,
826472ce
ZJS
1610 link_with : [libsystemd_journal_internal,
1611 libshared],
5c23128d
ZJS
1612 dependencies : [threads,
1613 libmicrohttpd,
1614 libgnutls,
1615 libxz,
1616 liblz4],
421f0012 1617 install_rpath : rootlibexecdir,
5c23128d
ZJS
1618 install : true,
1619 install_dir : rootlibexecdir)
1620
1621 executable('systemd-journal-gatewayd',
1622 systemd_journal_gatewayd_sources,
1623 include_directories : includes,
826472ce
ZJS
1624 link_with : [libsystemd_journal_internal,
1625 libshared],
5c23128d
ZJS
1626 dependencies : [threads,
1627 libmicrohttpd,
1628 libgnutls,
1629 libxz,
1630 liblz4],
421f0012 1631 install_rpath : rootlibexecdir,
5c23128d
ZJS
1632 install : true,
1633 install_dir : rootlibexecdir)
1634endif
1635
1636if conf.get('ENABLE_COREDUMP', 0) == 1
1637 executable('systemd-coredump',
1638 systemd_coredump_sources,
1639 include_directories : includes,
826472ce
ZJS
1640 link_with : [libsystemd_journal_internal,
1641 libshared,
1642 libsystemd],
5c23128d
ZJS
1643 dependencies : [threads,
1644 libacl,
1645 libdw,
1646 libxz,
1647 liblz4],
421f0012 1648 install_rpath : rootlibexecdir,
5c23128d
ZJS
1649 install : true,
1650 install_dir : rootlibexecdir)
1651
1652 executable('coredumpctl',
1653 coredumpctl_sources,
1654 include_directories : includes,
826472ce
ZJS
1655 link_with : [libsystemd_journal_internal,
1656 libshared,
1657 libsystemd_internal],
5c23128d
ZJS
1658 dependencies : [threads,
1659 libxz,
1660 liblz4],
b2fc5836 1661 install_rpath : rootlibexecdir,
5c23128d
ZJS
1662 install : true)
1663endif
1664
1665if conf.get('ENABLE_BINFMT', 0) == 1
1666 executable('systemd-binfmt',
1667 'src/binfmt/binfmt.c',
1668 include_directories : includes,
1669 link_with : [libshared],
421f0012 1670 install_rpath : rootlibexecdir,
5c23128d
ZJS
1671 install : true,
1672 install_dir : rootlibexecdir)
94e75a54
ZJS
1673
1674 meson.add_install_script('sh', '-c',
1675 mkdir_p.format(binfmtdir))
1676 meson.add_install_script('sh', '-c',
1677 mkdir_p.format(sysconfdir + '/binfmt.d'))
5c23128d
ZJS
1678endif
1679
1680if conf.get('ENABLE_VCONSOLE', 0) == 1
1681 executable('systemd-vconsole-setup',
1682 'src/vconsole/vconsole-setup.c',
1683 include_directories : includes,
1684 link_with : [libshared],
421f0012 1685 install_rpath : rootlibexecdir,
5c23128d
ZJS
1686 install : true,
1687 install_dir : rootlibexecdir)
1688endif
1689
1690if conf.get('ENABLE_RANDOMSEED', 0) == 1
1691 executable('systemd-random-seed',
1692 'src/random-seed/random-seed.c',
1693 include_directories : includes,
1694 link_with : [libshared],
421f0012 1695 install_rpath : rootlibexecdir,
5c23128d
ZJS
1696 install : true,
1697 install_dir : rootlibexecdir)
1698endif
1699
1700if conf.get('ENABLE_FIRSTBOOT', 0) == 1
1701 executable('systemd-firstboot',
1702 'src/firstboot/firstboot.c',
1703 include_directories : includes,
1704 link_with : [libshared],
1705 dependencies : [libcrypt],
b2fc5836 1706 install_rpath : rootlibexecdir,
5c23128d
ZJS
1707 install : true,
1708 install_dir : rootbindir)
1709endif
1710
1711executable('systemd-remount-fs',
1712 'src/remount-fs/remount-fs.c',
1713 'src/core/mount-setup.c',
1714 'src/core/mount-setup.h',
1715 include_directories : includes,
1716 link_with : [libshared],
b2fc5836 1717 install_rpath : rootlibexecdir,
5c23128d
ZJS
1718 install : true,
1719 install_dir : rootlibexecdir)
1720
1721executable('systemd-machine-id-setup',
1722 'src/machine-id-setup/machine-id-setup-main.c',
1723 'src/core/machine-id-setup.c',
1724 'src/core/machine-id-setup.h',
1725 include_directories : includes,
826472ce
ZJS
1726 link_with : [libshared,
1727 libsystemd_internal],
b2fc5836 1728 install_rpath : rootlibexecdir,
5c23128d
ZJS
1729 install : true,
1730 install_dir : rootbindir)
1731
1732executable('systemd-fsck',
1733 'src/fsck/fsck.c',
1734 include_directories : includes,
826472ce
ZJS
1735 link_with : [libshared,
1736 libsystemd_internal],
421f0012 1737 install_rpath : rootlibexecdir,
5c23128d
ZJS
1738 install : true,
1739 install_dir : rootlibexecdir)
1740
1741executable('systemd-sleep',
1742 'src/sleep/sleep.c',
1743 include_directories : includes,
1744 link_with : [libshared],
421f0012 1745 install_rpath : rootlibexecdir,
5c23128d
ZJS
1746 install : true,
1747 install_dir : rootlibexecdir)
1748
1749executable('systemd-sysctl',
1750 'src/sysctl/sysctl.c',
1751 include_directories : includes,
1752 link_with : [libshared],
421f0012 1753 install_rpath : rootlibexecdir,
5c23128d
ZJS
1754 install : true,
1755 install_dir : rootlibexecdir)
1756
1757executable('systemd-ac-power',
1758 'src/ac-power/ac-power.c',
1759 include_directories : includes,
1760 link_with : [libshared],
421f0012 1761 install_rpath : rootlibexecdir,
5c23128d
ZJS
1762 install : true,
1763 install_dir : rootlibexecdir)
1764
1765executable('systemd-detect-virt',
1766 'src/detect-virt/detect-virt.c',
1767 include_directories : includes,
1768 link_with : [libshared],
b2fc5836 1769 install_rpath : rootlibexecdir,
5c23128d
ZJS
1770 install : true)
1771
1772executable('systemd-delta',
1773 'src/delta/delta.c',
1774 include_directories : includes,
1775 link_with : [libshared],
b2fc5836 1776 install_rpath : rootlibexecdir,
5c23128d
ZJS
1777 install : true)
1778
1779executable('systemd-escape',
1780 'src/escape/escape.c',
1781 include_directories : includes,
1782 link_with : [libshared],
b2fc5836 1783 install_rpath : rootlibexecdir,
5c23128d
ZJS
1784 install : true,
1785 install_dir : rootbindir)
1786
1787executable('systemd-notify',
1788 'src/notify/notify.c',
1789 include_directories : includes,
1790 link_with : [libshared],
b2fc5836 1791 install_rpath : rootlibexecdir,
5c23128d
ZJS
1792 install : true,
1793 install_dir : rootbindir)
1794
1795executable('systemd-volatile-root',
1796 'src/volatile-root/volatile-root.c',
1797 include_directories : includes,
1798 link_with : [libshared],
421f0012 1799 install_rpath : rootlibexecdir,
5c23128d
ZJS
1800 install : true,
1801 install_dir : rootlibexecdir)
1802
1803executable('systemd-cgroups-agent',
1804 'src/cgroups-agent/cgroups-agent.c',
1805 include_directories : includes,
1806 link_with : [libshared],
421f0012 1807 install_rpath : rootlibexecdir,
5c23128d
ZJS
1808 install : true,
1809 install_dir : rootlibexecdir)
1810
1811executable('systemd-path',
1812 'src/path/path.c',
1813 include_directories : includes,
826472ce
ZJS
1814 link_with : [libsystemd_internal,
1815 libshared],
b2fc5836 1816 install_rpath : rootlibexecdir,
5c23128d
ZJS
1817 install : true)
1818
1819executable('systemd-ask-password',
1820 'src/ask-password/ask-password.c',
1821 include_directories : includes,
826472ce
ZJS
1822 link_with : [libshared,
1823 libsystemd_internal],
b2fc5836 1824 install_rpath : rootlibexecdir,
5c23128d
ZJS
1825 install : true,
1826 install_dir : rootbindir)
1827
1828executable('systemd-reply-password',
1829 'src/reply-password/reply-password.c',
1830 include_directories : includes,
826472ce
ZJS
1831 link_with : [libshared,
1832 libsystemd_internal],
421f0012 1833 install_rpath : rootlibexecdir,
5c23128d
ZJS
1834 install : true,
1835 install_dir : rootlibexecdir)
1836
1837executable('systemd-tty-ask-password-agent',
1838 'src/tty-ask-password-agent/tty-ask-password-agent.c',
1839 include_directories : includes,
826472ce
ZJS
1840 link_with : [libshared,
1841 libsystemd_internal],
b2fc5836 1842 install_rpath : rootlibexecdir,
5c23128d
ZJS
1843 install : true,
1844 install_dir : rootbindir)
1845
1846executable('systemd-cgls',
1847 'src/cgls/cgls.c',
1848 include_directories : includes,
826472ce
ZJS
1849 link_with : [libshared,
1850 libsystemd_internal],
b2fc5836 1851 install_rpath : rootlibexecdir,
5c23128d
ZJS
1852 install : true)
1853
1854executable('systemd-cgtop',
1855 'src/cgtop/cgtop.c',
1856 include_directories : includes,
826472ce
ZJS
1857 link_with : [libshared,
1858 libsystemd_internal],
b2fc5836 1859 install_rpath : rootlibexecdir,
5c23128d
ZJS
1860 install : true)
1861
1862executable('systemd-initctl',
1863 'src/initctl/initctl.c',
1864 include_directories : includes,
826472ce
ZJS
1865 link_with : [libshared,
1866 libsystemd_internal],
421f0012 1867 install_rpath : rootlibexecdir,
5c23128d
ZJS
1868 install : true,
1869 install_dir : rootlibexecdir)
1870
1871executable('systemd-mount',
1872 'src/mount/mount-tool.c',
1873 include_directories : includes,
826472ce
ZJS
1874 link_with : [libshared,
1875 libsystemd_internal,
1876 libudev],
b2fc5836 1877 install_rpath : rootlibexecdir,
5c23128d
ZJS
1878 install : true)
1879
7b76fce1
ZJS
1880meson.add_install_script(meson_make_symlink,
1881 'systemd-mount', bindir + '/systemd-umount')
1882
5c23128d
ZJS
1883executable('systemd-run',
1884 'src/run/run.c',
1885 include_directories : includes,
826472ce
ZJS
1886 link_with : [libshared,
1887 libsystemd_internal],
b2fc5836 1888 install_rpath : rootlibexecdir,
5c23128d
ZJS
1889 install : true)
1890
1891executable('systemd-stdio-bridge',
1892 'src/stdio-bridge/stdio-bridge.c',
1893 include_directories : includes,
826472ce
ZJS
1894 link_with : [libshared,
1895 libsystemd_internal],
b2fc5836 1896 install_rpath : rootlibexecdir,
5c23128d
ZJS
1897 install : true)
1898
1899executable('busctl',
1900 'src/busctl/busctl.c',
1901 'src/busctl/busctl-introspect.c',
1902 'src/busctl/busctl-introspect.h',
1903 include_directories : includes,
826472ce
ZJS
1904 link_with : [libshared,
1905 libsystemd_internal],
b2fc5836 1906 install_rpath : rootlibexecdir,
5c23128d
ZJS
1907 install : true)
1908
1909if conf.get('ENABLE_SYSUSERS', 0) == 1
1910 executable('systemd-sysusers',
1911 'src/sysusers/sysusers.c',
1912 include_directories : includes,
1913 link_with : [libshared],
b2fc5836 1914 install_rpath : rootlibexecdir,
5c23128d
ZJS
1915 install : true,
1916 install_dir : rootbindir)
1917endif
1918
1919if conf.get('ENABLE_TMPFILES', 0) == 1
1920 executable('systemd-tmpfiles',
1921 'src/tmpfiles/tmpfiles.c',
1922 include_directories : includes,
1923 link_with : [libshared],
1924 dependencies : [libacl],
b2fc5836 1925 install_rpath : rootlibexecdir,
5c23128d
ZJS
1926 install : true,
1927 install_dir : rootbindir)
1928endif
1929
1930if conf.get('ENABLE_HWDB', 0) == 1
1931 executable('systemd-hwdb',
1932 'src/hwdb/hwdb.c',
1933 'src/libsystemd/sd-hwdb/hwdb-internal.h',
1934 include_directories : includes,
826472ce
ZJS
1935 link_with : [libshared,
1936 libsystemd_internal],
b2fc5836 1937 install_rpath : rootlibexecdir,
5c23128d
ZJS
1938 install : true,
1939 install_dir : rootbindir)
1940endif
1941
1942if conf.get('ENABLE_QUOTACHECK', 0) == 1
1943 executable('systemd-quotacheck',
1944 'src/quotacheck/quotacheck.c',
1945 include_directories : includes,
1946 link_with : [libshared],
421f0012 1947 install_rpath : rootlibexecdir,
5c23128d
ZJS
1948 install : true,
1949 install_dir : rootlibexecdir)
1950endif
1951
1952executable('systemd-socket-proxyd',
1953 'src/socket-proxy/socket-proxyd.c',
1954 include_directories : includes,
1955 link_with : [libshared,
826472ce 1956 libsystemd_internal],
5c23128d 1957 dependencies : [threads],
421f0012 1958 install_rpath : rootlibexecdir,
5c23128d
ZJS
1959 install : true,
1960 install_dir : rootlibexecdir)
1961
1962executable('systemd-udevd',
1963 systemd_udevd_sources,
1964 include_directories : includes,
1965 link_with : [libudev_core,
1966 libudev_internal,
1967 libsystemd_network,
826472ce 1968 libsystemd_internal,
5c23128d
ZJS
1969 libshared],
1970 dependencies : [libkmod,
1971 libidn,
1972 libacl],
421f0012 1973 install_rpath : rootlibexecdir,
5c23128d
ZJS
1974 install : true,
1975 install_dir : rootlibexecdir)
1976
1977executable('udevadm',
1978 udevadm_sources,
1979 include_directories : includes,
1980 link_with : [libudev_core,
1981 libudev_internal,
1982 libsystemd_network,
826472ce
ZJS
1983 libshared,
1984 libsystemd_internal],
5c23128d
ZJS
1985 dependencies : [libkmod,
1986 libidn,
1987 libacl],
b2fc5836 1988 install_rpath : rootlibexecdir,
5c23128d
ZJS
1989 install : true,
1990 install_dir : rootbindir)
1991
1992executable('systemd-shutdown',
1993 systemd_shutdown_sources,
1994 include_directories : includes,
826472ce
ZJS
1995 link_with : [libshared,
1996 libudev],
421f0012 1997 install_rpath : rootlibexecdir,
5c23128d
ZJS
1998 install : true,
1999 install_dir : rootlibexecdir)
2000
2001executable('systemd-update-done',
2002 'src/update-done/update-done.c',
2003 include_directories : includes,
2004 link_with : [libshared],
421f0012 2005 install_rpath : rootlibexecdir,
5c23128d
ZJS
2006 install : true,
2007 install_dir : rootlibexecdir)
2008
2009executable('systemd-update-utmp',
2010 'src/update-utmp/update-utmp.c',
2011 include_directories : includes,
826472ce
ZJS
2012 link_with : [libshared,
2013 libsystemd_internal],
5c23128d 2014 dependencies : [libaudit],
421f0012 2015 install_rpath : rootlibexecdir,
5c23128d
ZJS
2016 install : true,
2017 install_dir : rootlibexecdir)
2018
2019if conf.get('HAVE_KMOD', 0) == 1
2020 executable('systemd-modules-load',
2021 'src/modules-load/modules-load.c',
2022 include_directories : includes,
2023 link_with : [libshared],
2024 dependencies : [libkmod],
421f0012 2025 install_rpath : rootlibexecdir,
5c23128d
ZJS
2026 install : true,
2027 install_dir : rootlibexecdir)
94e75a54
ZJS
2028
2029 meson.add_install_script('sh', '-c',
2030 mkdir_p.format(modulesloaddir))
2031 meson.add_install_script('sh', '-c',
2032 mkdir_p.format(sysconfdir + '/modules-load.d'))
5c23128d
ZJS
2033endif
2034
2035executable('systemd-nspawn',
2036 systemd_nspawn_sources,
2037 'src/core/mount-setup.c', # FIXME: use a variable?
2038 'src/core/mount-setup.h',
2039 'src/core/loopback-setup.c',
2040 'src/core/loopback-setup.h',
2041 include_directories : [includes, include_directories('src/nspawn')],
2042 link_with : [libfirewall,
826472ce
ZJS
2043 libshared,
2044 libudev,
2045 libsystemd_internal],
5c23128d
ZJS
2046 dependencies : [libacl,
2047 libblkid,
2048 libseccomp,
2049 libselinux],
b2fc5836 2050 install_rpath : rootlibexecdir,
5c23128d
ZJS
2051 install : true)
2052
f0bd7cc7
ZJS
2053if conf.get('ENABLE_NETWORKD', 0) == 1
2054 executable('systemd-networkd',
2055 systemd_networkd_sources,
2056 include_directories : includes,
2057 link_with : [libnetworkd_core,
2058 libfirewall,
2059 libsystemd_network,
2060 libudev_internal,
2061 libshared,
2062 libsystemd_internal],
2063 install_rpath : rootlibexecdir,
2064 install : true,
2065 install_dir : rootlibexecdir)
5c23128d 2066
f0bd7cc7
ZJS
2067 executable('systemd-networkd-wait-online',
2068 systemd_networkd_wait_online_sources,
2069 include_directories : includes,
2070 link_with : [libnetworkd_core,
2071 libshared,
2072 libsystemd_internal],
2073 install_rpath : rootlibexecdir,
2074 install : true,
2075 install_dir : rootlibexecdir)
2076endif
5c23128d
ZJS
2077
2078executable('networkctl',
2079 networkctl_sources,
2080 include_directories : includes,
2081 link_with : [libsystemd_network,
826472ce
ZJS
2082 libshared,
2083 libsystemd_internal],
421f0012 2084 install_rpath : rootlibexecdir,
5c23128d
ZJS
2085 install : true,
2086 install_dir : rootbindir)
2087
69e96427
ZJS
2088############################################################
2089
2090foreach tuple : tests
2091 sources = tuple[0]
2092 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2093 dependencies = tuple[2]
2094 condition = tuple.length() >= 4 ? tuple[3] : ''
2095 type = tuple.length() >= 5 ? tuple[4] : ''
2096 defs = tuple.length() >= 6 ? tuple[5] : []
2097 incs = tuple.length() >= 7 ? tuple[6] : includes
81efcc1c 2098 timeout = 30
69e96427
ZJS
2099
2100 name = sources[0].split('/')[-1].split('.')[0]
81efcc1c
ZJS
2101 if type.startswith('timeout=')
2102 timeout = type.split('=')[1].to_int()
2103 type = ''
2104 endif
69e96427
ZJS
2105
2106 if condition == '' or conf.get(condition, 0) == 1
572baca1
ZJS
2107 install = install_tests and type == ''
2108
69e96427
ZJS
2109 exe = executable(
2110 name,
2111 sources,
2112 include_directories : incs,
2113 link_with : link_with,
2114 dependencies : dependencies,
572baca1 2115 c_args : defs,
b2fc5836 2116 install_rpath : rootlibexecdir,
572baca1
ZJS
2117 install : install,
2118 install_dir : testsdir)
2119
69e96427
ZJS
2120 if type == 'manual'
2121 message('@0@ is a manual test'.format(name))
2122 elif type == 'unsafe' and want_tests != 'unsafe'
2123 message('@0@ is an unsafe test'.format(name))
2124 else
81efcc1c
ZJS
2125 test(name, exe,
2126 env : test_env,
2127 timeout : timeout)
69e96427
ZJS
2128 endif
2129 else
2130 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2131 endif
2132endforeach
2133
37ab1a25
ZJS
2134test_libsystemd_sym = executable(
2135 'test-libsystemd-sym',
2136 test_libsystemd_sym_c,
2137 include_directories : includes,
ef0221bc 2138 link_with : [libsystemd],
37ab1a25
ZJS
2139 install : install_tests,
2140 install_dir : testsdir)
2141test('test-libsystemd-sym',
2142 test_libsystemd_sym)
2143
e0bec52f
ZJS
2144test_libudev_sym = executable(
2145 'test-libudev-sym',
2146 test_libudev_sym_c,
2147 include_directories : includes,
2148 c_args : ['-Wno-deprecated-declarations'],
ef0221bc 2149 link_with : [libudev],
e0bec52f
ZJS
2150 install : install_tests,
2151 install_dir : testsdir)
2152test('test-libudev-sym',
2153 test_libudev_sym)
2154
69e96427 2155############################################################
5c23128d
ZJS
2156
2157make_directive_index_py = find_program('tools/make-directive-index.py')
2158make_man_index_py = find_program('tools/make-man-index.py')
2159
2160subdir('units')
2161subdir('sysctl.d')
2162subdir('sysusers.d')
2163subdir('tmpfiles.d')
2164subdir('rules')
2165subdir('hwdb')
2166subdir('network')
2167subdir('man')
2168subdir('shell-completion/bash')
2169subdir('shell-completion/zsh')
2170subdir('docs/sysvinit')
2171subdir('docs/var-log')
2172
2173# FIXME: figure out if the warning is true:
2174# https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2175install_subdir('factory/etc',
2176 install_dir : factorydir)
2177
2178
2179install_data('xorg/50-systemd-user.sh',
2180 install_dir : xinitrcdir)
2181install_data('system-preset/90-systemd.preset',
2182 install_dir : systempresetdir)
2183install_data('README',
2184 'NEWS',
2185 'CODING_STYLE',
2186 'DISTRO_PORTING',
2187 'ENVIRONMENT.md',
2188 'LICENSE.GPL2',
2189 'LICENSE.LGPL2.1',
2190 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION',
2191 install_dir : docdir)
d68b342b 2192
94e75a54
ZJS
2193meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2194meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2195
d68b342b
ZJS
2196############################################################
2197
2198if git.found() and etags.found()
2199 all_files = run_command(
2200 git,
2201 ['--git-dir=@0@/.git'.format(meson.source_root()),
2202 'ls-files',
2203 ':/*.[ch]'])
2204 all_files = files(all_files.stdout().split())
2205
2206 custom_target(
2207 'TAGS',
2208 output : 'TAGS',
2209 input : all_files,
2210 command : [etags, '-o', '@OUTPUT@'] + all_files)
2211endif