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