1 # SPDX-License-Identifier: LGPL-2.1+
3 project('elogind', 'c',
12 meson_version : '>= 0.44',
15 #if 0 /// UNNEEDED by elogind - libudev is external
16 # libsystemd_version = '0.23.0'
17 # libudev_version = '1.6.11'
19 libelogind_version = '0.23.0'
22 # We need the same data in two different formats, ugh!
23 # Also, for hysterical reasons, we use different variable
24 # names, sometimes. Not all variables are included in every
26 conf = configuration_data()
27 conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
28 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
30 substs = configuration_data()
31 #if 0 /// Set elogind Package PACKAGE_URL
32 # substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
34 substs.set('PACKAGE_URL', 'https://github.com/elogind/elogind')
36 substs.set('PACKAGE_VERSION', meson.project_version())
38 #####################################################################
39 #if 0 /// elogind does not need this
41 # # Try to install the git pre-commit hook
42 # git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
43 # if git_hook.returncode() == 0
44 # message(git_hook.stdout().strip())
47 # elogind Note: We use precompiler masks for two reasons:
48 # 1) The masking is consistent with the sources
49 # 2) The git patch creator we use for preparing upstream patches
50 # manipulates commits to not take those masks out. Therefore
51 # it can be used to add commits updating the meson files, too.
54 #####################################################################
56 if get_option('split-usr') == 'auto'
57 split_usr = run_command('test', '-L', '/bin').returncode() != 0
59 split_usr = get_option('split-usr') == 'true'
61 conf.set10('HAVE_SPLIT_USR', split_usr,
62 description : '/usr/bin and /bin directories are separate')
64 if get_option('split-bin') == 'auto'
65 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
67 split_bin = get_option('split-bin') == 'true'
69 conf.set10('HAVE_SPLIT_BIN', split_bin,
70 description : 'bin and sbin directories are separate')
72 rootprefixdir = get_option('rootprefix')
73 # Unusual rootprefixdir values are used by some distros
74 # (see https://github.com/systemd/systemd/pull/7461).
75 rootprefix_default = split_usr ? '/' : '/usr'
76 if rootprefixdir == ''
77 rootprefixdir = rootprefix_default
80 #if 0 /// UNNEEDED by elogind
81 # sysvinit_path = get_option('sysvinit-path')
82 # sysvrcnd_path = get_option('sysvrcnd-path')
83 # conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '',
84 # description : 'SysV init scripts and rcN.d links are supported')
87 # join_paths ignore the preceding arguments if an absolute component is
88 # encountered, so this should canonicalize various paths when they are
89 # absolute or relative.
90 prefixdir = get_option('prefix')
91 if not prefixdir.startswith('/')
92 error('Prefix is not absolute: "@0@"'.format(prefixdir))
94 bindir = join_paths(prefixdir, get_option('bindir'))
95 libdir = join_paths(prefixdir, get_option('libdir'))
96 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
97 includedir = join_paths(prefixdir, get_option('includedir'))
98 datadir = join_paths(prefixdir, get_option('datadir'))
99 localstatedir = join_paths('/', get_option('localstatedir'))
101 rootbindir = join_paths(rootprefixdir, 'bin')
102 rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
103 #if 0 /// elogind has a different default
104 # rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
106 rootlibexecdir = get_option('rootlibexecdir')
107 rootlibexecdir = rootlibexecdir != '' ? rootlibexecdir : join_paths(rootprefixdir, 'lib/elogind')
110 rootlibdir = get_option('rootlibdir')
112 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
115 # Dirs of external packages
116 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
117 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
118 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
119 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
120 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
121 varlogdir = join_paths(localstatedir, 'log')
122 #if 0 /// UNNEEDED by elogind
123 # xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
124 # rpmmacrosdir = get_option('rpmmacrosdir')
125 # if rpmmacrosdir != 'no'
126 # rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
129 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
132 #if 0 /// elogind has a bit different layout and does not need all of theses
133 # pkgdatadir = join_paths(datadir, 'systemd')
134 # environmentdir = join_paths(prefixdir, 'lib/environment.d')
135 # pkgsysconfdir = join_paths(sysconfdir, 'systemd')
136 # userunitdir = join_paths(prefixdir, 'lib/systemd/user')
137 # userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
138 # tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
139 # sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
140 # sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
141 # binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
142 # modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
143 # networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
144 # pkgincludedir = join_paths(includedir, 'systemd')
145 # systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
146 # usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
147 # systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
148 # userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
149 # systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
150 # systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
151 # systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
152 # systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
153 # udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
154 # udevhomedir = udevlibexecdir
155 # udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
156 # udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
157 # catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
158 # kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
159 # factorydir = join_paths(datadir, 'factory')
160 # bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
161 # testsdir = join_paths(prefixdir, 'lib/systemd/tests')
162 # systemdstatedir = join_paths(localstatedir, 'lib/systemd')
163 # catalogstatedir = join_paths(systemdstatedir, 'catalog')
164 # randomseeddir = join_paths(localstatedir, 'lib/systemd')
165 # profiledir = join_paths(rootlibexecdir, 'portable', 'profile')
167 # docdir = get_option('docdir')
169 # docdir = join_paths(datadir, 'doc/systemd')
172 pkgdatadir = join_paths(datadir, 'elogind')
173 pkgsysconfdir = join_paths(sysconfdir, 'elogind')
174 pkgincludedir = join_paths(includedir, 'elogind/systemd')
175 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
176 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
178 # in elogind, udev is external and thus configurable
179 udevlibexecdir = get_option('udevbindir')
180 udevlibexecdir = udevlibexecdir != '' ? udevlibexecdir : join_paths(rootprefixdir, 'lib/udev')
181 udevrulesdir = get_option('udevrulesdir')
182 udevrulesdir = udevrulesdir != '' ? udevrulesdir : join_paths(udevlibexecdir, 'rules.d')
183 udevhomedir = udevlibexecdir
184 factorydir = join_paths(datadir, 'factory')
185 docdir = get_option('docdir')
186 docdir = docdir != '' ? docdir: '-'.join([join_paths(datadir, 'doc/elogind'),
187 meson.project_version()])
188 testsdir = join_paths(prefixdir, 'lib/elogind/tests')
189 randomseeddir = join_paths(localstatedir, 'lib/elogind')
192 dbuspolicydir = get_option('dbuspolicydir')
193 if dbuspolicydir == ''
194 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
197 dbussessionservicedir = get_option('dbussessionservicedir')
198 if dbussessionservicedir == ''
199 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
202 dbussystemservicedir = get_option('dbussystemservicedir')
203 if dbussystemservicedir == ''
204 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
207 #if 1 /// Will elogind find system_bus_socket in /run/dbus or /var/run/dbus ?
208 varrunissymllink = run_command('test', '-L', '/var/run').returncode() == 0
209 message('Setting VARRUN_IS_SYMLINK to: @0@'.format(varrunissymllink))
210 conf.set10('VARRUN_IS_SYMLINK', varrunissymllink)
213 pamlibdir = get_option('pamlibdir')
215 pamlibdir = join_paths(rootlibdir, 'security')
218 pamconfdir = get_option('pamconfdir')
220 pamconfdir = join_paths(sysconfdir, 'pam.d')
223 #if 0 /// UNNEEDED by elogind
224 # memory_accounting_default = get_option('memory-accounting-default')
227 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
228 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
229 #if 0 /// UNNEEDED by elogind
230 # conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
231 # conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
232 # conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
233 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
234 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
236 # conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
238 # conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
239 # conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
240 # conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
241 # conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
242 # conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
243 # conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
244 # conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
245 # conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
246 # conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
247 # conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
248 # conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
249 # conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
250 # conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
251 # conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
253 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'elogind-cgroups-agent'))
254 conf.set_quoted('ELOGIND_UACCESS_COMMAND_PATH', join_paths(rootlibexecdir, 'elogind-uaccess-command'))
255 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'elogind'))
257 conf.set_quoted('ROOTPREFIX', rootprefixdir)
258 #if 0 /// UNNEEDED by elogind
259 # conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
260 # conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
261 # conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
262 # conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
263 # conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
264 # conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
265 # conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
267 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
268 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
269 #if 0 /// UNNEEDED by elogind
270 # conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
271 # conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
273 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
274 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
275 conf.set_quoted('LIBDIR', libdir)
276 conf.set_quoted('ROOTLIBDIR', rootlibdir)
277 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
278 #if 0 /// UNNEEDED by elogind
279 # conf.set_quoted('BOOTLIBDIR', bootlibdir)
280 # conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
281 # conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
282 # conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
283 # conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
284 # conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
285 # conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
286 # conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false')
287 # conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
290 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
291 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
293 substs.set('prefix', prefixdir)
294 substs.set('exec_prefix', prefixdir)
295 substs.set('libdir', libdir)
296 substs.set('rootlibdir', rootlibdir)
297 substs.set('includedir', includedir)
298 substs.set('pkgsysconfdir', pkgsysconfdir)
299 substs.set('bindir', bindir)
300 substs.set('rootbindir', rootbindir)
301 substs.set('rootlibexecdir', rootlibexecdir)
302 #if 0 /// UNNEEDED by elogind
303 # substs.set('systemunitdir', systemunitdir)
304 # substs.set('userunitdir', userunitdir)
305 # substs.set('systempresetdir', systempresetdir)
306 # substs.set('userpresetdir', userpresetdir)
307 # substs.set('udevhwdbdir', udevhwdbdir)
309 substs.set('udevrulesdir', udevrulesdir)
310 substs.set('udevlibexecdir', udevlibexecdir)
311 #if 0 /// UNNEEDED by elogind
312 # substs.set('environmentdir', environmentdir)
313 # substs.set('catalogdir', catalogdir)
314 # substs.set('tmpfilesdir', tmpfilesdir)
315 # substs.set('sysusersdir', sysusersdir)
316 # substs.set('sysctldir', sysctldir)
317 # substs.set('binfmtdir', binfmtdir)
318 # substs.set('modulesloaddir', modulesloaddir)
319 # substs.set('modprobedir', modprobedir)
320 # substs.set('systemgeneratordir', systemgeneratordir)
321 # substs.set('usergeneratordir', usergeneratordir)
322 # substs.set('systemenvgeneratordir', systemenvgeneratordir)
323 # substs.set('userenvgeneratordir', userenvgeneratordir)
325 substs.set('systemshutdowndir', systemshutdowndir)
326 substs.set('systemsleepdir', systemsleepdir)
327 substs.set('VARLOGDIR', varlogdir)
328 #if 0 /// UNNEEDED by elogind
329 # substs.set('CERTIFICATEROOT', get_option('certificate-root'))
330 # substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
331 # substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
332 # substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
333 # substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
334 # substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
335 # substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
336 # substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
339 #####################################################################
341 cc = meson.get_compiler('c')
342 pkgconfig = import('pkgconfig')
343 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
344 meson_build_sh = find_program('tools/meson-build.sh')
346 if get_option('tests') != 'false'
347 cxx = find_program('c++', required : false)
349 # Used only for tests
354 #if 0 /// elogind does not support fuzz stress testing (, yet).
355 # want_ossfuzz = get_option('oss-fuzz')
356 # want_libfuzzer = get_option('llvm-fuzz')
357 # fuzzer_build = want_ossfuzz or want_libfuzzer
358 # if want_ossfuzz and want_libfuzzer
359 # error('only one of oss-fuzz and llvm-fuzz can be specified')
362 # fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
365 # fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
371 possible_cc_flags = [
375 '-Wmissing-include-dirs',
376 '-Wold-style-definition',
380 '-Wsuggest-attribute=noreturn',
381 '-Werror=missing-prototypes',
382 '-Werror=implicit-function-declaration',
383 '-Werror=missing-declarations',
384 '-Werror=return-type',
385 '-Werror=incompatible-pointer-types',
387 '-Wstrict-prototypes',
389 '-Wmissing-noreturn',
390 '-Wimplicit-fallthrough=5',
393 '-Wstrict-aliasing=2',
396 '-Werror=shift-count-overflow',
397 '-Werror=shift-overflow=2',
402 '-fdiagnostics-show-option',
403 '-fno-strict-aliasing',
404 '-fvisibility=hidden',
406 '-fstack-protector-strong',
407 '--param=ssp-buffer-size=4',
410 # --as-needed and --no-undefined are provided by meson by default,
411 # run mesonconf to see what is enabled
412 possible_link_flags = [
417 # the oss-fuzz fuzzers are not built with -fPIE, so don't
418 # enable it when we are linking against them
420 possible_cc_flags += '-fPIE'
421 possible_link_flags += '-pie'
424 if cc.get_id() == 'clang'
425 possible_cc_flags += [
426 '-Wno-typedef-redefinition',
427 '-Wno-gnu-variable-sized-type-not-at-end',
431 if get_option('buildtype') != 'debug'
432 possible_cc_flags += [
433 '-ffunction-sections',
437 possible_link_flags += '-Wl,--gc-sections'
440 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
442 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
443 # arguments, just emits a warning. So test for the "positive" version instead.
444 foreach arg : ['unused-parameter',
445 'missing-field-initializers',
448 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
450 if cc.has_argument('-W' + arg)
451 add_project_arguments('-Wno-' + arg, language : 'c')
457 #include <inttypes.h>
458 typedef uint64_t usec_t;
459 usec_t now(clockid_t clock);
464 ''', name : '-Werror=shadow with local shadowing')
465 add_project_arguments('-Werror=shadow', language : 'c')
468 link_test_c = files('tools/meson-link-test.c')
470 foreach arg : possible_link_flags
471 have = run_command(check_compilation_sh,
472 cc.cmd_array(), '-x', 'c', arg,
473 '-include', link_test_c).returncode() == 0
474 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
476 add_project_link_arguments(arg, language : 'c')
480 cpp = ' '.join(cc.cmd_array()) + ' -E'
482 #####################################################################
483 # compilation result tests
485 conf.set('_GNU_SOURCE', true)
486 conf.set('__SANE_USERSPACE_TYPES__', true)
488 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
489 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
490 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
491 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
492 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
493 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
494 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
498 #include <linux/ethtool.h>
499 #include <linux/fib_rules.h>
500 #include <linux/stat.h>
501 #include <sys/stat.h>
503 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
505 foreach decl : ['char16_t',
508 'struct ethtool_link_settings',
509 'struct fib_rule_uid_range',
513 # We get -1 if the size cannot be determined
514 have = cc.sizeof(decl, prefix : decl_headers) > 0
515 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
518 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
519 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
520 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
521 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
522 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
523 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
524 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
525 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
526 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
527 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
528 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
529 # if_tunnel.h is buggy and cannot be included on its own
530 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
531 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
532 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
533 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
534 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
535 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
536 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
537 ['IPVLAN_F_PRIVATE', 'linux/if_link.h'],
538 ['NDA_IFINDEX', 'linux/neighbour.h'],
539 ['IFA_FLAGS', 'linux/if_addr.h'],
540 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
541 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
542 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
544 prefix = decl.length() > 2 ? decl[2] : ''
545 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
546 conf.set10('HAVE_' + decl[0], have)
549 foreach ident : ['secure_getenv', '__secure_getenv']
550 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
554 ['memfd_create', '''#include <sys/mman.h>'''],
555 ['gettid', '''#include <sys/types.h>
556 #include <unistd.h>'''],
557 ['pivot_root', '''#include <stdlib.h>
558 #include <unistd.h>'''], # no known header declares pivot_root
559 ['name_to_handle_at', '''#include <sys/types.h>
560 #include <sys/stat.h>
561 #include <fcntl.h>'''],
562 ['setns', '''#include <sched.h>'''],
563 ['renameat2', '''#include <stdio.h>
564 // #include <fcntl.h>'''],
565 ['kcmp', '''#include <linux/kcmp.h>'''],
566 ['keyctl', '''#include <sys/types.h>
567 #include <keyutils.h>'''],
568 ['copy_file_range', '''#include <sys/syscall.h>
569 #include <unistd.h>'''],
570 ['bpf', '''#include <sys/syscall.h>
571 #include <unistd.h>'''],
572 ['statx', '''#include <sys/types.h>
573 #include <sys/stat.h>
574 // #include <unistd.h>'''],
575 ['explicit_bzero' , '''#include <string.h>'''],
576 ['reallocarray', '''#include <malloc.h>'''],
579 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
580 conf.set10('HAVE_' + ident[0].to_upper(), have)
583 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
584 conf.set10('USE_SYS_RANDOM_H', true)
585 conf.set10('HAVE_GETRANDOM', true)
587 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
588 conf.set10('USE_SYS_RANDOM_H', false)
589 conf.set10('HAVE_GETRANDOM', have)
592 #####################################################################
594 sed = find_program('sed')
595 awk = find_program('awk')
596 m4 = find_program('m4')
597 stat = find_program('stat')
598 git = find_program('git', required : false)
599 env = find_program('env')
600 perl = find_program('perl', required : false)
602 #if 0 /// elogind does not use this but needs a tool to symlink its installed headers.
603 # meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
604 #else /// Needed by elogind
605 meson_symlink_headers = meson.source_root() + '/tools/meson-symlink_headers.sh'
607 mkdir_p = 'mkdir -p $DESTDIR/@0@'
608 #if 0 /// unneeded by elogind
609 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
610 # splash_bmp = files('test/splash.bmp')
613 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
614 # /usr/sbin, /sbin, and fall back to the default from middle column.
615 #if 0 /// elogind has a bit different list and some adaptions
616 # progs = [['quotaon', '/usr/sbin/quotaon' ],
617 # ['quotacheck', '/usr/sbin/quotacheck' ],
618 # ['kmod', '/usr/bin/kmod' ],
619 # ['kexec', '/usr/sbin/kexec' ],
620 # ['sulogin', '/usr/sbin/sulogin' ],
621 # ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
622 # ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
623 # ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
624 # ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
627 progs = [['halt', '/sbin/halt', 'HALT'],
628 ['kexec', '/usr/sbin/kexec', 'KEXEC'],
629 ['poweroff', '/sbin/poweroff', 'POWEROFF'],
630 ['reboot', '/sbin/reboot', 'REBOOT'],
634 path = get_option(prog[0] + '-path')
636 message('Using @1@ for @0@'.format(prog[0], path))
638 exe = find_program(prog[0],
639 '/usr/sbin/' + prog[0],
642 path = exe.found() ? exe.path() : prog[1]
644 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
645 conf.set_quoted(name, path)
646 substs.set(name, path)
649 #if 0 /// unneeded by elogind
650 # conf.set_quoted('TELINIT', get_option('telinit-path'))
652 # if run_command('ln', '--relative', '--help').returncode() != 0
653 # error('ln does not support --relative (added in coreutils 8.16)')
657 ############################################################
659 gperf = find_program('gperf')
661 gperf_test_format = '''
663 const char * in_word_set(const char *, @0@);
666 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
667 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
668 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
669 if cc.compiles(gperf_test)
670 gperf_len_type = 'size_t'
672 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
673 if cc.compiles(gperf_test)
674 gperf_len_type = 'unsigned'
676 error('unable to determine gperf len type')
679 message('gperf len type is @0@'.format(gperf_len_type))
680 conf.set('GPERF_LEN_TYPE', gperf_len_type,
681 description : 'The type of gperf "len" parameter')
683 ############################################################
685 if not cc.has_header('sys/capability.h')
686 error('POSIX caps headers not found')
688 foreach header : ['crypt.h',
691 'linux/vm_sockets.h',
693 'valgrind/memcheck.h',
694 'valgrind/valgrind.h',
697 conf.set10('HAVE_' + header.underscorify().to_upper(),
698 cc.has_header(header))
701 ############################################################
703 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
704 #if 0 /// UNNEEDED by elogind
705 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
706 # gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
709 default_hierarchy = get_option('default-hierarchy')
710 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
711 description : 'default cgroup hierarchy as string')
712 if default_hierarchy == 'legacy'
713 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
714 elif default_hierarchy == 'hybrid'
715 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
717 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
720 #if 0 /// UNNEEDED by elogind
721 # time_epoch = get_option('time-epoch')
722 # if time_epoch == ''
723 # NEWS = files('NEWS')
724 # time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
726 # time_epoch = time_epoch.to_int()
727 # conf.set('TIME_EPOCH', time_epoch)
729 ############################################################
730 # elogind needs to know which cgroups controller to follow.
731 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
732 with_cgroupctrl = get_option('cgroup-controller')
733 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
734 with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
735 elif with_cgroupctrl == 'none'
736 with_cgroupctrl = 'elogind'
739 # No controller now is a problem:
740 if with_cgroupctrl == ''
741 error('Unable to determine cgroup controller, but cgroups support is mandatory!')
744 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
745 description : 'name of the cgroup controller to use')
746 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
747 '='.join(['name', with_cgroupctrl]))
748 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
749 '='.join(['name', with_cgroupctrl]))
750 ############################################################
753 system_uid_max = get_option('system-uid-max')
754 if system_uid_max == ''
755 system_uid_max = run_command(
757 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
758 '/etc/login.defs').stdout().strip()
759 if system_uid_max == ''
760 system_uid_max = '999'
763 system_uid_max = system_uid_max.to_int()
764 conf.set('SYSTEM_UID_MAX', system_uid_max)
765 substs.set('systemuidmax', system_uid_max)
766 message('maximum system UID is @0@'.format(system_uid_max))
768 system_gid_max = get_option('system-gid-max')
769 if system_gid_max == ''
770 system_gid_max = run_command(
772 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
773 '/etc/login.defs').stdout().strip()
774 if system_gid_max == ''
775 system_gid_max = '999'
778 system_gid_max = system_gid_max.to_int()
779 conf.set('SYSTEM_GID_MAX', system_gid_max)
780 substs.set('systemgidmax', system_gid_max)
781 message('maximum system GID is @0@'.format(system_gid_max))
783 #if 0 /// UNNEEDED by elogind
784 # dynamic_uid_min = get_option('dynamic-uid-min').to_int()
785 # dynamic_uid_max = get_option('dynamic-uid-max').to_int()
786 # conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
787 # conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
788 # substs.set('dynamicuidmin', dynamic_uid_min)
789 # substs.set('dynamicuidmax', dynamic_uid_max)
791 # container_uid_base_min = get_option('container-uid-base-min').to_int()
792 # container_uid_base_max = get_option('container-uid-base-max').to_int()
793 # conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
794 # conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
795 # substs.set('containeruidbasemin', container_uid_base_min)
796 # substs.set('containeruidbasemax', container_uid_base_max)
799 nobody_user = get_option('nobody-user')
800 nobody_group = get_option('nobody-group')
802 getent_result = run_command('getent', 'passwd', '65534')
803 if getent_result.returncode() == 0
804 name = getent_result.stdout().split(':')[0]
805 if name != nobody_user
807 '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) +
808 'Your build will result in an user table setup that is incompatible with the local system.')
811 id_result = run_command('id', '-u', nobody_user)
812 if id_result.returncode() == 0
813 id = id_result.stdout().to_int()
816 '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) +
817 'Your build will result in an user table setup that is incompatible with the local system.')
821 getent_result = run_command('getent', 'group', '65534')
822 if getent_result.returncode() == 0
823 name = getent_result.stdout().split(':')[0]
824 if name != nobody_group
826 '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) +
827 'Your build will result in an group table setup that is incompatible with the local system.')
830 id_result = run_command('id', '-g', nobody_group)
831 if id_result.returncode() == 0
832 id = id_result.stdout().to_int()
835 '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) +
836 'Your build will result in an group table setup that is incompatible with the local system.')
839 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
841 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
842 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
845 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
846 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
847 substs.set('NOBODY_USER_NAME', nobody_user)
848 substs.set('NOBODY_GROUP_NAME', nobody_group)
850 tty_gid = get_option('tty-gid')
851 conf.set('TTY_GID', tty_gid)
852 substs.set('TTY_GID', tty_gid)
854 #if 0 /// UNNEEDED by elogind
855 # # Ensure provided GID argument is numeric, otherwise fallback to default assignment
856 # if get_option('users-gid') != ''
857 # users_gid = get_option('users-gid').to_int()
861 # substs.set('USERS_GID', users_gid)
863 # conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
864 # conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
866 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
867 # substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
870 kill_user_processes = get_option('default-kill-user-processes')
871 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
872 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
873 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
875 #if 0 /// UNNEEDED by elogind
876 # dns_servers = get_option('dns-servers')
877 # conf.set_quoted('DNS_SERVERS', dns_servers)
878 # substs.set('DNS_SERVERS', dns_servers)
880 # ntp_servers = get_option('ntp-servers')
881 # conf.set_quoted('NTP_SERVERS', ntp_servers)
882 # substs.set('NTP_SERVERS', ntp_servers)
885 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
887 #if 0 /// UNNEEDED by elogind
888 # substs.set('SUSHELL', get_option('debug-shell'))
889 # substs.set('DEBUGTTY', get_option('debug-tty'))
892 enable_debug_hashmap = false
893 enable_debug_mmap_cache = false
894 #if 1 /// additional elogind debug mode
895 enable_debug_elogind = false
897 foreach name : get_option('debug-extra')
899 enable_debug_hashmap = true
900 elif name == 'mmap-cache'
901 enable_debug_mmap_cache = true
902 #if 1 /// additional elogind debug mode
903 elif name == 'elogind'
904 enable_debug_elogind = true
907 message('unknown debug option "@0@", ignoring'.format(name))
910 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
911 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
912 #if 1 /// additional elogind debug mode
913 conf.set10('ENABLE_DEBUG_ELOGIND', enable_debug_elogind)
916 conf.set10('VALGRIND', get_option('valgrind'))
918 #####################################################################
920 threads = dependency('threads')
921 librt = cc.find_library('rt')
922 libm = cc.find_library('m')
923 libdl = cc.find_library('dl')
924 libcrypt = cc.find_library('crypt')
926 libcap = dependency('libcap', required : false)
927 if not libcap.found()
928 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
929 libcap = cc.find_library('cap')
932 #if 0 /// UNNEEDED by elogind
933 # libmount = dependency('mount',
934 # version : fuzzer_build ? '>= 0' : '>= 2.30')
936 # want_seccomp = get_option('seccomp')
937 # if want_seccomp != 'false' and not fuzzer_build
938 # libseccomp = dependency('libseccomp',
939 # version : '>= 2.3.1',
940 # required : want_seccomp == 'true')
941 # have = libseccomp.found()
949 conf.set10('HAVE_SECCOMP', have)
951 want_selinux = get_option('selinux')
952 if want_selinux != 'false' and not fuzzer_build
953 libselinux = dependency('libselinux',
954 version : '>= 2.1.9',
955 required : want_selinux == 'true')
956 have = libselinux.found()
961 conf.set10('HAVE_SELINUX', have)
963 #if 0 /// UNNEEDED by elogind
964 # want_apparmor = get_option('apparmor')
965 # if want_apparmor != 'false' and not fuzzer_build
966 # libapparmor = dependency('libapparmor',
967 # required : want_apparmor == 'true')
968 # have = libapparmor.found()
976 conf.set10('HAVE_APPARMOR', have)
978 smack_run_label = get_option('smack-run-label')
979 if smack_run_label != ''
980 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
983 want_polkit = get_option('polkit')
984 install_polkit = false
985 install_polkit_pkla = false
986 if want_polkit != 'false' and not fuzzer_build
987 install_polkit = true
989 libpolkit = dependency('polkit-gobject-1',
991 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
992 message('Old polkit detected, will install pkla files')
993 install_polkit_pkla = true
996 conf.set10('ENABLE_POLKIT', install_polkit)
998 want_acl = get_option('acl')
999 if want_acl != 'false' and not fuzzer_build
1000 libacl = cc.find_library('acl', required : want_acl == 'true')
1001 have = libacl.found()
1006 conf.set10('HAVE_ACL', have)
1008 want_audit = get_option('audit')
1009 if want_audit != 'false' and not fuzzer_build
1010 libaudit = dependency('audit', required : want_audit == 'true')
1011 have = libaudit.found()
1016 conf.set10('HAVE_AUDIT', have)
1018 #if 0 /// UNNEEDED by elogind
1019 # want_blkid = get_option('blkid')
1020 # if want_blkid != 'false' and not fuzzer_build
1021 # libblkid = dependency('blkid', required : want_blkid == 'true')
1022 # have = libblkid.found()
1027 # conf.set10('HAVE_BLKID', have)
1029 # want_kmod = get_option('kmod')
1030 # if want_kmod != 'false' and not fuzzer_build
1031 # libkmod = dependency('libkmod',
1032 # version : '>= 15',
1033 # required : want_kmod == 'true')
1034 # have = libkmod.found()
1039 # conf.set10('HAVE_KMOD', have)
1045 want_pam = get_option('pam')
1046 if want_pam != 'false' and not fuzzer_build
1047 libpam = cc.find_library('pam', required : want_pam == 'true')
1048 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1049 have = libpam.found() and libpam_misc.found()
1055 conf.set10('HAVE_PAM', have)
1057 #if 0 /// UNNEEDED by elogind
1058 # want_microhttpd = get_option('microhttpd')
1059 # if want_microhttpd != 'false' and not fuzzer_build
1060 # libmicrohttpd = dependency('libmicrohttpd',
1061 # version : '>= 0.9.33',
1062 # required : want_microhttpd == 'true')
1063 # have = libmicrohttpd.found()
1066 # libmicrohttpd = []
1068 # conf.set10('HAVE_MICROHTTPD', have)
1070 # want_libcryptsetup = get_option('libcryptsetup')
1071 # if want_libcryptsetup != 'false' and not fuzzer_build
1072 # libcryptsetup = dependency('libcryptsetup',
1073 # version : '>= 1.6.0',
1074 # required : want_libcryptsetup == 'true')
1075 # have = libcryptsetup.found()
1078 # libcryptsetup = []
1080 # conf.set10('HAVE_LIBCRYPTSETUP', have)
1082 # want_libcurl = get_option('libcurl')
1083 # if want_libcurl != 'false' and not fuzzer_build
1084 # libcurl = dependency('libcurl',
1085 # version : '>= 7.32.0',
1086 # required : want_libcurl == 'true')
1087 # have = libcurl.found()
1092 # conf.set10('HAVE_LIBCURL', have)
1094 # want_libidn = get_option('libidn')
1095 # want_libidn2 = get_option('libidn2')
1096 # if want_libidn == 'true' and want_libidn2 == 'true'
1097 # error('libidn and libidn2 cannot be requested simultaneously')
1100 # if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
1101 # libidn = dependency('libidn',
1102 # required : want_libidn == 'true')
1103 # have = libidn.found()
1108 # conf.set10('HAVE_LIBIDN', have)
1109 # if not have and want_libidn2 != 'false' and not fuzzer_build
1110 # # libidn is used for both libidn and libidn2 objects
1111 # libidn = dependency('libidn2',
1112 # required : want_libidn2 == 'true')
1113 # have = libidn.found()
1117 # conf.set10('HAVE_LIBIDN2', have)
1119 # want_libiptc = get_option('libiptc')
1120 # if want_libiptc != 'false' and not fuzzer_build
1121 # libiptc = dependency('libiptc',
1122 # required : want_libiptc == 'true')
1123 # have = libiptc.found()
1128 # conf.set10('HAVE_LIBIPTC', have)
1130 # want_qrencode = get_option('qrencode')
1131 # if want_qrencode != 'false' and not fuzzer_build
1132 # libqrencode = dependency('libqrencode',
1133 # required : want_qrencode == 'true')
1134 # have = libqrencode.found()
1139 # conf.set10('HAVE_QRENCODE', have)
1141 # want_gcrypt = get_option('gcrypt')
1142 # if want_gcrypt != 'false' and not fuzzer_build
1143 # libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1144 # libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1145 # have = libgcrypt.found() and libgpg_error.found()
1150 # # link to neither of the libs if one is not found
1154 # conf.set10('HAVE_GCRYPT', have)
1156 # want_gnutls = get_option('gnutls')
1157 # if want_gnutls != 'false' and not fuzzer_build
1158 # libgnutls = dependency('gnutls',
1159 # version : '>= 3.1.4',
1160 # required : want_gnutls == 'true')
1161 # have = libgnutls.found()
1166 # conf.set10('HAVE_GNUTLS', have)
1168 # want_elfutils = get_option('elfutils')
1169 # if want_elfutils != 'false' and not fuzzer_build
1170 # libdw = dependency('libdw',
1171 # required : want_elfutils == 'true')
1172 # have = libdw.found()
1177 # conf.set10('HAVE_ELFUTILS', have)
1179 # want_zlib = get_option('zlib')
1180 # if want_zlib != 'false' and not fuzzer_build
1181 # libz = dependency('zlib',
1182 # required : want_zlib == 'true')
1183 # have = libz.found()
1188 # conf.set10('HAVE_ZLIB', have)
1190 # want_bzip2 = get_option('bzip2')
1191 # if want_bzip2 != 'false' and not fuzzer_build
1192 # libbzip2 = cc.find_library('bz2',
1193 # required : want_bzip2 == 'true')
1194 # have = libbzip2.found()
1199 # conf.set10('HAVE_BZIP2', have)
1201 # want_xz = get_option('xz')
1202 # if want_xz != 'false' and not fuzzer_build
1203 # libxz = dependency('liblzma',
1204 # required : want_xz == 'true')
1205 # have = libxz.found()
1210 # conf.set10('HAVE_XZ', have)
1212 # want_lz4 = get_option('lz4')
1213 # if want_lz4 != 'false' and not fuzzer_build
1214 # liblz4 = dependency('liblz4',
1215 # required : want_lz4 == 'true')
1216 # have = liblz4.found()
1221 # conf.set10('HAVE_LZ4', have)
1223 # want_xkbcommon = get_option('xkbcommon')
1224 # if want_xkbcommon != 'false' and not fuzzer_build
1225 # libxkbcommon = dependency('xkbcommon',
1226 # version : '>= 0.3.0',
1227 # required : want_xkbcommon == 'true')
1228 # have = libxkbcommon.found()
1250 conf.set10('HAVE_XKBCOMMON', have)
1252 want_pcre2 = get_option('pcre2')
1253 if want_pcre2 != 'false'
1254 libpcre2 = dependency('libpcre2-8',
1255 required : want_pcre2 == 'true')
1256 have = libpcre2.found()
1261 conf.set10('HAVE_PCRE2', have)
1263 want_glib = get_option('glib')
1264 if want_glib != 'false' and not fuzzer_build
1265 libglib = dependency('glib-2.0',
1266 version : '>= 2.22.0',
1267 required : want_glib == 'true')
1268 libgobject = dependency('gobject-2.0',
1269 version : '>= 2.22.0',
1270 required : want_glib == 'true')
1271 libgio = dependency('gio-2.0',
1272 required : want_glib == 'true')
1273 have = libglib.found() and libgobject.found() and libgio.found()
1280 conf.set10('HAVE_GLIB', have)
1282 want_dbus = get_option('dbus')
1283 if want_dbus != 'false' and not fuzzer_build
1284 libdbus = dependency('dbus-1',
1285 version : '>= 1.3.2',
1286 required : want_dbus == 'true')
1287 have = libdbus.found()
1292 conf.set10('HAVE_DBUS', have)
1294 #if 0 /// UNNEEDED by elogind
1295 # default_dnssec = get_option('default-dnssec')
1297 # default_dnssec = 'no'
1299 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1300 # message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1301 # default_dnssec = 'no'
1303 # conf.set('DEFAULT_DNSSEC_MODE',
1304 # 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1305 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1307 # dns_over_tls = get_option('dns-over-tls')
1308 # if dns_over_tls != 'false'
1309 # have = conf.get('HAVE_GNUTLS') == 1
1310 # if dns_over_tls == 'true' and not have
1311 # error('DNS-over-TLS support was requested, but dependencies are not available')
1316 # conf.set10('ENABLE_DNS_OVER_TLS', have)
1318 # default_dns_over_tls = get_option('default-dns-over-tls')
1320 # default_dns_over_tls = 'no'
1322 # if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1323 # message('default-dns-over-tls cannot be set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.')
1324 # default_dns_over_tls = 'no'
1326 # conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1327 # 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1328 # substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls)
1330 # want_importd = get_option('importd')
1331 # if want_importd != 'false'
1332 # have = (conf.get('HAVE_LIBCURL') == 1 and
1333 # conf.get('HAVE_ZLIB') == 1 and
1334 # conf.get('HAVE_BZIP2') == 1 and
1335 # conf.get('HAVE_XZ') == 1 and
1336 # conf.get('HAVE_GCRYPT') == 1)
1337 # if want_importd == 'true' and not have
1338 # error('importd support was requested, but dependencies are not available')
1343 # conf.set10('ENABLE_IMPORTD', have)
1345 # want_remote = get_option('remote')
1346 # if want_remote != 'false'
1347 # have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1348 # conf.get('HAVE_LIBCURL') == 1]
1349 # # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1350 # # it's possible to build one without the other. Complain only if
1351 # # support was explictly requested. The auxiliary files like sysusers
1352 # # config should be installed when any of the programs are built.
1353 # if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1354 # error('remote support was requested, but dependencies are not available')
1356 # have = have_deps[0] or have_deps[1]
1361 conf.set10('ENABLE_REMOTE', have)
1363 foreach term : ['utmp',
1364 #if 0 /// UNNEEDED by elogind
1399 have = get_option(term)
1400 name = 'ENABLE_' + term.underscorify().to_upper()
1401 conf.set10(name, have)
1404 #if 0 /// UNNEEDED by elogind
1405 # conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1408 want_tests = get_option('tests')
1409 install_tests = get_option('install-tests')
1410 slow_tests = get_option('slow-tests')
1414 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1416 #####################################################################
1418 #if 0 /// UNNEEDED by elogind
1419 # if get_option('efi')
1420 # efi_arch = host_machine.cpu_family()
1422 # if efi_arch == 'x86'
1423 # EFI_MACHINE_TYPE_NAME = 'ia32'
1424 # gnu_efi_arch = 'ia32'
1425 # elif efi_arch == 'x86_64'
1426 # EFI_MACHINE_TYPE_NAME = 'x64'
1427 # gnu_efi_arch = 'x86_64'
1428 # elif efi_arch == 'arm'
1429 # EFI_MACHINE_TYPE_NAME = 'arm'
1430 # gnu_efi_arch = 'arm'
1431 # elif efi_arch == 'aarch64'
1432 # EFI_MACHINE_TYPE_NAME = 'aa64'
1433 # gnu_efi_arch = 'aarch64'
1435 # EFI_MACHINE_TYPE_NAME = ''
1440 # conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1442 # conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1447 conf.set10('ENABLE_EFI', have)
1449 #####################################################################
1451 #if 1 /// These are not needed by elogind, but meson wants them although they are commented out.
1452 conf.set_quoted('CERTIFICATE_ROOT', '/dev/null')
1453 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', 'N/A')
1454 conf.set_quoted('MOUNT_PATH', '/dev/null')
1455 conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', '/dev/null')
1456 conf.set_quoted('SYSTEM_GENERATOR_PATH', '/dev/null')
1457 conf.set_quoted('UMOUNT_PATH', '/dev/null')
1458 conf.set_quoted('USER_ENV_GENERATOR_PATH', '/dev/null')
1459 conf.set_quoted('USER_GENERATOR_PATH', '/dev/null')
1460 #####################################################################
1464 config_h = configure_file(
1465 output : 'config.h',
1466 configuration : conf)
1468 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1470 includes = include_directories('src/basic',
1473 #if 0 /// UNNEEDED by elogind
1475 # 'src/journal-remote',
1479 # 'src/time-wait-sync',
1482 #if 0 /// UNNEEDED by elogind
1487 #if 0 /// elogind has a different list
1488 # 'src/libsystemd/sd-bus',
1489 # 'src/libsystemd/sd-device',
1490 # 'src/libsystemd/sd-hwdb',
1491 # 'src/libsystemd/sd-id128',
1492 # 'src/libsystemd/sd-netlink',
1493 # 'src/libsystemd/sd-network',
1494 # 'src/libsystemd-network',
1496 'src/libelogind/sd-bus',
1497 'src/libelogind/sd-id128',
1503 add_project_arguments('-include', 'config.h', language : 'c')
1506 #if 0 /// UNNEEDED by elogind
1509 subdir('src/systemd')
1511 #if 0 /// UNNEEDED by elogind
1512 # subdir('src/libsystemd')
1513 # subdir('src/libsystemd-network')
1514 # subdir('src/journal')
1517 subdir('src/libelogind')
1519 subdir('src/update-utmp')
1523 #if 0 /// UNNEEDED by elogind
1524 # libjournal_core = static_library(
1526 # libjournal_core_sources,
1528 # include_directories : includes,
1532 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1533 libelogind = shared_library(
1535 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
1536 version : libelogind_version,
1537 include_directories : includes,
1538 link_args : ['-shared',
1539 '-Wl,--version-script=' + libelogind_sym_path],
1540 #if 0 /// elogind does not need gcrypt or libjournal_client, only threads.
1541 # link_with : [libbasic,
1543 # link_whole : [libsystemd_static,
1544 # libjournal_client],
1545 # dependencies : [threads,
1549 # link_depends : libsystemd_sym,
1551 link_with : [libbasic],
1552 link_whole : [libelogind_static],
1553 dependencies : [threads],
1554 link_depends : libelogind_sym,
1557 install_dir : rootlibdir)
1559 static_libelogind = get_option('static-libelogind')
1560 static_libelogind_pic = static_libelogind == 'true' or static_libelogind == 'pic'
1562 install_libelogind_static = static_library(
1565 #if 0 /// No journald with elogind (And before you ask: NO!)
1566 # journal_client_sources,
1569 #if 0 /// No gcrypt with elogind
1570 # basic_gcrypt_sources,
1572 include_directories : includes,
1573 build_by_default : static_libelogind != 'false',
1574 install : static_libelogind != 'false',
1575 install_dir : rootlibdir,
1576 pic : static_libelogind == 'true' or static_libelogind == 'pic',
1577 dependencies : [threads,
1583 #if 0 /// libmount isn't built with elogind (and absolutely not needed anyway.)
1587 #if 0 /// No grypt with elogind
1592 c_args : libelogind_c_args + (static_libelogind_pic ? [] : ['-fno-PIC']))
1594 ############################################################
1596 # binaries that have --help and are intended for use by humans,
1597 # usually, but not always, installed in /bin.
1598 public_programs = []
1600 #if 0 /// UNNEEDED by elogind
1601 # subdir('src/libudev')
1603 # elogind depends on external libudev:
1604 libudev = dependency('libudev', required : true)
1606 subdir('src/shared')
1607 #if 0 /// UNNEEDED by elogind
1608 # subdir('src/core')
1609 # subdir('src/udev')
1610 # subdir('src/network')
1612 # subdir('src/analyze')
1613 # subdir('src/journal-remote')
1614 # subdir('src/coredump')
1615 # subdir('src/hostname')
1616 # subdir('src/import')
1617 # subdir('src/kernel-install')
1618 # subdir('src/locale')
1619 # subdir('src/machine')
1620 # subdir('src/portable')
1621 # subdir('src/nspawn')
1622 # subdir('src/resolve')
1623 # subdir('src/timedate')
1624 # subdir('src/timesync')
1625 # subdir('src/vconsole')
1626 # subdir('src/boot/efi')
1630 #if 0 /// UNNEEDED by elogind
1631 # subdir('src/fuzz')
1636 ############################################################
1638 # only static linking apart from libdl, to make sure that the
1639 # module is linked to all libraries that it uses.
1640 test_dlopen = executable(
1643 include_directories : includes,
1644 link_with : [libbasic],
1645 dependencies : [libdl])
1647 #if 0 /// UNNEEDED by elogind
1648 # foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1649 # ['systemd', 'ENABLE_NSS_SYSTEMD'],
1650 # ['mymachines', 'ENABLE_MACHINED'],
1651 # ['resolve', 'ENABLE_RESOLVE']]
1653 # condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1657 # sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1658 # version_script_arg = join_paths(meson.current_source_dir(), sym)
1660 # nss = shared_library(
1662 # 'src/nss-@0@/nss-@0@.c'.format(module),
1664 # include_directories : includes,
1665 # # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1666 # link_args : ['-Wl,-z,nodelete',
1668 # '-Wl,--version-script=' + version_script_arg,
1669 # '-Wl,--undefined'],
1670 # link_with : [libsystemd_static,
1672 # dependencies : [threads,
1674 # link_depends : sym,
1676 # install_dir : rootlibdir)
1678 # # We cannot use shared_module because it does not support version suffix.
1679 # # Unfortunately shared_library insists on creating the symlink…
1680 # meson.add_install_script('sh', '-c',
1681 # 'rm $DESTDIR@0@/libnss_@1@.so'
1682 # .format(rootlibdir, module))
1684 # test('dlopen-nss_' + module,
1686 # args : [nss.full_path()]) # path to dlopen must include a slash
1691 ############################################################
1693 #if 0 /// UNNEEDED by elogind
1694 # executable('systemd',
1696 # include_directories : includes,
1697 # link_with : [libcore,
1699 # dependencies : [threads,
1705 # install_rpath : rootlibexecdir,
1707 # install_dir : rootlibexecdir)
1709 # meson.add_install_script(meson_make_symlink,
1710 # join_paths(rootlibexecdir, 'systemd'),
1711 # join_paths(rootsbindir, 'init'))
1713 # exe = executable('systemd-analyze',
1714 # systemd_analyze_sources,
1715 # include_directories : includes,
1716 # link_with : [libcore,
1718 # dependencies : [threads,
1724 # install_rpath : rootlibexecdir,
1726 # public_programs += [exe]
1728 # executable('systemd-journald',
1729 # systemd_journald_sources,
1730 # include_directories : includes,
1731 # link_with : [libjournal_core,
1733 # dependencies : [threads,
1737 # install_rpath : rootlibexecdir,
1739 # install_dir : rootlibexecdir)
1741 # exe = executable('systemd-cat',
1742 # systemd_cat_sources,
1743 # include_directories : includes,
1744 # link_with : [libjournal_core,
1746 # dependencies : [threads],
1747 # install_rpath : rootlibexecdir,
1749 # public_programs += [exe]
1751 # exe = executable('journalctl',
1752 # journalctl_sources,
1753 # include_directories : includes,
1754 # link_with : [libshared],
1755 # dependencies : [threads,
1760 # install_rpath : rootlibexecdir,
1762 # install_dir : rootbindir)
1763 # public_programs += [exe]
1765 # executable('systemd-getty-generator',
1766 # 'src/getty-generator/getty-generator.c',
1767 # include_directories : includes,
1768 # link_with : [libshared],
1769 # install_rpath : rootlibexecdir,
1771 # install_dir : systemgeneratordir)
1773 # executable('systemd-debug-generator',
1774 # 'src/debug-generator/debug-generator.c',
1775 # include_directories : includes,
1776 # link_with : [libshared],
1777 # install_rpath : rootlibexecdir,
1779 # install_dir : systemgeneratordir)
1781 # executable('systemd-fstab-generator',
1782 # 'src/fstab-generator/fstab-generator.c',
1783 # 'src/core/mount-setup.c',
1784 # include_directories : includes,
1785 # link_with : [libshared],
1786 # install_rpath : rootlibexecdir,
1788 # install_dir : systemgeneratordir)
1790 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1791 # executable('30-systemd-environment-d-generator',
1792 # 'src/environment-d-generator/environment-d-generator.c',
1793 # include_directories : includes,
1794 # link_with : [libshared],
1795 # install_rpath : rootlibexecdir,
1797 # install_dir : userenvgeneratordir)
1799 # meson.add_install_script(meson_make_symlink,
1800 # join_paths(sysconfdir, 'environment'),
1801 # join_paths(environmentdir, '99-environment.conf'))
1804 # if conf.get('ENABLE_HIBERNATE') == 1
1805 # executable('systemd-hibernate-resume-generator',
1806 # 'src/hibernate-resume/hibernate-resume-generator.c',
1807 # include_directories : includes,
1808 # link_with : [libshared],
1809 # install_rpath : rootlibexecdir,
1811 # install_dir : systemgeneratordir)
1813 # executable('systemd-hibernate-resume',
1814 # 'src/hibernate-resume/hibernate-resume.c',
1815 # include_directories : includes,
1816 # link_with : [libshared],
1817 # install_rpath : rootlibexecdir,
1819 # install_dir : rootlibexecdir)
1822 # if conf.get('HAVE_BLKID') == 1
1823 # executable('systemd-gpt-auto-generator',
1824 # 'src/gpt-auto-generator/gpt-auto-generator.c',
1825 # 'src/basic/blkid-util.h',
1826 # include_directories : includes,
1827 # link_with : [libshared],
1828 # dependencies : libblkid,
1829 # install_rpath : rootlibexecdir,
1831 # install_dir : systemgeneratordir)
1833 # exe = executable('systemd-dissect',
1834 # 'src/dissect/dissect.c',
1835 # include_directories : includes,
1836 # link_with : [libshared],
1837 # install_rpath : rootlibexecdir,
1839 # install_dir : rootlibexecdir)
1840 # public_programs += [exe]
1843 # if conf.get('ENABLE_RESOLVE') == 1
1844 # executable('systemd-resolved',
1845 # systemd_resolved_sources,
1846 # include_directories : includes,
1847 # link_with : [libshared,
1849 # libsystemd_resolve_core],
1850 # dependencies : systemd_resolved_dependencies,
1851 # install_rpath : rootlibexecdir,
1853 # install_dir : rootlibexecdir)
1855 # exe = executable('resolvectl',
1856 # resolvectl_sources,
1857 # include_directories : includes,
1858 # link_with : [libshared,
1860 # libsystemd_resolve_core],
1861 # dependencies : [threads,
1865 # install_rpath : rootlibexecdir,
1867 # public_programs += [exe]
1869 # meson.add_install_script(meson_make_symlink,
1870 # join_paths(bindir, 'resolvectl'),
1871 # join_paths(rootsbindir, 'resolvconf'))
1873 # meson.add_install_script(meson_make_symlink,
1874 # join_paths(bindir, 'resolvectl'),
1875 # join_paths(bindir, 'systemd-resolve'))
1878 # if conf.get('ENABLE_LOGIND') == 1
1879 # executable('systemd-logind',
1880 # systemd_logind_sources,
1881 # include_directories : includes,
1882 # link_with : [liblogind_core,
1884 # 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,
1897 # install_rpath : rootlibexecdir,
1899 # install_dir : rootbindir)
1900 # public_programs += [exe]
1902 # exe = executable('systemd-inhibit',
1903 # 'src/login/inhibit.c',
1904 # include_directories : includes,
1905 # link_with : [libshared],
1906 # install_rpath : rootlibexecdir,
1908 # install_dir : rootbindir)
1909 # public_programs += [exe]
1911 # if conf.get('HAVE_PAM') == 1
1912 # version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1913 # pam_systemd = shared_library(
1917 # include_directories : includes,
1918 # link_args : ['-shared',
1919 # '-Wl,--version-script=' + version_script_arg],
1920 # link_with : [libsystemd_static,
1921 # libshared_static],
1922 # dependencies : [threads,
1925 # link_depends : pam_systemd_sym,
1927 # install_dir : pamlibdir)
1929 # test('dlopen-pam_systemd',
1931 # args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1935 # executable('systemd-user-runtime-dir',
1936 # user_runtime_dir_sources,
1937 # include_directories : includes,
1938 # link_with : [libshared, liblogind_core],
1939 # install_rpath : rootlibexecdir,
1941 # install_dir : rootlibexecdir)
1945 executable('elogind',
1947 include_directories : includes,
1948 link_with : [liblogind_core,
1950 dependencies : [threads,
1953 install_rpath : rootlibexecdir,
1955 install_dir : rootlibexecdir)
1957 exe = executable('loginctl',
1959 include_directories : includes,
1960 link_with : [libshared],
1961 dependencies : [threads,
1963 install_rpath : rootlibexecdir,
1965 install_dir : rootbindir)
1966 public_programs += [exe]
1968 exe = executable('elogind-inhibit',
1969 'src/login/inhibit.c',
1970 include_directories : includes,
1971 link_with : [libshared],
1972 dependencies : [threads],
1973 install_rpath : rootlibexecdir,
1975 install_dir : rootbindir)
1976 public_programs += [exe]
1978 if conf.get('HAVE_PAM') == 1
1979 version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1980 pam_elogind = shared_library(
1984 include_directories : includes,
1985 link_args : ['-shared',
1986 '-Wl,--version-script=' + version_script_arg],
1987 link_with : [libelogind_static,
1989 dependencies : [threads,
1992 link_depends : pam_elogind_sym,
1994 install_dir : pamlibdir)
1996 test('dlopen-pam_elogind',
1998 args : [pam_elogind.full_path()]) # path to dlopen must include a slash
2001 #if 0 /// UNNEEDED by elogind
2002 # executable('systemd-user-sessions',
2003 # 'src/user-sessions/user-sessions.c',
2004 # include_directories : includes,
2005 # link_with : [libshared],
2006 # install_rpath : rootlibexecdir,
2008 # install_dir : rootlibexecdir)
2011 # if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
2012 # exe = executable('bootctl',
2013 # 'src/boot/bootctl.c',
2014 # include_directories : includes,
2015 # link_with : [libshared],
2016 # dependencies : [libblkid],
2017 # install_rpath : rootlibexecdir,
2019 # public_programs += [exe]
2022 # exe = executable('systemd-socket-activate', 'src/activate/activate.c',
2023 # include_directories : includes,
2024 # link_with : [libshared],
2025 # dependencies : [threads],
2026 # install_rpath : rootlibexecdir,
2028 # public_programs += [exe]
2031 # if get_option('link-systemctl-shared')
2032 # systemctl_link_with = [libshared]
2034 # systemctl_link_with = [libsystemd_static,
2036 # libjournal_client,
2040 # exe = executable('systemctl', 'src/systemctl/systemctl.c',
2041 # include_directories : includes,
2042 # link_with : systemctl_link_with,
2043 # dependencies : [threads,
2048 # install_rpath : rootlibexecdir,
2050 # install_dir : rootbindir)
2051 # public_programs += [exe]
2053 # if conf.get('ENABLE_PORTABLED') == 1
2054 # executable('systemd-portabled',
2055 # systemd_portabled_sources,
2056 # include_directories : includes,
2057 # link_with : [libshared],
2058 # dependencies : [threads],
2059 # install_rpath : rootlibexecdir,
2061 # install_dir : rootlibexecdir)
2063 # exe = executable('portablectl', 'src/portable/portablectl.c',
2064 # include_directories : includes,
2065 # link_with : [libshared],
2066 # dependencies : [threads],
2067 # install_rpath : rootlibexecdir,
2069 # install_dir : rootlibexecdir)
2070 # public_programs += [exe]
2073 # foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit']
2074 # meson.add_install_script(meson_make_symlink,
2075 # join_paths(rootbindir, 'systemctl'),
2076 # join_paths(rootsbindir, alias))
2079 # if conf.get('ENABLE_BACKLIGHT') == 1
2080 # executable('systemd-backlight',
2081 # 'src/backlight/backlight.c',
2082 # include_directories : includes,
2083 # link_with : [libshared],
2084 # install_rpath : rootlibexecdir,
2086 # install_dir : rootlibexecdir)
2089 # if conf.get('ENABLE_RFKILL') == 1
2090 # executable('systemd-rfkill',
2091 # 'src/rfkill/rfkill.c',
2092 # include_directories : includes,
2093 # link_with : [libshared],
2094 # install_rpath : rootlibexecdir,
2096 # install_dir : rootlibexecdir)
2099 # executable('systemd-system-update-generator',
2100 # 'src/system-update-generator/system-update-generator.c',
2101 # include_directories : includes,
2102 # link_with : [libshared],
2103 # install_rpath : rootlibexecdir,
2105 # install_dir : systemgeneratordir)
2107 # if conf.get('HAVE_LIBCRYPTSETUP') == 1
2108 # executable('systemd-cryptsetup',
2109 # 'src/cryptsetup/cryptsetup.c',
2110 # include_directories : includes,
2111 # link_with : [libshared],
2112 # dependencies : [libcryptsetup],
2113 # install_rpath : rootlibexecdir,
2115 # install_dir : rootlibexecdir)
2117 # executable('systemd-cryptsetup-generator',
2118 # 'src/cryptsetup/cryptsetup-generator.c',
2119 # include_directories : includes,
2120 # link_with : [libshared],
2121 # dependencies : [libcryptsetup],
2122 # install_rpath : rootlibexecdir,
2124 # install_dir : systemgeneratordir)
2126 # executable('systemd-veritysetup',
2127 # 'src/veritysetup/veritysetup.c',
2128 # include_directories : includes,
2129 # link_with : [libshared],
2130 # dependencies : [libcryptsetup],
2131 # install_rpath : rootlibexecdir,
2133 # install_dir : rootlibexecdir)
2135 # executable('systemd-veritysetup-generator',
2136 # 'src/veritysetup/veritysetup-generator.c',
2137 # include_directories : includes,
2138 # link_with : [libshared],
2139 # dependencies : [libcryptsetup],
2140 # install_rpath : rootlibexecdir,
2142 # install_dir : systemgeneratordir)
2145 # if conf.get('HAVE_SYSV_COMPAT') == 1
2146 # executable('systemd-sysv-generator',
2147 # 'src/sysv-generator/sysv-generator.c',
2148 # include_directories : includes,
2149 # link_with : [libshared],
2150 # install_rpath : rootlibexecdir,
2152 # install_dir : systemgeneratordir)
2154 # executable('systemd-rc-local-generator',
2155 # 'src/rc-local-generator/rc-local-generator.c',
2156 # include_directories : includes,
2157 # link_with : [libshared],
2158 # install_rpath : rootlibexecdir,
2160 # install_dir : systemgeneratordir)
2163 # if conf.get('ENABLE_HOSTNAMED') == 1
2164 # executable('systemd-hostnamed',
2165 # 'src/hostname/hostnamed.c',
2166 # include_directories : includes,
2167 # link_with : [libshared],
2168 # install_rpath : rootlibexecdir,
2170 # install_dir : rootlibexecdir)
2172 # exe = executable('hostnamectl',
2173 # 'src/hostname/hostnamectl.c',
2174 # include_directories : includes,
2175 # link_with : [libshared],
2176 # install_rpath : rootlibexecdir,
2178 # public_programs += [exe]
2181 # if conf.get('ENABLE_LOCALED') == 1
2182 # if conf.get('HAVE_XKBCOMMON') == 1
2183 # # logind will load libxkbcommon.so dynamically on its own
2189 # executable('systemd-localed',
2190 # systemd_localed_sources,
2191 # include_directories : includes,
2192 # link_with : [libshared],
2193 # dependencies : deps,
2194 # install_rpath : rootlibexecdir,
2196 # install_dir : rootlibexecdir)
2198 # exe = executable('localectl',
2199 # localectl_sources,
2200 # include_directories : includes,
2201 # link_with : [libshared],
2202 # install_rpath : rootlibexecdir,
2204 # public_programs += [exe]
2207 # if conf.get('ENABLE_TIMEDATED') == 1
2208 # executable('systemd-timedated',
2209 # 'src/timedate/timedated.c',
2210 # include_directories : includes,
2211 # link_with : [libshared],
2212 # install_rpath : rootlibexecdir,
2214 # install_dir : rootlibexecdir)
2217 # if conf.get('ENABLE_TIMEDATECTL') == 1
2218 # exe = executable('timedatectl',
2219 # 'src/timedate/timedatectl.c',
2220 # include_directories : includes,
2221 # install_rpath : rootlibexecdir,
2222 # link_with : [libshared],
2223 # dependencies : [libm],
2225 # public_programs += [exe]
2228 # if conf.get('ENABLE_TIMESYNCD') == 1
2229 # executable('systemd-timesyncd',
2230 # systemd_timesyncd_sources,
2231 # include_directories : includes,
2232 # link_with : [libshared],
2233 # dependencies : [threads,
2235 # install_rpath : rootlibexecdir,
2237 # install_dir : rootlibexecdir)
2239 # executable('systemd-time-wait-sync',
2240 # 'src/time-wait-sync/time-wait-sync.c',
2241 # include_directories : includes,
2242 # link_with : [libshared],
2243 # install_rpath : rootlibexecdir,
2245 # install_dir : rootlibexecdir)
2248 # if conf.get('ENABLE_MACHINED') == 1
2249 # executable('systemd-machined',
2250 # systemd_machined_sources,
2251 # include_directories : includes,
2252 # link_with : [libmachine_core,
2254 # install_rpath : rootlibexecdir,
2256 # install_dir : rootlibexecdir)
2258 # exe = executable('machinectl',
2259 # 'src/machine/machinectl.c',
2260 # include_directories : includes,
2261 # link_with : [libshared],
2262 # dependencies : [threads,
2265 # install_rpath : rootlibexecdir,
2267 # install_dir : rootbindir)
2268 # public_programs += [exe]
2271 # if conf.get('ENABLE_IMPORTD') == 1
2272 # executable('systemd-importd',
2273 # systemd_importd_sources,
2274 # include_directories : includes,
2275 # link_with : [libshared],
2276 # dependencies : [threads],
2277 # install_rpath : rootlibexecdir,
2279 # install_dir : rootlibexecdir)
2281 # systemd_pull = executable('systemd-pull',
2282 # systemd_pull_sources,
2283 # include_directories : includes,
2284 # link_with : [libshared],
2285 # dependencies : [libcurl,
2290 # install_rpath : rootlibexecdir,
2292 # install_dir : rootlibexecdir)
2294 # systemd_import = executable('systemd-import',
2295 # systemd_import_sources,
2296 # include_directories : includes,
2297 # link_with : [libshared],
2298 # dependencies : [libcurl,
2302 # install_rpath : rootlibexecdir,
2304 # install_dir : rootlibexecdir)
2306 # systemd_export = executable('systemd-export',
2307 # systemd_export_sources,
2308 # include_directories : includes,
2309 # link_with : [libshared],
2310 # dependencies : [libcurl,
2314 # install_rpath : rootlibexecdir,
2316 # install_dir : rootlibexecdir)
2317 # public_programs += [systemd_pull, systemd_import, systemd_export]
2320 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2321 # exe = executable('systemd-journal-upload',
2322 # systemd_journal_upload_sources,
2323 # include_directories : includes,
2324 # link_with : [libshared],
2325 # dependencies : [threads,
2330 # install_rpath : rootlibexecdir,
2332 # install_dir : rootlibexecdir)
2333 # public_programs += [exe]
2336 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2337 # s_j_remote = executable('systemd-journal-remote',
2338 # systemd_journal_remote_sources,
2339 # include_directories : includes,
2340 # link_with : [libshared,
2341 # libsystemd_journal_remote],
2342 # dependencies : [threads,
2347 # install_rpath : rootlibexecdir,
2349 # install_dir : rootlibexecdir)
2351 # s_j_gatewayd = executable('systemd-journal-gatewayd',
2352 # systemd_journal_gatewayd_sources,
2353 # include_directories : includes,
2354 # link_with : [libshared],
2355 # dependencies : [threads,
2360 # install_rpath : rootlibexecdir,
2362 # install_dir : rootlibexecdir)
2363 # public_programs += [s_j_remote, s_j_gatewayd]
2366 # if conf.get('ENABLE_COREDUMP') == 1
2367 # executable('systemd-coredump',
2368 # systemd_coredump_sources,
2369 # include_directories : includes,
2370 # link_with : [libshared],
2371 # dependencies : [threads,
2376 # install_rpath : rootlibexecdir,
2378 # install_dir : rootlibexecdir)
2380 # exe = executable('coredumpctl',
2381 # coredumpctl_sources,
2382 # include_directories : includes,
2383 # link_with : [libshared],
2384 # dependencies : [threads,
2387 # install_rpath : rootlibexecdir,
2389 # public_programs += [exe]
2392 # if conf.get('ENABLE_BINFMT') == 1
2393 # exe = executable('systemd-binfmt',
2394 # 'src/binfmt/binfmt.c',
2395 # include_directories : includes,
2396 # link_with : [libshared],
2397 # install_rpath : rootlibexecdir,
2399 # install_dir : rootlibexecdir)
2400 # public_programs += [exe]
2402 # meson.add_install_script('sh', '-c',
2403 # mkdir_p.format(binfmtdir))
2404 # meson.add_install_script('sh', '-c',
2405 # mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2408 # if conf.get('ENABLE_VCONSOLE') == 1
2409 # executable('systemd-vconsole-setup',
2410 # 'src/vconsole/vconsole-setup.c',
2411 # include_directories : includes,
2412 # link_with : [libshared],
2413 # install_rpath : rootlibexecdir,
2415 # install_dir : rootlibexecdir)
2418 # if conf.get('ENABLE_RANDOMSEED') == 1
2419 # executable('systemd-random-seed',
2420 # 'src/random-seed/random-seed.c',
2421 # include_directories : includes,
2422 # link_with : [libshared],
2423 # install_rpath : rootlibexecdir,
2425 # install_dir : rootlibexecdir)
2428 # if conf.get('ENABLE_FIRSTBOOT') == 1
2429 # executable('systemd-firstboot',
2430 # 'src/firstboot/firstboot.c',
2431 # include_directories : includes,
2432 # link_with : [libshared],
2433 # dependencies : [libcrypt],
2434 # install_rpath : rootlibexecdir,
2436 # install_dir : rootbindir)
2439 # executable('systemd-remount-fs',
2440 # 'src/remount-fs/remount-fs.c',
2441 # 'src/core/mount-setup.c',
2442 # 'src/core/mount-setup.h',
2443 # include_directories : includes,
2444 # link_with : [libshared],
2445 # install_rpath : rootlibexecdir,
2447 # install_dir : rootlibexecdir)
2449 # executable('systemd-machine-id-setup',
2450 # 'src/machine-id-setup/machine-id-setup-main.c',
2451 # 'src/core/machine-id-setup.c',
2452 # 'src/core/machine-id-setup.h',
2453 # include_directories : includes,
2454 # link_with : [libshared],
2455 # install_rpath : rootlibexecdir,
2457 # install_dir : rootbindir)
2459 # executable('systemd-fsck',
2460 # 'src/fsck/fsck.c',
2461 # include_directories : includes,
2462 # link_with : [libshared],
2463 # install_rpath : rootlibexecdir,
2465 # install_dir : rootlibexecdir)
2467 # executable('elogind-growfs',
2468 # 'src/partition/growfs.c',
2469 # include_directories : includes,
2470 # link_with : [libshared],
2471 # dependencies : [libcryptsetup],
2472 # install_rpath : rootlibexecdir,
2474 # install_dir : rootlibexecdir)
2476 # executable('elogind-makefs',
2477 # 'src/partition/makefs.c',
2478 # include_directories : includes,
2479 # link_with : [libshared],
2480 # install_rpath : rootlibexecdir,
2482 # install_dir : rootlibexecdir)
2484 # executable('systemd-sleep',
2485 # 'src/sleep/sleep.c',
2486 # include_directories : includes,
2487 # link_with : [libshared],
2488 # install_rpath : rootlibexecdir,
2490 # install_dir : rootlibexecdir)
2492 # exe = executable('systemd-sysctl',
2493 # 'src/sysctl/sysctl.c',
2494 # include_directories : includes,
2495 # link_with : [libshared],
2496 # install_rpath : rootlibexecdir,
2498 # install_dir : rootlibexecdir)
2499 # public_programs += [exe]
2501 # executable('systemd-ac-power',
2502 # 'src/ac-power/ac-power.c',
2503 # include_directories : includes,
2504 # link_with : [libshared],
2505 # install_rpath : rootlibexecdir,
2507 # install_dir : rootlibexecdir)
2509 # exe = executable('systemd-detect-virt',
2510 # 'src/detect-virt/detect-virt.c',
2511 # include_directories : includes,
2512 # link_with : [libshared],
2513 # install_rpath : rootlibexecdir,
2515 # public_programs += [exe]
2517 # exe = executable('systemd-delta',
2518 # 'src/delta/delta.c',
2519 # include_directories : includes,
2520 # link_with : [libshared],
2521 # install_rpath : rootlibexecdir,
2523 # public_programs += [exe]
2525 # exe = executable('systemd-escape',
2526 # 'src/escape/escape.c',
2527 # include_directories : includes,
2528 # link_with : [libshared],
2529 # install_rpath : rootlibexecdir,
2531 # install_dir : rootbindir)
2532 # public_programs += [exe]
2534 # exe = executable('systemd-notify',
2535 # 'src/notify/notify.c',
2536 # include_directories : includes,
2537 # link_with : [libshared],
2538 # install_rpath : rootlibexecdir,
2540 # install_dir : rootbindir)
2541 # public_programs += [exe]
2543 # executable('systemd-volatile-root',
2544 # 'src/volatile-root/volatile-root.c',
2545 # include_directories : includes,
2546 # link_with : [libshared],
2547 # install_rpath : rootlibexecdir,
2549 # install_dir : rootlibexecdir)
2551 # executable('systemd-cgroups-agent',
2552 # 'src/cgroups-agent/cgroups-agent.c',
2553 # include_directories : includes,
2554 # link_with : [libshared],
2555 # install_rpath : rootlibexecdir,
2557 # install_dir : rootlibexecdir)
2559 executable('elogind-cgroups-agent',
2560 'src/cgroups-agent/cgroups-agent.c',
2561 include_directories : includes,
2562 link_with : [libshared],
2563 install_rpath : rootlibexecdir,
2565 install_dir : rootlibexecdir)
2568 #if 0 /// UNNEEDED by elogind
2569 # exe = executable('systemd-path',
2570 # 'src/path/path.c',
2571 # include_directories : includes,
2572 # link_with : [libshared],
2573 # install_rpath : rootlibexecdir,
2575 # public_programs += [exe]
2577 # exe = executable('systemd-ask-password',
2578 # 'src/ask-password/ask-password.c',
2579 # include_directories : includes,
2580 # link_with : [libshared],
2581 # install_rpath : rootlibexecdir,
2583 # install_dir : rootbindir)
2584 # public_programs += [exe]
2586 # executable('systemd-reply-password',
2587 # 'src/reply-password/reply-password.c',
2588 # include_directories : includes,
2589 # link_with : [libshared],
2590 # install_rpath : rootlibexecdir,
2592 # install_dir : rootlibexecdir)
2594 # exe = executable('systemd-tty-ask-password-agent',
2595 # 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2596 # include_directories : includes,
2597 # link_with : [libshared],
2598 # install_rpath : rootlibexecdir,
2600 # install_dir : rootbindir)
2601 # public_programs += [exe]
2603 # exe = executable('systemd-cgls',
2604 # 'src/cgls/cgls.c',
2605 # include_directories : includes,
2606 # link_with : [libshared],
2607 # install_rpath : rootlibexecdir,
2609 # public_programs += [exe]
2611 # exe = executable('systemd-cgtop',
2612 # 'src/cgtop/cgtop.c',
2613 # include_directories : includes,
2614 # link_with : [libshared],
2615 # install_rpath : rootlibexecdir,
2617 # public_programs += [exe]
2619 # executable('systemd-initctl',
2620 # 'src/initctl/initctl.c',
2621 # include_directories : includes,
2622 # link_with : [libshared],
2623 # install_rpath : rootlibexecdir,
2625 # install_dir : rootlibexecdir)
2627 # exe = executable('systemd-mount',
2628 # 'src/mount/mount-tool.c',
2629 # include_directories : includes,
2630 # link_with : [libshared],
2631 # install_rpath : rootlibexecdir,
2633 # public_programs += [exe]
2635 # meson.add_install_script(meson_make_symlink,
2636 # 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2638 # exe = executable('systemd-run',
2640 # include_directories : includes,
2641 # link_with : [libshared],
2642 # install_rpath : rootlibexecdir,
2644 # public_programs += [exe]
2646 # exe = executable('systemd-stdio-bridge',
2647 # 'src/stdio-bridge/stdio-bridge.c',
2648 # include_directories : includes,
2649 # link_with : [libshared],
2650 # install_rpath : rootlibexecdir,
2652 # public_programs += [exe]
2654 # exe = executable('busctl',
2655 # 'src/busctl/busctl.c',
2656 # 'src/busctl/busctl-introspect.c',
2657 # 'src/busctl/busctl-introspect.h',
2658 # include_directories : includes,
2659 # link_with : [libshared],
2660 # install_rpath : rootlibexecdir,
2662 # public_programs += [exe]
2664 # if conf.get('ENABLE_SYSUSERS') == 1
2665 # exe = executable('systemd-sysusers',
2666 # 'src/sysusers/sysusers.c',
2667 # include_directories : includes,
2668 # link_with : [libshared],
2669 # install_rpath : rootlibexecdir,
2671 # install_dir : rootbindir)
2672 # public_programs += [exe]
2675 # if conf.get('ENABLE_TMPFILES') == 1
2676 # exe = executable('systemd-tmpfiles',
2677 # 'src/tmpfiles/tmpfiles.c',
2678 # include_directories : includes,
2679 # link_with : [libshared],
2680 # dependencies : [libacl],
2681 # install_rpath : rootlibexecdir,
2683 # install_dir : rootbindir)
2684 # public_programs += [exe]
2686 # test('test-systemd-tmpfiles',
2687 # test_systemd_tmpfiles_py,
2688 # args : exe.full_path())
2689 # # https://github.com/mesonbuild/meson/issues/2681
2692 # if conf.get('ENABLE_HWDB') == 1
2693 # exe = executable('systemd-hwdb',
2694 # 'src/hwdb/hwdb.c',
2695 # 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2696 # include_directories : includes,
2697 # link_with : [libudev_static],
2698 # install_rpath : udev_rpath,
2700 # install_dir : rootbindir)
2701 # public_programs += [exe]
2704 # if conf.get('ENABLE_QUOTACHECK') == 1
2705 # executable('systemd-quotacheck',
2706 # 'src/quotacheck/quotacheck.c',
2707 # include_directories : includes,
2708 # link_with : [libshared],
2709 # install_rpath : rootlibexecdir,
2711 # install_dir : rootlibexecdir)
2714 # exe = executable('systemd-socket-proxyd',
2715 # 'src/socket-proxy/socket-proxyd.c',
2716 # include_directories : includes,
2717 # link_with : [libshared],
2718 # dependencies : [threads],
2719 # install_rpath : rootlibexecdir,
2721 # install_dir : rootlibexecdir)
2722 # public_programs += [exe]
2724 # exe = executable('systemd-udevd',
2725 # systemd_udevd_sources,
2726 # include_directories : includes,
2727 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2728 # link_with : [libudev_core,
2729 # libsystemd_network,
2731 # dependencies : [threads,
2736 # install_rpath : udev_rpath,
2738 # install_dir : rootlibexecdir)
2739 # public_programs += [exe]
2741 # exe = executable('udevadm',
2743 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2744 # include_directories : includes,
2745 # link_with : [libudev_core,
2746 # libsystemd_network,
2748 # dependencies : [threads,
2753 # install_rpath : udev_rpath,
2755 # install_dir : rootbindir)
2756 # public_programs += [exe]
2758 # executable('systemd-shutdown',
2759 # systemd_shutdown_sources,
2760 # include_directories : includes,
2761 # link_with : [libshared],
2762 # dependencies : [libmount],
2763 # install_rpath : rootlibexecdir,
2765 # install_dir : rootlibexecdir)
2767 # executable('systemd-update-done',
2768 # 'src/update-done/update-done.c',
2769 # include_directories : includes,
2770 # link_with : [libshared],
2771 # install_rpath : rootlibexecdir,
2773 # install_dir : rootlibexecdir)
2775 # executable('systemd-update-utmp',
2776 # 'src/update-utmp/update-utmp.c',
2777 # include_directories : includes,
2778 # link_with : [libshared],
2779 # dependencies : [libaudit],
2780 # install_rpath : rootlibexecdir,
2782 # install_dir : rootlibexecdir)
2784 # if conf.get('HAVE_KMOD') == 1
2785 # executable('systemd-modules-load',
2786 # 'src/modules-load/modules-load.c',
2787 # include_directories : includes,
2788 # link_with : [libshared],
2789 # dependencies : [libkmod],
2790 # install_rpath : rootlibexecdir,
2792 # install_dir : rootlibexecdir)
2794 # meson.add_install_script('sh', '-c',
2795 # mkdir_p.format(modulesloaddir))
2796 # meson.add_install_script('sh', '-c',
2797 # mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2800 # exe = executable('systemd-nspawn',
2801 # systemd_nspawn_sources,
2802 # 'src/core/mount-setup.c', # FIXME: use a variable?
2803 # 'src/core/mount-setup.h',
2804 # 'src/core/loopback-setup.c',
2805 # 'src/core/loopback-setup.h',
2806 # include_directories : includes,
2807 # link_with : [libnspawn_core,
2809 # dependencies : [libblkid],
2810 # install_rpath : rootlibexecdir,
2812 # public_programs += [exe]
2814 # if conf.get('ENABLE_NETWORKD') == 1
2815 # executable('systemd-networkd',
2816 # systemd_networkd_sources,
2817 # include_directories : includes,
2818 # link_with : [libnetworkd_core,
2819 # libsystemd_network,
2822 # dependencies : [threads],
2823 # install_rpath : rootlibexecdir,
2825 # install_dir : rootlibexecdir)
2827 # executable('systemd-networkd-wait-online',
2828 # systemd_networkd_wait_online_sources,
2829 # include_directories : includes,
2830 # link_with : [libnetworkd_core,
2832 # install_rpath : rootlibexecdir,
2834 # install_dir : rootlibexecdir)
2836 # exe = executable('networkctl',
2837 # networkctl_sources,
2838 # include_directories : includes,
2839 # link_with : [libsystemd_network,
2841 # install_rpath : rootlibexecdir,
2843 # install_dir : rootbindir)
2844 # public_programs += [exe]
2847 # executable('systemd-sulogin-shell',
2848 # ['src/sulogin-shell/sulogin-shell.c'],
2849 # include_directories : includes,
2850 # link_with : [libshared],
2851 # install_rpath : rootlibexecdir,
2853 # install_dir : rootlibexecdir)
2855 executable('elogind-uaccess-command',
2856 'src/uaccess-command/uaccess-command.c',
2857 include_directories : includes,
2858 link_with : [liblogind_core,
2860 dependencies: [libacl,
2862 install_rpath : rootlibexecdir,
2864 install_dir : rootlibexecdir)
2867 ############################################################
2869 foreach tuple : tests
2871 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2872 dependencies = tuple[2]
2873 condition = tuple.length() >= 4 ? tuple[3] : ''
2874 type = tuple.length() >= 5 ? tuple[4] : ''
2875 defs = tuple.length() >= 6 ? tuple[5] : []
2876 incs = tuple.length() >= 7 ? tuple[6] : includes
2879 name = sources[0].split('/')[-1].split('.')[0]
2880 if type.startswith('timeout=')
2881 timeout = type.split('=')[1].to_int()
2884 if want_tests == 'false'
2885 message('Not compiling @0@ because tests is set to false'.format(name))
2886 elif condition == '' or conf.get(condition) == 1
2890 include_directories : incs,
2891 link_with : link_with,
2892 dependencies : dependencies,
2894 install_rpath : rootlibexecdir,
2895 install : install_tests,
2896 install_dir : join_paths(testsdir, type))
2899 message('@0@ is a manual test'.format(name))
2900 elif type == 'unsafe' and want_tests != 'unsafe'
2901 message('@0@ is an unsafe test'.format(name))
2908 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2912 #if 0 /// UNNEEDED by elogind
2914 # 'test-libsystemd-sym',
2915 # test_libsystemd_sym_c,
2916 # include_directories : includes,
2917 # link_with : [libsystemd],
2918 # install : install_tests,
2919 # install_dir : testsdir)
2920 # test('test-libsystemd-sym', exe)
2923 # 'test-libsystemd-static-sym',
2924 # test_libsystemd_sym_c,
2925 # include_directories : includes,
2926 # link_with : [install_libsystemd_static],
2927 # dependencies : [threads], # threads is already included in dependencies on the library,
2928 # # but does not seem to get propagated. Add here as a work-around.
2929 # build_by_default : static_libsystemd_pic,
2930 # install : install_tests and static_libsystemd_pic,
2931 # install_dir : testsdir)
2932 # if static_libsystemd_pic
2933 # test('test-libsystemd-static-sym', exe)
2937 # 'test-libudev-sym',
2938 # test_libudev_sym_c,
2939 # include_directories : includes,
2940 # c_args : ['-Wno-deprecated-declarations'],
2941 # link_with : [libudev],
2942 # install : install_tests,
2943 # install_dir : testsdir)
2944 # test('test-libudev-sym', exe)
2947 # 'test-libudev-static-sym',
2948 # test_libudev_sym_c,
2949 # include_directories : includes,
2950 # c_args : ['-Wno-deprecated-declarations'],
2951 # link_with : [install_libudev_static],
2952 # build_by_default : static_libudev_pic,
2953 # install : install_tests and static_libudev_pic,
2954 # install_dir : testsdir)
2955 # if static_libudev_pic
2956 # test('test-libudev-static-sym', exe)
2959 # ############################################################
2963 # foreach tuple : fuzzers
2964 # sources = tuple[0]
2965 # link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2966 # dependencies = tuple[2]
2967 # defs = tuple.length() >= 4 ? tuple[3] : []
2968 # incs = tuple.length() >= 5 ? tuple[4] : includes
2971 # dependencies += fuzzing_engine
2973 # sources += 'src/fuzz/fuzz-main.c'
2976 # name = sources[0].split('/')[-1].split('.')[0]
2978 # fuzzer_exes += executable(
2981 # include_directories : [incs, include_directories('src/fuzz')],
2982 # link_with : link_with,
2983 # dependencies : dependencies,
2988 # run_target('fuzzers',
2989 # depends : fuzzer_exes,
2990 # command : ['true'])
2992 # ############################################################
2995 test_libelogind_sym = executable(
2996 'test-libelogind-sym',
2997 test_libelogind_sym_c,
2998 include_directories : includes,
2999 link_with : [libelogind],
3000 install : install_tests,
3001 install_dir : testsdir)
3002 test('test-libelogind-sym',
3003 test_libelogind_sym)
3005 make_directive_index_py = find_program('tools/make-directive-index.py')
3006 make_man_index_py = find_program('tools/make-man-index.py')
3007 xml_helper_py = find_program('tools/xml_helper.py')
3008 #if 0 /// UNNEEDED by elogind
3009 # hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
3012 # subdir('sysctl.d')
3013 # subdir('sysusers.d')
3014 # subdir('tmpfiles.d')
3020 subdir('shell-completion/bash')
3021 subdir('shell-completion/zsh')
3022 #if 0 /// UNNEEDED by elogind
3023 # subdir('doc/sysvinit')
3024 # subdir('doc/var-log')
3027 # FIXME: figure out if the warning is true:
3028 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
3029 install_subdir('factory/etc',
3030 install_dir : factorydir)
3033 #if 0 /// UNNEEDED by elogind
3034 # install_data('xorg/50-systemd-user.sh',
3035 # install_dir : xinitrcdir)
3036 # install_data('modprobe.d/systemd.conf',
3037 # install_dir : modprobedir)
3039 install_data('LICENSE.GPL2',
3044 #if 0 /// irrelevant for elogind
3045 # 'doc/DISTRO_PORTING',
3046 # 'doc/ENVIRONMENT.md',
3048 # 'doc/TRANSIENT-SETTINGS.md',
3049 # 'doc/TRANSLATORS',
3050 # 'doc/UIDS-GIDS.md',
3052 'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
3053 install_dir : docdir)
3055 #if 0 /// UNNEEDED by elogind
3056 # meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3058 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3060 ############################################################
3062 meson_check_help = find_program('tools/meson-check-help.sh')
3064 foreach exec : public_programs
3065 name = exec.full_path().split('/')[-1]
3066 test('check-help-' + name,
3068 args : [exec.full_path()])
3071 ############################################################
3073 #if 0 /// fuzz regression tests are not supported by elogind
3074 # # Enable tests for all supported sanitizers
3075 # foreach tuple : sanitizers
3076 # sanitizer = tuple[0]
3079 # have = run_command(check_compilation_sh,
3080 # cc.cmd_array(), '-x', 'c',
3081 # '-fsanitize=@0@'.format(sanitizer),
3082 # '-include', link_test_c).returncode() == 0
3083 # message('@0@ sanitizer supported: @1@'.format(sanitizer, have ? 'yes' : 'no'))
3087 # foreach p : fuzz_regression_tests
3088 # b = p.split('/')[-2]
3089 # c = p.split('/')[-1]
3091 # name = '@0@:@1@'.format(b, sanitizer)
3094 # if want_tests == 'false'
3095 # message('Not compiling @0@ because tests is set to false'.format(name))
3097 # exe = custom_target(
3101 # command : [env, 'ln', '-fs',
3102 # join_paths(build.full_path(), b),
3104 # build_by_default : true)
3106 # message('Not compiling @0@ because slow-tests is set to false'.format(name))
3111 # if want_tests != 'false' and slow_tests
3112 # test('@0@:@1@:@2@'.format(b, c, sanitizer),
3114 # args : [exe.full_path(),
3115 # join_paths(meson.source_root(),
3116 # 'test/fuzz-regressions',
3125 ############################################################
3128 all_files = run_command(
3130 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3133 all_files = files(all_files.stdout().split())
3138 command : [env, 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
3141 command : [env, 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
3144 #if 0 /// UNNEEDED by elogind
3146 # meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
3149 # command : [meson_git_contrib_sh])
3154 git_head = run_command(
3156 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3157 'rev-parse', 'HEAD']).stdout().strip()
3158 git_head_short = run_command(
3160 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3161 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3165 command : ['git', 'archive',
3166 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
3168 '--prefix', 'systemd-@0@/'.format(git_head),
3172 ############################################################
3174 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
3177 #if 0 /// libudev is external, elogind does not need to document it.
3178 # depends : [man, libsystemd, libudev],
3179 # command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3181 depends : [man, libelogind],
3182 command : [meson_check_api_docs_sh, libelogind.full_path()])
3185 ############################################################
3188 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3190 'split /usr: @0@'.format(split_usr),
3191 'split bin-sbin: @0@'.format(split_bin),
3192 'prefix directory: @0@'.format(prefixdir),
3193 'rootprefix directory: @0@'.format(rootprefixdir),
3194 'sysconf directory: @0@'.format(sysconfdir),
3195 'include directory: @0@'.format(includedir),
3196 'lib directory: @0@'.format(libdir),
3197 'rootlib directory: @0@'.format(rootlibdir),
3198 #if 1 /// Needed by elogind
3199 'rootexeclib dir: @0@'.format(rootlibexecdir),
3201 #if 0 /// UNNEEDED by elogind
3202 # 'SysV init scripts: @0@'.format(sysvinit_path),
3203 # 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3205 'PAM modules directory: @0@'.format(pamlibdir),
3206 'PAM configuration directory: @0@'.format(pamconfdir),
3207 #if 0 /// UNNEEDED by elogind
3208 # 'RPM macros directory: @0@'.format(rpmmacrosdir),
3210 'modprobe.d directory: @0@'.format(modprobedir),
3211 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3212 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3213 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3214 'bash completions directory: @0@'.format(bashcompletiondir),
3215 'zsh completions directory: @0@'.format(zshcompletiondir),
3216 #if 0 /// UNSUPPORTED by elogind
3217 # 'extra start script: @0@'.format(get_option('rc-local')),
3218 # 'extra stop script: @0@'.format(get_option('halt-local')),
3219 # 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3220 # get_option('debug-tty')),
3222 'TTY GID: @0@'.format(tty_gid),
3223 #if 0 /// UNSUPPORTED by elogind
3224 # 'users GID: @0@'.format(users_gid),
3226 'maximum system UID: @0@'.format(system_uid_max),
3227 'maximum system GID: @0@'.format(system_gid_max),
3228 #if 0 /// UNSUPPORTED by elogind
3229 # 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
3230 # 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
3231 # 'minimum container UID base: @0@'.format(container_uid_base_min),
3232 # 'maximum container UID base: @0@'.format(container_uid_base_max),
3233 # '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3234 # 'render group access mode: @0@'.format(get_option('group-render-mode')),
3235 # 'certificate root directory: @0@'.format(get_option('certificate-root')),
3236 # 'support URL: @0@'.format(support_url),
3238 'nobody user name: @0@'.format(nobody_user),
3239 'nobody group name: @0@'.format(nobody_group),
3240 #if 0 /// UNSUPPORTED by elogind
3241 # 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3242 # 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
3244 # 'default DNSSEC mode: @0@'.format(default_dnssec),
3245 # 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
3246 # 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3248 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
3250 #if 0 /// UNSUPPORTED by elogind
3251 # alt_dns_servers = '\n '.join(dns_servers.split(' '))
3252 # alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3254 # 'default DNS servers: @0@'.format(alt_dns_servers),
3255 # 'default NTP servers: @0@'.format(alt_ntp_servers)]
3257 # alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3258 # '@@0@'.format(time_epoch)).stdout().strip()
3260 # 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3264 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3265 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3266 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3268 #if 0 /// UNNEEDED by elogind
3269 # if conf.get('ENABLE_EFI') == 1
3271 # 'efi arch: @0@'.format(efi_arch)]
3275 # 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3276 # 'EFI CC @0@'.format(efi_cc),
3277 # 'EFI lib directory: @0@'.format(efi_libdir),
3278 # 'EFI lds directory: @0@'.format(efi_ldsdir),
3279 # 'EFI include directory: @0@'.format(efi_incdir)]
3288 #if 0 /// UNNEEDED by elogind
3289 # ['libcryptsetup'],
3293 #if 0 /// UNNEEDED by elogind
3298 #if 0 /// UNNEEDED by elogind
3302 #if 0 /// UNNEEDED by elogind
3309 #if 0 /// UNNEEDED by elogind
3325 # ['environment.d'],
3345 ['legacy pkla', install_polkit_pkla],
3346 #if 0 /// UNNEEDED by elogind
3348 # ['gnu-efi', have_gnu_efi],
3356 #if 0 /// UNNEEDED by elogind
3357 # ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
3361 ['man pages', want_man],
3362 ['html pages', want_html],
3363 ['man page indices', want_man and have_lxml],
3364 #if 0 /// UNNEEDED by elogind
3368 #if 0 /// UNNEEDED by elogind
3371 # ['adm group', get_option('adm-group')],
3372 # ['wheel group', get_option('wheel-group')],
3375 ['valgrind', conf.get('VALGRIND') == 1],
3376 #if 1 /// Extra debugging for elogind
3380 ['debug mmap cache'],
3383 if tuple.length() >= 2
3386 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3387 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3388 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3393 missing += [tuple[0]]
3399 'enabled features: @0@'.format(', '.join(found)),
3401 'disabled features: @0@'.format(', '.join(missing)),
3403 message('\n '.join(status))
3405 #if 0 /// Nicely enough this isn't true for elogind. :-)
3406 # if rootprefixdir != rootprefix_default
3408 # 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3409 # 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3410 # 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))