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