1 # SPDX-License-Identifier: LGPL-2.1+
3 # Copyright 2017 Zbigniew Jędrzejewski-Szmek
5 project('elogind', 'c',
14 meson_version : '>= 0.44',
17 #if 0 /// UNNEEDED by elogind - libudev is external
18 # libsystemd_version = '0.22.0'
19 # libudev_version = '1.6.10'
21 libelogind_version = '0.22.0'
24 # We need the same data in two different formats, ugh!
25 # Also, for hysterical reasons, we use different variable
26 # names, sometimes. Not all variables are included in every
28 conf = configuration_data()
29 conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
30 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
32 substs = configuration_data()
33 #if 0 /// Set elogind Package PACKAGE_URL
34 # substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
36 substs.set('PACKAGE_URL', 'https://github.com/elogind/elogind')
38 substs.set('PACKAGE_VERSION', meson.project_version())
40 #####################################################################
41 #if 0 /// elogind does not need this
43 # # Try to install the git pre-commit hook
44 # git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
45 # if git_hook.returncode() == 0
46 # message(git_hook.stdout().strip())
49 # elogind Note: We use precompiler masks for two reasons:
50 # 1) The masking is consistent with the sources
51 # 2) The git patch creator we use for preparing upstream patches
52 # manipulates commits to not take those masks out. Therefore
53 # it can be used to add commits updating the meson files, too.
56 #####################################################################
58 if get_option('split-usr') == 'auto'
59 split_usr = run_command('test', '-L', '/bin').returncode() != 0
61 split_usr = get_option('split-usr') == 'true'
63 conf.set10('HAVE_SPLIT_USR', split_usr,
64 description : '/usr/bin and /bin directories are separate')
66 if get_option('split-bin') == 'auto'
67 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
69 split_bin = get_option('split-bin') == 'true'
71 conf.set10('HAVE_SPLIT_BIN', split_bin,
72 description : 'bin and sbin directories are separate')
74 rootprefixdir = get_option('rootprefix')
75 # Unusual rootprefixdir values are used by some distros
76 # (see https://github.com/systemd/systemd/pull/7461).
77 rootprefix_default = split_usr ? '/' : '/usr'
78 if rootprefixdir == ''
79 rootprefixdir = rootprefix_default
82 #if 0 /// UNNEEDED by elogind
83 # sysvinit_path = get_option('sysvinit-path')
84 # sysvrcnd_path = get_option('sysvrcnd-path')
85 # conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
86 # description : 'SysV init scripts and rcN.d links are supported')
89 # join_paths ignore the preceding arguments if an absolute component is
90 # encountered, so this should canonicalize various paths when they are
91 # absolute or relative.
92 prefixdir = get_option('prefix')
93 if not prefixdir.startswith('/')
94 error('Prefix is not absolute: "@0@"'.format(prefixdir))
96 bindir = join_paths(prefixdir, get_option('bindir'))
97 libdir = join_paths(prefixdir, get_option('libdir'))
98 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
99 includedir = join_paths(prefixdir, get_option('includedir'))
100 datadir = join_paths(prefixdir, get_option('datadir'))
101 localstatedir = join_paths('/', get_option('localstatedir'))
103 rootbindir = join_paths(rootprefixdir, 'bin')
104 rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
105 #if 0 /// elogind has a different default
106 # rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
108 rootlibexecdir = get_option('rootlibexecdir')
109 rootlibexecdir = rootlibexecdir != '' ? rootlibexecdir : join_paths(rootprefixdir, 'lib/elogind')
112 rootlibdir = get_option('rootlibdir')
114 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
117 # Dirs of external packages
118 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
119 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
120 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
121 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
122 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
123 varlogdir = join_paths(localstatedir, 'log')
124 #if 0 /// UNNEEDED by elogind
125 # xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
126 # rpmmacrosdir = get_option('rpmmacrosdir')
127 # if rpmmacrosdir != 'no'
128 # rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
131 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
134 #if 0 /// elogind has a bit different layout and does not need all of theses
135 # pkgdatadir = join_paths(datadir, 'systemd')
136 # environmentdir = join_paths(prefixdir, 'lib/environment.d')
137 # pkgsysconfdir = join_paths(sysconfdir, 'systemd')
138 # userunitdir = join_paths(prefixdir, 'lib/systemd/user')
139 # userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
140 # tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
141 # sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
142 # sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
143 # binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
144 # modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
145 # networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
146 # pkgincludedir = join_paths(includedir, 'systemd')
147 # systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
148 # usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
149 # systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
150 # userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
151 # systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
152 # systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
153 # systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
154 # systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
155 # udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
156 # udevhomedir = udevlibexecdir
157 # udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
158 # udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
159 # catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
160 # kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
161 # factorydir = join_paths(datadir, 'factory')
162 # bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
163 # testsdir = join_paths(prefixdir, 'lib/systemd/tests')
164 # systemdstatedir = join_paths(localstatedir, 'lib/systemd')
165 # catalogstatedir = join_paths(systemdstatedir, 'catalog')
166 # randomseeddir = join_paths(localstatedir, 'lib/systemd')
168 # docdir = get_option('docdir')
170 # docdir = join_paths(datadir, 'doc/systemd')
173 pkgdatadir = join_paths(datadir, 'elogind')
174 pkgsysconfdir = join_paths(sysconfdir, 'elogind')
175 pkgincludedir = join_paths(includedir, 'elogind/systemd')
176 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
177 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
179 # in elogind, udev is external and thus configurable
180 udevlibexecdir = get_option('udevbindir')
181 udevlibexecdir = udevlibexecdir != '' ? udevlibexecdir : join_paths(rootprefixdir, 'lib/udev')
182 udevrulesdir = get_option('udevrulesdir')
183 udevrulesdir = udevrulesdir != '' ? udevrulesdir : join_paths(udevlibexecdir, 'rules.d')
184 udevhomedir = udevlibexecdir
185 factorydir = join_paths(datadir, 'factory')
186 docdir = get_option('docdir')
187 docdir = docdir != '' ? docdir: '-'.join([join_paths(datadir, 'doc/elogind'),
188 meson.project_version()])
189 testsdir = join_paths(prefixdir, 'lib/elogind/tests')
190 randomseeddir = join_paths(localstatedir, 'lib/elogind')
193 dbuspolicydir = get_option('dbuspolicydir')
194 if dbuspolicydir == ''
195 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
198 dbussessionservicedir = get_option('dbussessionservicedir')
199 if dbussessionservicedir == ''
200 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
203 dbussystemservicedir = get_option('dbussystemservicedir')
204 if dbussystemservicedir == ''
205 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
208 pamlibdir = get_option('pamlibdir')
210 pamlibdir = join_paths(rootlibdir, 'security')
213 pamconfdir = get_option('pamconfdir')
215 pamconfdir = join_paths(sysconfdir, 'pam.d')
218 #if 0 /// UNNEEDED by elogind
219 # memory_accounting_default = get_option('memory-accounting-default')
222 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
223 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
224 #if 0 /// UNNEEDED by elogind
225 # conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
226 # conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
227 # conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
228 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
229 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
231 # conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
233 # conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
234 # conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
235 # conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
236 # conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
237 # conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
238 # conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
239 # conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
240 # conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
241 # conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
242 # conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
243 # conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
244 # conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
245 # conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
246 # conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
248 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'elogind-cgroups-agent'))
249 conf.set_quoted('ELOGIND_UACCESS_COMMAND_PATH', join_paths(rootlibexecdir, 'elogind-uaccess-command'))
250 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'elogind'))
252 conf.set_quoted('ROOTPREFIX', rootprefixdir)
253 #if 0 /// UNNEEDED by elogind
254 # conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
255 # conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
256 # conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
257 # conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
258 # conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
259 # conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
260 # conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
262 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
263 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
264 #if 0 /// UNNEEDED by elogind
265 # conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
266 # conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
268 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
269 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
270 conf.set_quoted('LIBDIR', libdir)
271 conf.set_quoted('ROOTLIBDIR', rootlibdir)
272 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
273 #if 0 /// UNNEEDED by elogind
274 # conf.set_quoted('BOOTLIBDIR', bootlibdir)
275 # conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
276 # conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
277 # conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
278 # conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
279 # conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
280 # conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
281 # conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false')
283 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
285 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
286 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
288 substs.set('prefix', prefixdir)
289 substs.set('exec_prefix', prefixdir)
290 substs.set('libdir', libdir)
291 substs.set('rootlibdir', rootlibdir)
292 substs.set('includedir', includedir)
293 substs.set('pkgsysconfdir', pkgsysconfdir)
294 substs.set('bindir', bindir)
295 substs.set('rootbindir', rootbindir)
296 substs.set('rootlibexecdir', rootlibexecdir)
297 #if 0 /// UNNEEDED by elogind
298 # substs.set('systemunitdir', systemunitdir)
299 # substs.set('userunitdir', userunitdir)
300 # substs.set('systempresetdir', systempresetdir)
301 # substs.set('userpresetdir', userpresetdir)
302 # substs.set('udevhwdbdir', udevhwdbdir)
304 substs.set('udevrulesdir', udevrulesdir)
305 substs.set('udevlibexecdir', udevlibexecdir)
306 #if 0 /// UNNEEDED by elogind
307 # substs.set('catalogdir', catalogdir)
308 # substs.set('tmpfilesdir', tmpfilesdir)
309 # substs.set('sysusersdir', sysusersdir)
310 # substs.set('sysctldir', sysctldir)
311 # substs.set('binfmtdir', binfmtdir)
312 # substs.set('modulesloaddir', modulesloaddir)
313 # substs.set('systemgeneratordir', systemgeneratordir)
314 # substs.set('usergeneratordir', usergeneratordir)
315 # substs.set('systemenvgeneratordir', systemenvgeneratordir)
316 # substs.set('userenvgeneratordir', userenvgeneratordir)
318 substs.set('systemshutdowndir', systemshutdowndir)
319 substs.set('systemsleepdir', systemsleepdir)
320 substs.set('VARLOGDIR', varlogdir)
321 #if 0 /// UNNEEDED by elogind
322 # substs.set('CERTIFICATEROOT', get_option('certificate-root'))
323 # substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
324 # substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
325 # substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
326 # substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
327 # substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
328 # substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
329 # substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
332 #####################################################################
334 cc = meson.get_compiler('c')
335 pkgconfig = import('pkgconfig')
336 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
337 meson_build_sh = find_program('tools/meson-build.sh')
339 if get_option('tests') != 'false'
340 cxx = find_program('c++', required : false)
342 # Used only for tests
347 #if 0 /// elogind does not support fuzz stress testing (, yet).
348 # want_ossfuzz = get_option('oss-fuzz')
349 # want_libfuzzer = get_option('llvm-fuzz')
350 # fuzzer_build = want_ossfuzz or want_libfuzzer
351 # if want_ossfuzz and want_libfuzzer
352 # error('only one of oss-fuzz and llvm-fuzz can be specified')
355 # fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
358 # fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
361 # possible_cc_flags = [
365 # '-Wmissing-include-dirs',
366 # '-Wold-style-definition',
369 # '-Wdeclaration-after-statement',
371 # '-Wsuggest-attribute=noreturn',
372 # '-Werror=missing-prototypes',
373 # '-Werror=implicit-function-declaration',
374 # '-Werror=missing-declarations',
375 # '-Werror=return-type',
376 # '-Werror=incompatible-pointer-types',
377 # '-Werror=format=2',
378 # '-Wstrict-prototypes',
379 # '-Wredundant-decls',
380 # '-Wmissing-noreturn',
381 # '-Wimplicit-fallthrough=5',
384 # '-Wstrict-aliasing=2',
386 # '-Werror=overflow',
388 # '-Wnested-externs',
391 # '-fdiagnostics-show-option',
392 # '-fno-strict-aliasing',
393 # '-fvisibility=hidden',
394 # '-fstack-protector',
395 # '-fstack-protector-strong',
396 # '--param=ssp-buffer-size=4',
399 # # --as-needed and --no-undefined are provided by meson by default,
400 # # run mesonconf to see what is enabled
401 # possible_link_flags = [
409 # the oss-fuzz fuzzers are not built with -fPIE, so don't
410 # enable it when we are linking against them
412 possible_cc_flags += '-fPIE'
413 possible_link_flags += '-pie'
416 if cc.get_id() == 'clang'
417 possible_cc_flags += [
418 '-Wno-typedef-redefinition',
419 '-Wno-gnu-variable-sized-type-not-at-end',
423 if get_option('buildtype') != 'debug'
424 possible_cc_flags += [
425 '-ffunction-sections',
429 possible_link_flags += '-Wl,--gc-sections'
432 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
434 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
435 # arguments, just emits a warnings. So test for the "positive" version instead.
436 foreach arg : ['unused-parameter',
437 'missing-field-initializers',
440 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
442 if cc.has_argument('-W' + arg)
443 add_project_arguments('-Wno-' + arg, language : 'c')
449 #include <inttypes.h>
450 typedef uint64_t usec_t;
451 usec_t now(clockid_t clock);
456 ''', name : '-Werror=shadow with local shadowing')
457 add_project_arguments('-Werror=shadow', language : 'c')
460 link_test_c = files('tools/meson-link-test.c')
462 foreach arg : possible_link_flags
463 have = run_command(check_compilation_sh,
464 cc.cmd_array(), '-x', 'c', arg,
465 '-include', link_test_c).returncode() == 0
466 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
468 add_project_link_arguments(arg, language : 'c')
472 cpp = ' '.join(cc.cmd_array()) + ' -E'
474 #####################################################################
475 # compilation result tests
477 conf.set('_GNU_SOURCE', true)
478 conf.set('__SANE_USERSPACE_TYPES__', true)
480 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
481 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
482 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
483 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
484 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
485 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
486 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
490 #include <linux/ethtool.h>
491 #include <linux/fib_rules.h>
492 //#include <linux/stat.h>
493 //#include <sys/stat.h>
495 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
497 foreach decl : ['char16_t',
500 'struct ethtool_link_settings',
501 'struct fib_rule_uid_range',
505 # We get -1 if the size cannot be determined
506 have = cc.sizeof(decl, prefix : decl_headers) > 0
507 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
510 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
511 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
512 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
513 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
514 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
515 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
516 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
517 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
518 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
519 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
520 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
521 # if_tunnel.h is buggy and cannot be included on its own
522 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
523 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
524 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
525 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
526 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
527 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
528 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
529 ['IPVLAN_F_PRIVATE', 'linux/if_link.h'],
530 ['NDA_IFINDEX', 'linux/neighbour.h'],
531 ['IFA_FLAGS', 'linux/if_addr.h'],
532 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
533 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
534 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
536 prefix = decl.length() > 2 ? decl[2] : ''
537 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
538 conf.set10('HAVE_' + decl[0], have)
541 foreach ident : ['secure_getenv', '__secure_getenv']
542 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
546 ['memfd_create', '''#include <sys/mman.h>'''],
547 ['gettid', '''#include <sys/types.h>
548 #include <unistd.h>'''],
549 ['pivot_root', '''#include <stdlib.h>
550 #include <unistd.h>'''], # no known header declares pivot_root
551 ['name_to_handle_at', '''#include <sys/types.h>
552 #include <sys/stat.h>
553 #include <fcntl.h>'''],
554 ['setns', '''#include <sched.h>'''],
555 ['renameat2', '''#include <stdio.h>
556 // #include <fcntl.h>'''],
557 ['kcmp', '''#include <linux/kcmp.h>'''],
558 ['keyctl', '''#include <sys/types.h>
559 #include <keyutils.h>'''],
560 ['copy_file_range', '''#include <sys/syscall.h>
561 #include <unistd.h>'''],
562 ['bpf', '''#include <sys/syscall.h>
563 #include <unistd.h>'''],
564 ['statx', '''#include <sys/types.h>
565 #include <sys/stat.h>
566 // #include <unistd.h>'''],
567 ['explicit_bzero' , '''#include <string.h>'''],
568 ['reallocarray', '''#include <malloc.h>'''],
571 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
572 conf.set10('HAVE_' + ident[0].to_upper(), have)
575 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
576 conf.set10('USE_SYS_RANDOM_H', true)
577 conf.set10('HAVE_GETRANDOM', true)
579 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
580 conf.set10('USE_SYS_RANDOM_H', false)
581 conf.set10('HAVE_GETRANDOM', have)
584 #####################################################################
586 sed = find_program('sed')
587 awk = find_program('awk')
588 m4 = find_program('m4')
589 stat = find_program('stat')
590 git = find_program('git', required : false)
591 env = find_program('env')
592 perl = find_program('perl', required : false)
594 #if 0 /// elogind does not use this but needs a tool to symlink its installed headers.
595 # meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
596 #else /// Needed by elogind
597 meson_symlink_headers = meson.source_root() + '/tools/meson-symlink_headers.sh'
599 mkdir_p = 'mkdir -p $DESTDIR/@0@'
600 #if 0 /// unneeded by elogind
601 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
602 # splash_bmp = files('test/splash.bmp')
605 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
606 # /usr/sbin, /sbin, and fall back to the default from middle column.
607 #if 0 /// elogind has a bit different list and some adaptions
608 # progs = [['quotaon', '/usr/sbin/quotaon' ],
609 # ['quotacheck', '/usr/sbin/quotacheck' ],
610 # ['kmod', '/usr/bin/kmod' ],
611 # ['kexec', '/usr/sbin/kexec' ],
612 # ['sulogin', '/usr/sbin/sulogin' ],
613 # ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
614 # ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
615 # ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
616 # ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
619 progs = [['halt', '/sbin/halt', 'HALT'],
620 ['kexec', '/usr/sbin/kexec', 'KEXEC'],
621 ['poweroff', '/sbin/poweroff', 'POWEROFF'],
622 ['reboot', '/sbin/reboot', 'REBOOT'],
626 path = get_option(prog[0] + '-path')
628 message('Using @1@ for @0@'.format(prog[0], path))
630 exe = find_program(prog[0],
631 '/usr/sbin/' + prog[0],
634 path = exe.found() ? exe.path() : prog[1]
636 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
637 conf.set_quoted(name, path)
638 substs.set(name, path)
641 #if 0 /// unneeded by elogind
642 # conf.set_quoted('TELINIT', get_option('telinit-path'))
644 # if run_command('ln', '--relative', '--help').returncode() != 0
645 # error('ln does not support --relative (added in coreutils 8.16)')
649 ############################################################
651 gperf = find_program('gperf')
653 gperf_test_format = '''
655 const char * in_word_set(const char *, @0@);
658 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
659 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
660 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
661 if cc.compiles(gperf_test)
662 gperf_len_type = 'size_t'
664 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
665 if cc.compiles(gperf_test)
666 gperf_len_type = 'unsigned'
668 error('unable to determine gperf len type')
671 message('gperf len type is @0@'.format(gperf_len_type))
672 conf.set('GPERF_LEN_TYPE', gperf_len_type,
673 description : 'The type of gperf "len" parameter')
675 ############################################################
677 if not cc.has_header('sys/capability.h')
678 error('POSIX caps headers not found')
680 foreach header : ['crypt.h',
683 'linux/vm_sockets.h',
685 'valgrind/memcheck.h',
686 'valgrind/valgrind.h',
689 conf.set10('HAVE_' + header.underscorify().to_upper(),
690 cc.has_header(header))
693 ############################################################
695 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
696 #if 0 /// UNNEEDED by elogind
697 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
698 # gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
701 default_hierarchy = get_option('default-hierarchy')
702 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
703 description : 'default cgroup hierarchy as string')
704 if default_hierarchy == 'legacy'
705 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
706 elif default_hierarchy == 'hybrid'
707 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
709 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
712 #if 0 /// UNNEEDED by elogind
713 # time_epoch = get_option('time-epoch')
714 # if time_epoch == ''
715 # NEWS = files('NEWS')
716 # time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
718 # time_epoch = time_epoch.to_int()
719 # conf.set('TIME_EPOCH', time_epoch)
721 ############################################################
722 # elogind needs to know which cgroups controller to follow.
723 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
724 with_cgroupctrl = get_option('cgroup-controller')
725 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
726 with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
727 elif with_cgroupctrl == 'none'
728 with_cgroupctrl = 'elogind'
731 # No controller now is a problem:
732 if with_cgroupctrl == ''
733 error('Unable to determine cgroup controller, but cgroups support is mandatory!')
736 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
737 description : 'name of the cgroup controller to use')
738 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
739 '='.join(['name', with_cgroupctrl]))
740 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
741 '='.join(['name', with_cgroupctrl]))
742 ############################################################
745 system_uid_max = get_option('system-uid-max')
746 if system_uid_max == ''
747 system_uid_max = run_command(
749 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
750 '/etc/login.defs').stdout().strip()
751 if system_uid_max == ''
752 system_uid_max = '999'
755 system_uid_max = system_uid_max.to_int()
756 conf.set('SYSTEM_UID_MAX', system_uid_max)
757 substs.set('systemuidmax', system_uid_max)
758 message('maximum system UID is @0@'.format(system_uid_max))
760 system_gid_max = get_option('system-gid-max')
761 if system_gid_max == ''
762 system_gid_max = run_command(
764 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
765 '/etc/login.defs').stdout().strip()
766 if system_gid_max == ''
767 system_gid_max = '999'
770 system_gid_max = system_gid_max.to_int()
771 conf.set('SYSTEM_GID_MAX', system_gid_max)
772 substs.set('systemgidmax', system_gid_max)
773 message('maximum system GID is @0@'.format(system_gid_max))
775 #if 0 /// UNNEEDED by elogind
776 # dynamic_uid_min = get_option('dynamic-uid-min').to_int()
777 # dynamic_uid_max = get_option('dynamic-uid-max').to_int()
778 # conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
779 # conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
780 # substs.set('dynamicuidmin', dynamic_uid_min)
781 # substs.set('dynamicuidmax', dynamic_uid_max)
783 # container_uid_base_min = get_option('container-uid-base-min').to_int()
784 # container_uid_base_max = get_option('container-uid-base-max').to_int()
785 # conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
786 # conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
787 # substs.set('containeruidbasemin', container_uid_base_min)
788 # substs.set('containeruidbasemax', container_uid_base_max)
791 nobody_user = get_option('nobody-user')
792 nobody_group = get_option('nobody-group')
794 getent_result = run_command('getent', 'passwd', '65534')
795 if getent_result.returncode() == 0
796 name = getent_result.stdout().split(':')[0]
797 if name != nobody_user
799 'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
800 'Your build will result in an user table setup that is incompatible with the local system.')
803 id_result = run_command('id', '-u', nobody_user)
804 if id_result.returncode() == 0
805 id = id_result.stdout().to_int()
808 'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
809 'Your build will result in an user table setup that is incompatible with the local system.')
813 getent_result = run_command('getent', 'group', '65534')
814 if getent_result.returncode() == 0
815 name = getent_result.stdout().split(':')[0]
816 if name != nobody_group
818 'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
819 'Your build will result in an group table setup that is incompatible with the local system.')
822 id_result = run_command('id', '-g', nobody_group)
823 if id_result.returncode() == 0
824 id = id_result.stdout().to_int()
827 'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) +
828 'Your build will result in an group table setup that is incompatible with the local system.')
831 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
833 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
834 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
837 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
838 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
839 substs.set('NOBODY_USER_NAME', nobody_user)
840 substs.set('NOBODY_GROUP_NAME', nobody_group)
842 tty_gid = get_option('tty-gid')
843 conf.set('TTY_GID', tty_gid)
844 substs.set('TTY_GID', tty_gid)
846 #if 0 /// UNNEEDED by elogind
847 # # Ensure provided GID argument is numeric, otherwise fallback to default assignment
848 # if get_option('users-gid') != ''
849 # users_gid = get_option('users-gid').to_int()
853 # substs.set('USERS_GID', users_gid)
855 # conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
856 # conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
858 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
859 # substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
862 kill_user_processes = get_option('default-kill-user-processes')
863 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
864 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
865 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
867 #if 0 /// UNNEEDED by elogind
868 # dns_servers = get_option('dns-servers')
869 # conf.set_quoted('DNS_SERVERS', dns_servers)
870 # substs.set('DNS_SERVERS', dns_servers)
872 # ntp_servers = get_option('ntp-servers')
873 # conf.set_quoted('NTP_SERVERS', ntp_servers)
874 # substs.set('NTP_SERVERS', ntp_servers)
877 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
879 #if 0 /// UNNEEDED by elogind
880 # substs.set('SUSHELL', get_option('debug-shell'))
881 # substs.set('DEBUGTTY', get_option('debug-tty'))
884 enable_debug_hashmap = false
885 enable_debug_mmap_cache = false
886 #if 1 /// additional elogind debug mode
887 enable_debug_elogind = false
889 #if 1 /// additional elogind debug mode
890 elif name == 'elogind'
891 enable_debug_elogind = true
893 foreach name : get_option('debug')
895 enable_debug_hashmap = true
896 elif name == 'mmap-cache'
897 enable_debug_mmap_cache = true
899 message('unknown debug option "@0@", ignoring'.format(name))
902 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
903 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
904 #if 1 /// additional elogind debug mode
905 conf.set10('ENABLE_DEBUG_ELOGIND', enable_debug_elogind)
908 #####################################################################
910 threads = dependency('threads')
911 librt = cc.find_library('rt')
912 libm = cc.find_library('m')
913 libdl = cc.find_library('dl')
914 libcrypt = cc.find_library('crypt')
916 libcap = dependency('libcap', required : false)
917 if not libcap.found()
918 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
919 libcap = cc.find_library('cap')
922 #if 0 /// UNNEEDED by elogind
923 # libmount = dependency('mount',
924 # version : fuzzer_build ? '>= 0' : '>= 2.30')
926 # want_seccomp = get_option('seccomp')
927 # if want_seccomp != 'false' and not fuzzer_build
928 # libseccomp = dependency('libseccomp',
929 # version : '>= 2.3.1',
930 # required : want_seccomp == 'true')
931 # have = libseccomp.found()
939 conf.set10('HAVE_SECCOMP', have)
941 want_selinux = get_option('selinux')
942 if want_selinux != 'false' and not fuzzer_build
943 libselinux = dependency('libselinux',
944 version : '>= 2.1.9',
945 required : want_selinux == 'true')
946 have = libselinux.found()
951 conf.set10('HAVE_SELINUX', have)
953 #if 0 /// UNNEEDED by elogind
954 # want_apparmor = get_option('apparmor')
955 # if want_apparmor != 'false' and not fuzzer_build
956 # libapparmor = dependency('libapparmor',
957 # required : want_apparmor == 'true')
958 # have = libapparmor.found()
966 conf.set10('HAVE_APPARMOR', have)
968 smack_run_label = get_option('smack-run-label')
969 if smack_run_label != ''
970 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
973 want_polkit = get_option('polkit')
974 install_polkit = false
975 install_polkit_pkla = false
976 if want_polkit != 'false' and not fuzzer_build
977 install_polkit = true
979 libpolkit = dependency('polkit-gobject-1',
981 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
982 message('Old polkit detected, will install pkla files')
983 install_polkit_pkla = true
986 conf.set10('ENABLE_POLKIT', install_polkit)
988 want_acl = get_option('acl')
989 if want_acl != 'false' and not fuzzer_build
990 libacl = cc.find_library('acl', required : want_acl == 'true')
991 have = libacl.found()
996 conf.set10('HAVE_ACL', have)
998 want_audit = get_option('audit')
999 if want_audit != 'false' and not fuzzer_build
1000 libaudit = dependency('audit', required : want_audit == 'true')
1001 have = libaudit.found()
1006 conf.set10('HAVE_AUDIT', have)
1008 #if 0 /// UNNEEDED by elogind
1009 # want_blkid = get_option('blkid')
1010 # if want_blkid != 'false' and not fuzzer_build
1011 # libblkid = dependency('blkid', required : want_blkid == 'true')
1012 # have = libblkid.found()
1017 # conf.set10('HAVE_BLKID', have)
1019 # want_kmod = get_option('kmod')
1020 # if want_kmod != 'false' and not fuzzer_build
1021 # libkmod = dependency('libkmod',
1022 # version : '>= 15',
1023 # required : want_kmod == 'true')
1024 # have = libkmod.found()
1029 # conf.set10('HAVE_KMOD', have)
1035 want_pam = get_option('pam')
1036 if want_pam != 'false' and not fuzzer_build
1037 libpam = cc.find_library('pam', required : want_pam == 'true')
1038 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1039 have = libpam.found() and libpam_misc.found()
1045 conf.set10('HAVE_PAM', have)
1047 #if 0 /// UNNEEDED by elogind
1048 # want_microhttpd = get_option('microhttpd')
1049 # if want_microhttpd != 'false' and not fuzzer_build
1050 # libmicrohttpd = dependency('libmicrohttpd',
1051 # version : '>= 0.9.33',
1052 # required : want_microhttpd == 'true')
1053 # have = libmicrohttpd.found()
1056 # libmicrohttpd = []
1058 # conf.set10('HAVE_MICROHTTPD', have)
1060 # want_libcryptsetup = get_option('libcryptsetup')
1061 # if want_libcryptsetup != 'false' and not fuzzer_build
1062 # libcryptsetup = dependency('libcryptsetup',
1063 # version : '>= 1.6.0',
1064 # required : want_libcryptsetup == 'true')
1065 # have = libcryptsetup.found()
1068 # libcryptsetup = []
1070 # conf.set10('HAVE_LIBCRYPTSETUP', have)
1072 # want_libcurl = get_option('libcurl')
1073 # if want_libcurl != 'false' and not fuzzer_build
1074 # libcurl = dependency('libcurl',
1075 # version : '>= 7.32.0',
1076 # required : want_libcurl == 'true')
1077 # have = libcurl.found()
1082 # conf.set10('HAVE_LIBCURL', have)
1084 # want_libidn = get_option('libidn')
1085 # want_libidn2 = get_option('libidn2')
1086 # if want_libidn == 'true' and want_libidn2 == 'true'
1087 # error('libidn and libidn2 cannot be requested simultaneously')
1090 # if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
1091 # libidn = dependency('libidn',
1092 # required : want_libidn == 'true')
1093 # have = libidn.found()
1098 # conf.set10('HAVE_LIBIDN', have)
1099 # if not have and want_libidn2 != 'false' and not fuzzer_build
1100 # # libidn is used for both libidn and libidn2 objects
1101 # libidn = dependency('libidn2',
1102 # required : want_libidn2 == 'true')
1103 # have = libidn.found()
1107 # conf.set10('HAVE_LIBIDN2', have)
1109 # want_libiptc = get_option('libiptc')
1110 # if want_libiptc != 'false' and not fuzzer_build
1111 # libiptc = dependency('libiptc',
1112 # required : want_libiptc == 'true')
1113 # have = libiptc.found()
1118 # conf.set10('HAVE_LIBIPTC', have)
1120 # want_qrencode = get_option('qrencode')
1121 # if want_qrencode != 'false' and not fuzzer_build
1122 # libqrencode = dependency('libqrencode',
1123 # required : want_qrencode == 'true')
1124 # have = libqrencode.found()
1129 # conf.set10('HAVE_QRENCODE', have)
1131 # want_gcrypt = get_option('gcrypt')
1132 # if want_gcrypt != 'false' and not fuzzer_build
1133 # libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1134 # libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1135 # have = libgcrypt.found() and libgpg_error.found()
1140 # # link to neither of the libs if one is not found
1144 # conf.set10('HAVE_GCRYPT', have)
1146 # want_gnutls = get_option('gnutls')
1147 # if want_gnutls != 'false' and not fuzzer_build
1148 # libgnutls = dependency('gnutls',
1149 # version : '>= 3.1.4',
1150 # required : want_gnutls == 'true')
1151 # have = libgnutls.found()
1156 # conf.set10('HAVE_GNUTLS', have)
1158 # want_elfutils = get_option('elfutils')
1159 # if want_elfutils != 'false' and not fuzzer_build
1160 # libdw = dependency('libdw',
1161 # required : want_elfutils == 'true')
1162 # have = libdw.found()
1167 # conf.set10('HAVE_ELFUTILS', have)
1169 # want_zlib = get_option('zlib')
1170 # if want_zlib != 'false' and not fuzzer_build
1171 # libz = dependency('zlib',
1172 # required : want_zlib == 'true')
1173 # have = libz.found()
1178 # conf.set10('HAVE_ZLIB', have)
1180 # want_bzip2 = get_option('bzip2')
1181 # if want_bzip2 != 'false' and not fuzzer_build
1182 # libbzip2 = cc.find_library('bz2',
1183 # required : want_bzip2 == 'true')
1184 # have = libbzip2.found()
1189 # conf.set10('HAVE_BZIP2', have)
1191 # want_xz = get_option('xz')
1192 # if want_xz != 'false' and not fuzzer_build
1193 # libxz = dependency('liblzma',
1194 # required : want_xz == 'true')
1195 # have = libxz.found()
1200 # conf.set10('HAVE_XZ', have)
1202 # want_lz4 = get_option('lz4')
1203 # if want_lz4 != 'false' and not fuzzer_build
1204 # liblz4 = dependency('liblz4',
1205 # required : want_lz4 == 'true')
1206 # have = liblz4.found()
1211 # conf.set10('HAVE_LZ4', have)
1213 # want_xkbcommon = get_option('xkbcommon')
1214 # if want_xkbcommon != 'false' and not fuzzer_build
1215 # libxkbcommon = dependency('xkbcommon',
1216 # version : '>= 0.3.0',
1217 # required : want_xkbcommon == 'true')
1218 # have = libxkbcommon.found()
1240 conf.set10('HAVE_XKBCOMMON', have)
1242 want_pcre2 = get_option('pcre2')
1243 if want_pcre2 != 'false'
1244 libpcre2 = dependency('libpcre2-8',
1245 required : want_pcre2 == 'true')
1246 have = libpcre2.found()
1251 conf.set10('HAVE_PCRE2', have)
1253 want_glib = get_option('glib')
1254 if want_glib != 'false' and not fuzzer_build
1255 libglib = dependency('glib-2.0',
1256 version : '>= 2.22.0',
1257 required : want_glib == 'true')
1258 libgobject = dependency('gobject-2.0',
1259 version : '>= 2.22.0',
1260 required : want_glib == 'true')
1261 libgio = dependency('gio-2.0',
1262 required : want_glib == 'true')
1263 have = libglib.found() and libgobject.found() and libgio.found()
1270 conf.set10('HAVE_GLIB', have)
1272 want_dbus = get_option('dbus')
1273 if want_dbus != 'false' and not fuzzer_build
1274 libdbus = dependency('dbus-1',
1275 version : '>= 1.3.2',
1276 required : want_dbus == 'true')
1277 have = libdbus.found()
1282 conf.set10('HAVE_DBUS', have)
1284 #if 0 /// UNNEEDED by elogind
1285 # default_dnssec = get_option('default-dnssec')
1287 # default_dnssec = 'no'
1289 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1290 # message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1291 # default_dnssec = 'no'
1293 # conf.set('DEFAULT_DNSSEC_MODE',
1294 # 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1295 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1297 # want_importd = get_option('importd')
1298 # if want_importd != 'false'
1299 # have = (conf.get('HAVE_LIBCURL') == 1 and
1300 # conf.get('HAVE_ZLIB') == 1 and
1301 # conf.get('HAVE_BZIP2') == 1 and
1302 # conf.get('HAVE_XZ') == 1 and
1303 # conf.get('HAVE_GCRYPT') == 1)
1304 # if want_importd == 'true' and not have
1305 # error('importd support was requested, but dependencies are not available')
1310 # conf.set10('ENABLE_IMPORTD', have)
1312 # want_remote = get_option('remote')
1313 # if want_remote != 'false'
1314 # have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1315 # conf.get('HAVE_LIBCURL') == 1]
1316 # # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1317 # # it's possible to build one without the other. Complain only if
1318 # # support was explictly requested. The auxiliary files like sysusers
1319 # # config should be installed when any of the programs are built.
1320 # if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1321 # error('remote support was requested, but dependencies are not available')
1323 # have = have_deps[0] or have_deps[1]
1328 conf.set10('ENABLE_REMOTE', have)
1330 foreach term : ['utmp',
1331 #if 0 /// UNNEEDED by elogind
1365 have = get_option(term)
1366 name = 'ENABLE_' + term.underscorify().to_upper()
1367 conf.set10(name, have)
1370 conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1372 want_tests = get_option('tests')
1373 install_tests = get_option('install-tests')
1374 slow_tests = get_option('slow-tests')
1378 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1380 #####################################################################
1382 #if 0 /// UNNEEDED by elogind
1383 # if get_option('efi')
1384 # efi_arch = host_machine.cpu_family()
1386 # if efi_arch == 'x86'
1387 # EFI_MACHINE_TYPE_NAME = 'ia32'
1388 # gnu_efi_arch = 'ia32'
1389 # elif efi_arch == 'x86_64'
1390 # EFI_MACHINE_TYPE_NAME = 'x64'
1391 # gnu_efi_arch = 'x86_64'
1392 # elif efi_arch == 'arm'
1393 # EFI_MACHINE_TYPE_NAME = 'arm'
1394 # gnu_efi_arch = 'arm'
1395 # elif efi_arch == 'aarch64'
1396 # EFI_MACHINE_TYPE_NAME = 'aa64'
1397 # gnu_efi_arch = 'aarch64'
1399 # EFI_MACHINE_TYPE_NAME = ''
1404 # conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1406 # conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1411 conf.set10('ENABLE_EFI', have)
1413 #####################################################################
1415 config_h = configure_file(
1416 output : 'config.h',
1417 configuration : conf)
1419 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1421 includes = include_directories('src/basic',
1424 #if 0 /// UNNEEDED by elogind
1429 'src/time-wait-sync',
1431 #if 0 /// UNNEEDED by elogind
1436 #if 0 /// elogind has a different list
1437 # 'src/libsystemd/sd-bus',
1438 # 'src/libsystemd/sd-device',
1439 # 'src/libsystemd/sd-hwdb',
1440 # 'src/libsystemd/sd-id128',
1441 # 'src/libsystemd/sd-netlink',
1442 # 'src/libsystemd/sd-network',
1443 # 'src/libsystemd-network',
1445 'src/libelogind/sd-bus',
1446 'src/libelogind/sd-id128',
1452 add_project_arguments('-include', 'config.h', language : 'c')
1455 #if 0 /// UNNEEDED by elogind
1458 subdir('src/systemd')
1460 #if 0 /// UNNEEDED by elogind
1461 # subdir('src/libsystemd')
1462 # subdir('src/libsystemd-network')
1463 # subdir('src/journal')
1466 subdir('src/libelogind')
1468 subdir('src/update-utmp')
1472 #if 0 /// UNNEEDED by elogind
1473 # libjournal_core = static_library(
1475 # libjournal_core_sources,
1477 # include_directories : includes,
1481 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1482 libelogind = shared_library(
1484 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
1485 version : libelogind_version,
1486 include_directories : includes,
1487 link_args : ['-shared',
1488 '-Wl,--version-script=' + libelogind_sym_path],
1489 #if 0 /// elogind does not need gcrypt or libjournal_client, only threads.
1490 # link_with : [libbasic,
1492 # link_whole : [libsystemd_static,
1493 # libjournal_client],
1494 # dependencies : [threads,
1498 # link_depends : libsystemd_sym,
1500 link_with : [libbasic],
1501 link_whole : [libelogind_static],
1502 dependencies : [threads],
1503 link_depends : libelogind_sym,
1506 install_dir : rootlibdir)
1508 static_libelogind = get_option('static-libelogind')
1509 static_libelogind_pic = static_libelogind == 'true' or static_libelogind == 'pic'
1511 install_libelogind_static = static_library(
1514 journal_client_sources,
1516 basic_gcrypt_sources,
1517 include_directories : includes,
1518 build_by_default : static_libelogind != 'false',
1519 install : static_libelogind != 'false',
1520 install_dir : rootlibdir,
1521 pic : static_libelogind == 'true' or static_libelogind == 'pic',
1522 dependencies : [threads,
1531 c_args : libelogind_c_args + (static_libelogind_pic ? [] : ['-fno-PIC']))
1533 ############################################################
1535 # binaries that have --help and are intended for use by humans,
1536 # usually, but not always, installed in /bin.
1537 public_programs = []
1539 #if 0 /// UNNEEDED by elogind
1540 # subdir('src/libudev')
1542 # elogind depends on external libudev:
1543 libudev = dependency('libudev', required : true)
1545 subdir('src/shared')
1546 #if 0 /// UNNEEDED by elogind
1547 # subdir('src/core')
1548 # subdir('src/udev')
1549 # subdir('src/network')
1551 # subdir('src/analyze')
1552 # subdir('src/journal-remote')
1553 # subdir('src/coredump')
1554 # subdir('src/hostname')
1555 # subdir('src/import')
1556 # subdir('src/kernel-install')
1557 # subdir('src/locale')
1558 # subdir('src/machine')
1559 # subdir('src/nspawn')
1560 # subdir('src/resolve')
1561 # subdir('src/timedate')
1562 # subdir('src/timesync')
1563 # subdir('src/vconsole')
1564 # subdir('src/boot/efi')
1568 #if 0 /// UNNEEDED by elogind
1569 # subdir('src/fuzz')
1574 ############################################################
1576 # only static linking apart from libdl, to make sure that the
1577 # module is linked to all libraries that it uses.
1578 test_dlopen = executable(
1581 include_directories : includes,
1582 link_with : [libbasic],
1583 dependencies : [libdl])
1585 #if 0 /// UNNEEDED by elogind
1586 # foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1587 # ['systemd', 'ENABLE_NSS_SYSTEMD'],
1588 # ['mymachines', 'ENABLE_MACHINED'],
1589 # ['resolve', 'ENABLE_RESOLVE']]
1591 # condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1595 # sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1596 # version_script_arg = join_paths(meson.current_source_dir(), sym)
1598 # nss = shared_library(
1600 # 'src/nss-@0@/nss-@0@.c'.format(module),
1602 # include_directories : includes,
1603 # # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1604 # link_args : ['-Wl,-z,nodelete',
1606 # '-Wl,--version-script=' + version_script_arg,
1607 # '-Wl,--undefined'],
1608 # link_with : [libsystemd_static,
1610 # dependencies : [threads,
1612 # link_depends : sym,
1614 # install_dir : rootlibdir)
1616 # # We cannot use shared_module because it does not support version suffix.
1617 # # Unfortunately shared_library insists on creating the symlink…
1618 # meson.add_install_script('sh', '-c',
1619 # 'rm $DESTDIR@0@/libnss_@1@.so'
1620 # .format(rootlibdir, module))
1622 # test('dlopen-nss_' + module,
1624 # args : [nss.full_path()]) # path to dlopen must include a slash
1629 ############################################################
1631 #if 0 /// UNNEEDED by elogind
1632 # executable('systemd',
1634 # include_directories : includes,
1635 # link_with : [libcore,
1637 # dependencies : [threads,
1643 # install_rpath : rootlibexecdir,
1645 # install_dir : rootlibexecdir)
1647 # meson.add_install_script(meson_make_symlink,
1648 # join_paths(rootlibexecdir, 'systemd'),
1649 # join_paths(rootsbindir, 'init'))
1651 # exe = executable('systemd-analyze',
1652 # systemd_analyze_sources,
1653 # include_directories : includes,
1654 # link_with : [libcore,
1656 # dependencies : [threads,
1662 # install_rpath : rootlibexecdir,
1664 # public_programs += [exe]
1666 # executable('systemd-journald',
1667 # systemd_journald_sources,
1668 # include_directories : includes,
1669 # link_with : [libjournal_core,
1671 # dependencies : [threads,
1675 # install_rpath : rootlibexecdir,
1677 # install_dir : rootlibexecdir)
1679 # exe = executable('systemd-cat',
1680 # systemd_cat_sources,
1681 # include_directories : includes,
1682 # link_with : [libjournal_core,
1684 # dependencies : [threads],
1685 # install_rpath : rootlibexecdir,
1687 # public_programs += [exe]
1689 # exe = executable('journalctl',
1690 # journalctl_sources,
1691 # include_directories : includes,
1692 # link_with : [libshared],
1693 # dependencies : [threads,
1698 # install_rpath : rootlibexecdir,
1700 # install_dir : rootbindir)
1701 # public_programs += [exe]
1703 # executable('systemd-getty-generator',
1704 # 'src/getty-generator/getty-generator.c',
1705 # include_directories : includes,
1706 # link_with : [libshared],
1707 # install_rpath : rootlibexecdir,
1709 # install_dir : systemgeneratordir)
1711 # executable('systemd-debug-generator',
1712 # 'src/debug-generator/debug-generator.c',
1713 # include_directories : includes,
1714 # link_with : [libshared],
1715 # install_rpath : rootlibexecdir,
1717 # install_dir : systemgeneratordir)
1719 # executable('systemd-fstab-generator',
1720 # 'src/fstab-generator/fstab-generator.c',
1721 # 'src/core/mount-setup.c',
1722 # include_directories : includes,
1723 # link_with : [libshared],
1724 # install_rpath : rootlibexecdir,
1726 # install_dir : systemgeneratordir)
1728 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1729 # executable('30-systemd-environment-d-generator',
1730 # 'src/environment-d-generator/environment-d-generator.c',
1731 # include_directories : includes,
1732 # link_with : [libshared],
1733 # install_rpath : rootlibexecdir,
1735 # install_dir : userenvgeneratordir)
1737 # meson.add_install_script(meson_make_symlink,
1738 # join_paths(sysconfdir, 'environment'),
1739 # join_paths(environmentdir, '99-environment.conf'))
1742 # if conf.get('ENABLE_HIBERNATE') == 1
1743 # executable('systemd-hibernate-resume-generator',
1744 # 'src/hibernate-resume/hibernate-resume-generator.c',
1745 # include_directories : includes,
1746 # link_with : [libshared],
1747 # install_rpath : rootlibexecdir,
1749 # install_dir : systemgeneratordir)
1751 # executable('systemd-hibernate-resume',
1752 # 'src/hibernate-resume/hibernate-resume.c',
1753 # include_directories : includes,
1754 # link_with : [libshared],
1755 # install_rpath : rootlibexecdir,
1757 # install_dir : rootlibexecdir)
1760 # if conf.get('HAVE_BLKID') == 1
1761 # executable('systemd-gpt-auto-generator',
1762 # 'src/gpt-auto-generator/gpt-auto-generator.c',
1763 # 'src/basic/blkid-util.h',
1764 # include_directories : includes,
1765 # link_with : [libshared],
1766 # dependencies : libblkid,
1767 # install_rpath : rootlibexecdir,
1769 # install_dir : systemgeneratordir)
1771 # exe = executable('systemd-dissect',
1772 # 'src/dissect/dissect.c',
1773 # include_directories : includes,
1774 # link_with : [libshared],
1775 # install_rpath : rootlibexecdir,
1777 # install_dir : rootlibexecdir)
1778 # public_programs += [exe]
1781 # if conf.get('ENABLE_RESOLVE') == 1
1782 # executable('systemd-resolved',
1783 # systemd_resolved_sources,
1784 # include_directories : includes,
1785 # link_with : [libshared,
1787 # libsystemd_resolve_core],
1788 # dependencies : [threads,
1792 # install_rpath : rootlibexecdir,
1794 # install_dir : rootlibexecdir)
1796 # exe = executable('resolvectl',
1797 # resolvectl_sources,
1798 # include_directories : includes,
1799 # link_with : [libshared,
1801 # libsystemd_resolve_core],
1802 # dependencies : [threads,
1806 # install_rpath : rootlibexecdir,
1808 # public_programs += [exe]
1810 # meson.add_install_script(meson_make_symlink,
1811 # join_paths(bindir, 'resolvectl'),
1812 # join_paths(rootsbindir, 'resolvconf'))
1814 # meson.add_install_script(meson_make_symlink,
1815 # join_paths(bindir, 'resolvectl'),
1816 # join_paths(bindir, 'systemd-resolve'))
1819 # if conf.get('ENABLE_LOGIND') == 1
1820 # executable('systemd-logind',
1821 # systemd_logind_sources,
1822 # include_directories : includes,
1823 # link_with : [liblogind_core,
1825 # dependencies : [threads,
1827 # install_rpath : rootlibexecdir,
1829 # install_dir : rootlibexecdir)
1831 # exe = executable('loginctl',
1833 # include_directories : includes,
1834 # link_with : [libshared],
1835 # dependencies : [threads,
1838 # install_rpath : rootlibexecdir,
1840 # install_dir : rootbindir)
1841 # public_programs += [exe]
1843 # exe = executable('systemd-inhibit',
1844 # 'src/login/inhibit.c',
1845 # include_directories : includes,
1846 # link_with : [libshared],
1847 # install_rpath : rootlibexecdir,
1849 # install_dir : rootbindir)
1850 # public_programs += [exe]
1852 # if conf.get('HAVE_PAM') == 1
1853 # version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1854 # pam_systemd = shared_library(
1858 # include_directories : includes,
1859 # link_args : ['-shared',
1860 # '-Wl,--version-script=' + version_script_arg],
1861 # link_with : [libsystemd_static,
1862 # libshared_static],
1863 # dependencies : [threads,
1866 # link_depends : pam_systemd_sym,
1868 # install_dir : pamlibdir)
1870 # test('dlopen-pam_systemd',
1872 # args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1878 executable('elogind',
1880 include_directories : includes,
1881 link_with : [liblogind_core,
1883 dependencies : [threads,
1886 install_rpath : rootlibexecdir,
1888 install_dir : rootlibexecdir)
1890 exe = executable('loginctl',
1892 include_directories : includes,
1893 link_with : [libshared],
1894 dependencies : [threads,
1896 install_rpath : rootlibexecdir,
1898 install_dir : rootbindir)
1899 public_programs += [exe]
1901 exe = executable('elogind-inhibit',
1902 'src/login/inhibit.c',
1903 include_directories : includes,
1904 link_with : [libshared],
1905 dependencies : [threads],
1906 install_rpath : rootlibexecdir,
1908 install_dir : rootbindir)
1909 public_programs += [exe]
1910 executable('elogind-user-runtime-dir',
1911 executable('elogind-user-runtime-dir',
1912 executable('elogind-user-runtime-dir',
1913 user_runtime_dir_sources,
1914 include_directories : includes,
1915 link_with : [libshared, liblogind_core],
1916 install_rpath : rootlibexecdir,
1918 install_dir : rootlibexecdir)
1920 if conf.get('HAVE_PAM') == 1
1921 version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1922 pam_elogind = shared_library(
1926 include_directories : includes,
1927 link_args : ['-shared',
1928 '-Wl,--version-script=' + version_script_arg],
1929 link_with : [libelogind_static,
1931 dependencies : [threads,
1934 link_depends : pam_elogind_sym,
1936 install_dir : pamlibdir)
1938 test('dlopen-pam_elogind',
1940 args : [pam_elogind.full_path()]) # path to dlopen must include a slash
1943 #if 0 /// UNNEEDED by elogind
1944 # executable('systemd-user-sessions',
1945 # 'src/user-sessions/user-sessions.c',
1946 # include_directories : includes,
1947 # link_with : [libshared],
1948 # install_rpath : rootlibexecdir,
1950 # install_dir : rootlibexecdir)
1953 # if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1954 # exe = executable('bootctl',
1955 # 'src/boot/bootctl.c',
1956 # include_directories : includes,
1957 # link_with : [libshared],
1958 # dependencies : [libblkid],
1959 # install_rpath : rootlibexecdir,
1961 # public_programs += [exe]
1964 # exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1965 # include_directories : includes,
1966 # link_with : [libshared],
1967 # dependencies : [threads],
1968 # install_rpath : rootlibexecdir,
1970 # public_programs += [exe]
1972 # exe = executable('systemctl', 'src/systemctl/systemctl.c',
1973 # include_directories : includes,
1974 # link_with : [libshared],
1975 # dependencies : [threads,
1980 # install_rpath : rootlibexecdir,
1982 # install_dir : rootbindir)
1983 # public_programs += [exe]
1985 # foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit']
1986 # meson.add_install_script(meson_make_symlink,
1987 # join_paths(rootbindir, 'systemctl'),
1988 # join_paths(rootsbindir, alias))
1991 # if conf.get('ENABLE_BACKLIGHT') == 1
1992 # executable('systemd-backlight',
1993 # 'src/backlight/backlight.c',
1994 # include_directories : includes,
1995 # link_with : [libshared],
1996 # install_rpath : rootlibexecdir,
1998 # install_dir : rootlibexecdir)
2001 # if conf.get('ENABLE_RFKILL') == 1
2002 # executable('systemd-rfkill',
2003 # 'src/rfkill/rfkill.c',
2004 # include_directories : includes,
2005 # link_with : [libshared],
2006 # install_rpath : rootlibexecdir,
2008 # install_dir : rootlibexecdir)
2011 # executable('systemd-system-update-generator',
2012 # 'src/system-update-generator/system-update-generator.c',
2013 # include_directories : includes,
2014 # link_with : [libshared],
2015 # install_rpath : rootlibexecdir,
2017 # install_dir : systemgeneratordir)
2019 # if conf.get('HAVE_LIBCRYPTSETUP') == 1
2020 # executable('systemd-cryptsetup',
2021 # 'src/cryptsetup/cryptsetup.c',
2022 # include_directories : includes,
2023 # link_with : [libshared],
2024 # dependencies : [libcryptsetup],
2025 # install_rpath : rootlibexecdir,
2027 # install_dir : rootlibexecdir)
2029 # executable('systemd-cryptsetup-generator',
2030 # 'src/cryptsetup/cryptsetup-generator.c',
2031 # include_directories : includes,
2032 # link_with : [libshared],
2033 # dependencies : [libcryptsetup],
2034 # install_rpath : rootlibexecdir,
2036 # install_dir : systemgeneratordir)
2038 # executable('systemd-veritysetup',
2039 # 'src/veritysetup/veritysetup.c',
2040 # include_directories : includes,
2041 # link_with : [libshared],
2042 # dependencies : [libcryptsetup],
2043 # install_rpath : rootlibexecdir,
2045 # install_dir : rootlibexecdir)
2047 # executable('systemd-veritysetup-generator',
2048 # 'src/veritysetup/veritysetup-generator.c',
2049 # include_directories : includes,
2050 # link_with : [libshared],
2051 # dependencies : [libcryptsetup],
2052 # install_rpath : rootlibexecdir,
2054 # install_dir : systemgeneratordir)
2057 # if conf.get('HAVE_SYSV_COMPAT') == 1
2058 # executable('systemd-sysv-generator',
2059 # 'src/sysv-generator/sysv-generator.c',
2060 # include_directories : includes,
2061 # link_with : [libshared],
2062 # install_rpath : rootlibexecdir,
2064 # install_dir : systemgeneratordir)
2066 # executable('systemd-rc-local-generator',
2067 # 'src/rc-local-generator/rc-local-generator.c',
2068 # include_directories : includes,
2069 # link_with : [libshared],
2070 # install_rpath : rootlibexecdir,
2072 # install_dir : systemgeneratordir)
2075 # if conf.get('ENABLE_HOSTNAMED') == 1
2076 # executable('systemd-hostnamed',
2077 # 'src/hostname/hostnamed.c',
2078 # include_directories : includes,
2079 # link_with : [libshared],
2080 # install_rpath : rootlibexecdir,
2082 # install_dir : rootlibexecdir)
2084 # exe = executable('hostnamectl',
2085 # 'src/hostname/hostnamectl.c',
2086 # include_directories : includes,
2087 # link_with : [libshared],
2088 # install_rpath : rootlibexecdir,
2090 # public_programs += [exe]
2093 # if conf.get('ENABLE_LOCALED') == 1
2094 # if conf.get('HAVE_XKBCOMMON') == 1
2095 # # logind will load libxkbcommon.so dynamically on its own
2101 # executable('systemd-localed',
2102 # systemd_localed_sources,
2103 # include_directories : includes,
2104 # link_with : [libshared],
2105 # dependencies : deps,
2106 # install_rpath : rootlibexecdir,
2108 # install_dir : rootlibexecdir)
2110 # exe = executable('localectl',
2111 # localectl_sources,
2112 # include_directories : includes,
2113 # link_with : [libshared],
2114 # install_rpath : rootlibexecdir,
2116 # public_programs += [exe]
2119 # if conf.get('ENABLE_TIMEDATED') == 1
2120 # executable('systemd-timedated',
2121 # 'src/timedate/timedated.c',
2122 # include_directories : includes,
2123 # link_with : [libshared],
2124 # install_rpath : rootlibexecdir,
2126 # install_dir : rootlibexecdir)
2129 # if conf.get('ENABLE_TIMEDATECTL') == 1
2130 # exe = executable('timedatectl',
2131 # 'src/timedate/timedatectl.c',
2132 # include_directories : includes,
2133 # install_rpath : rootlibexecdir,
2134 # link_with : [libshared],
2135 # dependencies : [libm],
2137 # public_programs += [exe]
2140 # if conf.get('ENABLE_TIMESYNCD') == 1
2141 # executable('systemd-timesyncd',
2142 # systemd_timesyncd_sources,
2143 # include_directories : includes,
2144 # link_with : [libshared],
2145 # dependencies : [threads,
2147 # install_rpath : rootlibexecdir,
2149 # install_dir : rootlibexecdir)
2151 # executable('systemd-time-wait-sync',
2152 # 'src/time-wait-sync/time-wait-sync.c',
2153 # include_directories : includes,
2154 # link_with : [libshared],
2155 # install_rpath : rootlibexecdir,
2157 # install_dir : rootlibexecdir)
2160 # if conf.get('ENABLE_MACHINED') == 1
2161 # executable('systemd-machined',
2162 # systemd_machined_sources,
2163 # include_directories : includes,
2164 # link_with : [libmachine_core,
2166 # install_rpath : rootlibexecdir,
2168 # install_dir : rootlibexecdir)
2170 # exe = executable('machinectl',
2171 # 'src/machine/machinectl.c',
2172 # include_directories : includes,
2173 # link_with : [libshared],
2174 # dependencies : [threads,
2177 # install_rpath : rootlibexecdir,
2179 # install_dir : rootbindir)
2180 # public_programs += [exe]
2183 # if conf.get('ENABLE_IMPORTD') == 1
2184 # executable('systemd-importd',
2185 # systemd_importd_sources,
2186 # include_directories : includes,
2187 # link_with : [libshared],
2188 # dependencies : [threads],
2189 # install_rpath : rootlibexecdir,
2191 # install_dir : rootlibexecdir)
2193 # systemd_pull = executable('systemd-pull',
2194 # systemd_pull_sources,
2195 # include_directories : includes,
2196 # link_with : [libshared],
2197 # dependencies : [libcurl,
2202 # install_rpath : rootlibexecdir,
2204 # install_dir : rootlibexecdir)
2206 # systemd_import = executable('systemd-import',
2207 # systemd_import_sources,
2208 # include_directories : includes,
2209 # link_with : [libshared],
2210 # dependencies : [libcurl,
2214 # install_rpath : rootlibexecdir,
2216 # install_dir : rootlibexecdir)
2218 # systemd_export = executable('systemd-export',
2219 # systemd_export_sources,
2220 # include_directories : includes,
2221 # link_with : [libshared],
2222 # dependencies : [libcurl,
2226 # install_rpath : rootlibexecdir,
2228 # install_dir : rootlibexecdir)
2229 # public_programs += [systemd_pull, systemd_import, systemd_export]
2232 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2233 # exe = executable('systemd-journal-upload',
2234 # systemd_journal_upload_sources,
2235 # include_directories : includes,
2236 # link_with : [libshared],
2237 # dependencies : [threads,
2242 # install_rpath : rootlibexecdir,
2244 # install_dir : rootlibexecdir)
2245 # public_programs += [exe]
2248 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2249 # s_j_remote = executable('systemd-journal-remote',
2250 # systemd_journal_remote_sources,
2251 # include_directories : includes,
2252 # link_with : [libshared],
2253 # dependencies : [threads,
2258 # install_rpath : rootlibexecdir,
2260 # install_dir : rootlibexecdir)
2262 # s_j_gatewayd = executable('systemd-journal-gatewayd',
2263 # systemd_journal_gatewayd_sources,
2264 # include_directories : includes,
2265 # link_with : [libshared],
2266 # dependencies : [threads,
2271 # install_rpath : rootlibexecdir,
2273 # install_dir : rootlibexecdir)
2274 # public_programs += [s_j_remote, s_j_gatewayd]
2277 # if conf.get('ENABLE_COREDUMP') == 1
2278 # executable('systemd-coredump',
2279 # systemd_coredump_sources,
2280 # include_directories : includes,
2281 # link_with : [libshared],
2282 # dependencies : [threads,
2287 # install_rpath : rootlibexecdir,
2289 # install_dir : rootlibexecdir)
2291 # exe = executable('coredumpctl',
2292 # coredumpctl_sources,
2293 # include_directories : includes,
2294 # link_with : [libshared],
2295 # dependencies : [threads,
2298 # install_rpath : rootlibexecdir,
2300 # public_programs += [exe]
2303 # if conf.get('ENABLE_BINFMT') == 1
2304 # exe = executable('systemd-binfmt',
2305 # 'src/binfmt/binfmt.c',
2306 # include_directories : includes,
2307 # link_with : [libshared],
2308 # install_rpath : rootlibexecdir,
2310 # install_dir : rootlibexecdir)
2311 # public_programs += [exe]
2313 # meson.add_install_script('sh', '-c',
2314 # mkdir_p.format(binfmtdir))
2315 # meson.add_install_script('sh', '-c',
2316 # mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2319 # if conf.get('ENABLE_VCONSOLE') == 1
2320 # executable('systemd-vconsole-setup',
2321 # 'src/vconsole/vconsole-setup.c',
2322 # include_directories : includes,
2323 # link_with : [libshared],
2324 # install_rpath : rootlibexecdir,
2326 # install_dir : rootlibexecdir)
2329 # if conf.get('ENABLE_RANDOMSEED') == 1
2330 # executable('systemd-random-seed',
2331 # 'src/random-seed/random-seed.c',
2332 # include_directories : includes,
2333 # link_with : [libshared],
2334 # install_rpath : rootlibexecdir,
2336 # install_dir : rootlibexecdir)
2339 # if conf.get('ENABLE_FIRSTBOOT') == 1
2340 # executable('systemd-firstboot',
2341 # 'src/firstboot/firstboot.c',
2342 # include_directories : includes,
2343 # link_with : [libshared],
2344 # dependencies : [libcrypt],
2345 # install_rpath : rootlibexecdir,
2347 # install_dir : rootbindir)
2350 # executable('systemd-remount-fs',
2351 # 'src/remount-fs/remount-fs.c',
2352 # 'src/core/mount-setup.c',
2353 # 'src/core/mount-setup.h',
2354 # include_directories : includes,
2355 # link_with : [libshared],
2356 # install_rpath : rootlibexecdir,
2358 # install_dir : rootlibexecdir)
2360 # executable('systemd-machine-id-setup',
2361 # 'src/machine-id-setup/machine-id-setup-main.c',
2362 # 'src/core/machine-id-setup.c',
2363 # 'src/core/machine-id-setup.h',
2364 # include_directories : includes,
2365 # link_with : [libshared],
2366 # install_rpath : rootlibexecdir,
2368 # install_dir : rootbindir)
2370 # executable('systemd-fsck',
2371 # 'src/fsck/fsck.c',
2372 # include_directories : includes,
2373 # link_with : [libshared],
2374 # install_rpath : rootlibexecdir,
2376 # install_dir : rootlibexecdir)
2378 # executable('elogind-growfs',
2379 # 'src/partition/growfs.c',
2380 # include_directories : includes,
2381 # link_with : [libshared],
2382 # dependencies : [libcryptsetup],
2383 # install_rpath : rootlibexecdir,
2385 # install_dir : rootlibexecdir)
2387 # executable('elogind-makefs',
2388 # 'src/partition/makefs.c',
2389 # include_directories : includes,
2390 # link_with : [libshared],
2391 # install_rpath : rootlibexecdir,
2393 # install_dir : rootlibexecdir)
2395 # executable('systemd-sleep',
2396 # 'src/sleep/sleep.c',
2397 # include_directories : includes,
2398 # link_with : [libshared],
2399 # install_rpath : rootlibexecdir,
2401 # install_dir : rootlibexecdir)
2403 # exe = executable('systemd-sysctl',
2404 # 'src/sysctl/sysctl.c',
2405 # include_directories : includes,
2406 # link_with : [libshared],
2407 # install_rpath : rootlibexecdir,
2409 # install_dir : rootlibexecdir)
2410 # public_programs += [exe]
2412 # executable('systemd-ac-power',
2413 # 'src/ac-power/ac-power.c',
2414 # include_directories : includes,
2415 # link_with : [libshared],
2416 # install_rpath : rootlibexecdir,
2418 # install_dir : rootlibexecdir)
2420 # exe = executable('systemd-detect-virt',
2421 # 'src/detect-virt/detect-virt.c',
2422 # include_directories : includes,
2423 # link_with : [libshared],
2424 # install_rpath : rootlibexecdir,
2426 # public_programs += [exe]
2428 # exe = executable('systemd-delta',
2429 # 'src/delta/delta.c',
2430 # include_directories : includes,
2431 # link_with : [libshared],
2432 # install_rpath : rootlibexecdir,
2434 # public_programs += [exe]
2436 # exe = executable('systemd-escape',
2437 # 'src/escape/escape.c',
2438 # include_directories : includes,
2439 # link_with : [libshared],
2440 # install_rpath : rootlibexecdir,
2442 # install_dir : rootbindir)
2443 # public_programs += [exe]
2445 # exe = executable('systemd-notify',
2446 # 'src/notify/notify.c',
2447 # include_directories : includes,
2448 # link_with : [libshared],
2449 # install_rpath : rootlibexecdir,
2451 # install_dir : rootbindir)
2452 # public_programs += [exe]
2454 # executable('systemd-volatile-root',
2455 # 'src/volatile-root/volatile-root.c',
2456 # include_directories : includes,
2457 # link_with : [libshared],
2458 # install_rpath : rootlibexecdir,
2460 # install_dir : rootlibexecdir)
2462 # executable('systemd-cgroups-agent',
2463 # 'src/cgroups-agent/cgroups-agent.c',
2464 # include_directories : includes,
2465 # link_with : [libshared],
2466 # install_rpath : rootlibexecdir,
2468 # install_dir : rootlibexecdir)
2470 executable('elogind-cgroups-agent',
2471 'src/cgroups-agent/cgroups-agent.c',
2472 include_directories : includes,
2473 link_with : [libshared],
2474 install_rpath : rootlibexecdir,
2476 install_dir : rootlibexecdir)
2479 #if 0 /// UNNEEDED by elogind
2480 # exe = executable('systemd-path',
2481 # 'src/path/path.c',
2482 # include_directories : includes,
2483 # link_with : [libshared],
2484 # install_rpath : rootlibexecdir,
2486 # public_programs += [exe]
2488 # exe = executable('systemd-ask-password',
2489 # 'src/ask-password/ask-password.c',
2490 # include_directories : includes,
2491 # link_with : [libshared],
2492 # install_rpath : rootlibexecdir,
2494 # install_dir : rootbindir)
2495 # public_programs += [exe]
2497 # executable('systemd-reply-password',
2498 # 'src/reply-password/reply-password.c',
2499 # include_directories : includes,
2500 # link_with : [libshared],
2501 # install_rpath : rootlibexecdir,
2503 # install_dir : rootlibexecdir)
2505 # exe = executable('systemd-tty-ask-password-agent',
2506 # 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2507 # include_directories : includes,
2508 # link_with : [libshared],
2509 # install_rpath : rootlibexecdir,
2511 # install_dir : rootbindir)
2512 # public_programs += [exe]
2514 # exe = executable('systemd-cgls',
2515 # 'src/cgls/cgls.c',
2516 # include_directories : includes,
2517 # link_with : [libshared],
2518 # install_rpath : rootlibexecdir,
2520 # public_programs += [exe]
2522 # exe = executable('systemd-cgtop',
2523 # 'src/cgtop/cgtop.c',
2524 # include_directories : includes,
2525 # link_with : [libshared],
2526 # install_rpath : rootlibexecdir,
2528 # public_programs += [exe]
2530 # executable('systemd-initctl',
2531 # 'src/initctl/initctl.c',
2532 # include_directories : includes,
2533 # link_with : [libshared],
2534 # install_rpath : rootlibexecdir,
2536 # install_dir : rootlibexecdir)
2538 # exe = executable('systemd-mount',
2539 # 'src/mount/mount-tool.c',
2540 # include_directories : includes,
2541 # link_with : [libshared],
2542 # install_rpath : rootlibexecdir,
2544 # public_programs += [exe]
2546 # meson.add_install_script(meson_make_symlink,
2547 # 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2549 # exe = executable('systemd-run',
2551 # include_directories : includes,
2552 # link_with : [libshared],
2553 # install_rpath : rootlibexecdir,
2555 # public_programs += [exe]
2557 # exe = executable('systemd-stdio-bridge',
2558 # 'src/stdio-bridge/stdio-bridge.c',
2559 # include_directories : includes,
2560 # link_with : [libshared],
2561 # install_rpath : rootlibexecdir,
2563 # public_programs += [exe]
2565 # exe = executable('busctl',
2566 # 'src/busctl/busctl.c',
2567 # 'src/busctl/busctl-introspect.c',
2568 # 'src/busctl/busctl-introspect.h',
2569 # include_directories : includes,
2570 # link_with : [libshared],
2571 # install_rpath : rootlibexecdir,
2573 # public_programs += [exe]
2575 # if conf.get('ENABLE_SYSUSERS') == 1
2576 # exe = executable('systemd-sysusers',
2577 # 'src/sysusers/sysusers.c',
2578 # include_directories : includes,
2579 # link_with : [libshared],
2580 # install_rpath : rootlibexecdir,
2582 # install_dir : rootbindir)
2583 # public_programs += [exe]
2586 # if conf.get('ENABLE_TMPFILES') == 1
2587 # exe = executable('systemd-tmpfiles',
2588 # 'src/tmpfiles/tmpfiles.c',
2589 # include_directories : includes,
2590 # link_with : [libshared],
2591 # dependencies : [libacl],
2592 # install_rpath : rootlibexecdir,
2594 # install_dir : rootbindir)
2595 # public_programs += [exe]
2597 # test('test-systemd-tmpfiles',
2598 # test_systemd_tmpfiles_py,
2599 # args : exe.full_path())
2600 # # https://github.com/mesonbuild/meson/issues/2681
2603 # if conf.get('ENABLE_HWDB') == 1
2604 # exe = executable('systemd-hwdb',
2605 # 'src/hwdb/hwdb.c',
2606 # 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2607 # include_directories : includes,
2608 # link_with : [libudev_static],
2609 # install_rpath : udev_rpath,
2611 # install_dir : rootbindir)
2612 # public_programs += [exe]
2615 # if conf.get('ENABLE_QUOTACHECK') == 1
2616 # executable('systemd-quotacheck',
2617 # 'src/quotacheck/quotacheck.c',
2618 # include_directories : includes,
2619 # link_with : [libshared],
2620 # install_rpath : rootlibexecdir,
2622 # install_dir : rootlibexecdir)
2625 # exe = executable('systemd-socket-proxyd',
2626 # 'src/socket-proxy/socket-proxyd.c',
2627 # include_directories : includes,
2628 # link_with : [libshared],
2629 # dependencies : [threads],
2630 # install_rpath : rootlibexecdir,
2632 # install_dir : rootlibexecdir)
2633 # public_programs += [exe]
2635 # exe = executable('systemd-udevd',
2636 # systemd_udevd_sources,
2637 # include_directories : includes,
2638 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2639 # link_with : [libudev_core,
2640 # libsystemd_network,
2642 # dependencies : [threads,
2647 # install_rpath : udev_rpath,
2649 # install_dir : rootlibexecdir)
2650 # public_programs += [exe]
2652 # exe = executable('udevadm',
2654 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2655 # include_directories : includes,
2656 # link_with : [libudev_core,
2657 # libsystemd_network,
2659 # dependencies : [threads,
2664 # install_rpath : udev_rpath,
2666 # install_dir : rootbindir)
2667 # public_programs += [exe]
2669 # executable('systemd-shutdown',
2670 # systemd_shutdown_sources,
2671 # include_directories : includes,
2672 # link_with : [libshared],
2673 # dependencies : [libmount],
2674 # install_rpath : rootlibexecdir,
2676 # install_dir : rootlibexecdir)
2678 # executable('systemd-update-done',
2679 # 'src/update-done/update-done.c',
2680 # include_directories : includes,
2681 # link_with : [libshared],
2682 # install_rpath : rootlibexecdir,
2684 # install_dir : rootlibexecdir)
2686 # executable('systemd-update-utmp',
2687 # 'src/update-utmp/update-utmp.c',
2688 # include_directories : includes,
2689 # link_with : [libshared],
2690 # dependencies : [libaudit],
2691 # install_rpath : rootlibexecdir,
2693 # install_dir : rootlibexecdir)
2695 # if conf.get('HAVE_KMOD') == 1
2696 # executable('systemd-modules-load',
2697 # 'src/modules-load/modules-load.c',
2698 # include_directories : includes,
2699 # link_with : [libshared],
2700 # dependencies : [libkmod],
2701 # install_rpath : rootlibexecdir,
2703 # install_dir : rootlibexecdir)
2705 # meson.add_install_script('sh', '-c',
2706 # mkdir_p.format(modulesloaddir))
2707 # meson.add_install_script('sh', '-c',
2708 # mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2711 # exe = executable('systemd-nspawn',
2712 # systemd_nspawn_sources,
2713 # 'src/core/mount-setup.c', # FIXME: use a variable?
2714 # 'src/core/mount-setup.h',
2715 # 'src/core/loopback-setup.c',
2716 # 'src/core/loopback-setup.h',
2717 # include_directories : [includes, include_directories('src/nspawn')],
2718 # link_with : [libshared],
2719 # dependencies : [libacl,
2723 # install_rpath : rootlibexecdir,
2725 # public_programs += [exe]
2727 # if conf.get('ENABLE_NETWORKD') == 1
2728 # executable('systemd-networkd',
2729 # systemd_networkd_sources,
2730 # include_directories : includes,
2731 # link_with : [libnetworkd_core,
2732 # libsystemd_network,
2735 # dependencies : [threads],
2736 # install_rpath : rootlibexecdir,
2738 # install_dir : rootlibexecdir)
2740 # executable('systemd-networkd-wait-online',
2741 # systemd_networkd_wait_online_sources,
2742 # include_directories : includes,
2743 # link_with : [libnetworkd_core,
2745 # install_rpath : rootlibexecdir,
2747 # install_dir : rootlibexecdir)
2749 # exe = executable('networkctl',
2750 # networkctl_sources,
2751 # include_directories : includes,
2752 # link_with : [libsystemd_network,
2754 # install_rpath : rootlibexecdir,
2756 # install_dir : rootbindir)
2757 # public_programs += [exe]
2760 # executable('systemd-sulogin-shell',
2761 # ['src/sulogin-shell/sulogin-shell.c'],
2762 # include_directories : includes,
2763 # link_with : [libshared],
2764 # install_rpath : rootlibexecdir,
2766 # install_dir : rootlibexecdir)
2768 executable('elogind-uaccess-command',
2769 'src/uaccess-command/uaccess-command.c',
2770 include_directories : includes,
2771 link_with : [liblogind_core,
2773 dependencies: [libacl,
2775 install_rpath : rootlibexecdir,
2777 install_dir : rootlibexecdir)
2780 ############################################################
2782 foreach tuple : tests
2784 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2785 dependencies = tuple[2]
2786 condition = tuple.length() >= 4 ? tuple[3] : ''
2787 type = tuple.length() >= 5 ? tuple[4] : ''
2788 defs = tuple.length() >= 6 ? tuple[5] : []
2789 incs = tuple.length() >= 7 ? tuple[6] : includes
2792 name = sources[0].split('/')[-1].split('.')[0]
2793 if type.startswith('timeout=')
2794 timeout = type.split('=')[1].to_int()
2797 if want_tests == 'false'
2798 message('Not compiling @0@ because tests is set to false'.format(name))
2799 elif condition == '' or conf.get(condition) == 1
2803 include_directories : incs,
2804 link_with : link_with,
2805 dependencies : dependencies,
2807 install_rpath : rootlibexecdir,
2808 install : install_tests,
2809 install_dir : join_paths(testsdir, type))
2812 message('@0@ is a manual test'.format(name))
2813 elif type == 'unsafe' and want_tests != 'unsafe'
2814 message('@0@ is an unsafe test'.format(name))
2821 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2825 #if 0 /// UNNEEDED by elogind
2827 # 'test-libsystemd-sym',
2828 # test_libsystemd_sym_c,
2829 # include_directories : includes,
2830 # link_with : [libsystemd],
2831 # install : install_tests,
2832 # install_dir : testsdir)
2833 # test('test-libsystemd-sym', exe)
2836 # 'test-libsystemd-static-sym',
2837 # test_libsystemd_sym_c,
2838 # include_directories : includes,
2839 # link_with : [install_libsystemd_static],
2840 # dependencies : [threads], # threads is already included in dependencies on the library,
2841 # # but does not seem to get propagated. Add here as a work-around.
2842 # build_by_default : static_libsystemd_pic,
2843 # install : install_tests and static_libsystemd_pic,
2844 # install_dir : testsdir)
2845 # if static_libsystemd_pic
2846 # test('test-libsystemd-static-sym', exe)
2850 # 'test-libudev-sym',
2851 # test_libudev_sym_c,
2852 # include_directories : includes,
2853 # c_args : ['-Wno-deprecated-declarations'],
2854 # link_with : [libudev],
2855 # install : install_tests,
2856 # install_dir : testsdir)
2857 # test('test-libudev-sym', exe)
2860 # 'test-libudev-static-sym',
2861 # test_libudev_sym_c,
2862 # include_directories : includes,
2863 # c_args : ['-Wno-deprecated-declarations'],
2864 # link_with : [install_libudev_static],
2865 # build_by_default : static_libudev_pic,
2866 # install : install_tests and static_libudev_pic,
2867 # install_dir : testsdir)
2868 # if static_libudev_pic
2869 # test('test-libudev-static-sym', exe)
2872 # ############################################################
2876 # foreach tuple : fuzzers
2877 # sources = tuple[0]
2878 # link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2879 # dependencies = tuple[2]
2880 # defs = tuple.length() >= 4 ? tuple[3] : []
2881 # incs = tuple.length() >= 5 ? tuple[4] : includes
2884 # dependencies += fuzzing_engine
2886 # sources += 'src/fuzz/fuzz-main.c'
2889 # name = sources[0].split('/')[-1].split('.')[0]
2891 # fuzzer_exes += executable(
2894 # include_directories : [incs, include_directories('src/fuzz')],
2895 # link_with : link_with,
2896 # dependencies : dependencies,
2901 # run_target('fuzzers',
2902 # depends : fuzzer_exes,
2903 # command : ['true'])
2905 # ############################################################
2908 test_libelogind_sym = executable(
2909 'test-libelogind-sym',
2910 test_libelogind_sym_c,
2911 include_directories : includes,
2912 link_with : [libelogind],
2913 install : install_tests,
2914 install_dir : testsdir)
2915 test('test-libelogind-sym',
2916 test_libelogind_sym)
2918 make_directive_index_py = find_program('tools/make-directive-index.py')
2919 make_man_index_py = find_program('tools/make-man-index.py')
2920 xml_helper_py = find_program('tools/xml_helper.py')
2921 #if 0 /// UNNEEDED by elogind
2922 # hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2925 # subdir('sysctl.d')
2926 # subdir('sysusers.d')
2927 # subdir('tmpfiles.d')
2933 subdir('shell-completion/bash')
2934 subdir('shell-completion/zsh')
2935 #if 0 /// UNNEEDED by elogind
2937 subdir('doc/sysvinit')
2938 subdir('doc/var-log')
2940 # FIXME: figure out if the warning is true:
2941 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2942 install_subdir('factory/etc',
2943 install_dir : factorydir)
2946 #if 0 /// UNNEEDED by elogind
2947 # install_data('xorg/50-systemd-user.sh',
2948 # install_dir : xinitrcdir)
2949 # install_data('modprobe.d/systemd.conf',
2950 # install_dir : modprobedir)
2952 install_data('LICENSE.GPL2',
2957 #if 0 /// irrelevant for elogind
2958 # 'doc/DISTRO_PORTING',
2959 # 'doc/ENVIRONMENT.md',
2961 # 'doc/TRANSIENT-SETTINGS.md',
2962 # 'doc/TRANSLATORS',
2963 # 'doc/UIDS-GIDS.md',
2965 'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
2966 install_dir : docdir)
2968 #if 0 /// UNNEEDED by elogind
2969 # meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2971 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2973 ############################################################
2975 meson_check_help = find_program('tools/meson-check-help.sh')
2977 foreach exec : public_programs
2978 name = exec.full_path().split('/')[-1]
2979 test('check-help-' + name,
2981 args : [exec.full_path()])
2984 ############################################################
2986 #if 0 /// fuzz regression tests are not supported by elogind
2987 # # Enable tests for all supported sanitizers
2988 # foreach tuple : sanitizers
2989 # sanitizer = tuple[0]
2992 # have = run_command(check_compilation_sh,
2993 # cc.cmd_array(), '-x', 'c',
2994 # '-fsanitize=@0@'.format(sanitizer),
2995 # '-include', link_test_c).returncode() == 0
2996 # message('@0@ sanitizer supported: @1@'.format(sanitizer, have ? 'yes' : 'no'))
3000 # foreach p : fuzz_regression_tests
3001 # b = p.split('/')[-2]
3002 # c = p.split('/')[-1]
3004 # name = '@0@:@1@'.format(b, sanitizer)
3007 # if want_tests == 'false'
3008 # message('Not compiling @0@ because tests is set to false'.format(name))
3010 # exe = custom_target(
3014 # command : [env, 'ln', '-fs',
3015 # join_paths(build.full_path(), b),
3017 # build_by_default : true)
3019 # message('Not compiling @0@ because slow-tests is set to false'.format(name))
3024 # if want_tests != 'false' and slow_tests
3025 # test('@0@:@1@:@2@'.format(b, c, sanitizer),
3027 # args : [exe.full_path(),
3028 # join_paths(meson.source_root(),
3029 # 'test/fuzz-regressions',
3038 ############################################################
3041 all_files = run_command(
3043 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3046 all_files = files(all_files.stdout().split())
3051 command : [env, 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
3055 command : [env, 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
3058 #if 0 /// UNNEEDED by elogind
3060 # meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
3063 # command : [meson_git_contrib_sh])
3068 git_head = run_command(
3070 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3071 'rev-parse', 'HEAD']).stdout().strip()
3072 git_head_short = run_command(
3074 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3075 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3079 command : ['git', 'archive',
3080 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
3082 '--prefix', 'systemd-@0@/'.format(git_head),
3086 ############################################################
3088 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
3091 #if 0 /// libudev is external, elogind does not need to document it.
3092 # depends : [man, libsystemd, libudev],
3093 # command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3095 depends : [man, libelogind],
3096 command : [meson_check_api_docs_sh, libelogind.full_path()])
3099 ############################################################
3102 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3104 'split /usr: @0@'.format(split_usr),
3105 'split bin-sbin: @0@'.format(split_bin),
3106 #if 0 /// UNSUPPORTED by elogind
3107 # 'prefix directory: @0@'.format(prefixdir),
3108 # 'rootprefix directory: @0@'.format(rootprefixdir),
3109 # 'sysconf directory: @0@'.format(sysconfdir),
3110 # 'include directory: @0@'.format(includedir),
3111 # 'lib directory: @0@'.format(libdir),
3112 # 'rootlib directory: @0@'.format(rootlibdir),
3113 # 'SysV init scripts: @0@'.format(sysvinit_path),
3114 # 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3116 'rootexeclib dir: @0@'.format(rootlibexecdir),
3118 #if 0 /// UNSUPPORTED by elogind
3119 # 'PAM modules directory: @0@'.format(pamlibdir),
3120 # 'PAM configuration directory: @0@'.format(pamconfdir),
3121 # 'RPM macros directory: @0@'.format(rpmmacrosdir),
3122 # 'modprobe.d directory: @0@'.format(modprobedir),
3123 # 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3124 # 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3125 # 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3126 # 'bash completions directory: @0@'.format(bashcompletiondir),
3127 # 'zsh completions directory: @0@'.format(zshcompletiondir),
3128 # 'extra start script: @0@'.format(get_option('rc-local')),
3129 # 'extra stop script: @0@'.format(get_option('halt-local')),
3130 # 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3131 # get_option('debug-tty')),
3133 'TTY GID: @0@'.format(tty_gid),
3134 #if 0 /// UNSUPPORTED by elogind
3135 # 'users GID: @0@'.format(users_gid),
3137 'maximum system UID: @0@'.format(system_uid_max),
3138 'maximum system GID: @0@'.format(system_gid_max),
3139 #if 0 /// UNSUPPORTED by elogind
3140 # 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
3141 # 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
3142 # 'minimum container UID base: @0@'.format(container_uid_base_min),
3143 # 'maximum container UID base: @0@'.format(container_uid_base_max),
3144 # '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3145 # 'render group access mode: @0@'.format(get_option('group-render-mode')),
3146 # 'certificate root directory: @0@'.format(get_option('certificate-root')),
3147 # 'support URL: @0@'.format(support_url),
3148 # 'nobody user name: @0@'.format(nobody_user),
3149 # 'nobody group name: @0@'.format(nobody_group),
3150 # 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3151 # 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
3153 # 'default DNSSEC mode: @0@'.format(default_dnssec),
3154 # 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3156 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
3158 #if 0 /// UNSUPPORTED by elogind
3159 # alt_dns_servers = '\n '.join(dns_servers.split(' '))
3160 # alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3162 # 'default DNS servers: @0@'.format(alt_dns_servers),
3163 # 'default NTP servers: @0@'.format(alt_ntp_servers)]
3165 # alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3166 # '@@0@'.format(time_epoch)).stdout().strip()
3168 # 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3172 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3173 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3174 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3176 #if 0 /// UNNEEDED by elogind
3177 # if conf.get('ENABLE_EFI') == 1
3179 # 'efi arch: @0@'.format(efi_arch)]
3183 # 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3184 # 'EFI CC @0@'.format(efi_cc),
3185 # 'EFI lib directory: @0@'.format(efi_libdir),
3186 # 'EFI lds directory: @0@'.format(efi_ldsdir),
3187 # 'EFI include directory: @0@'.format(efi_incdir)]
3196 #if 0 /// UNNEEDED by elogind
3197 # ['libcryptsetup'],
3201 #if 0 /// UNNEEDED by elogind
3206 #if 0 /// UNNEEDED by elogind
3210 #if 0 /// UNNEEDED by elogind
3217 #if 0 /// UNNEEDED by elogind
3233 # ['environment.d'],
3251 ['legacy pkla', install_polkit_pkla],
3252 #if 0 /// UNNEEDED by elogind
3254 # ['gnu-efi', have_gnu_efi],
3262 #if 0 /// UNNEEDED by elogind
3263 # ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
3267 ['man pages', want_man],
3268 ['html pages', want_html],
3269 ['man page indices', want_man and have_lxml],
3270 #if 0 /// UNNEEDED by elogind
3274 #if 0 /// UNNEEDED by elogind
3277 # ['adm group', get_option('adm-group')],
3278 # ['wheel group', get_option('wheel-group')],
3284 ['debug mmap cache'],
3287 if tuple.length() >= 2
3290 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3291 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3292 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3297 missing += [tuple[0]]
3303 'enabled features: @0@'.format(', '.join(found)),
3305 'disabled features: @0@'.format(', '.join(missing)),
3307 message('\n '.join(status))
3309 if rootprefixdir != rootprefix_default
3311 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3312 'elogind used fixed names for unit file directories and other paths, so anything\n' +
3313 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))