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