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