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.22.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 pamlibdir = get_option('pamlibdir')
209 pamlibdir = join_paths(rootlibdir, 'security')
212 pamconfdir = get_option('pamconfdir')
214 pamconfdir = join_paths(sysconfdir, 'pam.d')
217 #if 0 /// UNNEEDED by elogind
218 # memory_accounting_default = get_option('memory-accounting-default')
221 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
222 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
223 #if 0 /// UNNEEDED by elogind
224 # conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
225 # conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
226 # conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
227 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
228 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
230 # conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
232 # conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
233 # conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
234 # conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
235 # conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
236 # conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
237 # conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
238 # conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
239 # conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
240 # conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
241 # conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
242 # conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
243 # conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
244 # conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
245 # conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
247 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'elogind-cgroups-agent'))
248 conf.set_quoted('ELOGIND_UACCESS_COMMAND_PATH', join_paths(rootlibexecdir, 'elogind-uaccess-command'))
249 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'elogind'))
251 conf.set_quoted('ROOTPREFIX', rootprefixdir)
252 #if 0 /// UNNEEDED by elogind
253 # conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
254 # conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
255 # conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
256 # conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
257 # conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
258 # conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
259 # conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
261 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
262 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
263 #if 0 /// UNNEEDED by elogind
264 # conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
265 # conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
267 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
268 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
269 conf.set_quoted('LIBDIR', libdir)
270 conf.set_quoted('ROOTLIBDIR', rootlibdir)
271 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
272 #if 0 /// UNNEEDED by elogind
273 # conf.set_quoted('BOOTLIBDIR', bootlibdir)
274 # conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
275 # conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
276 # conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
277 # conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
278 # conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
279 # conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
280 # conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false')
281 # conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
284 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
285 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
287 substs.set('prefix', prefixdir)
288 substs.set('exec_prefix', prefixdir)
289 substs.set('libdir', libdir)
290 substs.set('rootlibdir', rootlibdir)
291 substs.set('includedir', includedir)
292 substs.set('pkgsysconfdir', pkgsysconfdir)
293 substs.set('bindir', bindir)
294 substs.set('rootbindir', rootbindir)
295 substs.set('rootlibexecdir', rootlibexecdir)
296 #if 0 /// UNNEEDED by elogind
297 # substs.set('systemunitdir', systemunitdir)
298 # substs.set('userunitdir', userunitdir)
299 # substs.set('systempresetdir', systempresetdir)
300 # substs.set('userpresetdir', userpresetdir)
301 # substs.set('udevhwdbdir', udevhwdbdir)
303 substs.set('udevrulesdir', udevrulesdir)
304 substs.set('udevlibexecdir', udevlibexecdir)
305 #if 0 /// UNNEEDED by elogind
306 # substs.set('environmentdir', environmentdir)
307 # substs.set('catalogdir', catalogdir)
308 # substs.set('tmpfilesdir', tmpfilesdir)
309 # substs.set('sysusersdir', sysusersdir)
310 # substs.set('sysctldir', sysctldir)
311 # substs.set('binfmtdir', binfmtdir)
312 # substs.set('modulesloaddir', modulesloaddir)
313 # substs.set('modprobedir', modprobedir)
314 # substs.set('systemgeneratordir', systemgeneratordir)
315 # substs.set('usergeneratordir', usergeneratordir)
316 # substs.set('systemenvgeneratordir', systemenvgeneratordir)
317 # substs.set('userenvgeneratordir', userenvgeneratordir)
319 substs.set('systemshutdowndir', systemshutdowndir)
320 substs.set('systemsleepdir', systemsleepdir)
321 substs.set('VARLOGDIR', varlogdir)
322 #if 0 /// UNNEEDED by elogind
323 # substs.set('CERTIFICATEROOT', get_option('certificate-root'))
324 # substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
325 # substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
326 # substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
327 # substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
328 # substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
329 # substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
330 # substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
333 #####################################################################
335 cc = meson.get_compiler('c')
336 pkgconfig = import('pkgconfig')
337 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
338 meson_build_sh = find_program('tools/meson-build.sh')
340 if get_option('tests') != 'false'
341 cxx = find_program('c++', required : false)
343 # Used only for tests
348 #if 0 /// elogind does not support fuzz stress testing (, yet).
349 # want_ossfuzz = get_option('oss-fuzz')
350 # want_libfuzzer = get_option('llvm-fuzz')
351 # fuzzer_build = want_ossfuzz or want_libfuzzer
352 # if want_ossfuzz and want_libfuzzer
353 # error('only one of oss-fuzz and llvm-fuzz can be specified')
356 # fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
359 # fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
365 possible_cc_flags = [
369 '-Wmissing-include-dirs',
370 '-Wold-style-definition',
374 '-Wsuggest-attribute=noreturn',
375 '-Werror=missing-prototypes',
376 '-Werror=implicit-function-declaration',
377 '-Werror=missing-declarations',
378 '-Werror=return-type',
379 '-Werror=incompatible-pointer-types',
381 '-Wstrict-prototypes',
383 '-Wmissing-noreturn',
384 '-Wimplicit-fallthrough=5',
387 '-Wstrict-aliasing=2',
390 '-Werror=shift-count-overflow',
391 '-Werror=shift-overflow=2',
396 '-fdiagnostics-show-option',
397 '-fno-strict-aliasing',
398 '-fvisibility=hidden',
400 '-fstack-protector-strong',
401 '--param=ssp-buffer-size=4',
404 # --as-needed and --no-undefined are provided by meson by default,
405 # run mesonconf to see what is enabled
406 possible_link_flags = [
411 # the oss-fuzz fuzzers are not built with -fPIE, so don't
412 # enable it when we are linking against them
414 possible_cc_flags += '-fPIE'
415 possible_link_flags += '-pie'
418 if cc.get_id() == 'clang'
419 possible_cc_flags += [
420 '-Wno-typedef-redefinition',
421 '-Wno-gnu-variable-sized-type-not-at-end',
425 if get_option('buildtype') != 'debug'
426 possible_cc_flags += [
427 '-ffunction-sections',
431 possible_link_flags += '-Wl,--gc-sections'
434 add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
436 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
437 # arguments, just emits a warning. So test for the "positive" version instead.
438 foreach arg : ['unused-parameter',
439 'missing-field-initializers',
442 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
444 if cc.has_argument('-W' + arg)
445 add_project_arguments('-Wno-' + arg, language : 'c')
451 #include <inttypes.h>
452 typedef uint64_t usec_t;
453 usec_t now(clockid_t clock);
458 ''', name : '-Werror=shadow with local shadowing')
459 add_project_arguments('-Werror=shadow', language : 'c')
462 link_test_c = files('tools/meson-link-test.c')
464 foreach arg : possible_link_flags
465 have = run_command(check_compilation_sh,
466 cc.cmd_array(), '-x', 'c', arg,
467 '-include', link_test_c).returncode() == 0
468 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
470 add_project_link_arguments(arg, language : 'c')
474 cpp = ' '.join(cc.cmd_array()) + ' -E'
476 #####################################################################
477 # compilation result tests
479 conf.set('_GNU_SOURCE', true)
480 conf.set('__SANE_USERSPACE_TYPES__', true)
482 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
483 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
484 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
485 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
486 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
487 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
488 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
492 #include <linux/ethtool.h>
493 #include <linux/fib_rules.h>
494 //#include <linux/stat.h>
495 //#include <sys/stat.h>
497 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
499 foreach decl : ['char16_t',
502 'struct ethtool_link_settings',
503 'struct fib_rule_uid_range',
507 # We get -1 if the size cannot be determined
508 have = cc.sizeof(decl, prefix : decl_headers) > 0
509 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
512 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
513 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
514 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
515 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
516 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
517 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
518 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
519 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
520 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
521 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
522 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
523 # if_tunnel.h is buggy and cannot be included on its own
524 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
525 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
526 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
527 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
528 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
529 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
530 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
531 ['IPVLAN_F_PRIVATE', 'linux/if_link.h'],
532 ['NDA_IFINDEX', 'linux/neighbour.h'],
533 ['IFA_FLAGS', 'linux/if_addr.h'],
534 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
535 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
536 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
538 prefix = decl.length() > 2 ? decl[2] : ''
539 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
540 conf.set10('HAVE_' + decl[0], have)
543 foreach ident : ['secure_getenv', '__secure_getenv']
544 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
548 ['memfd_create', '''#include <sys/mman.h>'''],
549 ['gettid', '''#include <sys/types.h>
550 #include <unistd.h>'''],
551 ['pivot_root', '''#include <stdlib.h>
552 #include <unistd.h>'''], # no known header declares pivot_root
553 ['name_to_handle_at', '''#include <sys/types.h>
554 #include <sys/stat.h>
555 #include <fcntl.h>'''],
556 ['setns', '''#include <sched.h>'''],
557 ['renameat2', '''#include <stdio.h>
558 // #include <fcntl.h>'''],
559 ['kcmp', '''#include <linux/kcmp.h>'''],
560 ['keyctl', '''#include <sys/types.h>
561 #include <keyutils.h>'''],
562 ['copy_file_range', '''#include <sys/syscall.h>
563 #include <unistd.h>'''],
564 ['bpf', '''#include <sys/syscall.h>
565 #include <unistd.h>'''],
566 ['statx', '''#include <sys/types.h>
567 #include <sys/stat.h>
568 // #include <unistd.h>'''],
569 ['explicit_bzero' , '''#include <string.h>'''],
570 ['reallocarray', '''#include <malloc.h>'''],
573 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
574 conf.set10('HAVE_' + ident[0].to_upper(), have)
577 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
578 conf.set10('USE_SYS_RANDOM_H', true)
579 conf.set10('HAVE_GETRANDOM', true)
581 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
582 conf.set10('USE_SYS_RANDOM_H', false)
583 conf.set10('HAVE_GETRANDOM', have)
586 #####################################################################
588 sed = find_program('sed')
589 awk = find_program('awk')
590 m4 = find_program('m4')
591 stat = find_program('stat')
592 git = find_program('git', required : false)
593 env = find_program('env')
594 perl = find_program('perl', required : false)
596 #if 0 /// elogind does not use this but needs a tool to symlink its installed headers.
597 # meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
598 #else /// Needed by elogind
599 meson_symlink_headers = meson.source_root() + '/tools/meson-symlink_headers.sh'
601 mkdir_p = 'mkdir -p $DESTDIR/@0@'
602 #if 0 /// unneeded by elogind
603 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
604 # splash_bmp = files('test/splash.bmp')
607 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
608 # /usr/sbin, /sbin, and fall back to the default from middle column.
609 #if 0 /// elogind has a bit different list and some adaptions
610 # progs = [['quotaon', '/usr/sbin/quotaon' ],
611 # ['quotacheck', '/usr/sbin/quotacheck' ],
612 # ['kmod', '/usr/bin/kmod' ],
613 # ['kexec', '/usr/sbin/kexec' ],
614 # ['sulogin', '/usr/sbin/sulogin' ],
615 # ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
616 # ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
617 # ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
618 # ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
621 progs = [['halt', '/sbin/halt', 'HALT'],
622 ['kexec', '/usr/sbin/kexec', 'KEXEC'],
623 ['poweroff', '/sbin/poweroff', 'POWEROFF'],
624 ['reboot', '/sbin/reboot', 'REBOOT'],
628 path = get_option(prog[0] + '-path')
630 message('Using @1@ for @0@'.format(prog[0], path))
632 exe = find_program(prog[0],
633 '/usr/sbin/' + prog[0],
636 path = exe.found() ? exe.path() : prog[1]
638 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
639 conf.set_quoted(name, path)
640 substs.set(name, path)
643 #if 0 /// unneeded by elogind
644 # conf.set_quoted('TELINIT', get_option('telinit-path'))
646 # if run_command('ln', '--relative', '--help').returncode() != 0
647 # error('ln does not support --relative (added in coreutils 8.16)')
651 ############################################################
653 gperf = find_program('gperf')
655 gperf_test_format = '''
657 const char * in_word_set(const char *, @0@);
660 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
661 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
662 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
663 if cc.compiles(gperf_test)
664 gperf_len_type = 'size_t'
666 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
667 if cc.compiles(gperf_test)
668 gperf_len_type = 'unsigned'
670 error('unable to determine gperf len type')
673 message('gperf len type is @0@'.format(gperf_len_type))
674 conf.set('GPERF_LEN_TYPE', gperf_len_type,
675 description : 'The type of gperf "len" parameter')
677 ############################################################
679 if not cc.has_header('sys/capability.h')
680 error('POSIX caps headers not found')
682 foreach header : ['crypt.h',
685 'linux/vm_sockets.h',
687 #if 0 /// UNNEEDED by elogind
688 # 'valgrind/memcheck.h',
689 # 'valgrind/valgrind.h',
693 conf.set10('HAVE_' + header.underscorify().to_upper(),
694 cc.has_header(header))
697 ############################################################
699 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
700 #if 0 /// UNNEEDED by elogind
701 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
702 # gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
705 default_hierarchy = get_option('default-hierarchy')
706 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
707 description : 'default cgroup hierarchy as string')
708 if default_hierarchy == 'legacy'
709 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
710 elif default_hierarchy == 'hybrid'
711 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
713 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
716 #if 0 /// UNNEEDED by elogind
717 # time_epoch = get_option('time-epoch')
718 # if time_epoch == ''
719 # NEWS = files('NEWS')
720 # time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
722 # time_epoch = time_epoch.to_int()
723 # conf.set('TIME_EPOCH', time_epoch)
725 ############################################################
726 # elogind needs to know which cgroups controller to follow.
727 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
728 with_cgroupctrl = get_option('cgroup-controller')
729 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
730 with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
731 elif with_cgroupctrl == 'none'
732 with_cgroupctrl = 'elogind'
735 # No controller now is a problem:
736 if with_cgroupctrl == ''
737 error('Unable to determine cgroup controller, but cgroups support is mandatory!')
740 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
741 description : 'name of the cgroup controller to use')
742 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
743 '='.join(['name', with_cgroupctrl]))
744 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
745 '='.join(['name', with_cgroupctrl]))
746 ############################################################
749 system_uid_max = get_option('system-uid-max')
750 if system_uid_max == ''
751 system_uid_max = run_command(
753 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
754 '/etc/login.defs').stdout().strip()
755 if system_uid_max == ''
756 system_uid_max = '999'
759 system_uid_max = system_uid_max.to_int()
760 conf.set('SYSTEM_UID_MAX', system_uid_max)
761 substs.set('systemuidmax', system_uid_max)
762 message('maximum system UID is @0@'.format(system_uid_max))
764 system_gid_max = get_option('system-gid-max')
765 if system_gid_max == ''
766 system_gid_max = run_command(
768 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
769 '/etc/login.defs').stdout().strip()
770 if system_gid_max == ''
771 system_gid_max = '999'
774 system_gid_max = system_gid_max.to_int()
775 conf.set('SYSTEM_GID_MAX', system_gid_max)
776 substs.set('systemgidmax', system_gid_max)
777 message('maximum system GID is @0@'.format(system_gid_max))
779 #if 0 /// UNNEEDED by elogind
780 # dynamic_uid_min = get_option('dynamic-uid-min').to_int()
781 # dynamic_uid_max = get_option('dynamic-uid-max').to_int()
782 # conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
783 # conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
784 # substs.set('dynamicuidmin', dynamic_uid_min)
785 # substs.set('dynamicuidmax', dynamic_uid_max)
787 # container_uid_base_min = get_option('container-uid-base-min').to_int()
788 # container_uid_base_max = get_option('container-uid-base-max').to_int()
789 # conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
790 # conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
791 # substs.set('containeruidbasemin', container_uid_base_min)
792 # substs.set('containeruidbasemax', container_uid_base_max)
795 nobody_user = get_option('nobody-user')
796 nobody_group = get_option('nobody-group')
798 getent_result = run_command('getent', 'passwd', '65534')
799 if getent_result.returncode() == 0
800 name = getent_result.stdout().split(':')[0]
801 if name != nobody_user
803 '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) +
804 'Your build will result in an user table setup that is incompatible with the local system.')
807 id_result = run_command('id', '-u', nobody_user)
808 if id_result.returncode() == 0
809 id = id_result.stdout().to_int()
812 '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) +
813 'Your build will result in an user table setup that is incompatible with the local system.')
817 getent_result = run_command('getent', 'group', '65534')
818 if getent_result.returncode() == 0
819 name = getent_result.stdout().split(':')[0]
820 if name != nobody_group
822 '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) +
823 'Your build will result in an group table setup that is incompatible with the local system.')
826 id_result = run_command('id', '-g', nobody_group)
827 if id_result.returncode() == 0
828 id = id_result.stdout().to_int()
831 '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) +
832 'Your build will result in an group table setup that is incompatible with the local system.')
835 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
837 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
838 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
841 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
842 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
843 substs.set('NOBODY_USER_NAME', nobody_user)
844 substs.set('NOBODY_GROUP_NAME', nobody_group)
846 tty_gid = get_option('tty-gid')
847 conf.set('TTY_GID', tty_gid)
848 substs.set('TTY_GID', tty_gid)
850 #if 0 /// UNNEEDED by elogind
851 # # Ensure provided GID argument is numeric, otherwise fallback to default assignment
852 # if get_option('users-gid') != ''
853 # users_gid = get_option('users-gid').to_int()
857 # substs.set('USERS_GID', users_gid)
859 # conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
860 # conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
862 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
863 # substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
866 kill_user_processes = get_option('default-kill-user-processes')
867 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
868 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
869 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
871 #if 0 /// UNNEEDED by elogind
872 # dns_servers = get_option('dns-servers')
873 # conf.set_quoted('DNS_SERVERS', dns_servers)
874 # substs.set('DNS_SERVERS', dns_servers)
876 # ntp_servers = get_option('ntp-servers')
877 # conf.set_quoted('NTP_SERVERS', ntp_servers)
878 # substs.set('NTP_SERVERS', ntp_servers)
881 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
883 #if 0 /// UNNEEDED by elogind
884 # substs.set('SUSHELL', get_option('debug-shell'))
885 # substs.set('DEBUGTTY', get_option('debug-tty'))
888 enable_debug_hashmap = false
889 enable_debug_mmap_cache = false
890 #if 1 /// additional elogind debug mode
891 enable_debug_elogind = false
893 foreach name : get_option('debug')
895 enable_debug_hashmap = true
896 elif name == 'mmap-cache'
897 enable_debug_mmap_cache = true
898 #if 1 /// additional elogind debug mode
899 elif name == 'elogind'
900 enable_debug_elogind = true
903 message('unknown debug option "@0@", ignoring'.format(name))
906 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
907 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
908 #if 1 /// additional elogind debug mode
909 conf.set10('ENABLE_DEBUG_ELOGIND', enable_debug_elogind)
912 #if 0 /// UNNEEDED by elogind
913 # conf.set10('VALGRIND', get_option('valgrind'))
916 #####################################################################
918 threads = dependency('threads')
919 librt = cc.find_library('rt')
920 libm = cc.find_library('m')
921 libdl = cc.find_library('dl')
922 libcrypt = cc.find_library('crypt')
924 libcap = dependency('libcap', required : false)
925 if not libcap.found()
926 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
927 libcap = cc.find_library('cap')
930 #if 0 /// UNNEEDED by elogind
931 # libmount = dependency('mount',
932 # version : fuzzer_build ? '>= 0' : '>= 2.30')
934 # want_seccomp = get_option('seccomp')
935 # if want_seccomp != 'false' and not fuzzer_build
936 # libseccomp = dependency('libseccomp',
937 # version : '>= 2.3.1',
938 # required : want_seccomp == 'true')
939 # have = libseccomp.found()
947 conf.set10('HAVE_SECCOMP', have)
949 want_selinux = get_option('selinux')
950 if want_selinux != 'false' and not fuzzer_build
951 libselinux = dependency('libselinux',
952 version : '>= 2.1.9',
953 required : want_selinux == 'true')
954 have = libselinux.found()
959 conf.set10('HAVE_SELINUX', have)
961 #if 0 /// UNNEEDED by elogind
962 # want_apparmor = get_option('apparmor')
963 # if want_apparmor != 'false' and not fuzzer_build
964 # libapparmor = dependency('libapparmor',
965 # required : want_apparmor == 'true')
966 # have = libapparmor.found()
974 conf.set10('HAVE_APPARMOR', have)
976 smack_run_label = get_option('smack-run-label')
977 if smack_run_label != ''
978 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
981 want_polkit = get_option('polkit')
982 install_polkit = false
983 install_polkit_pkla = false
984 if want_polkit != 'false' and not fuzzer_build
985 install_polkit = true
987 libpolkit = dependency('polkit-gobject-1',
989 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
990 message('Old polkit detected, will install pkla files')
991 install_polkit_pkla = true
994 conf.set10('ENABLE_POLKIT', install_polkit)
996 want_acl = get_option('acl')
997 if want_acl != 'false' and not fuzzer_build
998 libacl = cc.find_library('acl', required : want_acl == 'true')
999 have = libacl.found()
1004 conf.set10('HAVE_ACL', have)
1006 want_audit = get_option('audit')
1007 if want_audit != 'false' and not fuzzer_build
1008 libaudit = dependency('audit', required : want_audit == 'true')
1009 have = libaudit.found()
1014 conf.set10('HAVE_AUDIT', have)
1016 #if 0 /// UNNEEDED by elogind
1017 # want_blkid = get_option('blkid')
1018 # if want_blkid != 'false' and not fuzzer_build
1019 # libblkid = dependency('blkid', required : want_blkid == 'true')
1020 # have = libblkid.found()
1025 # conf.set10('HAVE_BLKID', have)
1027 # want_kmod = get_option('kmod')
1028 # if want_kmod != 'false' and not fuzzer_build
1029 # libkmod = dependency('libkmod',
1030 # version : '>= 15',
1031 # required : want_kmod == 'true')
1032 # have = libkmod.found()
1037 # conf.set10('HAVE_KMOD', have)
1043 want_pam = get_option('pam')
1044 if want_pam != 'false' and not fuzzer_build
1045 libpam = cc.find_library('pam', required : want_pam == 'true')
1046 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1047 have = libpam.found() and libpam_misc.found()
1053 conf.set10('HAVE_PAM', have)
1055 #if 0 /// UNNEEDED by elogind
1056 # want_microhttpd = get_option('microhttpd')
1057 # if want_microhttpd != 'false' and not fuzzer_build
1058 # libmicrohttpd = dependency('libmicrohttpd',
1059 # version : '>= 0.9.33',
1060 # required : want_microhttpd == 'true')
1061 # have = libmicrohttpd.found()
1064 # libmicrohttpd = []
1066 # conf.set10('HAVE_MICROHTTPD', have)
1068 # want_libcryptsetup = get_option('libcryptsetup')
1069 # if want_libcryptsetup != 'false' and not fuzzer_build
1070 # libcryptsetup = dependency('libcryptsetup',
1071 # version : '>= 1.6.0',
1072 # required : want_libcryptsetup == 'true')
1073 # have = libcryptsetup.found()
1076 # libcryptsetup = []
1078 # conf.set10('HAVE_LIBCRYPTSETUP', have)
1080 # want_libcurl = get_option('libcurl')
1081 # if want_libcurl != 'false' and not fuzzer_build
1082 # libcurl = dependency('libcurl',
1083 # version : '>= 7.32.0',
1084 # required : want_libcurl == 'true')
1085 # have = libcurl.found()
1090 # conf.set10('HAVE_LIBCURL', have)
1092 # want_libidn = get_option('libidn')
1093 # want_libidn2 = get_option('libidn2')
1094 # if want_libidn == 'true' and want_libidn2 == 'true'
1095 # error('libidn and libidn2 cannot be requested simultaneously')
1098 # if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
1099 # libidn = dependency('libidn',
1100 # required : want_libidn == 'true')
1101 # have = libidn.found()
1106 # conf.set10('HAVE_LIBIDN', have)
1107 # if not have and want_libidn2 != 'false' and not fuzzer_build
1108 # # libidn is used for both libidn and libidn2 objects
1109 # libidn = dependency('libidn2',
1110 # required : want_libidn2 == 'true')
1111 # have = libidn.found()
1115 # conf.set10('HAVE_LIBIDN2', have)
1117 # want_libiptc = get_option('libiptc')
1118 # if want_libiptc != 'false' and not fuzzer_build
1119 # libiptc = dependency('libiptc',
1120 # required : want_libiptc == 'true')
1121 # have = libiptc.found()
1126 # conf.set10('HAVE_LIBIPTC', have)
1128 # want_qrencode = get_option('qrencode')
1129 # if want_qrencode != 'false' and not fuzzer_build
1130 # libqrencode = dependency('libqrencode',
1131 # required : want_qrencode == 'true')
1132 # have = libqrencode.found()
1137 # conf.set10('HAVE_QRENCODE', have)
1139 # want_gcrypt = get_option('gcrypt')
1140 # if want_gcrypt != 'false' and not fuzzer_build
1141 # libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1142 # libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1143 # have = libgcrypt.found() and libgpg_error.found()
1148 # # link to neither of the libs if one is not found
1152 # conf.set10('HAVE_GCRYPT', have)
1154 # want_gnutls = get_option('gnutls')
1155 # if want_gnutls != 'false' and not fuzzer_build
1156 # libgnutls = dependency('gnutls',
1157 # version : '>= 3.1.4',
1158 # required : want_gnutls == 'true')
1159 # have = libgnutls.found()
1164 # conf.set10('HAVE_GNUTLS', have)
1166 # want_elfutils = get_option('elfutils')
1167 # if want_elfutils != 'false' and not fuzzer_build
1168 # libdw = dependency('libdw',
1169 # required : want_elfutils == 'true')
1170 # have = libdw.found()
1175 # conf.set10('HAVE_ELFUTILS', have)
1177 # want_zlib = get_option('zlib')
1178 # if want_zlib != 'false' and not fuzzer_build
1179 # libz = dependency('zlib',
1180 # required : want_zlib == 'true')
1181 # have = libz.found()
1186 # conf.set10('HAVE_ZLIB', have)
1188 # want_bzip2 = get_option('bzip2')
1189 # if want_bzip2 != 'false' and not fuzzer_build
1190 # libbzip2 = cc.find_library('bz2',
1191 # required : want_bzip2 == 'true')
1192 # have = libbzip2.found()
1197 # conf.set10('HAVE_BZIP2', have)
1199 # want_xz = get_option('xz')
1200 # if want_xz != 'false' and not fuzzer_build
1201 # libxz = dependency('liblzma',
1202 # required : want_xz == 'true')
1203 # have = libxz.found()
1208 # conf.set10('HAVE_XZ', have)
1210 # want_lz4 = get_option('lz4')
1211 # if want_lz4 != 'false' and not fuzzer_build
1212 # liblz4 = dependency('liblz4',
1213 # required : want_lz4 == 'true')
1214 # have = liblz4.found()
1219 # conf.set10('HAVE_LZ4', have)
1221 # want_xkbcommon = get_option('xkbcommon')
1222 # if want_xkbcommon != 'false' and not fuzzer_build
1223 # libxkbcommon = dependency('xkbcommon',
1224 # version : '>= 0.3.0',
1225 # required : want_xkbcommon == 'true')
1226 # have = libxkbcommon.found()
1248 conf.set10('HAVE_XKBCOMMON', have)
1250 want_pcre2 = get_option('pcre2')
1251 if want_pcre2 != 'false'
1252 libpcre2 = dependency('libpcre2-8',
1253 required : want_pcre2 == 'true')
1254 have = libpcre2.found()
1259 conf.set10('HAVE_PCRE2', have)
1261 want_glib = get_option('glib')
1262 if want_glib != 'false' and not fuzzer_build
1263 libglib = dependency('glib-2.0',
1264 version : '>= 2.22.0',
1265 required : want_glib == 'true')
1266 libgobject = dependency('gobject-2.0',
1267 version : '>= 2.22.0',
1268 required : want_glib == 'true')
1269 libgio = dependency('gio-2.0',
1270 required : want_glib == 'true')
1271 have = libglib.found() and libgobject.found() and libgio.found()
1278 conf.set10('HAVE_GLIB', have)
1280 want_dbus = get_option('dbus')
1281 if want_dbus != 'false' and not fuzzer_build
1282 libdbus = dependency('dbus-1',
1283 version : '>= 1.3.2',
1284 required : want_dbus == 'true')
1285 have = libdbus.found()
1290 conf.set10('HAVE_DBUS', have)
1292 #if 0 /// UNNEEDED by elogind
1293 # default_dnssec = get_option('default-dnssec')
1295 # default_dnssec = 'no'
1297 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1298 # message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1299 # default_dnssec = 'no'
1301 # conf.set('DEFAULT_DNSSEC_MODE',
1302 # 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1303 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1305 # dns_over_tls = get_option('dns-over-tls')
1306 # if dns_over_tls != 'false'
1307 # have = conf.get('HAVE_GNUTLS') == 1
1308 # if dns_over_tls == 'true' and not have
1309 # error('DNS-over-TLS support was requested, but dependencies are not available')
1314 # conf.set10('ENABLE_DNS_OVER_TLS', have)
1316 # default_dns_over_tls = get_option('default-dns-over-tls')
1318 # default_dns_over_tls = 'no'
1320 # if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0
1321 # message('default-dns-over-tls cannot be set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.')
1322 # default_dns_over_tls = 'no'
1324 # conf.set('DEFAULT_DNS_OVER_TLS_MODE',
1325 # 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper())
1326 # substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls)
1328 # want_importd = get_option('importd')
1329 # if want_importd != 'false'
1330 # have = (conf.get('HAVE_LIBCURL') == 1 and
1331 # conf.get('HAVE_ZLIB') == 1 and
1332 # conf.get('HAVE_BZIP2') == 1 and
1333 # conf.get('HAVE_XZ') == 1 and
1334 # conf.get('HAVE_GCRYPT') == 1)
1335 # if want_importd == 'true' and not have
1336 # error('importd support was requested, but dependencies are not available')
1341 # conf.set10('ENABLE_IMPORTD', have)
1343 # want_remote = get_option('remote')
1344 # if want_remote != 'false'
1345 # have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1346 # conf.get('HAVE_LIBCURL') == 1]
1347 # # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1348 # # it's possible to build one without the other. Complain only if
1349 # # support was explictly requested. The auxiliary files like sysusers
1350 # # config should be installed when any of the programs are built.
1351 # if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1352 # error('remote support was requested, but dependencies are not available')
1354 # have = have_deps[0] or have_deps[1]
1359 conf.set10('ENABLE_REMOTE', have)
1361 foreach term : ['utmp',
1362 #if 0 /// UNNEEDED by elogind
1397 have = get_option(term)
1398 name = 'ENABLE_' + term.underscorify().to_upper()
1399 conf.set10(name, have)
1402 #if 0 /// UNNEEDED by elogind
1403 # conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
1406 want_tests = get_option('tests')
1407 install_tests = get_option('install-tests')
1408 slow_tests = get_option('slow-tests')
1412 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1414 #####################################################################
1416 #if 0 /// UNNEEDED by elogind
1417 # if get_option('efi')
1418 # efi_arch = host_machine.cpu_family()
1420 # if efi_arch == 'x86'
1421 # EFI_MACHINE_TYPE_NAME = 'ia32'
1422 # gnu_efi_arch = 'ia32'
1423 # elif efi_arch == 'x86_64'
1424 # EFI_MACHINE_TYPE_NAME = 'x64'
1425 # gnu_efi_arch = 'x86_64'
1426 # elif efi_arch == 'arm'
1427 # EFI_MACHINE_TYPE_NAME = 'arm'
1428 # gnu_efi_arch = 'arm'
1429 # elif efi_arch == 'aarch64'
1430 # EFI_MACHINE_TYPE_NAME = 'aa64'
1431 # gnu_efi_arch = 'aarch64'
1433 # EFI_MACHINE_TYPE_NAME = ''
1438 # conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1440 # conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1445 conf.set10('ENABLE_EFI', have)
1447 #####################################################################
1449 config_h = configure_file(
1450 output : 'config.h',
1451 configuration : conf)
1453 meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
1455 includes = include_directories('src/basic',
1458 #if 0 /// UNNEEDED by elogind
1460 # 'src/journal-remote',
1464 # 'src/time-wait-sync',
1467 #if 0 /// UNNEEDED by elogind
1472 #if 0 /// elogind has a different list
1473 # 'src/libsystemd/sd-bus',
1474 # 'src/libsystemd/sd-device',
1475 # 'src/libsystemd/sd-hwdb',
1476 # 'src/libsystemd/sd-id128',
1477 # 'src/libsystemd/sd-netlink',
1478 # 'src/libsystemd/sd-network',
1479 # 'src/libsystemd-network',
1481 'src/libelogind/sd-bus',
1482 'src/libelogind/sd-id128',
1488 add_project_arguments('-include', 'config.h', language : 'c')
1491 #if 0 /// UNNEEDED by elogind
1494 subdir('src/systemd')
1496 #if 0 /// UNNEEDED by elogind
1497 # subdir('src/libsystemd')
1498 # subdir('src/libsystemd-network')
1499 # subdir('src/journal')
1502 subdir('src/libelogind')
1504 subdir('src/update-utmp')
1508 #if 0 /// UNNEEDED by elogind
1509 # libjournal_core = static_library(
1511 # libjournal_core_sources,
1513 # include_directories : includes,
1517 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1518 libelogind = shared_library(
1520 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
1521 version : libelogind_version,
1522 include_directories : includes,
1523 link_args : ['-shared',
1524 '-Wl,--version-script=' + libelogind_sym_path],
1525 #if 0 /// elogind does not need gcrypt or libjournal_client, only threads.
1526 # link_with : [libbasic,
1528 # link_whole : [libsystemd_static,
1529 # libjournal_client],
1530 # dependencies : [threads,
1534 # link_depends : libsystemd_sym,
1536 link_with : [libbasic],
1537 link_whole : [libelogind_static],
1538 dependencies : [threads],
1539 link_depends : libelogind_sym,
1542 install_dir : rootlibdir)
1544 static_libelogind = get_option('static-libelogind')
1545 static_libelogind_pic = static_libelogind == 'true' or static_libelogind == 'pic'
1547 install_libelogind_static = static_library(
1550 #if 0 /// No journald with elogind (And before you ask: NO!)
1551 # journal_client_sources,
1554 #if 0 /// No gcrypt with elogind
1555 # basic_gcrypt_sources,
1557 include_directories : includes,
1558 build_by_default : static_libelogind != 'false',
1559 install : static_libelogind != 'false',
1560 install_dir : rootlibdir,
1561 pic : static_libelogind == 'true' or static_libelogind == 'pic',
1562 dependencies : [threads,
1568 #if 0 /// libmount isn't built with elogind (and absolutely not needed anyway.)
1572 #if 0 /// No grypt with elogind
1577 c_args : libelogind_c_args + (static_libelogind_pic ? [] : ['-fno-PIC']))
1579 ############################################################
1581 # binaries that have --help and are intended for use by humans,
1582 # usually, but not always, installed in /bin.
1583 public_programs = []
1585 #if 0 /// UNNEEDED by elogind
1586 # subdir('src/libudev')
1588 # elogind depends on external libudev:
1589 libudev = dependency('libudev', required : true)
1591 subdir('src/shared')
1592 #if 0 /// UNNEEDED by elogind
1593 # subdir('src/core')
1594 # subdir('src/udev')
1595 # subdir('src/network')
1597 # subdir('src/analyze')
1598 # subdir('src/journal-remote')
1599 # subdir('src/coredump')
1600 # subdir('src/hostname')
1601 # subdir('src/import')
1602 # subdir('src/kernel-install')
1603 # subdir('src/locale')
1604 # subdir('src/machine')
1605 # subdir('src/portable')
1606 # subdir('src/nspawn')
1607 # subdir('src/resolve')
1608 # subdir('src/timedate')
1609 # subdir('src/timesync')
1610 # subdir('src/vconsole')
1611 # subdir('src/boot/efi')
1615 #if 0 /// UNNEEDED by elogind
1616 # subdir('src/fuzz')
1621 ############################################################
1623 # only static linking apart from libdl, to make sure that the
1624 # module is linked to all libraries that it uses.
1625 test_dlopen = executable(
1628 include_directories : includes,
1629 link_with : [libbasic],
1630 dependencies : [libdl])
1632 #if 0 /// UNNEEDED by elogind
1633 # foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1634 # ['systemd', 'ENABLE_NSS_SYSTEMD'],
1635 # ['mymachines', 'ENABLE_MACHINED'],
1636 # ['resolve', 'ENABLE_RESOLVE']]
1638 # condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1642 # sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1643 # version_script_arg = join_paths(meson.current_source_dir(), sym)
1645 # nss = shared_library(
1647 # 'src/nss-@0@/nss-@0@.c'.format(module),
1649 # include_directories : includes,
1650 # # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1651 # link_args : ['-Wl,-z,nodelete',
1653 # '-Wl,--version-script=' + version_script_arg,
1654 # '-Wl,--undefined'],
1655 # link_with : [libsystemd_static,
1657 # dependencies : [threads,
1659 # link_depends : sym,
1661 # install_dir : rootlibdir)
1663 # # We cannot use shared_module because it does not support version suffix.
1664 # # Unfortunately shared_library insists on creating the symlink…
1665 # meson.add_install_script('sh', '-c',
1666 # 'rm $DESTDIR@0@/libnss_@1@.so'
1667 # .format(rootlibdir, module))
1669 # test('dlopen-nss_' + module,
1671 # args : [nss.full_path()]) # path to dlopen must include a slash
1676 ############################################################
1678 #if 0 /// UNNEEDED by elogind
1679 # executable('systemd',
1681 # include_directories : includes,
1682 # link_with : [libcore,
1684 # dependencies : [threads,
1690 # install_rpath : rootlibexecdir,
1692 # install_dir : rootlibexecdir)
1694 # meson.add_install_script(meson_make_symlink,
1695 # join_paths(rootlibexecdir, 'systemd'),
1696 # join_paths(rootsbindir, 'init'))
1698 # exe = executable('systemd-analyze',
1699 # systemd_analyze_sources,
1700 # include_directories : includes,
1701 # link_with : [libcore,
1703 # dependencies : [threads,
1709 # install_rpath : rootlibexecdir,
1711 # public_programs += [exe]
1713 # executable('systemd-journald',
1714 # systemd_journald_sources,
1715 # include_directories : includes,
1716 # link_with : [libjournal_core,
1718 # dependencies : [threads,
1722 # install_rpath : rootlibexecdir,
1724 # install_dir : rootlibexecdir)
1726 # exe = executable('systemd-cat',
1727 # systemd_cat_sources,
1728 # include_directories : includes,
1729 # link_with : [libjournal_core,
1731 # dependencies : [threads],
1732 # install_rpath : rootlibexecdir,
1734 # public_programs += [exe]
1736 # exe = executable('journalctl',
1737 # journalctl_sources,
1738 # include_directories : includes,
1739 # link_with : [libshared],
1740 # dependencies : [threads,
1745 # install_rpath : rootlibexecdir,
1747 # install_dir : rootbindir)
1748 # public_programs += [exe]
1750 # executable('systemd-getty-generator',
1751 # 'src/getty-generator/getty-generator.c',
1752 # include_directories : includes,
1753 # link_with : [libshared],
1754 # install_rpath : rootlibexecdir,
1756 # install_dir : systemgeneratordir)
1758 # executable('systemd-debug-generator',
1759 # 'src/debug-generator/debug-generator.c',
1760 # include_directories : includes,
1761 # link_with : [libshared],
1762 # install_rpath : rootlibexecdir,
1764 # install_dir : systemgeneratordir)
1766 # executable('systemd-fstab-generator',
1767 # 'src/fstab-generator/fstab-generator.c',
1768 # 'src/core/mount-setup.c',
1769 # include_directories : includes,
1770 # link_with : [libshared],
1771 # install_rpath : rootlibexecdir,
1773 # install_dir : systemgeneratordir)
1775 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1776 # executable('30-systemd-environment-d-generator',
1777 # 'src/environment-d-generator/environment-d-generator.c',
1778 # include_directories : includes,
1779 # link_with : [libshared],
1780 # install_rpath : rootlibexecdir,
1782 # install_dir : userenvgeneratordir)
1784 # meson.add_install_script(meson_make_symlink,
1785 # join_paths(sysconfdir, 'environment'),
1786 # join_paths(environmentdir, '99-environment.conf'))
1789 # if conf.get('ENABLE_HIBERNATE') == 1
1790 # executable('systemd-hibernate-resume-generator',
1791 # 'src/hibernate-resume/hibernate-resume-generator.c',
1792 # include_directories : includes,
1793 # link_with : [libshared],
1794 # install_rpath : rootlibexecdir,
1796 # install_dir : systemgeneratordir)
1798 # executable('systemd-hibernate-resume',
1799 # 'src/hibernate-resume/hibernate-resume.c',
1800 # include_directories : includes,
1801 # link_with : [libshared],
1802 # install_rpath : rootlibexecdir,
1804 # install_dir : rootlibexecdir)
1807 # if conf.get('HAVE_BLKID') == 1
1808 # executable('systemd-gpt-auto-generator',
1809 # 'src/gpt-auto-generator/gpt-auto-generator.c',
1810 # 'src/basic/blkid-util.h',
1811 # include_directories : includes,
1812 # link_with : [libshared],
1813 # dependencies : libblkid,
1814 # install_rpath : rootlibexecdir,
1816 # install_dir : systemgeneratordir)
1818 # exe = executable('systemd-dissect',
1819 # 'src/dissect/dissect.c',
1820 # include_directories : includes,
1821 # link_with : [libshared],
1822 # install_rpath : rootlibexecdir,
1824 # install_dir : rootlibexecdir)
1825 # public_programs += [exe]
1828 # if conf.get('ENABLE_RESOLVE') == 1
1829 # executable('systemd-resolved',
1830 # systemd_resolved_sources,
1831 # include_directories : includes,
1832 # link_with : [libshared,
1834 # libsystemd_resolve_core],
1835 # dependencies : systemd_resolved_dependencies,
1836 # install_rpath : rootlibexecdir,
1838 # install_dir : rootlibexecdir)
1840 # exe = executable('resolvectl',
1841 # resolvectl_sources,
1842 # include_directories : includes,
1843 # link_with : [libshared,
1845 # libsystemd_resolve_core],
1846 # dependencies : [threads,
1850 # install_rpath : rootlibexecdir,
1852 # public_programs += [exe]
1854 # meson.add_install_script(meson_make_symlink,
1855 # join_paths(bindir, 'resolvectl'),
1856 # join_paths(rootsbindir, 'resolvconf'))
1858 # meson.add_install_script(meson_make_symlink,
1859 # join_paths(bindir, 'resolvectl'),
1860 # join_paths(bindir, 'systemd-resolve'))
1863 # if conf.get('ENABLE_LOGIND') == 1
1864 # executable('systemd-logind',
1865 # systemd_logind_sources,
1866 # include_directories : includes,
1867 # link_with : [liblogind_core,
1869 # dependencies : [threads,
1871 # install_rpath : rootlibexecdir,
1873 # install_dir : rootlibexecdir)
1875 # exe = executable('loginctl',
1877 # include_directories : includes,
1878 # link_with : [libshared],
1879 # dependencies : [threads,
1882 # install_rpath : rootlibexecdir,
1884 # install_dir : rootbindir)
1885 # public_programs += [exe]
1887 # exe = executable('systemd-inhibit',
1888 # 'src/login/inhibit.c',
1889 # include_directories : includes,
1890 # link_with : [libshared],
1891 # install_rpath : rootlibexecdir,
1893 # install_dir : rootbindir)
1894 # public_programs += [exe]
1896 # if conf.get('HAVE_PAM') == 1
1897 # version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1898 # pam_systemd = shared_library(
1902 # include_directories : includes,
1903 # link_args : ['-shared',
1904 # '-Wl,--version-script=' + version_script_arg],
1905 # link_with : [libsystemd_static,
1906 # libshared_static],
1907 # dependencies : [threads,
1910 # link_depends : pam_systemd_sym,
1912 # install_dir : pamlibdir)
1914 # test('dlopen-pam_systemd',
1916 # args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1920 # executable('systemd-user-runtime-dir',
1921 # user_runtime_dir_sources,
1922 # include_directories : includes,
1923 # link_with : [libshared, liblogind_core],
1924 # install_rpath : rootlibexecdir,
1926 # install_dir : rootlibexecdir)
1930 executable('elogind',
1932 include_directories : includes,
1933 link_with : [liblogind_core,
1935 dependencies : [threads,
1938 install_rpath : rootlibexecdir,
1940 install_dir : rootlibexecdir)
1942 exe = executable('loginctl',
1944 include_directories : includes,
1945 link_with : [libshared],
1946 dependencies : [threads,
1948 install_rpath : rootlibexecdir,
1950 install_dir : rootbindir)
1951 public_programs += [exe]
1953 exe = executable('elogind-inhibit',
1954 'src/login/inhibit.c',
1955 include_directories : includes,
1956 link_with : [libshared],
1957 dependencies : [threads],
1958 install_rpath : rootlibexecdir,
1960 install_dir : rootbindir)
1961 public_programs += [exe]
1963 if conf.get('HAVE_PAM') == 1
1964 version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1965 pam_elogind = shared_library(
1969 include_directories : includes,
1970 link_args : ['-shared',
1971 '-Wl,--version-script=' + version_script_arg],
1972 link_with : [libelogind_static,
1974 dependencies : [threads,
1977 link_depends : pam_elogind_sym,
1979 install_dir : pamlibdir)
1981 test('dlopen-pam_elogind',
1983 args : [pam_elogind.full_path()]) # path to dlopen must include a slash
1986 #if 0 /// UNNEEDED by elogind
1987 # executable('systemd-user-sessions',
1988 # 'src/user-sessions/user-sessions.c',
1989 # include_directories : includes,
1990 # link_with : [libshared],
1991 # install_rpath : rootlibexecdir,
1993 # install_dir : rootlibexecdir)
1996 # if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1997 # exe = executable('bootctl',
1998 # 'src/boot/bootctl.c',
1999 # include_directories : includes,
2000 # link_with : [libshared],
2001 # dependencies : [libblkid],
2002 # install_rpath : rootlibexecdir,
2004 # public_programs += [exe]
2007 # exe = executable('systemd-socket-activate', 'src/activate/activate.c',
2008 # include_directories : includes,
2009 # link_with : [libshared],
2010 # dependencies : [threads],
2011 # install_rpath : rootlibexecdir,
2013 # public_programs += [exe]
2016 # if get_option('link-systemctl-shared')
2017 # systemctl_link_with = [libshared]
2019 # systemctl_link_with = [libsystemd_static,
2021 # libjournal_client,
2025 # exe = executable('systemctl', 'src/systemctl/systemctl.c',
2026 # include_directories : includes,
2027 # link_with : systemctl_link_with,
2028 # dependencies : [threads,
2033 # install_rpath : rootlibexecdir,
2035 # install_dir : rootbindir)
2036 # public_programs += [exe]
2038 # if conf.get('ENABLE_PORTABLED') == 1
2039 # executable('systemd-portabled',
2040 # systemd_portabled_sources,
2041 # include_directories : includes,
2042 # link_with : [libshared],
2043 # dependencies : [threads],
2044 # install_rpath : rootlibexecdir,
2046 # install_dir : rootlibexecdir)
2048 # exe = executable('portablectl', 'src/portable/portablectl.c',
2049 # include_directories : includes,
2050 # link_with : [libshared],
2051 # dependencies : [threads],
2052 # install_rpath : rootlibexecdir,
2054 # install_dir : rootlibexecdir)
2055 # public_programs += [exe]
2058 # foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit']
2059 # meson.add_install_script(meson_make_symlink,
2060 # join_paths(rootbindir, 'systemctl'),
2061 # join_paths(rootsbindir, alias))
2064 # if conf.get('ENABLE_BACKLIGHT') == 1
2065 # executable('systemd-backlight',
2066 # 'src/backlight/backlight.c',
2067 # include_directories : includes,
2068 # link_with : [libshared],
2069 # install_rpath : rootlibexecdir,
2071 # install_dir : rootlibexecdir)
2074 # if conf.get('ENABLE_RFKILL') == 1
2075 # executable('systemd-rfkill',
2076 # 'src/rfkill/rfkill.c',
2077 # include_directories : includes,
2078 # link_with : [libshared],
2079 # install_rpath : rootlibexecdir,
2081 # install_dir : rootlibexecdir)
2084 # executable('systemd-system-update-generator',
2085 # 'src/system-update-generator/system-update-generator.c',
2086 # include_directories : includes,
2087 # link_with : [libshared],
2088 # install_rpath : rootlibexecdir,
2090 # install_dir : systemgeneratordir)
2092 # if conf.get('HAVE_LIBCRYPTSETUP') == 1
2093 # executable('systemd-cryptsetup',
2094 # 'src/cryptsetup/cryptsetup.c',
2095 # include_directories : includes,
2096 # link_with : [libshared],
2097 # dependencies : [libcryptsetup],
2098 # install_rpath : rootlibexecdir,
2100 # install_dir : rootlibexecdir)
2102 # executable('systemd-cryptsetup-generator',
2103 # 'src/cryptsetup/cryptsetup-generator.c',
2104 # include_directories : includes,
2105 # link_with : [libshared],
2106 # dependencies : [libcryptsetup],
2107 # install_rpath : rootlibexecdir,
2109 # install_dir : systemgeneratordir)
2111 # executable('systemd-veritysetup',
2112 # 'src/veritysetup/veritysetup.c',
2113 # include_directories : includes,
2114 # link_with : [libshared],
2115 # dependencies : [libcryptsetup],
2116 # install_rpath : rootlibexecdir,
2118 # install_dir : rootlibexecdir)
2120 # executable('systemd-veritysetup-generator',
2121 # 'src/veritysetup/veritysetup-generator.c',
2122 # include_directories : includes,
2123 # link_with : [libshared],
2124 # dependencies : [libcryptsetup],
2125 # install_rpath : rootlibexecdir,
2127 # install_dir : systemgeneratordir)
2130 # if conf.get('HAVE_SYSV_COMPAT') == 1
2131 # executable('systemd-sysv-generator',
2132 # 'src/sysv-generator/sysv-generator.c',
2133 # include_directories : includes,
2134 # link_with : [libshared],
2135 # install_rpath : rootlibexecdir,
2137 # install_dir : systemgeneratordir)
2139 # executable('systemd-rc-local-generator',
2140 # 'src/rc-local-generator/rc-local-generator.c',
2141 # include_directories : includes,
2142 # link_with : [libshared],
2143 # install_rpath : rootlibexecdir,
2145 # install_dir : systemgeneratordir)
2148 # if conf.get('ENABLE_HOSTNAMED') == 1
2149 # executable('systemd-hostnamed',
2150 # 'src/hostname/hostnamed.c',
2151 # include_directories : includes,
2152 # link_with : [libshared],
2153 # install_rpath : rootlibexecdir,
2155 # install_dir : rootlibexecdir)
2157 # exe = executable('hostnamectl',
2158 # 'src/hostname/hostnamectl.c',
2159 # include_directories : includes,
2160 # link_with : [libshared],
2161 # install_rpath : rootlibexecdir,
2163 # public_programs += [exe]
2166 # if conf.get('ENABLE_LOCALED') == 1
2167 # if conf.get('HAVE_XKBCOMMON') == 1
2168 # # logind will load libxkbcommon.so dynamically on its own
2174 # executable('systemd-localed',
2175 # systemd_localed_sources,
2176 # include_directories : includes,
2177 # link_with : [libshared],
2178 # dependencies : deps,
2179 # install_rpath : rootlibexecdir,
2181 # install_dir : rootlibexecdir)
2183 # exe = executable('localectl',
2184 # localectl_sources,
2185 # include_directories : includes,
2186 # link_with : [libshared],
2187 # install_rpath : rootlibexecdir,
2189 # public_programs += [exe]
2192 # if conf.get('ENABLE_TIMEDATED') == 1
2193 # executable('systemd-timedated',
2194 # 'src/timedate/timedated.c',
2195 # include_directories : includes,
2196 # link_with : [libshared],
2197 # install_rpath : rootlibexecdir,
2199 # install_dir : rootlibexecdir)
2202 # if conf.get('ENABLE_TIMEDATECTL') == 1
2203 # exe = executable('timedatectl',
2204 # 'src/timedate/timedatectl.c',
2205 # include_directories : includes,
2206 # install_rpath : rootlibexecdir,
2207 # link_with : [libshared],
2208 # dependencies : [libm],
2210 # public_programs += [exe]
2213 # if conf.get('ENABLE_TIMESYNCD') == 1
2214 # executable('systemd-timesyncd',
2215 # systemd_timesyncd_sources,
2216 # include_directories : includes,
2217 # link_with : [libshared],
2218 # dependencies : [threads,
2220 # install_rpath : rootlibexecdir,
2222 # install_dir : rootlibexecdir)
2224 # executable('systemd-time-wait-sync',
2225 # 'src/time-wait-sync/time-wait-sync.c',
2226 # include_directories : includes,
2227 # link_with : [libshared],
2228 # install_rpath : rootlibexecdir,
2230 # install_dir : rootlibexecdir)
2233 # if conf.get('ENABLE_MACHINED') == 1
2234 # executable('systemd-machined',
2235 # systemd_machined_sources,
2236 # include_directories : includes,
2237 # link_with : [libmachine_core,
2239 # install_rpath : rootlibexecdir,
2241 # install_dir : rootlibexecdir)
2243 # exe = executable('machinectl',
2244 # 'src/machine/machinectl.c',
2245 # include_directories : includes,
2246 # link_with : [libshared],
2247 # dependencies : [threads,
2250 # install_rpath : rootlibexecdir,
2252 # install_dir : rootbindir)
2253 # public_programs += [exe]
2256 # if conf.get('ENABLE_IMPORTD') == 1
2257 # executable('systemd-importd',
2258 # systemd_importd_sources,
2259 # include_directories : includes,
2260 # link_with : [libshared],
2261 # dependencies : [threads],
2262 # install_rpath : rootlibexecdir,
2264 # install_dir : rootlibexecdir)
2266 # systemd_pull = executable('systemd-pull',
2267 # systemd_pull_sources,
2268 # include_directories : includes,
2269 # link_with : [libshared],
2270 # dependencies : [libcurl,
2275 # install_rpath : rootlibexecdir,
2277 # install_dir : rootlibexecdir)
2279 # systemd_import = executable('systemd-import',
2280 # systemd_import_sources,
2281 # include_directories : includes,
2282 # link_with : [libshared],
2283 # dependencies : [libcurl,
2287 # install_rpath : rootlibexecdir,
2289 # install_dir : rootlibexecdir)
2291 # systemd_export = executable('systemd-export',
2292 # systemd_export_sources,
2293 # include_directories : includes,
2294 # link_with : [libshared],
2295 # dependencies : [libcurl,
2299 # install_rpath : rootlibexecdir,
2301 # install_dir : rootlibexecdir)
2302 # public_programs += [systemd_pull, systemd_import, systemd_export]
2305 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2306 # exe = executable('systemd-journal-upload',
2307 # systemd_journal_upload_sources,
2308 # include_directories : includes,
2309 # link_with : [libshared],
2310 # dependencies : [threads,
2315 # install_rpath : rootlibexecdir,
2317 # install_dir : rootlibexecdir)
2318 # public_programs += [exe]
2321 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2322 # s_j_remote = executable('systemd-journal-remote',
2323 # systemd_journal_remote_sources,
2324 # include_directories : includes,
2325 # link_with : [libshared,
2326 # libsystemd_journal_remote],
2327 # dependencies : [threads,
2332 # install_rpath : rootlibexecdir,
2334 # install_dir : rootlibexecdir)
2336 # s_j_gatewayd = executable('systemd-journal-gatewayd',
2337 # systemd_journal_gatewayd_sources,
2338 # include_directories : includes,
2339 # link_with : [libshared],
2340 # dependencies : [threads,
2345 # install_rpath : rootlibexecdir,
2347 # install_dir : rootlibexecdir)
2348 # public_programs += [s_j_remote, s_j_gatewayd]
2351 # if conf.get('ENABLE_COREDUMP') == 1
2352 # executable('systemd-coredump',
2353 # systemd_coredump_sources,
2354 # include_directories : includes,
2355 # link_with : [libshared],
2356 # dependencies : [threads,
2361 # install_rpath : rootlibexecdir,
2363 # install_dir : rootlibexecdir)
2365 # exe = executable('coredumpctl',
2366 # coredumpctl_sources,
2367 # include_directories : includes,
2368 # link_with : [libshared],
2369 # dependencies : [threads,
2372 # install_rpath : rootlibexecdir,
2374 # public_programs += [exe]
2377 # if conf.get('ENABLE_BINFMT') == 1
2378 # exe = executable('systemd-binfmt',
2379 # 'src/binfmt/binfmt.c',
2380 # include_directories : includes,
2381 # link_with : [libshared],
2382 # install_rpath : rootlibexecdir,
2384 # install_dir : rootlibexecdir)
2385 # public_programs += [exe]
2387 # meson.add_install_script('sh', '-c',
2388 # mkdir_p.format(binfmtdir))
2389 # meson.add_install_script('sh', '-c',
2390 # mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2393 # if conf.get('ENABLE_VCONSOLE') == 1
2394 # executable('systemd-vconsole-setup',
2395 # 'src/vconsole/vconsole-setup.c',
2396 # include_directories : includes,
2397 # link_with : [libshared],
2398 # install_rpath : rootlibexecdir,
2400 # install_dir : rootlibexecdir)
2403 # if conf.get('ENABLE_RANDOMSEED') == 1
2404 # executable('systemd-random-seed',
2405 # 'src/random-seed/random-seed.c',
2406 # include_directories : includes,
2407 # link_with : [libshared],
2408 # install_rpath : rootlibexecdir,
2410 # install_dir : rootlibexecdir)
2413 # if conf.get('ENABLE_FIRSTBOOT') == 1
2414 # executable('systemd-firstboot',
2415 # 'src/firstboot/firstboot.c',
2416 # include_directories : includes,
2417 # link_with : [libshared],
2418 # dependencies : [libcrypt],
2419 # install_rpath : rootlibexecdir,
2421 # install_dir : rootbindir)
2424 # executable('systemd-remount-fs',
2425 # 'src/remount-fs/remount-fs.c',
2426 # 'src/core/mount-setup.c',
2427 # 'src/core/mount-setup.h',
2428 # include_directories : includes,
2429 # link_with : [libshared],
2430 # install_rpath : rootlibexecdir,
2432 # install_dir : rootlibexecdir)
2434 # executable('systemd-machine-id-setup',
2435 # 'src/machine-id-setup/machine-id-setup-main.c',
2436 # 'src/core/machine-id-setup.c',
2437 # 'src/core/machine-id-setup.h',
2438 # include_directories : includes,
2439 # link_with : [libshared],
2440 # install_rpath : rootlibexecdir,
2442 # install_dir : rootbindir)
2444 # executable('systemd-fsck',
2445 # 'src/fsck/fsck.c',
2446 # include_directories : includes,
2447 # link_with : [libshared],
2448 # install_rpath : rootlibexecdir,
2450 # install_dir : rootlibexecdir)
2452 # executable('elogind-growfs',
2453 # 'src/partition/growfs.c',
2454 # include_directories : includes,
2455 # link_with : [libshared],
2456 # dependencies : [libcryptsetup],
2457 # install_rpath : rootlibexecdir,
2459 # install_dir : rootlibexecdir)
2461 # executable('elogind-makefs',
2462 # 'src/partition/makefs.c',
2463 # include_directories : includes,
2464 # link_with : [libshared],
2465 # install_rpath : rootlibexecdir,
2467 # install_dir : rootlibexecdir)
2469 # executable('systemd-sleep',
2470 # 'src/sleep/sleep.c',
2471 # include_directories : includes,
2472 # link_with : [libshared],
2473 # install_rpath : rootlibexecdir,
2475 # install_dir : rootlibexecdir)
2477 # exe = executable('systemd-sysctl',
2478 # 'src/sysctl/sysctl.c',
2479 # include_directories : includes,
2480 # link_with : [libshared],
2481 # install_rpath : rootlibexecdir,
2483 # install_dir : rootlibexecdir)
2484 # public_programs += [exe]
2486 # executable('systemd-ac-power',
2487 # 'src/ac-power/ac-power.c',
2488 # include_directories : includes,
2489 # link_with : [libshared],
2490 # install_rpath : rootlibexecdir,
2492 # install_dir : rootlibexecdir)
2494 # exe = executable('systemd-detect-virt',
2495 # 'src/detect-virt/detect-virt.c',
2496 # include_directories : includes,
2497 # link_with : [libshared],
2498 # install_rpath : rootlibexecdir,
2500 # public_programs += [exe]
2502 # exe = executable('systemd-delta',
2503 # 'src/delta/delta.c',
2504 # include_directories : includes,
2505 # link_with : [libshared],
2506 # install_rpath : rootlibexecdir,
2508 # public_programs += [exe]
2510 # exe = executable('systemd-escape',
2511 # 'src/escape/escape.c',
2512 # include_directories : includes,
2513 # link_with : [libshared],
2514 # install_rpath : rootlibexecdir,
2516 # install_dir : rootbindir)
2517 # public_programs += [exe]
2519 # exe = executable('systemd-notify',
2520 # 'src/notify/notify.c',
2521 # include_directories : includes,
2522 # link_with : [libshared],
2523 # install_rpath : rootlibexecdir,
2525 # install_dir : rootbindir)
2526 # public_programs += [exe]
2528 # executable('systemd-volatile-root',
2529 # 'src/volatile-root/volatile-root.c',
2530 # include_directories : includes,
2531 # link_with : [libshared],
2532 # install_rpath : rootlibexecdir,
2534 # install_dir : rootlibexecdir)
2536 # executable('systemd-cgroups-agent',
2537 # 'src/cgroups-agent/cgroups-agent.c',
2538 # include_directories : includes,
2539 # link_with : [libshared],
2540 # install_rpath : rootlibexecdir,
2542 # install_dir : rootlibexecdir)
2544 executable('elogind-cgroups-agent',
2545 'src/cgroups-agent/cgroups-agent.c',
2546 include_directories : includes,
2547 link_with : [libshared],
2548 install_rpath : rootlibexecdir,
2550 install_dir : rootlibexecdir)
2553 #if 0 /// UNNEEDED by elogind
2554 # exe = executable('systemd-path',
2555 # 'src/path/path.c',
2556 # include_directories : includes,
2557 # link_with : [libshared],
2558 # install_rpath : rootlibexecdir,
2560 # public_programs += [exe]
2562 # exe = executable('systemd-ask-password',
2563 # 'src/ask-password/ask-password.c',
2564 # include_directories : includes,
2565 # link_with : [libshared],
2566 # install_rpath : rootlibexecdir,
2568 # install_dir : rootbindir)
2569 # public_programs += [exe]
2571 # executable('systemd-reply-password',
2572 # 'src/reply-password/reply-password.c',
2573 # include_directories : includes,
2574 # link_with : [libshared],
2575 # install_rpath : rootlibexecdir,
2577 # install_dir : rootlibexecdir)
2579 # exe = executable('systemd-tty-ask-password-agent',
2580 # 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2581 # include_directories : includes,
2582 # link_with : [libshared],
2583 # install_rpath : rootlibexecdir,
2585 # install_dir : rootbindir)
2586 # public_programs += [exe]
2588 # exe = executable('systemd-cgls',
2589 # 'src/cgls/cgls.c',
2590 # include_directories : includes,
2591 # link_with : [libshared],
2592 # install_rpath : rootlibexecdir,
2594 # public_programs += [exe]
2596 # exe = executable('systemd-cgtop',
2597 # 'src/cgtop/cgtop.c',
2598 # include_directories : includes,
2599 # link_with : [libshared],
2600 # install_rpath : rootlibexecdir,
2602 # public_programs += [exe]
2604 # executable('systemd-initctl',
2605 # 'src/initctl/initctl.c',
2606 # include_directories : includes,
2607 # link_with : [libshared],
2608 # install_rpath : rootlibexecdir,
2610 # install_dir : rootlibexecdir)
2612 # exe = executable('systemd-mount',
2613 # 'src/mount/mount-tool.c',
2614 # include_directories : includes,
2615 # link_with : [libshared],
2616 # install_rpath : rootlibexecdir,
2618 # public_programs += [exe]
2620 # meson.add_install_script(meson_make_symlink,
2621 # 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2623 # exe = executable('systemd-run',
2625 # include_directories : includes,
2626 # link_with : [libshared],
2627 # install_rpath : rootlibexecdir,
2629 # public_programs += [exe]
2631 # exe = executable('systemd-stdio-bridge',
2632 # 'src/stdio-bridge/stdio-bridge.c',
2633 # include_directories : includes,
2634 # link_with : [libshared],
2635 # install_rpath : rootlibexecdir,
2637 # public_programs += [exe]
2639 # exe = executable('busctl',
2640 # 'src/busctl/busctl.c',
2641 # 'src/busctl/busctl-introspect.c',
2642 # 'src/busctl/busctl-introspect.h',
2643 # include_directories : includes,
2644 # link_with : [libshared],
2645 # install_rpath : rootlibexecdir,
2647 # public_programs += [exe]
2649 # if conf.get('ENABLE_SYSUSERS') == 1
2650 # exe = executable('systemd-sysusers',
2651 # 'src/sysusers/sysusers.c',
2652 # include_directories : includes,
2653 # link_with : [libshared],
2654 # install_rpath : rootlibexecdir,
2656 # install_dir : rootbindir)
2657 # public_programs += [exe]
2660 # if conf.get('ENABLE_TMPFILES') == 1
2661 # exe = executable('systemd-tmpfiles',
2662 # 'src/tmpfiles/tmpfiles.c',
2663 # include_directories : includes,
2664 # link_with : [libshared],
2665 # dependencies : [libacl],
2666 # install_rpath : rootlibexecdir,
2668 # install_dir : rootbindir)
2669 # public_programs += [exe]
2671 # test('test-systemd-tmpfiles',
2672 # test_systemd_tmpfiles_py,
2673 # args : exe.full_path())
2674 # # https://github.com/mesonbuild/meson/issues/2681
2677 # if conf.get('ENABLE_HWDB') == 1
2678 # exe = executable('systemd-hwdb',
2679 # 'src/hwdb/hwdb.c',
2680 # 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2681 # include_directories : includes,
2682 # link_with : [libudev_static],
2683 # install_rpath : udev_rpath,
2685 # install_dir : rootbindir)
2686 # public_programs += [exe]
2689 # if conf.get('ENABLE_QUOTACHECK') == 1
2690 # executable('systemd-quotacheck',
2691 # 'src/quotacheck/quotacheck.c',
2692 # include_directories : includes,
2693 # link_with : [libshared],
2694 # install_rpath : rootlibexecdir,
2696 # install_dir : rootlibexecdir)
2699 # exe = executable('systemd-socket-proxyd',
2700 # 'src/socket-proxy/socket-proxyd.c',
2701 # include_directories : includes,
2702 # link_with : [libshared],
2703 # dependencies : [threads],
2704 # install_rpath : rootlibexecdir,
2706 # install_dir : rootlibexecdir)
2707 # public_programs += [exe]
2709 # exe = executable('systemd-udevd',
2710 # systemd_udevd_sources,
2711 # include_directories : includes,
2712 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2713 # link_with : [libudev_core,
2714 # libsystemd_network,
2716 # dependencies : [threads,
2721 # install_rpath : udev_rpath,
2723 # install_dir : rootlibexecdir)
2724 # public_programs += [exe]
2726 # exe = executable('udevadm',
2728 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2729 # include_directories : includes,
2730 # link_with : [libudev_core,
2731 # libsystemd_network,
2733 # dependencies : [threads,
2738 # install_rpath : udev_rpath,
2740 # install_dir : rootbindir)
2741 # public_programs += [exe]
2743 # executable('systemd-shutdown',
2744 # systemd_shutdown_sources,
2745 # include_directories : includes,
2746 # link_with : [libshared],
2747 # dependencies : [libmount],
2748 # install_rpath : rootlibexecdir,
2750 # install_dir : rootlibexecdir)
2752 # executable('systemd-update-done',
2753 # 'src/update-done/update-done.c',
2754 # include_directories : includes,
2755 # link_with : [libshared],
2756 # install_rpath : rootlibexecdir,
2758 # install_dir : rootlibexecdir)
2760 # executable('systemd-update-utmp',
2761 # 'src/update-utmp/update-utmp.c',
2762 # include_directories : includes,
2763 # link_with : [libshared],
2764 # dependencies : [libaudit],
2765 # install_rpath : rootlibexecdir,
2767 # install_dir : rootlibexecdir)
2769 # if conf.get('HAVE_KMOD') == 1
2770 # executable('systemd-modules-load',
2771 # 'src/modules-load/modules-load.c',
2772 # include_directories : includes,
2773 # link_with : [libshared],
2774 # dependencies : [libkmod],
2775 # install_rpath : rootlibexecdir,
2777 # install_dir : rootlibexecdir)
2779 # meson.add_install_script('sh', '-c',
2780 # mkdir_p.format(modulesloaddir))
2781 # meson.add_install_script('sh', '-c',
2782 # mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2785 # exe = executable('systemd-nspawn',
2786 # systemd_nspawn_sources,
2787 # 'src/core/mount-setup.c', # FIXME: use a variable?
2788 # 'src/core/mount-setup.h',
2789 # 'src/core/loopback-setup.c',
2790 # 'src/core/loopback-setup.h',
2791 # include_directories : includes,
2792 # link_with : [libnspawn_core,
2794 # dependencies : [libblkid],
2795 # install_rpath : rootlibexecdir,
2797 # public_programs += [exe]
2799 # if conf.get('ENABLE_NETWORKD') == 1
2800 # executable('systemd-networkd',
2801 # systemd_networkd_sources,
2802 # include_directories : includes,
2803 # link_with : [libnetworkd_core,
2804 # libsystemd_network,
2807 # dependencies : [threads],
2808 # install_rpath : rootlibexecdir,
2810 # install_dir : rootlibexecdir)
2812 # executable('systemd-networkd-wait-online',
2813 # systemd_networkd_wait_online_sources,
2814 # include_directories : includes,
2815 # link_with : [libnetworkd_core,
2817 # install_rpath : rootlibexecdir,
2819 # install_dir : rootlibexecdir)
2821 # exe = executable('networkctl',
2822 # networkctl_sources,
2823 # include_directories : includes,
2824 # link_with : [libsystemd_network,
2826 # install_rpath : rootlibexecdir,
2828 # install_dir : rootbindir)
2829 # public_programs += [exe]
2832 # executable('systemd-sulogin-shell',
2833 # ['src/sulogin-shell/sulogin-shell.c'],
2834 # include_directories : includes,
2835 # link_with : [libshared],
2836 # install_rpath : rootlibexecdir,
2838 # install_dir : rootlibexecdir)
2840 executable('elogind-uaccess-command',
2841 'src/uaccess-command/uaccess-command.c',
2842 include_directories : includes,
2843 link_with : [liblogind_core,
2845 dependencies: [libacl,
2847 install_rpath : rootlibexecdir,
2849 install_dir : rootlibexecdir)
2852 ############################################################
2854 foreach tuple : tests
2856 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2857 dependencies = tuple[2]
2858 condition = tuple.length() >= 4 ? tuple[3] : ''
2859 type = tuple.length() >= 5 ? tuple[4] : ''
2860 defs = tuple.length() >= 6 ? tuple[5] : []
2861 incs = tuple.length() >= 7 ? tuple[6] : includes
2864 name = sources[0].split('/')[-1].split('.')[0]
2865 if type.startswith('timeout=')
2866 timeout = type.split('=')[1].to_int()
2869 if want_tests == 'false'
2870 message('Not compiling @0@ because tests is set to false'.format(name))
2871 elif condition == '' or conf.get(condition) == 1
2875 include_directories : incs,
2876 link_with : link_with,
2877 dependencies : dependencies,
2879 install_rpath : rootlibexecdir,
2880 install : install_tests,
2881 install_dir : join_paths(testsdir, type))
2884 message('@0@ is a manual test'.format(name))
2885 elif type == 'unsafe' and want_tests != 'unsafe'
2886 message('@0@ is an unsafe test'.format(name))
2893 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2897 #if 0 /// UNNEEDED by elogind
2899 # 'test-libsystemd-sym',
2900 # test_libsystemd_sym_c,
2901 # include_directories : includes,
2902 # link_with : [libsystemd],
2903 # install : install_tests,
2904 # install_dir : testsdir)
2905 # test('test-libsystemd-sym', exe)
2908 # 'test-libsystemd-static-sym',
2909 # test_libsystemd_sym_c,
2910 # include_directories : includes,
2911 # link_with : [install_libsystemd_static],
2912 # dependencies : [threads], # threads is already included in dependencies on the library,
2913 # # but does not seem to get propagated. Add here as a work-around.
2914 # build_by_default : static_libsystemd_pic,
2915 # install : install_tests and static_libsystemd_pic,
2916 # install_dir : testsdir)
2917 # if static_libsystemd_pic
2918 # test('test-libsystemd-static-sym', exe)
2922 # 'test-libudev-sym',
2923 # test_libudev_sym_c,
2924 # include_directories : includes,
2925 # c_args : ['-Wno-deprecated-declarations'],
2926 # link_with : [libudev],
2927 # install : install_tests,
2928 # install_dir : testsdir)
2929 # test('test-libudev-sym', exe)
2932 # 'test-libudev-static-sym',
2933 # test_libudev_sym_c,
2934 # include_directories : includes,
2935 # c_args : ['-Wno-deprecated-declarations'],
2936 # link_with : [install_libudev_static],
2937 # build_by_default : static_libudev_pic,
2938 # install : install_tests and static_libudev_pic,
2939 # install_dir : testsdir)
2940 # if static_libudev_pic
2941 # test('test-libudev-static-sym', exe)
2944 # ############################################################
2948 # foreach tuple : fuzzers
2949 # sources = tuple[0]
2950 # link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2951 # dependencies = tuple[2]
2952 # defs = tuple.length() >= 4 ? tuple[3] : []
2953 # incs = tuple.length() >= 5 ? tuple[4] : includes
2956 # dependencies += fuzzing_engine
2958 # sources += 'src/fuzz/fuzz-main.c'
2961 # name = sources[0].split('/')[-1].split('.')[0]
2963 # fuzzer_exes += executable(
2966 # include_directories : [incs, include_directories('src/fuzz')],
2967 # link_with : link_with,
2968 # dependencies : dependencies,
2973 # run_target('fuzzers',
2974 # depends : fuzzer_exes,
2975 # command : ['true'])
2977 # ############################################################
2980 test_libelogind_sym = executable(
2981 'test-libelogind-sym',
2982 test_libelogind_sym_c,
2983 include_directories : includes,
2984 link_with : [libelogind],
2985 install : install_tests,
2986 install_dir : testsdir)
2987 test('test-libelogind-sym',
2988 test_libelogind_sym)
2990 make_directive_index_py = find_program('tools/make-directive-index.py')
2991 make_man_index_py = find_program('tools/make-man-index.py')
2992 xml_helper_py = find_program('tools/xml_helper.py')
2993 #if 0 /// UNNEEDED by elogind
2994 # hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2997 # subdir('sysctl.d')
2998 # subdir('sysusers.d')
2999 # subdir('tmpfiles.d')
3005 subdir('shell-completion/bash')
3006 subdir('shell-completion/zsh')
3007 #if 0 /// UNNEEDED by elogind
3008 # subdir('doc/sysvinit')
3009 # subdir('doc/var-log')
3012 # FIXME: figure out if the warning is true:
3013 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
3014 install_subdir('factory/etc',
3015 install_dir : factorydir)
3018 #if 0 /// UNNEEDED by elogind
3019 # install_data('xorg/50-systemd-user.sh',
3020 # install_dir : xinitrcdir)
3021 # install_data('modprobe.d/systemd.conf',
3022 # install_dir : modprobedir)
3024 install_data('LICENSE.GPL2',
3029 #if 0 /// irrelevant for elogind
3030 # 'doc/DISTRO_PORTING',
3031 # 'doc/ENVIRONMENT.md',
3033 # 'doc/TRANSIENT-SETTINGS.md',
3034 # 'doc/TRANSLATORS',
3035 # 'doc/UIDS-GIDS.md',
3037 'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
3038 install_dir : docdir)
3040 #if 0 /// UNNEEDED by elogind
3041 # meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
3043 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
3045 ############################################################
3047 meson_check_help = find_program('tools/meson-check-help.sh')
3049 foreach exec : public_programs
3050 name = exec.full_path().split('/')[-1]
3051 test('check-help-' + name,
3053 args : [exec.full_path()])
3056 ############################################################
3058 #if 0 /// fuzz regression tests are not supported by elogind
3059 # # Enable tests for all supported sanitizers
3060 # foreach tuple : sanitizers
3061 # sanitizer = tuple[0]
3064 # have = run_command(check_compilation_sh,
3065 # cc.cmd_array(), '-x', 'c',
3066 # '-fsanitize=@0@'.format(sanitizer),
3067 # '-include', link_test_c).returncode() == 0
3068 # message('@0@ sanitizer supported: @1@'.format(sanitizer, have ? 'yes' : 'no'))
3072 # foreach p : fuzz_regression_tests
3073 # b = p.split('/')[-2]
3074 # c = p.split('/')[-1]
3076 # name = '@0@:@1@'.format(b, sanitizer)
3079 # if want_tests == 'false'
3080 # message('Not compiling @0@ because tests is set to false'.format(name))
3082 # exe = custom_target(
3086 # command : [env, 'ln', '-fs',
3087 # join_paths(build.full_path(), b),
3089 # build_by_default : true)
3091 # message('Not compiling @0@ because slow-tests is set to false'.format(name))
3096 # if want_tests != 'false' and slow_tests
3097 # test('@0@:@1@:@2@'.format(b, c, sanitizer),
3099 # args : [exe.full_path(),
3100 # join_paths(meson.source_root(),
3101 # 'test/fuzz-regressions',
3110 ############################################################
3113 all_files = run_command(
3115 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3118 all_files = files(all_files.stdout().split())
3123 command : [env, 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
3126 command : [env, 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
3129 #if 0 /// UNNEEDED by elogind
3131 # meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
3134 # command : [meson_git_contrib_sh])
3139 git_head = run_command(
3141 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3142 'rev-parse', 'HEAD']).stdout().strip()
3143 git_head_short = run_command(
3145 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3146 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3150 command : ['git', 'archive',
3151 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
3153 '--prefix', 'systemd-@0@/'.format(git_head),
3157 ############################################################
3159 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
3162 #if 0 /// libudev is external, elogind does not need to document it.
3163 # depends : [man, libsystemd, libudev],
3164 # command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3166 depends : [man, libelogind],
3167 command : [meson_check_api_docs_sh, libelogind.full_path()])
3170 ############################################################
3173 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3175 'split /usr: @0@'.format(split_usr),
3176 'split bin-sbin: @0@'.format(split_bin),
3177 #if 0 /// UNSUPPORTED by elogind
3178 # 'prefix directory: @0@'.format(prefixdir),
3179 # 'rootprefix directory: @0@'.format(rootprefixdir),
3180 # 'sysconf directory: @0@'.format(sysconfdir),
3181 # 'include directory: @0@'.format(includedir),
3182 # 'lib directory: @0@'.format(libdir),
3183 # 'rootlib directory: @0@'.format(rootlibdir),
3184 # 'SysV init scripts: @0@'.format(sysvinit_path),
3185 # 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3187 'rootexeclib dir: @0@'.format(rootlibexecdir),
3189 #if 0 /// UNSUPPORTED by elogind
3190 # 'PAM modules directory: @0@'.format(pamlibdir),
3191 # 'PAM configuration directory: @0@'.format(pamconfdir),
3192 # 'RPM macros directory: @0@'.format(rpmmacrosdir),
3193 # 'modprobe.d directory: @0@'.format(modprobedir),
3194 # 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3195 # 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3196 # 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3197 # 'bash completions directory: @0@'.format(bashcompletiondir),
3198 # 'zsh completions directory: @0@'.format(zshcompletiondir),
3199 # 'extra start script: @0@'.format(get_option('rc-local')),
3200 # 'extra stop script: @0@'.format(get_option('halt-local')),
3201 # 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3202 # get_option('debug-tty')),
3204 'TTY GID: @0@'.format(tty_gid),
3205 #if 0 /// UNSUPPORTED by elogind
3206 # 'users GID: @0@'.format(users_gid),
3208 'maximum system UID: @0@'.format(system_uid_max),
3209 'maximum system GID: @0@'.format(system_gid_max),
3210 #if 0 /// UNSUPPORTED by elogind
3211 # 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
3212 # 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
3213 # 'minimum container UID base: @0@'.format(container_uid_base_min),
3214 # 'maximum container UID base: @0@'.format(container_uid_base_max),
3215 # '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3216 # 'render group access mode: @0@'.format(get_option('group-render-mode')),
3217 # 'certificate root directory: @0@'.format(get_option('certificate-root')),
3218 # 'support URL: @0@'.format(support_url),
3219 # 'nobody user name: @0@'.format(nobody_user),
3220 # 'nobody group name: @0@'.format(nobody_group),
3221 # 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3222 # 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
3224 # 'default DNSSEC mode: @0@'.format(default_dnssec),
3225 # 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
3226 # 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3228 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
3230 #if 0 /// UNSUPPORTED by elogind
3231 # alt_dns_servers = '\n '.join(dns_servers.split(' '))
3232 # alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3234 # 'default DNS servers: @0@'.format(alt_dns_servers),
3235 # 'default NTP servers: @0@'.format(alt_ntp_servers)]
3237 # alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3238 # '@@0@'.format(time_epoch)).stdout().strip()
3240 # 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3244 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3245 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3246 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3248 #if 0 /// UNNEEDED by elogind
3249 # if conf.get('ENABLE_EFI') == 1
3251 # 'efi arch: @0@'.format(efi_arch)]
3255 # 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3256 # 'EFI CC @0@'.format(efi_cc),
3257 # 'EFI lib directory: @0@'.format(efi_libdir),
3258 # 'EFI lds directory: @0@'.format(efi_ldsdir),
3259 # 'EFI include directory: @0@'.format(efi_incdir)]
3268 #if 0 /// UNNEEDED by elogind
3269 # ['libcryptsetup'],
3273 #if 0 /// UNNEEDED by elogind
3278 #if 0 /// UNNEEDED by elogind
3282 #if 0 /// UNNEEDED by elogind
3289 #if 0 /// UNNEEDED by elogind
3305 # ['environment.d'],
3325 ['legacy pkla', install_polkit_pkla],
3326 #if 0 /// UNNEEDED by elogind
3328 # ['gnu-efi', have_gnu_efi],
3336 #if 0 /// UNNEEDED by elogind
3337 # ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
3341 ['man pages', want_man],
3342 ['html pages', want_html],
3343 ['man page indices', want_man and have_lxml],
3344 #if 0 /// UNNEEDED by elogind
3348 #if 0 /// UNNEEDED by elogind
3351 # ['adm group', get_option('adm-group')],
3352 # ['wheel group', get_option('wheel-group')],
3354 # ['valgrind', conf.get('VALGRIND') == 1],
3359 ['debug mmap cache'],
3362 if tuple.length() >= 2
3365 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3366 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3367 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3372 missing += [tuple[0]]
3378 'enabled features: @0@'.format(', '.join(found)),
3380 'disabled features: @0@'.format(', '.join(missing)),
3382 message('\n '.join(status))
3384 #if 0 /// Nicely enough this isn't true for elogind. :-)
3385 # if rootprefixdir != rootprefix_default
3387 # 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3388 # 'systemd used fixed names for unit file directories and other paths, so anything\n' +
3389 # 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))