1 # SPDX-License-Identifier: LGPL-2.1+
3 # Copyright 2017 Zbigniew Jędrzejewski-Szmek
5 # elogind is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2.1 of the License, or
8 # (at your option) any later version.
10 # elogind is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with elogind; If not, see <http://www.gnu.org/licenses/>.
18 project('elogind', 'c',
27 meson_version : '>= 0.41',
30 #if 0 /// UNNEEDED by elogind - libudev is external
31 # libsystemd_version = '0.22.0'
32 # libudev_version = '1.6.10'
34 libelogind_version = '0.22.0'
37 # We need the same data in three different formats, ugh!
38 # Also, for hysterical reasons, we use different variable
39 # names, sometimes. Not all variables are included in every
41 conf = configuration_data()
42 conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
43 conf.set_quoted('PACKAGE_VERSION', meson.project_version())
45 substs = configuration_data()
46 #if 0 /// Set elogind Package PACKAGE_URL
47 # substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd')
49 substs.set('PACKAGE_URL', 'https://github.com/elogind/elogind')
51 substs.set('PACKAGE_VERSION', meson.project_version())
55 #####################################################################
56 #if 0 /// elogind does not need this
58 # # Try to install the git pre-commit hook
59 # git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh'))
60 # if git_hook.returncode() == 0
61 # message(git_hook.stdout().strip())
64 # elogind Note: We use precompiler masks for two reasons:
65 # 1) The masking is consistent with the sources
66 # 2) The git patch creator we use for preparing upstream patches
67 # manipulates commits to not take those masks out. Therefore
68 # it can be used to add commits updating the meson files, too.
71 #####################################################################
73 if get_option('split-usr') == 'auto'
74 split_usr = run_command('test', '-L', '/bin').returncode() != 0
76 split_usr = get_option('split-usr') == 'true'
78 conf.set10('HAVE_SPLIT_USR', split_usr,
79 description : '/usr/bin and /bin directories are separate')
81 if get_option('split-bin') == 'auto'
82 split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
84 split_bin = get_option('split-bin') == 'true'
86 conf.set10('HAVE_SPLIT_BIN', split_bin,
87 description : 'bin and sbin directories are separate')
89 rootprefixdir = get_option('rootprefix')
90 # Unusual rootprefixdir values are used by some distros
91 # (see https://github.com/systemd/systemd/pull/7461).
92 rootprefix_default = split_usr ? '/' : '/usr'
93 if rootprefixdir == ''
94 rootprefixdir = rootprefix_default
97 #if 0 /// UNNEEDED by elogind
98 # sysvinit_path = get_option('sysvinit-path')
99 # sysvrcnd_path = get_option('sysvrcnd-path')
100 # have = sysvinit_path != '' and sysvrcnd_path != ''
101 # conf.set10('HAVE_SYSV_COMPAT', have,
102 # description : 'SysV init scripts and rcN.d links are supported')
103 # m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
106 # join_paths ignore the preceding arguments if an absolute component is
107 # encountered, so this should canonicalize various paths when they are
108 # absolute or relative.
109 prefixdir = get_option('prefix')
110 if not prefixdir.startswith('/')
111 error('Prefix is not absolute: "@0@"'.format(prefixdir))
113 bindir = join_paths(prefixdir, get_option('bindir'))
114 libdir = join_paths(prefixdir, get_option('libdir'))
115 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
116 includedir = join_paths(prefixdir, get_option('includedir'))
117 datadir = join_paths(prefixdir, get_option('datadir'))
118 localstatedir = join_paths('/', get_option('localstatedir'))
120 rootbindir = join_paths(rootprefixdir, 'bin')
121 rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin')
122 #if 0 /// elogind has a different default
123 # rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
125 rootlibexecdir = get_option('rootlibexecdir')
126 rootlibexecdir = rootlibexecdir != '' ? rootlibexecdir : join_paths(rootprefixdir, 'lib/elogind')
129 rootlibdir = get_option('rootlibdir')
131 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
134 # Dirs of external packages
135 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
136 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
137 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
138 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
139 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
140 varlogdir = join_paths(localstatedir, 'log')
141 #if 0 /// UNNEEDED by elogind
142 # xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
143 # rpmmacrosdir = get_option('rpmmacrosdir')
144 # if rpmmacrosdir != 'no'
145 # rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
148 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
151 #if 0 /// elogind has a bit different layout and does not need all of theses
152 # pkgdatadir = join_paths(datadir, 'systemd')
153 # environmentdir = join_paths(prefixdir, 'lib/environment.d')
154 # pkgsysconfdir = join_paths(sysconfdir, 'systemd')
155 # userunitdir = join_paths(prefixdir, 'lib/systemd/user')
156 # userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
157 # tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
158 # sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
159 # sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
160 # binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
161 # modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
162 # networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
163 # pkgincludedir = join_paths(includedir, 'systemd')
164 # systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
165 # usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
166 # systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
167 # userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
168 # systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
169 # systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
170 # systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
171 # systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
172 # udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
173 # udevhomedir = udevlibexecdir
174 # udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
175 # udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
176 # catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
177 # kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
178 # factorydir = join_paths(datadir, 'factory')
179 # bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
180 # testsdir = join_paths(prefixdir, 'lib/systemd/tests')
181 # systemdstatedir = join_paths(localstatedir, 'lib/systemd')
182 # catalogstatedir = join_paths(systemdstatedir, 'catalog')
183 # randomseeddir = join_paths(localstatedir, 'lib/systemd')
185 # docdir = get_option('docdir')
187 # docdir = join_paths(datadir, 'doc/systemd')
190 pkgdatadir = join_paths(datadir, 'elogind')
191 pkgsysconfdir = join_paths(sysconfdir, 'elogind')
192 pkgincludedir = join_paths(includedir, 'elogind/systemd')
193 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
194 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
196 # in elogind, udev is external and thus configurable
197 udevlibexecdir = get_option('udevbindir')
198 udevlibexecdir = udevlibexecdir != '' ? udevlibexecdir : join_paths(rootprefixdir, 'lib/udev')
199 udevrulesdir = get_option('udevrulesdir')
200 udevrulesdir = udevrulesdir != '' ? udevrulesdir : join_paths(udevlibexecdir, 'rules.d')
201 udevhomedir = udevlibexecdir
202 factorydir = join_paths(datadir, 'factory')
203 docdir = get_option('docdir')
204 docdir = docdir != '' ? docdir: '-'.join([join_paths(datadir, 'doc/elogind'),
205 meson.project_version()])
206 testsdir = join_paths(prefixdir, 'lib/elogind/tests')
207 randomseeddir = join_paths(localstatedir, 'lib/elogind')
210 dbuspolicydir = get_option('dbuspolicydir')
211 if dbuspolicydir == ''
212 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
215 dbussessionservicedir = get_option('dbussessionservicedir')
216 if dbussessionservicedir == ''
217 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
220 dbussystemservicedir = get_option('dbussystemservicedir')
221 if dbussystemservicedir == ''
222 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
225 pamlibdir = get_option('pamlibdir')
227 pamlibdir = join_paths(rootlibdir, 'security')
230 pamconfdir = get_option('pamconfdir')
232 pamconfdir = join_paths(sysconfdir, 'pam.d')
235 #if 0 /// UNNEEDED by elogind
236 # memory_accounting_default = get_option('memory-accounting-default')
239 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
240 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
241 #if 0 /// UNNEEDED by elogind
242 # conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
243 # conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
244 # conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
245 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
246 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
248 # conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper())
250 # conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
251 # conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
252 # conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
253 # conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
254 # conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
255 # conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
256 # conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
257 # conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
258 # conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
259 # conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
260 # conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
261 # conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
262 # conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
263 # conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
265 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'elogind-cgroups-agent'))
266 conf.set_quoted('ELOGIND_UACCESS_COMMAND_PATH', join_paths(rootlibexecdir, 'elogind-uaccess-command'))
267 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'elogind'))
269 conf.set_quoted('ROOTPREFIX', rootprefixdir)
270 #if 0 /// UNNEEDED by elogind
271 # conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
272 # conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
273 # conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
274 # conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
275 # conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
276 # conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
277 # conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
279 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
280 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
281 #if 0 /// UNNEEDED by elogind
282 # conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
283 # conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
285 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
286 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
287 conf.set_quoted('LIBDIR', libdir)
288 conf.set_quoted('ROOTLIBDIR', rootlibdir)
289 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
290 #if 0 /// UNNEEDED by elogind
291 # conf.set_quoted('BOOTLIBDIR', bootlibdir)
292 # conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
293 # conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
294 # conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
295 # conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
296 # conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
297 # conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
298 # conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false')
300 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no')
302 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
303 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
305 substs.set('prefix', prefixdir)
306 substs.set('exec_prefix', prefixdir)
307 substs.set('libdir', libdir)
308 substs.set('rootlibdir', rootlibdir)
309 substs.set('includedir', includedir)
310 substs.set('pkgsysconfdir', pkgsysconfdir)
311 substs.set('bindir', bindir)
312 substs.set('rootbindir', rootbindir)
313 substs.set('rootlibexecdir', rootlibexecdir)
314 #if 0 /// UNNEEDED by elogind
315 # substs.set('systemunitdir', systemunitdir)
316 # substs.set('userunitdir', userunitdir)
317 # substs.set('systempresetdir', systempresetdir)
318 # substs.set('userpresetdir', userpresetdir)
319 # substs.set('udevhwdbdir', udevhwdbdir)
321 substs.set('udevrulesdir', udevrulesdir)
322 substs.set('udevlibexecdir', udevlibexecdir)
323 #if 0 /// UNNEEDED by elogind
324 # substs.set('catalogdir', catalogdir)
325 # substs.set('tmpfilesdir', tmpfilesdir)
326 # substs.set('sysusersdir', sysusersdir)
327 # substs.set('sysctldir', sysctldir)
328 # substs.set('binfmtdir', binfmtdir)
329 # substs.set('modulesloaddir', modulesloaddir)
330 # substs.set('systemgeneratordir', systemgeneratordir)
331 # substs.set('usergeneratordir', usergeneratordir)
332 # substs.set('systemenvgeneratordir', systemenvgeneratordir)
333 # substs.set('userenvgeneratordir', userenvgeneratordir)
335 substs.set('systemshutdowndir', systemshutdowndir)
336 substs.set('systemsleepdir', systemsleepdir)
337 substs.set('VARLOGDIR', varlogdir)
338 #if 0 /// UNNEEDED by elogind
339 # substs.set('CERTIFICATEROOT', get_option('certificate-root'))
340 # substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
341 # substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
342 # substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
343 # substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
344 # substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
345 # substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
346 # substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
349 #####################################################################
351 cc = meson.get_compiler('c')
352 pkgconfig = import('pkgconfig')
353 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
354 meson_build_sh = find_program('tools/meson-build.sh')
356 if get_option('tests') != 'false'
357 cxx = find_program('c++', required : false)
359 # Used only for tests
364 #if 0 /// elogind does not support fuzz stress testing (, yet).
365 # want_ossfuzz = get_option('oss-fuzz')
366 # want_libfuzzer = get_option('llvm-fuzz')
367 # fuzzer_build = want_ossfuzz or want_libfuzzer
368 # if want_ossfuzz and want_libfuzzer
369 # error('only one of oss-fuzz and llvm-fuzz can be specified')
372 # fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
375 # fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
381 foreach arg : ['-Wextra',
384 '-Wmissing-include-dirs',
385 '-Wold-style-definition',
388 '-Wdeclaration-after-statement',
390 '-Wsuggest-attribute=noreturn',
391 '-Werror=missing-prototypes',
392 '-Werror=implicit-function-declaration',
393 '-Werror=missing-declarations',
394 '-Werror=return-type',
395 '-Werror=incompatible-pointer-types',
397 '-Wstrict-prototypes',
399 '-Wmissing-noreturn',
400 '-Wimplicit-fallthrough=5',
403 '-Wstrict-aliasing=2',
410 '-fdiagnostics-show-option',
411 '-fno-strict-aliasing',
412 '-fvisibility=hidden',
414 '-fstack-protector-strong',
415 '--param=ssp-buffer-size=4',
417 if cc.has_argument(arg)
418 add_project_arguments(arg, language : 'c')
422 # the oss-fuzz fuzzers are not built with -fPIE, so don't
423 # enable it when we are linking against them
425 if cc.has_argument('-fPIE')
426 add_project_arguments('-fPIE', language : 'c')
430 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
431 # arguments, just emits a warnings. So test for the "positive" version instead.
432 foreach arg : ['unused-parameter',
433 'missing-field-initializers',
436 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
438 if cc.has_argument('-W' + arg)
439 add_project_arguments('-Wno-' + arg, language : 'c')
445 #include <inttypes.h>
446 typedef uint64_t usec_t;
447 usec_t now(clockid_t clock);
452 ''', name : '-Werror=shadow with local shadowing')
453 add_project_arguments('-Werror=shadow', language : 'c')
456 if cc.get_id() == 'clang'
457 foreach arg : ['-Wno-typedef-redefinition',
458 '-Wno-gnu-variable-sized-type-not-at-end',
460 if cc.has_argument(arg,
461 name : '@0@ is supported'.format(arg))
462 add_project_arguments(arg, language : 'c')
467 link_test_c = files('tools/meson-link-test.c')
469 # --as-needed and --no-undefined are provided by meson by default,
470 # run mesonconf to see what is enabled
471 foreach arg : ['-Wl,-z,relro',
476 have = run_command(check_compilation_sh,
477 cc.cmd_array(), '-x', 'c', arg,
478 '-include', link_test_c).returncode() == 0
479 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
480 if have and (arg != '-pie' or not fuzzer_build)
481 add_project_link_arguments(arg, language : 'c')
485 if get_option('buildtype') != 'debug'
486 foreach arg : ['-ffunction-sections',
488 if cc.has_argument(arg,
489 name : '@0@ is supported'.format(arg))
490 add_project_arguments(arg, language : 'c')
494 foreach arg : ['-Wl,--gc-sections']
495 have = run_command(check_compilation_sh,
496 cc.cmd_array(), '-x', 'c', arg,
497 '-include', link_test_c).returncode() == 0
498 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
500 add_project_link_arguments(arg, language : 'c')
505 cpp = ' '.join(cc.cmd_array()) + ' -E'
507 #####################################################################
508 # compilation result tests
510 conf.set('_GNU_SOURCE', true)
511 conf.set('__SANE_USERSPACE_TYPES__', true)
513 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
514 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
515 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
516 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
517 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
518 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
519 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
523 #include <linux/ethtool.h>
524 #include <linux/fib_rules.h>
525 //#include <linux/stat.h>
526 //#include <sys/stat.h>
528 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
530 foreach decl : ['char16_t',
533 'struct ethtool_link_settings',
534 'struct fib_rule_uid_range',
538 # We get -1 if the size cannot be determined
539 have = cc.sizeof(decl, prefix : decl_headers) > 0
540 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
543 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
544 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
545 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
546 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
547 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
548 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
549 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
550 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
551 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
552 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
553 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
554 # if_tunnel.h is buggy and cannot be included on its own
555 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
556 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
557 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
558 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
559 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
560 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
561 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
562 ['IPVLAN_F_PRIVATE', 'linux/if_link.h'],
563 ['NDA_IFINDEX', 'linux/neighbour.h'],
564 ['IFA_FLAGS', 'linux/if_addr.h'],
565 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
566 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
567 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
569 prefix = decl.length() > 2 ? decl[2] : ''
570 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
571 conf.set10('HAVE_' + decl[0], have)
574 foreach ident : ['secure_getenv', '__secure_getenv']
575 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
579 ['memfd_create', '''#include <sys/mman.h>'''],
580 ['gettid', '''#include <sys/types.h>
581 #include <unistd.h>'''],
582 ['pivot_root', '''#include <stdlib.h>
583 #include <unistd.h>'''], # no known header declares pivot_root
584 ['name_to_handle_at', '''#include <sys/types.h>
585 #include <sys/stat.h>
586 #include <fcntl.h>'''],
587 ['setns', '''#include <sched.h>'''],
588 ['renameat2', '''#include <stdio.h>
589 // #include <fcntl.h>'''],
590 ['kcmp', '''#include <linux/kcmp.h>'''],
591 ['keyctl', '''#include <sys/types.h>
592 #include <keyutils.h>'''],
593 ['copy_file_range', '''#include <sys/syscall.h>
594 #include <unistd.h>'''],
595 ['bpf', '''#include <sys/syscall.h>
596 #include <unistd.h>'''],
597 ['statx', '''#include <sys/types.h>
598 #include <sys/stat.h>
599 // #include <unistd.h>'''],
600 ['explicit_bzero' , '''#include <string.h>'''],
601 ['reallocarray', '''#include <malloc.h>'''],
604 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
605 conf.set10('HAVE_' + ident[0].to_upper(), have)
608 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
609 conf.set10('USE_SYS_RANDOM_H', true)
610 conf.set10('HAVE_GETRANDOM', true)
612 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
613 conf.set10('USE_SYS_RANDOM_H', false)
614 conf.set10('HAVE_GETRANDOM', have)
617 #####################################################################
619 sed = find_program('sed')
620 awk = find_program('awk')
621 m4 = find_program('m4')
622 stat = find_program('stat')
623 git = find_program('git', required : false)
624 env = find_program('env')
625 perl = find_program('perl', required : false)
627 #if 0 /// elogind does not use this but needs a tool to symlink its installed headers.
628 # meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
629 #else /// Needed by elogind
630 meson_symlink_headers = meson.source_root() + '/tools/meson-symlink_headers.sh'
632 mkdir_p = 'mkdir -p $DESTDIR/@0@'
633 #if 0 /// unneeded by elogind
634 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
635 # splash_bmp = files('test/splash.bmp')
638 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
639 # /usr/sbin, /sbin, and fall back to the default from middle column.
640 #if 0 /// elogind has a bit different list and some adaptions
641 # progs = [['quotaon', '/usr/sbin/quotaon' ],
642 # ['quotacheck', '/usr/sbin/quotacheck' ],
643 # ['kill', '/usr/bin/kill' ],
644 # ['kmod', '/usr/bin/kmod' ],
645 # ['kexec', '/usr/sbin/kexec' ],
646 # ['sulogin', '/usr/sbin/sulogin' ],
647 # ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
648 # ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
649 # ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
650 # ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
653 progs = [['halt', '/sbin/halt', 'HALT'],
654 ['kexec', '/usr/sbin/kexec', 'KEXEC'],
655 ['poweroff', '/sbin/poweroff', 'POWEROFF'],
656 ['reboot', '/sbin/reboot', 'REBOOT'],
660 path = get_option(prog[0] + '-path')
662 message('Using @1@ for @0@'.format(prog[0], path))
664 exe = find_program(prog[0],
665 '/usr/sbin/' + prog[0],
668 path = exe.found() ? exe.path() : prog[1]
670 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
671 conf.set_quoted(name, path)
672 substs.set(name, path)
675 #if 0 /// unneeded by elogind
676 # conf.set_quoted('TELINIT', get_option('telinit-path'))
678 # if run_command('ln', '--relative', '--help').returncode() != 0
679 # error('ln does not support --relative (added in coreutils 8.16)')
683 ############################################################
685 gperf = find_program('gperf')
687 gperf_test_format = '''
689 const char * in_word_set(const char *, @0@);
692 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
693 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
694 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
695 if cc.compiles(gperf_test)
696 gperf_len_type = 'size_t'
698 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
699 if cc.compiles(gperf_test)
700 gperf_len_type = 'unsigned'
702 error('unable to determine gperf len type')
705 message('gperf len type is @0@'.format(gperf_len_type))
706 conf.set('GPERF_LEN_TYPE', gperf_len_type,
707 description : 'The type of gperf "len" parameter')
709 ############################################################
711 if not cc.has_header('sys/capability.h')
712 error('POSIX caps headers not found')
714 foreach header : ['crypt.h',
717 'linux/vm_sockets.h',
719 'valgrind/memcheck.h',
720 'valgrind/valgrind.h',
723 conf.set10('HAVE_' + header.underscorify().to_upper(),
724 cc.has_header(header))
727 ############################################################
729 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
730 #if 0 /// UNNEEDED by elogind
731 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
732 # gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
735 default_hierarchy = get_option('default-hierarchy')
736 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
737 description : 'default cgroup hierarchy as string')
738 if default_hierarchy == 'legacy'
739 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
740 elif default_hierarchy == 'hybrid'
741 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
743 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
746 #if 0 /// UNNEEDED by elogind
747 # time_epoch = get_option('time-epoch')
748 # if time_epoch == ''
749 # NEWS = files('NEWS')
750 # time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
752 # time_epoch = time_epoch.to_int()
753 # conf.set('TIME_EPOCH', time_epoch)
755 ############################################################
756 # elogind needs to know which cgroups controller to follow.
757 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
758 with_cgroupctrl = get_option('cgroup-controller')
759 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
760 with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
761 elif with_cgroupctrl == 'none'
762 with_cgroupctrl = 'elogind'
765 # No controller now is a problem:
766 if with_cgroupctrl == ''
767 error('Unable to determine cgroup controller, but cgroups support is mandatory!')
770 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
771 description : 'name of the cgroup controller to use')
772 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
773 '='.join(['name', with_cgroupctrl]))
774 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
775 '='.join(['name', with_cgroupctrl]))
776 ############################################################
779 system_uid_max = get_option('system-uid-max')
780 if system_uid_max == ''
781 system_uid_max = run_command(
783 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
784 '/etc/login.defs').stdout().strip()
785 if system_uid_max == ''
786 system_uid_max = '999'
789 system_uid_max = system_uid_max.to_int()
790 conf.set('SYSTEM_UID_MAX', system_uid_max)
791 substs.set('systemuidmax', system_uid_max)
792 message('maximum system UID is @0@'.format(system_uid_max))
794 system_gid_max = get_option('system-gid-max')
795 if system_gid_max == ''
796 system_gid_max = run_command(
798 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
799 '/etc/login.defs').stdout().strip()
800 if system_gid_max == ''
801 system_gid_max = '999'
804 system_gid_max = system_gid_max.to_int()
805 conf.set('SYSTEM_GID_MAX', system_gid_max)
806 substs.set('systemgidmax', system_gid_max)
807 message('maximum system GID is @0@'.format(system_gid_max))
809 #if 0 /// UNNEEDED by elogind
810 # dynamic_uid_min = get_option('dynamic-uid-min').to_int()
811 # dynamic_uid_max = get_option('dynamic-uid-max').to_int()
812 # conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
813 # conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
814 # substs.set('dynamicuidmin', dynamic_uid_min)
815 # substs.set('dynamicuidmax', dynamic_uid_max)
817 # container_uid_base_min = get_option('container-uid-base-min').to_int()
818 # container_uid_base_max = get_option('container-uid-base-max').to_int()
819 # conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
820 # conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
821 # substs.set('containeruidbasemin', container_uid_base_min)
822 # substs.set('containeruidbasemax', container_uid_base_max)
825 nobody_user = get_option('nobody-user')
826 nobody_group = get_option('nobody-group')
828 getent_result = run_command('getent', 'passwd', '65534')
829 if getent_result.returncode() == 0
830 name = getent_result.stdout().split(':')[0]
831 if name != nobody_user
832 message('WARNING:\n' +
833 ' 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) +
834 ' Your build will result in an user table setup that is incompatible with the local system.')
837 id_result = run_command('id', '-u', nobody_user)
838 if id_result.returncode() == 0
839 id = id_result.stdout().to_int()
841 message('WARNING:\n' +
842 ' 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) +
843 ' Your build will result in an user table setup that is incompatible with the local system.')
847 getent_result = run_command('getent', 'group', '65534')
848 if getent_result.returncode() == 0
849 name = getent_result.stdout().split(':')[0]
850 if name != nobody_group
851 message('WARNING:\n' +
852 ' 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) +
853 ' Your build will result in an group table setup that is incompatible with the local system.')
856 id_result = run_command('id', '-g', nobody_group)
857 if id_result.returncode() == 0
858 id = id_result.stdout().to_int()
860 message('WARNING:\n' +
861 ' 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) +
862 ' Your build will result in an group table setup that is incompatible with the local system.')
865 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
866 message('WARNING:\n' +
867 ' The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
868 ' Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
871 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
872 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
873 substs.set('NOBODY_USER_NAME', nobody_user)
874 substs.set('NOBODY_GROUP_NAME', nobody_group)
876 tty_gid = get_option('tty-gid')
877 conf.set('TTY_GID', tty_gid)
878 substs.set('TTY_GID', tty_gid)
880 #if 0 /// UNNEEDED by elogind
881 # # Ensure provided GID argument is numeric, otherwise fallback to default assignment
882 # if get_option('users-gid') != ''
883 # users_gid = get_option('users-gid').to_int()
887 # substs.set('USERS_GID', users_gid)
889 # if get_option('adm-group')
890 # m4_defines += ['-DENABLE_ADM_GROUP']
893 # if get_option('wheel-group')
894 # m4_defines += ['-DENABLE_WHEEL_GROUP']
897 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
898 # substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
901 kill_user_processes = get_option('default-kill-user-processes')
902 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
903 conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no')
904 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
906 #if 0 /// UNNEEDED by elogind
907 # dns_servers = get_option('dns-servers')
908 # conf.set_quoted('DNS_SERVERS', dns_servers)
909 # substs.set('DNS_SERVERS', dns_servers)
911 # ntp_servers = get_option('ntp-servers')
912 # conf.set_quoted('NTP_SERVERS', ntp_servers)
913 # substs.set('NTP_SERVERS', ntp_servers)
916 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
918 #if 0 /// UNNEEDED by elogind
919 # substs.set('SUSHELL', get_option('debug-shell'))
920 # substs.set('DEBUGTTY', get_option('debug-tty'))
923 debug = get_option('debug')
924 enable_debug_hashmap = false
925 enable_debug_mmap_cache = false
926 #if 1 /// additional elogind debug mode
927 enable_debug_elogind = false
930 foreach name : debug.split(',')
932 enable_debug_hashmap = true
933 elif name == 'mmap-cache'
934 enable_debug_mmap_cache = true
935 #if 1 /// additional elogind debug mode
936 elif name == 'elogind'
937 enable_debug_elogind = true
940 message('unknown debug option "@0@", ignoring'.format(name))
944 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
945 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
946 #if 1 /// additional elogind debug mode
947 conf.set10('ENABLE_DEBUG_ELOGIND', enable_debug_elogind)
950 #####################################################################
952 threads = dependency('threads')
953 librt = cc.find_library('rt')
954 libm = cc.find_library('m')
955 libdl = cc.find_library('dl')
956 libcrypt = cc.find_library('crypt')
958 libcap = dependency('libcap', required : false)
959 if not libcap.found()
960 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
961 libcap = cc.find_library('cap')
964 #if 0 /// UNNEEDED by elogind
965 # libmount = dependency('mount',
966 # version : fuzzer_build ? '>= 0' : '>= 2.30')
968 # want_seccomp = get_option('seccomp')
969 # if want_seccomp != 'false' and not fuzzer_build
970 # libseccomp = dependency('libseccomp',
971 # version : '>= 2.3.1',
972 # required : want_seccomp == 'true')
973 # have = libseccomp.found()
981 conf.set10('HAVE_SECCOMP', have)
982 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
984 want_selinux = get_option('selinux')
985 if want_selinux != 'false' and not fuzzer_build
986 libselinux = dependency('libselinux',
987 version : '>= 2.1.9',
988 required : want_selinux == 'true')
989 have = libselinux.found()
994 conf.set10('HAVE_SELINUX', have)
995 m4_defines += have ? ['-DHAVE_SELINUX'] : []
997 #if 0 /// UNNEEDED by elogind
998 # want_apparmor = get_option('apparmor')
999 # if want_apparmor != 'false' and not fuzzer_build
1000 # libapparmor = dependency('libapparmor',
1001 # required : want_apparmor == 'true')
1002 # have = libapparmor.found()
1010 conf.set10('HAVE_APPARMOR', have)
1011 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
1013 smack_run_label = get_option('smack-run-label')
1014 if smack_run_label != ''
1015 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
1016 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
1019 want_polkit = get_option('polkit')
1020 install_polkit = false
1021 install_polkit_pkla = false
1022 if want_polkit != 'false' and not fuzzer_build
1023 install_polkit = true
1025 libpolkit = dependency('polkit-gobject-1',
1027 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1028 message('Old polkit detected, will install pkla files')
1029 install_polkit_pkla = true
1032 conf.set10('ENABLE_POLKIT', install_polkit)
1034 want_acl = get_option('acl')
1035 if want_acl != 'false' and not fuzzer_build
1036 libacl = cc.find_library('acl', required : want_acl == 'true')
1037 have = libacl.found()
1042 conf.set10('HAVE_ACL', have)
1043 m4_defines += have ? ['-DHAVE_ACL'] : []
1045 want_audit = get_option('audit')
1046 if want_audit != 'false' and not fuzzer_build
1047 libaudit = dependency('audit', required : want_audit == 'true')
1048 have = libaudit.found()
1053 conf.set10('HAVE_AUDIT', have)
1055 #if 0 /// UNNEEDED by elogind
1056 # want_blkid = get_option('blkid')
1057 # if want_blkid != 'false' and not fuzzer_build
1058 # libblkid = dependency('blkid', required : want_blkid == 'true')
1059 # have = libblkid.found()
1064 # conf.set10('HAVE_BLKID', have)
1066 # want_kmod = get_option('kmod')
1067 # if want_kmod != 'false' and not fuzzer_build
1068 # libkmod = dependency('libkmod',
1069 # version : '>= 15',
1070 # required : want_kmod == 'true')
1071 # have = libkmod.found()
1076 # conf.set10('HAVE_KMOD', have)
1082 want_pam = get_option('pam')
1083 if want_pam != 'false' and not fuzzer_build
1084 libpam = cc.find_library('pam', required : want_pam == 'true')
1085 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1086 have = libpam.found() and libpam_misc.found()
1092 conf.set10('HAVE_PAM', have)
1093 m4_defines += have ? ['-DHAVE_PAM'] : []
1095 #if 0 /// UNNEEDED by elogind
1096 # want_microhttpd = get_option('microhttpd')
1097 # if want_microhttpd != 'false' and not fuzzer_build
1098 # libmicrohttpd = dependency('libmicrohttpd',
1099 # version : '>= 0.9.33',
1100 # required : want_microhttpd == 'true')
1101 # have = libmicrohttpd.found()
1104 # libmicrohttpd = []
1106 # conf.set10('HAVE_MICROHTTPD', have)
1107 # m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
1109 # want_libcryptsetup = get_option('libcryptsetup')
1110 # if want_libcryptsetup != 'false' and not fuzzer_build
1111 # libcryptsetup = dependency('libcryptsetup',
1112 # version : '>= 1.6.0',
1113 # required : want_libcryptsetup == 'true')
1114 # have = libcryptsetup.found()
1117 # libcryptsetup = []
1119 # conf.set10('HAVE_LIBCRYPTSETUP', have)
1121 # want_libcurl = get_option('libcurl')
1122 # if want_libcurl != 'false' and not fuzzer_build
1123 # libcurl = dependency('libcurl',
1124 # version : '>= 7.32.0',
1125 # required : want_libcurl == 'true')
1126 # have = libcurl.found()
1131 # conf.set10('HAVE_LIBCURL', have)
1132 # m4_defines += have ? ['-DHAVE_LIBCURL'] : []
1134 # want_libidn = get_option('libidn')
1135 # want_libidn2 = get_option('libidn2')
1136 # if want_libidn == 'true' and want_libidn2 == 'true'
1137 # error('libidn and libidn2 cannot be requested simultaneously')
1140 # if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
1141 # libidn = dependency('libidn',
1142 # required : want_libidn == 'true')
1143 # have = libidn.found()
1148 # conf.set10('HAVE_LIBIDN', have)
1149 # m4_defines += have ? ['-DHAVE_LIBIDN'] : []
1150 # if not have and want_libidn2 != 'false' and not fuzzer_build
1151 # # libidn is used for both libidn and libidn2 objects
1152 # libidn = dependency('libidn2',
1153 # required : want_libidn2 == 'true')
1154 # have = libidn.found()
1158 # conf.set10('HAVE_LIBIDN2', have)
1159 # m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
1161 # want_libiptc = get_option('libiptc')
1162 # if want_libiptc != 'false' and not fuzzer_build
1163 # libiptc = dependency('libiptc',
1164 # required : want_libiptc == 'true')
1165 # have = libiptc.found()
1170 # conf.set10('HAVE_LIBIPTC', have)
1171 # m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
1173 # want_qrencode = get_option('qrencode')
1174 # if want_qrencode != 'false' and not fuzzer_build
1175 # libqrencode = dependency('libqrencode',
1176 # required : want_qrencode == 'true')
1177 # have = libqrencode.found()
1182 # conf.set10('HAVE_QRENCODE', have)
1184 # want_gcrypt = get_option('gcrypt')
1185 # if want_gcrypt != 'false' and not fuzzer_build
1186 # libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1187 # libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1188 # have = libgcrypt.found() and libgpg_error.found()
1193 # # link to neither of the libs if one is not found
1197 # conf.set10('HAVE_GCRYPT', have)
1199 # want_gnutls = get_option('gnutls')
1200 # if want_gnutls != 'false' and not fuzzer_build
1201 # libgnutls = dependency('gnutls',
1202 # version : '>= 3.1.4',
1203 # required : want_gnutls == 'true')
1204 # have = libgnutls.found()
1209 # conf.set10('HAVE_GNUTLS', have)
1211 # want_elfutils = get_option('elfutils')
1212 # if want_elfutils != 'false' and not fuzzer_build
1213 # libdw = dependency('libdw',
1214 # required : want_elfutils == 'true')
1215 # have = libdw.found()
1220 # conf.set10('HAVE_ELFUTILS', have)
1222 # want_zlib = get_option('zlib')
1223 # if want_zlib != 'false' and not fuzzer_build
1224 # libz = dependency('zlib',
1225 # required : want_zlib == 'true')
1226 # have = libz.found()
1231 # conf.set10('HAVE_ZLIB', have)
1233 # want_bzip2 = get_option('bzip2')
1234 # if want_bzip2 != 'false' and not fuzzer_build
1235 # libbzip2 = cc.find_library('bz2',
1236 # required : want_bzip2 == 'true')
1237 # have = libbzip2.found()
1242 # conf.set10('HAVE_BZIP2', have)
1244 # want_xz = get_option('xz')
1245 # if want_xz != 'false' and not fuzzer_build
1246 # libxz = dependency('liblzma',
1247 # required : want_xz == 'true')
1248 # have = libxz.found()
1253 # conf.set10('HAVE_XZ', have)
1255 # want_lz4 = get_option('lz4')
1256 # if want_lz4 != 'false' and not fuzzer_build
1257 # liblz4 = dependency('liblz4',
1258 # required : want_lz4 == 'true')
1259 # have = liblz4.found()
1264 # conf.set10('HAVE_LZ4', have)
1266 # want_xkbcommon = get_option('xkbcommon')
1267 # if want_xkbcommon != 'false' and not fuzzer_build
1268 # libxkbcommon = dependency('xkbcommon',
1269 # version : '>= 0.3.0',
1270 # required : want_xkbcommon == 'true')
1271 # have = libxkbcommon.found()
1293 conf.set10('HAVE_XKBCOMMON', have)
1295 want_pcre2 = get_option('pcre2')
1296 if want_pcre2 != 'false'
1297 libpcre2 = dependency('libpcre2-8',
1298 required : want_pcre2 == 'true')
1299 have = libpcre2.found()
1304 conf.set10('HAVE_PCRE2', have)
1306 want_glib = get_option('glib')
1307 if want_glib != 'false' and not fuzzer_build
1308 libglib = dependency('glib-2.0',
1309 version : '>= 2.22.0',
1310 required : want_glib == 'true')
1311 libgobject = dependency('gobject-2.0',
1312 version : '>= 2.22.0',
1313 required : want_glib == 'true')
1314 libgio = dependency('gio-2.0',
1315 required : want_glib == 'true')
1316 have = libglib.found() and libgobject.found() and libgio.found()
1323 conf.set10('HAVE_GLIB', have)
1325 want_dbus = get_option('dbus')
1326 if want_dbus != 'false' and not fuzzer_build
1327 libdbus = dependency('dbus-1',
1328 version : '>= 1.3.2',
1329 required : want_dbus == 'true')
1330 have = libdbus.found()
1335 conf.set10('HAVE_DBUS', have)
1337 #if 0 /// UNNEEDED by elogind
1338 # default_dnssec = get_option('default-dnssec')
1340 # default_dnssec = 'no'
1342 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1343 # message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1344 # default_dnssec = 'no'
1346 # conf.set('DEFAULT_DNSSEC_MODE',
1347 # 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1348 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1350 # want_importd = get_option('importd')
1351 # if want_importd != 'false'
1352 # have = (conf.get('HAVE_LIBCURL') == 1 and
1353 # conf.get('HAVE_ZLIB') == 1 and
1354 # conf.get('HAVE_BZIP2') == 1 and
1355 # conf.get('HAVE_XZ') == 1 and
1356 # conf.get('HAVE_GCRYPT') == 1)
1357 # if want_importd == 'true' and not have
1358 # error('importd support was requested, but dependencies are not available')
1363 # conf.set10('ENABLE_IMPORTD', have)
1365 # want_remote = get_option('remote')
1366 # if want_remote != 'false'
1367 # have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1368 # conf.get('HAVE_LIBCURL') == 1]
1369 # # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1370 # # it's possible to build one without the other. Complain only if
1371 # # support was explictly requested. The auxiliary files like sysusers
1372 # # config should be installed when any of the programs are built.
1373 # if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1374 # error('remote support was requested, but dependencies are not available')
1376 # have = have_deps[0] or have_deps[1]
1381 conf.set10('ENABLE_REMOTE', have)
1383 foreach term : ['utmp',
1384 #if 0 /// UNNEEDED by elogind
1418 have = get_option(term)
1419 name = 'ENABLE_' + term.underscorify().to_upper()
1420 conf.set10(name, have)
1421 m4_defines += have ? ['-D' + name] : []
1424 want_tests = get_option('tests')
1425 install_tests = get_option('install-tests')
1426 slow_tests = get_option('slow-tests')
1430 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1432 #####################################################################
1434 #if 0 /// UNNEEDED by elogind
1435 # if get_option('efi')
1436 # efi_arch = host_machine.cpu_family()
1438 # if efi_arch == 'x86'
1439 # EFI_MACHINE_TYPE_NAME = 'ia32'
1440 # gnu_efi_arch = 'ia32'
1441 # elif efi_arch == 'x86_64'
1442 # EFI_MACHINE_TYPE_NAME = 'x64'
1443 # gnu_efi_arch = 'x86_64'
1444 # elif efi_arch == 'arm'
1445 # EFI_MACHINE_TYPE_NAME = 'arm'
1446 # gnu_efi_arch = 'arm'
1447 # elif efi_arch == 'aarch64'
1448 # EFI_MACHINE_TYPE_NAME = 'aa64'
1449 # gnu_efi_arch = 'aarch64'
1451 # EFI_MACHINE_TYPE_NAME = ''
1456 # conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1458 # conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1463 conf.set10('ENABLE_EFI', have)
1465 #####################################################################
1467 config_h = configure_file(
1468 output : 'config.h',
1469 configuration : conf)
1471 includes = include_directories('src/basic',
1474 #if 0 /// UNNEEDED by elogind
1479 'src/time-wait-sync',
1481 #if 0 /// UNNEEDED by elogind
1486 #if 0 /// elogind has a different list
1487 # 'src/libsystemd/sd-bus',
1488 # 'src/libsystemd/sd-device',
1489 # 'src/libsystemd/sd-hwdb',
1490 # 'src/libsystemd/sd-id128',
1491 # 'src/libsystemd/sd-netlink',
1492 # 'src/libsystemd/sd-network',
1493 # 'src/libsystemd-network',
1495 'src/libelogind/sd-bus',
1496 'src/libelogind/sd-id128',
1502 add_project_arguments('-include', 'config.h', language : 'c')
1505 #if 0 /// UNNEEDED by elogind
1508 subdir('src/systemd')
1510 #if 0 /// UNNEEDED by elogind
1511 # subdir('src/libsystemd')
1512 # subdir('src/libsystemd-network')
1513 # subdir('src/journal')
1516 subdir('src/libelogind')
1518 subdir('src/update-utmp')
1522 #if 0 /// UNNEEDED by elogind
1523 # libjournal_core = static_library(
1525 # libjournal_core_sources,
1527 # include_directories : includes,
1531 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1532 libelogind = shared_library(
1534 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
1535 version : libelogind_version,
1536 include_directories : includes,
1537 link_args : ['-shared',
1538 '-Wl,--version-script=' + libelogind_sym_path],
1539 #if 0 /// elogind does not need gcrypt or libjournal_client, only threads.
1540 # link_with : [libbasic,
1542 # link_whole : [libsystemd_static,
1543 # libjournal_client],
1544 # dependencies : [threads,
1548 # link_depends : libsystemd_sym,
1550 link_with : [libbasic],
1551 link_whole : [libelogind_static],
1552 dependencies : [threads],
1553 link_depends : libelogind_sym,
1556 install_dir : rootlibdir)
1558 ############################################################
1560 # binaries that have --help and are intended for use by humans,
1561 # usually, but not always, installed in /bin.
1562 public_programs = []
1564 #if 0 /// UNNEEDED by elogind
1565 # subdir('src/libudev')
1567 # elogind depends on external libudev:
1568 libudev = dependency('libudev', required : true)
1570 subdir('src/shared')
1571 #if 0 /// UNNEEDED by elogind
1572 # subdir('src/core')
1573 # subdir('src/udev')
1574 # subdir('src/network')
1576 # subdir('src/analyze')
1577 # subdir('src/journal-remote')
1578 # subdir('src/coredump')
1579 # subdir('src/hostname')
1580 # subdir('src/import')
1581 # subdir('src/kernel-install')
1582 # subdir('src/locale')
1583 # subdir('src/machine')
1584 # subdir('src/nspawn')
1585 # subdir('src/resolve')
1586 # subdir('src/timedate')
1587 # subdir('src/timesync')
1588 # subdir('src/vconsole')
1589 # subdir('src/boot/efi')
1593 #if 0 /// UNNEEDED by elogind
1594 # subdir('src/fuzz')
1599 ############################################################
1601 # only static linking apart from libdl, to make sure that the
1602 # module is linked to all libraries that it uses.
1603 test_dlopen = executable(
1606 include_directories : includes,
1607 link_with : [libbasic],
1608 dependencies : [libdl])
1610 #if 0 /// UNNEEDED by elogind
1611 # foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1612 # ['systemd', 'ENABLE_NSS_SYSTEMD'],
1613 # ['mymachines', 'ENABLE_MACHINED'],
1614 # ['resolve', 'ENABLE_RESOLVE']]
1616 # condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1620 # sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1621 # version_script_arg = join_paths(meson.current_source_dir(), sym)
1623 # nss = shared_library(
1625 # 'src/nss-@0@/nss-@0@.c'.format(module),
1627 # include_directories : includes,
1628 # # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1629 # link_args : ['-Wl,-z,nodelete',
1631 # '-Wl,--version-script=' + version_script_arg,
1632 # '-Wl,--undefined'],
1633 # link_with : [libsystemd_static,
1635 # dependencies : [threads,
1637 # link_depends : sym,
1639 # install_dir : rootlibdir)
1641 # # We cannot use shared_module because it does not support version suffix.
1642 # # Unfortunately shared_library insists on creating the symlink…
1643 # meson.add_install_script('sh', '-c',
1644 # 'rm $DESTDIR@0@/libnss_@1@.so'
1645 # .format(rootlibdir, module))
1647 # test('dlopen-nss_' + module,
1649 # args : [nss.full_path()]) # path to dlopen must include a slash
1654 ############################################################
1656 #if 0 /// UNNEEDED by elogind
1657 # executable('systemd',
1659 # include_directories : includes,
1660 # link_with : [libcore,
1662 # dependencies : [threads,
1668 # install_rpath : rootlibexecdir,
1670 # install_dir : rootlibexecdir)
1672 # meson.add_install_script(meson_make_symlink,
1673 # join_paths(rootlibexecdir, 'systemd'),
1674 # join_paths(rootsbindir, 'init'))
1676 # exe = executable('systemd-analyze',
1677 # systemd_analyze_sources,
1678 # include_directories : includes,
1679 # link_with : [libcore,
1681 # dependencies : [threads,
1687 # install_rpath : rootlibexecdir,
1689 # public_programs += [exe]
1691 # executable('systemd-journald',
1692 # systemd_journald_sources,
1693 # include_directories : includes,
1694 # link_with : [libjournal_core,
1696 # dependencies : [threads,
1700 # install_rpath : rootlibexecdir,
1702 # install_dir : rootlibexecdir)
1704 # exe = executable('systemd-cat',
1705 # systemd_cat_sources,
1706 # include_directories : includes,
1707 # link_with : [libjournal_core,
1709 # dependencies : [threads],
1710 # install_rpath : rootlibexecdir,
1712 # public_programs += [exe]
1714 # exe = executable('journalctl',
1715 # journalctl_sources,
1716 # include_directories : includes,
1717 # link_with : [libshared],
1718 # dependencies : [threads,
1723 # install_rpath : rootlibexecdir,
1725 # install_dir : rootbindir)
1726 # public_programs += [exe]
1728 # executable('systemd-getty-generator',
1729 # 'src/getty-generator/getty-generator.c',
1730 # include_directories : includes,
1731 # link_with : [libshared],
1732 # install_rpath : rootlibexecdir,
1734 # install_dir : systemgeneratordir)
1736 # executable('systemd-debug-generator',
1737 # 'src/debug-generator/debug-generator.c',
1738 # include_directories : includes,
1739 # link_with : [libshared],
1740 # install_rpath : rootlibexecdir,
1742 # install_dir : systemgeneratordir)
1744 # executable('systemd-fstab-generator',
1745 # 'src/fstab-generator/fstab-generator.c',
1746 # 'src/core/mount-setup.c',
1747 # include_directories : includes,
1748 # link_with : [libshared],
1749 # install_rpath : rootlibexecdir,
1751 # install_dir : systemgeneratordir)
1753 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1754 # executable('30-systemd-environment-d-generator',
1755 # 'src/environment-d-generator/environment-d-generator.c',
1756 # include_directories : includes,
1757 # link_with : [libshared],
1758 # install_rpath : rootlibexecdir,
1760 # install_dir : userenvgeneratordir)
1762 # meson.add_install_script(meson_make_symlink,
1763 # join_paths(sysconfdir, 'environment'),
1764 # join_paths(environmentdir, '99-environment.conf'))
1767 # if conf.get('ENABLE_HIBERNATE') == 1
1768 # executable('systemd-hibernate-resume-generator',
1769 # 'src/hibernate-resume/hibernate-resume-generator.c',
1770 # include_directories : includes,
1771 # link_with : [libshared],
1772 # install_rpath : rootlibexecdir,
1774 # install_dir : systemgeneratordir)
1776 # executable('systemd-hibernate-resume',
1777 # 'src/hibernate-resume/hibernate-resume.c',
1778 # include_directories : includes,
1779 # link_with : [libshared],
1780 # install_rpath : rootlibexecdir,
1782 # install_dir : rootlibexecdir)
1785 # if conf.get('HAVE_BLKID') == 1
1786 # executable('systemd-gpt-auto-generator',
1787 # 'src/gpt-auto-generator/gpt-auto-generator.c',
1788 # 'src/basic/blkid-util.h',
1789 # include_directories : includes,
1790 # link_with : [libshared],
1791 # dependencies : libblkid,
1792 # install_rpath : rootlibexecdir,
1794 # install_dir : systemgeneratordir)
1796 # exe = executable('systemd-dissect',
1797 # 'src/dissect/dissect.c',
1798 # include_directories : includes,
1799 # link_with : [libshared],
1800 # install_rpath : rootlibexecdir,
1802 # install_dir : rootlibexecdir)
1803 # public_programs += [exe]
1806 # if conf.get('ENABLE_RESOLVE') == 1
1807 # executable('systemd-resolved',
1808 # systemd_resolved_sources,
1809 # include_directories : includes,
1810 # link_with : [libshared,
1812 # libsystemd_resolve_core],
1813 # dependencies : [threads,
1817 # install_rpath : rootlibexecdir,
1819 # install_dir : rootlibexecdir)
1821 # exe = executable('systemd-resolve',
1822 # systemd_resolve_sources,
1823 # include_directories : includes,
1824 # link_with : [libshared,
1826 # libsystemd_resolve_core],
1827 # dependencies : [threads,
1831 # install_rpath : rootlibexecdir,
1833 # public_programs += [exe]
1835 # meson.add_install_script(meson_make_symlink,
1836 # join_paths(bindir, 'systemd-resolve'),
1837 # join_paths(rootsbindir, 'resolvconf'))
1840 # if conf.get('ENABLE_LOGIND') == 1
1841 # executable('systemd-logind',
1842 # systemd_logind_sources,
1843 # include_directories : includes,
1844 # link_with : [liblogind_core,
1846 # dependencies : [threads,
1848 # install_rpath : rootlibexecdir,
1850 # install_dir : rootlibexecdir)
1852 # exe = executable('loginctl',
1854 # include_directories : includes,
1855 # link_with : [libshared],
1856 # dependencies : [threads,
1859 # install_rpath : rootlibexecdir,
1861 # install_dir : rootbindir)
1862 # public_programs += [exe]
1864 # exe = executable('systemd-inhibit',
1865 # 'src/login/inhibit.c',
1866 # include_directories : includes,
1867 # link_with : [libshared],
1868 # install_rpath : rootlibexecdir,
1870 # install_dir : rootbindir)
1871 # public_programs += [exe]
1873 # if conf.get('HAVE_PAM') == 1
1874 # version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1875 # pam_systemd = shared_library(
1879 # include_directories : includes,
1880 # link_args : ['-shared',
1881 # '-Wl,--version-script=' + version_script_arg],
1882 # link_with : [libsystemd_static,
1883 # libshared_static],
1884 # dependencies : [threads,
1887 # link_depends : pam_systemd_sym,
1889 # install_dir : pamlibdir)
1891 # test('dlopen-pam_systemd',
1893 # args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1898 executable('elogind',
1900 include_directories : includes,
1901 link_with : [liblogind_core,
1903 dependencies : [threads,
1906 install_rpath : rootlibexecdir,
1908 install_dir : rootlibexecdir)
1910 exe = executable('loginctl',
1912 include_directories : includes,
1913 link_with : [libshared],
1914 dependencies : [threads,
1916 install_rpath : rootlibexecdir,
1918 install_dir : rootbindir)
1919 public_programs += [exe]
1921 exe = executable('elogind-inhibit',
1922 'src/login/inhibit.c',
1923 include_directories : includes,
1924 link_with : [libshared],
1925 dependencies : [threads],
1926 install_rpath : rootlibexecdir,
1928 install_dir : rootbindir)
1929 public_programs += [exe]
1931 if conf.get('HAVE_PAM') == 1
1932 version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1933 pam_elogind = shared_library(
1937 include_directories : includes,
1938 link_args : ['-shared',
1939 '-Wl,--version-script=' + version_script_arg],
1940 link_with : [libelogind_static,
1942 dependencies : [threads,
1945 link_depends : pam_elogind_sym,
1947 install_dir : pamlibdir)
1949 test('dlopen-pam_elogind',
1951 args : [pam_elogind.full_path()]) # path to dlopen must include a slash
1954 #if 0 /// UNNEEDED by elogind
1955 # executable('systemd-user-sessions',
1956 # 'src/user-sessions/user-sessions.c',
1957 # include_directories : includes,
1958 # link_with : [libshared],
1959 # install_rpath : rootlibexecdir,
1961 # install_dir : rootlibexecdir)
1964 # if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1965 # exe = executable('bootctl',
1966 # 'src/boot/bootctl.c',
1967 # include_directories : includes,
1968 # link_with : [libshared],
1969 # dependencies : [libblkid],
1970 # install_rpath : rootlibexecdir,
1972 # public_programs += [exe]
1975 # exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1976 # include_directories : includes,
1977 # link_with : [libshared],
1978 # dependencies : [threads],
1979 # install_rpath : rootlibexecdir,
1981 # public_programs += [exe]
1983 # exe = executable('systemctl', 'src/systemctl/systemctl.c',
1984 # include_directories : includes,
1985 # link_with : [libshared],
1986 # dependencies : [threads,
1991 # install_rpath : rootlibexecdir,
1993 # install_dir : rootbindir)
1994 # public_programs += [exe]
1996 # foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit']
1997 # meson.add_install_script(meson_make_symlink,
1998 # join_paths(rootbindir, 'systemctl'),
1999 # join_paths(rootsbindir, alias))
2002 # if conf.get('ENABLE_BACKLIGHT') == 1
2003 # executable('systemd-backlight',
2004 # 'src/backlight/backlight.c',
2005 # include_directories : includes,
2006 # link_with : [libshared],
2007 # install_rpath : rootlibexecdir,
2009 # install_dir : rootlibexecdir)
2012 # if conf.get('ENABLE_RFKILL') == 1
2013 # executable('systemd-rfkill',
2014 # 'src/rfkill/rfkill.c',
2015 # include_directories : includes,
2016 # link_with : [libshared],
2017 # install_rpath : rootlibexecdir,
2019 # install_dir : rootlibexecdir)
2022 # executable('systemd-system-update-generator',
2023 # 'src/system-update-generator/system-update-generator.c',
2024 # include_directories : includes,
2025 # link_with : [libshared],
2026 # install_rpath : rootlibexecdir,
2028 # install_dir : systemgeneratordir)
2030 # if conf.get('HAVE_LIBCRYPTSETUP') == 1
2031 # executable('systemd-cryptsetup',
2032 # 'src/cryptsetup/cryptsetup.c',
2033 # include_directories : includes,
2034 # link_with : [libshared],
2035 # dependencies : [libcryptsetup],
2036 # install_rpath : rootlibexecdir,
2038 # install_dir : rootlibexecdir)
2040 # executable('systemd-cryptsetup-generator',
2041 # 'src/cryptsetup/cryptsetup-generator.c',
2042 # include_directories : includes,
2043 # link_with : [libshared],
2044 # dependencies : [libcryptsetup],
2045 # install_rpath : rootlibexecdir,
2047 # install_dir : systemgeneratordir)
2049 # executable('systemd-veritysetup',
2050 # 'src/veritysetup/veritysetup.c',
2051 # include_directories : includes,
2052 # link_with : [libshared],
2053 # dependencies : [libcryptsetup],
2054 # install_rpath : rootlibexecdir,
2056 # install_dir : rootlibexecdir)
2058 # executable('systemd-veritysetup-generator',
2059 # 'src/veritysetup/veritysetup-generator.c',
2060 # include_directories : includes,
2061 # link_with : [libshared],
2062 # dependencies : [libcryptsetup],
2063 # install_rpath : rootlibexecdir,
2065 # install_dir : systemgeneratordir)
2068 # if conf.get('HAVE_SYSV_COMPAT') == 1
2069 # executable('systemd-sysv-generator',
2070 # 'src/sysv-generator/sysv-generator.c',
2071 # include_directories : includes,
2072 # link_with : [libshared],
2073 # install_rpath : rootlibexecdir,
2075 # install_dir : systemgeneratordir)
2077 # executable('systemd-rc-local-generator',
2078 # 'src/rc-local-generator/rc-local-generator.c',
2079 # include_directories : includes,
2080 # link_with : [libshared],
2081 # install_rpath : rootlibexecdir,
2083 # install_dir : systemgeneratordir)
2086 # if conf.get('ENABLE_HOSTNAMED') == 1
2087 # executable('systemd-hostnamed',
2088 # 'src/hostname/hostnamed.c',
2089 # include_directories : includes,
2090 # link_with : [libshared],
2091 # install_rpath : rootlibexecdir,
2093 # install_dir : rootlibexecdir)
2095 # exe = executable('hostnamectl',
2096 # 'src/hostname/hostnamectl.c',
2097 # include_directories : includes,
2098 # link_with : [libshared],
2099 # install_rpath : rootlibexecdir,
2101 # public_programs += [exe]
2104 # if conf.get('ENABLE_LOCALED') == 1
2105 # if conf.get('HAVE_XKBCOMMON') == 1
2106 # # logind will load libxkbcommon.so dynamically on its own
2112 # executable('systemd-localed',
2113 # systemd_localed_sources,
2114 # include_directories : includes,
2115 # link_with : [libshared],
2116 # dependencies : deps,
2117 # install_rpath : rootlibexecdir,
2119 # install_dir : rootlibexecdir)
2121 # exe = executable('localectl',
2122 # localectl_sources,
2123 # include_directories : includes,
2124 # link_with : [libshared],
2125 # install_rpath : rootlibexecdir,
2127 # public_programs += [exe]
2130 # if conf.get('ENABLE_TIMEDATED') == 1
2131 # executable('systemd-timedated',
2132 # 'src/timedate/timedated.c',
2133 # include_directories : includes,
2134 # link_with : [libshared],
2135 # install_rpath : rootlibexecdir,
2137 # install_dir : rootlibexecdir)
2139 # exe = executable('timedatectl',
2140 # 'src/timedate/timedatectl.c',
2141 # include_directories : includes,
2142 # install_rpath : rootlibexecdir,
2143 # link_with : [libshared],
2145 # public_programs += [exe]
2148 # if conf.get('ENABLE_TIMESYNCD') == 1
2149 # executable('systemd-timesyncd',
2150 # systemd_timesyncd_sources,
2151 # include_directories : includes,
2152 # link_with : [libshared],
2153 # dependencies : [threads,
2155 # install_rpath : rootlibexecdir,
2157 # install_dir : rootlibexecdir)
2159 # executable('systemd-time-wait-sync',
2160 # 'src/time-wait-sync/time-wait-sync.c',
2161 # include_directories : includes,
2162 # link_with : [libshared],
2163 # install_rpath : rootlibexecdir,
2165 # install_dir : rootlibexecdir)
2168 # if conf.get('ENABLE_MACHINED') == 1
2169 # executable('systemd-machined',
2170 # systemd_machined_sources,
2171 # include_directories : includes,
2172 # link_with : [libmachine_core,
2174 # install_rpath : rootlibexecdir,
2176 # install_dir : rootlibexecdir)
2178 # exe = executable('machinectl',
2179 # 'src/machine/machinectl.c',
2180 # include_directories : includes,
2181 # link_with : [libshared],
2182 # dependencies : [threads,
2185 # install_rpath : rootlibexecdir,
2187 # install_dir : rootbindir)
2188 # public_programs += [exe]
2191 # if conf.get('ENABLE_IMPORTD') == 1
2192 # executable('systemd-importd',
2193 # systemd_importd_sources,
2194 # include_directories : includes,
2195 # link_with : [libshared],
2196 # dependencies : [threads],
2197 # install_rpath : rootlibexecdir,
2199 # install_dir : rootlibexecdir)
2201 # systemd_pull = executable('systemd-pull',
2202 # systemd_pull_sources,
2203 # include_directories : includes,
2204 # link_with : [libshared],
2205 # dependencies : [libcurl,
2210 # install_rpath : rootlibexecdir,
2212 # install_dir : rootlibexecdir)
2214 # systemd_import = executable('systemd-import',
2215 # systemd_import_sources,
2216 # include_directories : includes,
2217 # link_with : [libshared],
2218 # dependencies : [libcurl,
2222 # install_rpath : rootlibexecdir,
2224 # install_dir : rootlibexecdir)
2226 # systemd_export = executable('systemd-export',
2227 # systemd_export_sources,
2228 # include_directories : includes,
2229 # link_with : [libshared],
2230 # dependencies : [libcurl,
2234 # install_rpath : rootlibexecdir,
2236 # install_dir : rootlibexecdir)
2237 # public_programs += [systemd_pull, systemd_import, systemd_export]
2240 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2241 # exe = executable('systemd-journal-upload',
2242 # systemd_journal_upload_sources,
2243 # include_directories : includes,
2244 # link_with : [libshared],
2245 # dependencies : [threads,
2250 # install_rpath : rootlibexecdir,
2252 # install_dir : rootlibexecdir)
2253 # public_programs += [exe]
2256 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2257 # s_j_remote = executable('systemd-journal-remote',
2258 # systemd_journal_remote_sources,
2259 # include_directories : includes,
2260 # link_with : [libshared],
2261 # dependencies : [threads,
2266 # install_rpath : rootlibexecdir,
2268 # install_dir : rootlibexecdir)
2270 # s_j_gatewayd = executable('systemd-journal-gatewayd',
2271 # systemd_journal_gatewayd_sources,
2272 # include_directories : includes,
2273 # link_with : [libshared],
2274 # dependencies : [threads,
2279 # install_rpath : rootlibexecdir,
2281 # install_dir : rootlibexecdir)
2282 # public_programs += [s_j_remote, s_j_gatewayd]
2285 # if conf.get('ENABLE_COREDUMP') == 1
2286 # executable('systemd-coredump',
2287 # systemd_coredump_sources,
2288 # include_directories : includes,
2289 # link_with : [libshared],
2290 # dependencies : [threads,
2295 # install_rpath : rootlibexecdir,
2297 # install_dir : rootlibexecdir)
2299 # exe = executable('coredumpctl',
2300 # coredumpctl_sources,
2301 # include_directories : includes,
2302 # link_with : [libshared],
2303 # dependencies : [threads,
2306 # install_rpath : rootlibexecdir,
2308 # public_programs += [exe]
2311 # if conf.get('ENABLE_BINFMT') == 1
2312 # exe = executable('systemd-binfmt',
2313 # 'src/binfmt/binfmt.c',
2314 # include_directories : includes,
2315 # link_with : [libshared],
2316 # install_rpath : rootlibexecdir,
2318 # install_dir : rootlibexecdir)
2319 # public_programs += [exe]
2321 # meson.add_install_script('sh', '-c',
2322 # mkdir_p.format(binfmtdir))
2323 # meson.add_install_script('sh', '-c',
2324 # mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2327 # if conf.get('ENABLE_VCONSOLE') == 1
2328 # executable('systemd-vconsole-setup',
2329 # 'src/vconsole/vconsole-setup.c',
2330 # include_directories : includes,
2331 # link_with : [libshared],
2332 # install_rpath : rootlibexecdir,
2334 # install_dir : rootlibexecdir)
2337 # if conf.get('ENABLE_RANDOMSEED') == 1
2338 # executable('systemd-random-seed',
2339 # 'src/random-seed/random-seed.c',
2340 # include_directories : includes,
2341 # link_with : [libshared],
2342 # install_rpath : rootlibexecdir,
2344 # install_dir : rootlibexecdir)
2347 # if conf.get('ENABLE_FIRSTBOOT') == 1
2348 # executable('systemd-firstboot',
2349 # 'src/firstboot/firstboot.c',
2350 # include_directories : includes,
2351 # link_with : [libshared],
2352 # dependencies : [libcrypt],
2353 # install_rpath : rootlibexecdir,
2355 # install_dir : rootbindir)
2358 # executable('systemd-remount-fs',
2359 # 'src/remount-fs/remount-fs.c',
2360 # 'src/core/mount-setup.c',
2361 # 'src/core/mount-setup.h',
2362 # include_directories : includes,
2363 # link_with : [libshared],
2364 # install_rpath : rootlibexecdir,
2366 # install_dir : rootlibexecdir)
2368 # executable('systemd-machine-id-setup',
2369 # 'src/machine-id-setup/machine-id-setup-main.c',
2370 # 'src/core/machine-id-setup.c',
2371 # 'src/core/machine-id-setup.h',
2372 # include_directories : includes,
2373 # link_with : [libshared],
2374 # install_rpath : rootlibexecdir,
2376 # install_dir : rootbindir)
2378 # executable('systemd-fsck',
2379 # 'src/fsck/fsck.c',
2380 # include_directories : includes,
2381 # link_with : [libshared],
2382 # install_rpath : rootlibexecdir,
2384 # install_dir : rootlibexecdir)
2386 # executable('elogind-growfs',
2387 # 'src/partition/growfs.c',
2388 # include_directories : includes,
2389 # link_with : [libshared],
2390 # dependencies : [libcryptsetup],
2391 # install_rpath : rootlibexecdir,
2393 # install_dir : rootlibexecdir)
2395 # executable('elogind-makefs',
2396 # 'src/partition/makefs.c',
2397 # include_directories : includes,
2398 # link_with : [libshared],
2399 # install_rpath : rootlibexecdir,
2401 # install_dir : rootlibexecdir)
2403 # executable('systemd-sleep',
2404 # 'src/sleep/sleep.c',
2405 # include_directories : includes,
2406 # link_with : [libshared],
2407 # install_rpath : rootlibexecdir,
2409 # install_dir : rootlibexecdir)
2411 # exe = executable('systemd-sysctl',
2412 # 'src/sysctl/sysctl.c',
2413 # include_directories : includes,
2414 # link_with : [libshared],
2415 # install_rpath : rootlibexecdir,
2417 # install_dir : rootlibexecdir)
2418 # public_programs += [exe]
2420 # executable('systemd-ac-power',
2421 # 'src/ac-power/ac-power.c',
2422 # include_directories : includes,
2423 # link_with : [libshared],
2424 # install_rpath : rootlibexecdir,
2426 # install_dir : rootlibexecdir)
2428 # exe = executable('systemd-detect-virt',
2429 # 'src/detect-virt/detect-virt.c',
2430 # include_directories : includes,
2431 # link_with : [libshared],
2432 # install_rpath : rootlibexecdir,
2434 # public_programs += [exe]
2436 # exe = executable('systemd-delta',
2437 # 'src/delta/delta.c',
2438 # include_directories : includes,
2439 # link_with : [libshared],
2440 # install_rpath : rootlibexecdir,
2442 # public_programs += [exe]
2444 # exe = executable('systemd-escape',
2445 # 'src/escape/escape.c',
2446 # include_directories : includes,
2447 # link_with : [libshared],
2448 # install_rpath : rootlibexecdir,
2450 # install_dir : rootbindir)
2451 # public_programs += [exe]
2453 # exe = executable('systemd-notify',
2454 # 'src/notify/notify.c',
2455 # include_directories : includes,
2456 # link_with : [libshared],
2457 # install_rpath : rootlibexecdir,
2459 # install_dir : rootbindir)
2460 # public_programs += [exe]
2462 # executable('systemd-volatile-root',
2463 # 'src/volatile-root/volatile-root.c',
2464 # include_directories : includes,
2465 # link_with : [libshared],
2466 # install_rpath : rootlibexecdir,
2468 # install_dir : rootlibexecdir)
2470 # executable('systemd-cgroups-agent',
2471 # 'src/cgroups-agent/cgroups-agent.c',
2472 # include_directories : includes,
2473 # link_with : [libshared],
2474 # install_rpath : rootlibexecdir,
2476 # install_dir : rootlibexecdir)
2478 executable('elogind-cgroups-agent',
2479 'src/cgroups-agent/cgroups-agent.c',
2480 include_directories : includes,
2481 link_with : [libshared],
2482 install_rpath : rootlibexecdir,
2484 install_dir : rootlibexecdir)
2487 #if 0 /// UNNEEDED by elogind
2488 # exe = executable('systemd-path',
2489 # 'src/path/path.c',
2490 # include_directories : includes,
2491 # link_with : [libshared],
2492 # install_rpath : rootlibexecdir,
2494 # public_programs += [exe]
2496 # exe = executable('systemd-ask-password',
2497 # 'src/ask-password/ask-password.c',
2498 # include_directories : includes,
2499 # link_with : [libshared],
2500 # install_rpath : rootlibexecdir,
2502 # install_dir : rootbindir)
2503 # public_programs += [exe]
2505 # executable('systemd-reply-password',
2506 # 'src/reply-password/reply-password.c',
2507 # include_directories : includes,
2508 # link_with : [libshared],
2509 # install_rpath : rootlibexecdir,
2511 # install_dir : rootlibexecdir)
2513 # exe = executable('systemd-tty-ask-password-agent',
2514 # 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2515 # include_directories : includes,
2516 # link_with : [libshared],
2517 # install_rpath : rootlibexecdir,
2519 # install_dir : rootbindir)
2520 # public_programs += [exe]
2522 # exe = executable('systemd-cgls',
2523 # 'src/cgls/cgls.c',
2524 # include_directories : includes,
2525 # link_with : [libshared],
2526 # install_rpath : rootlibexecdir,
2528 # public_programs += [exe]
2530 # exe = executable('systemd-cgtop',
2531 # 'src/cgtop/cgtop.c',
2532 # include_directories : includes,
2533 # link_with : [libshared],
2534 # install_rpath : rootlibexecdir,
2536 # public_programs += [exe]
2538 # executable('systemd-initctl',
2539 # 'src/initctl/initctl.c',
2540 # include_directories : includes,
2541 # link_with : [libshared],
2542 # install_rpath : rootlibexecdir,
2544 # install_dir : rootlibexecdir)
2546 # exe = executable('systemd-mount',
2547 # 'src/mount/mount-tool.c',
2548 # include_directories : includes,
2549 # link_with : [libshared],
2550 # install_rpath : rootlibexecdir,
2552 # public_programs += [exe]
2554 # meson.add_install_script(meson_make_symlink,
2555 # 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2557 # exe = executable('systemd-run',
2559 # include_directories : includes,
2560 # link_with : [libshared],
2561 # install_rpath : rootlibexecdir,
2563 # public_programs += [exe]
2565 # exe = executable('systemd-stdio-bridge',
2566 # 'src/stdio-bridge/stdio-bridge.c',
2567 # include_directories : includes,
2568 # link_with : [libshared],
2569 # install_rpath : rootlibexecdir,
2571 # public_programs += [exe]
2573 # exe = executable('busctl',
2574 # 'src/busctl/busctl.c',
2575 # 'src/busctl/busctl-introspect.c',
2576 # 'src/busctl/busctl-introspect.h',
2577 # include_directories : includes,
2578 # link_with : [libshared],
2579 # install_rpath : rootlibexecdir,
2581 # public_programs += [exe]
2583 # if conf.get('ENABLE_SYSUSERS') == 1
2584 # exe = executable('systemd-sysusers',
2585 # 'src/sysusers/sysusers.c',
2586 # include_directories : includes,
2587 # link_with : [libshared],
2588 # install_rpath : rootlibexecdir,
2590 # install_dir : rootbindir)
2591 # public_programs += [exe]
2594 # if conf.get('ENABLE_TMPFILES') == 1
2595 # exe = executable('systemd-tmpfiles',
2596 # 'src/tmpfiles/tmpfiles.c',
2597 # include_directories : includes,
2598 # link_with : [libshared],
2599 # dependencies : [libacl],
2600 # install_rpath : rootlibexecdir,
2602 # install_dir : rootbindir)
2603 # public_programs += [exe]
2605 # test('test-systemd-tmpfiles',
2606 # test_systemd_tmpfiles_py,
2607 # args : exe.full_path())
2608 # # https://github.com/mesonbuild/meson/issues/2681
2611 # if conf.get('ENABLE_HWDB') == 1
2612 # exe = executable('systemd-hwdb',
2613 # 'src/hwdb/hwdb.c',
2614 # 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2615 # include_directories : includes,
2616 # link_with : [libudev_static],
2617 # install_rpath : udev_rpath,
2619 # install_dir : rootbindir)
2620 # public_programs += [exe]
2623 # if conf.get('ENABLE_QUOTACHECK') == 1
2624 # executable('systemd-quotacheck',
2625 # 'src/quotacheck/quotacheck.c',
2626 # include_directories : includes,
2627 # link_with : [libshared],
2628 # install_rpath : rootlibexecdir,
2630 # install_dir : rootlibexecdir)
2633 # exe = executable('systemd-socket-proxyd',
2634 # 'src/socket-proxy/socket-proxyd.c',
2635 # include_directories : includes,
2636 # link_with : [libshared],
2637 # dependencies : [threads],
2638 # install_rpath : rootlibexecdir,
2640 # install_dir : rootlibexecdir)
2641 # public_programs += [exe]
2643 # exe = executable('systemd-udevd',
2644 # systemd_udevd_sources,
2645 # include_directories : includes,
2646 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2647 # link_with : [libudev_core,
2648 # libsystemd_network,
2650 # dependencies : [threads,
2655 # install_rpath : udev_rpath,
2657 # install_dir : rootlibexecdir)
2658 # public_programs += [exe]
2660 # exe = executable('udevadm',
2662 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2663 # include_directories : includes,
2664 # link_with : [libudev_core,
2665 # libsystemd_network,
2667 # dependencies : [threads,
2672 # install_rpath : udev_rpath,
2674 # install_dir : rootbindir)
2675 # public_programs += [exe]
2677 # executable('systemd-shutdown',
2678 # systemd_shutdown_sources,
2679 # include_directories : includes,
2680 # link_with : [libshared],
2681 # dependencies : [libmount],
2682 # install_rpath : rootlibexecdir,
2684 # install_dir : rootlibexecdir)
2686 # executable('systemd-update-done',
2687 # 'src/update-done/update-done.c',
2688 # include_directories : includes,
2689 # link_with : [libshared],
2690 # install_rpath : rootlibexecdir,
2692 # install_dir : rootlibexecdir)
2694 # executable('systemd-update-utmp',
2695 # 'src/update-utmp/update-utmp.c',
2696 # include_directories : includes,
2697 # link_with : [libshared],
2698 # dependencies : [libaudit],
2699 # install_rpath : rootlibexecdir,
2701 # install_dir : rootlibexecdir)
2703 # if conf.get('HAVE_KMOD') == 1
2704 # executable('systemd-modules-load',
2705 # 'src/modules-load/modules-load.c',
2706 # include_directories : includes,
2707 # link_with : [libshared],
2708 # dependencies : [libkmod],
2709 # install_rpath : rootlibexecdir,
2711 # install_dir : rootlibexecdir)
2713 # meson.add_install_script('sh', '-c',
2714 # mkdir_p.format(modulesloaddir))
2715 # meson.add_install_script('sh', '-c',
2716 # mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2719 # exe = executable('systemd-nspawn',
2720 # systemd_nspawn_sources,
2721 # 'src/core/mount-setup.c', # FIXME: use a variable?
2722 # 'src/core/mount-setup.h',
2723 # 'src/core/loopback-setup.c',
2724 # 'src/core/loopback-setup.h',
2725 # include_directories : [includes, include_directories('src/nspawn')],
2726 # link_with : [libshared],
2727 # dependencies : [libacl,
2731 # install_rpath : rootlibexecdir,
2733 # public_programs += [exe]
2735 # if conf.get('ENABLE_NETWORKD') == 1
2736 # executable('systemd-networkd',
2737 # systemd_networkd_sources,
2738 # include_directories : includes,
2739 # link_with : [libnetworkd_core,
2740 # libsystemd_network,
2743 # dependencies : [threads],
2744 # install_rpath : rootlibexecdir,
2746 # install_dir : rootlibexecdir)
2748 # executable('systemd-networkd-wait-online',
2749 # systemd_networkd_wait_online_sources,
2750 # include_directories : includes,
2751 # link_with : [libnetworkd_core,
2753 # install_rpath : rootlibexecdir,
2755 # install_dir : rootlibexecdir)
2757 # exe = executable('networkctl',
2758 # networkctl_sources,
2759 # include_directories : includes,
2760 # link_with : [libsystemd_network,
2762 # install_rpath : rootlibexecdir,
2764 # install_dir : rootbindir)
2765 # public_programs += [exe]
2768 # executable('systemd-sulogin-shell',
2769 # ['src/sulogin-shell/sulogin-shell.c'],
2770 # include_directories : includes,
2771 # link_with : [libshared],
2772 # install_rpath : rootlibexecdir,
2774 # install_dir : rootlibexecdir)
2776 executable('elogind-uaccess-command',
2777 'src/uaccess-command/uaccess-command.c',
2778 include_directories : includes,
2779 link_with : [liblogind_core,
2781 dependencies: [libacl,
2783 install_rpath : rootlibexecdir,
2785 install_dir : rootlibexecdir)
2788 ############################################################
2790 foreach tuple : tests
2792 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2793 dependencies = tuple[2]
2794 condition = tuple.length() >= 4 ? tuple[3] : ''
2795 type = tuple.length() >= 5 ? tuple[4] : ''
2796 defs = tuple.length() >= 6 ? tuple[5] : []
2797 incs = tuple.length() >= 7 ? tuple[6] : includes
2800 name = sources[0].split('/')[-1].split('.')[0]
2801 if type.startswith('timeout=')
2802 timeout = type.split('=')[1].to_int()
2805 if want_tests == 'false'
2806 message('Not compiling @0@ because tests is set to false'.format(name))
2807 elif condition == '' or conf.get(condition) == 1
2811 include_directories : incs,
2812 link_with : link_with,
2813 dependencies : dependencies,
2815 install_rpath : rootlibexecdir,
2816 install : install_tests,
2817 install_dir : join_paths(testsdir, type))
2820 message('@0@ is a manual test'.format(name))
2821 elif type == 'unsafe' and want_tests != 'unsafe'
2822 message('@0@ is an unsafe test'.format(name))
2829 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2833 #if 0 /// UNNEEDED by elogind
2834 # test_libsystemd_sym = executable(
2835 # 'test-libsystemd-sym',
2836 # test_libsystemd_sym_c,
2837 # include_directories : includes,
2838 # link_with : [libsystemd],
2839 # install : install_tests,
2840 # install_dir : testsdir)
2841 # test('test-libsystemd-sym',
2842 # test_libsystemd_sym)
2844 # test_libudev_sym = executable(
2845 # 'test-libudev-sym',
2846 # test_libudev_sym_c,
2847 # include_directories : includes,
2848 # c_args : ['-Wno-deprecated-declarations'],
2849 # link_with : [libudev],
2850 # install : install_tests,
2851 # install_dir : testsdir)
2852 # test('test-libudev-sym',
2855 # ############################################################
2859 # foreach tuple : fuzzers
2860 # sources = tuple[0]
2861 # link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2862 # dependencies = tuple[2]
2863 # defs = tuple.length() >= 4 ? tuple[3] : []
2864 # incs = tuple.length() >= 5 ? tuple[4] : includes
2867 # dependencies += fuzzing_engine
2869 # sources += 'src/fuzz/fuzz-main.c'
2872 # name = sources[0].split('/')[-1].split('.')[0]
2874 # fuzzer_exes += executable(
2877 # include_directories : [incs, include_directories('src/fuzz')],
2878 # link_with : link_with,
2879 # dependencies : dependencies,
2884 # run_target('fuzzers',
2885 # depends : fuzzer_exes,
2886 # command : ['true'])
2888 # ############################################################
2891 test_libelogind_sym = executable(
2892 'test-libelogind-sym',
2893 test_libelogind_sym_c,
2894 include_directories : includes,
2895 link_with : [libelogind],
2896 install : install_tests,
2897 install_dir : testsdir)
2898 test('test-libelogind-sym',
2899 test_libelogind_sym)
2901 make_directive_index_py = find_program('tools/make-directive-index.py')
2902 make_man_index_py = find_program('tools/make-man-index.py')
2903 xml_helper_py = find_program('tools/xml_helper.py')
2904 #if 0 /// UNNEEDED by elogind
2905 # hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2908 # subdir('sysctl.d')
2909 # subdir('sysusers.d')
2910 # subdir('tmpfiles.d')
2916 subdir('shell-completion/bash')
2917 subdir('shell-completion/zsh')
2918 #if 0 /// UNNEEDED by elogind
2920 subdir('doc/sysvinit')
2921 subdir('doc/var-log')
2923 # FIXME: figure out if the warning is true:
2924 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2925 install_subdir('factory/etc',
2926 install_dir : factorydir)
2929 #if 0 /// UNNEEDED by elogind
2930 # install_data('xorg/50-systemd-user.sh',
2931 # install_dir : xinitrcdir)
2932 # install_data('modprobe.d/systemd.conf',
2933 # install_dir : modprobedir)
2935 install_data('LICENSE.GPL2',
2940 #if 0 /// irrelevant for elogind
2941 # 'doc/DISTRO_PORTING',
2942 # 'doc/ENVIRONMENT.md',
2944 # 'doc/TRANSIENT-SETTINGS.md',
2945 # 'doc/TRANSLATORS',
2946 # 'doc/UIDS-GIDS.md',
2948 'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
2949 install_dir : docdir)
2951 #if 0 /// UNNEEDED by elogind
2952 # meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2954 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2956 ############################################################
2958 meson_check_help = find_program('tools/meson-check-help.sh')
2960 foreach exec : public_programs
2961 name = exec.full_path().split('/')[-1]
2962 test('check-help-' + name,
2964 args : [exec.full_path()])
2967 ############################################################
2969 #if 0 /// fuzz regression tests are not supported by elogind
2970 # # Enable tests for all supported sanitizers
2971 # foreach tuple : sanitizers
2972 # sanitizer = tuple[0]
2975 # have = run_command(check_compilation_sh,
2976 # cc.cmd_array(), '-x', 'c',
2977 # '-fsanitize=@0@'.format(sanitizer),
2978 # '-include', link_test_c).returncode() == 0
2979 # message('@0@ sanitizer supported: @1@'.format(sanitizer, have ? 'yes' : 'no'))
2983 # foreach p : fuzz_regression_tests
2984 # b = p.split('/')[-2]
2985 # c = p.split('/')[-1]
2987 # name = '@0@:@1@'.format(b, sanitizer)
2990 # if want_tests == 'false'
2991 # message('Not compiling @0@ because tests is set to false'.format(name))
2993 # exe = custom_target(
2997 # command : [env, 'ln', '-fs',
2998 # join_paths(build.full_path(), b),
3000 # build_by_default : true)
3002 # message('Not compiling @0@ because slow-tests is set to false'.format(name))
3007 # if want_tests != 'false' and slow_tests
3008 # test('@0@:@1@:@2@'.format(b, c, sanitizer),
3010 # args : [exe.full_path(),
3011 # join_paths(meson.source_root(),
3012 # 'test/fuzz-regressions',
3021 ############################################################
3024 all_files = run_command(
3026 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3029 all_files = files(all_files.stdout().split())
3034 command : [env, 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
3038 command : [env, 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
3041 #if 0 /// UNNEEDED by elogind
3043 # meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
3046 # command : [meson_git_contrib_sh])
3051 git_head = run_command(
3053 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3054 'rev-parse', 'HEAD']).stdout().strip()
3055 git_head_short = run_command(
3057 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3058 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3062 command : ['git', 'archive',
3063 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
3065 '--prefix', 'systemd-@0@/'.format(git_head),
3069 ############################################################
3071 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
3074 #if 0 /// libudev is external, elogind does not need to document it.
3075 # depends : [man, libsystemd, libudev],
3076 # command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()])
3078 depends : [man, libelogind],
3079 command : [meson_check_api_docs_sh, libelogind.full_path()])
3082 ############################################################
3085 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3087 'split /usr: @0@'.format(split_usr),
3088 'split bin-sbin: @0@'.format(split_bin),
3089 #if 0 /// UNSUPPORTED by elogind
3090 # 'prefix directory: @0@'.format(prefixdir),
3091 # 'rootprefix directory: @0@'.format(rootprefixdir),
3092 # 'sysconf directory: @0@'.format(sysconfdir),
3093 # 'include directory: @0@'.format(includedir),
3094 # 'lib directory: @0@'.format(libdir),
3095 # 'rootlib directory: @0@'.format(rootlibdir),
3096 # 'SysV init scripts: @0@'.format(sysvinit_path),
3097 # 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3099 'rootexeclib dir: @0@'.format(rootlibexecdir),
3101 #if 0 /// UNSUPPORTED by elogind
3102 # 'PAM modules directory: @0@'.format(pamlibdir),
3103 # 'PAM configuration directory: @0@'.format(pamconfdir),
3104 # 'RPM macros directory: @0@'.format(rpmmacrosdir),
3105 # 'modprobe.d directory: @0@'.format(modprobedir),
3106 # 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3107 # 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3108 # 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3109 # 'bash completions directory: @0@'.format(bashcompletiondir),
3110 # 'zsh completions directory: @0@'.format(zshcompletiondir),
3111 # 'extra start script: @0@'.format(get_option('rc-local')),
3112 # 'extra stop script: @0@'.format(get_option('halt-local')),
3113 # 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3114 # get_option('debug-tty')),
3116 'TTY GID: @0@'.format(tty_gid),
3117 #if 0 /// UNSUPPORTED by elogind
3118 # 'users GID: @0@'.format(users_gid),
3120 'maximum system UID: @0@'.format(system_uid_max),
3121 'maximum system GID: @0@'.format(system_gid_max),
3122 #if 0 /// UNSUPPORTED by elogind
3123 # 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
3124 # 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
3125 # 'minimum container UID base: @0@'.format(container_uid_base_min),
3126 # 'maximum container UID base: @0@'.format(container_uid_base_max),
3127 # '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3128 # 'render group access mode: @0@'.format(get_option('group-render-mode')),
3129 # 'certificate root directory: @0@'.format(get_option('certificate-root')),
3130 # 'support URL: @0@'.format(support_url),
3131 # 'nobody user name: @0@'.format(nobody_user),
3132 # 'nobody group name: @0@'.format(nobody_group),
3133 # 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3134 # 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
3136 # 'default DNSSEC mode: @0@'.format(default_dnssec),
3137 # 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3139 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
3141 #if 0 /// UNSUPPORTED by elogind
3142 # alt_dns_servers = '\n '.join(dns_servers.split(' '))
3143 # alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3145 # 'default DNS servers: @0@'.format(alt_dns_servers),
3146 # 'default NTP servers: @0@'.format(alt_ntp_servers)]
3148 # alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3149 # '@@0@'.format(time_epoch)).stdout().strip()
3151 # 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3155 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3156 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3157 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3159 #if 0 /// UNNEEDED by elogind
3160 # if conf.get('ENABLE_EFI') == 1
3162 # 'efi arch: @0@'.format(efi_arch)]
3166 # 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3167 # 'EFI CC @0@'.format(efi_cc),
3168 # 'EFI lib directory: @0@'.format(efi_libdir),
3169 # 'EFI lds directory: @0@'.format(efi_ldsdir),
3170 # 'EFI include directory: @0@'.format(efi_incdir)]
3179 #if 0 /// UNNEEDED by elogind
3180 # ['libcryptsetup'],
3184 #if 0 /// UNNEEDED by elogind
3189 #if 0 /// UNNEEDED by elogind
3193 #if 0 /// UNNEEDED by elogind
3200 #if 0 /// UNNEEDED by elogind
3216 # ['environment.d'],
3234 ['legacy pkla', install_polkit_pkla],
3235 #if 0 /// UNNEEDED by elogind
3237 # ['gnu-efi', have_gnu_efi],
3245 #if 0 /// UNNEEDED by elogind
3246 # ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
3250 ['man pages', want_man],
3251 ['html pages', want_html],
3252 ['man page indices', want_man and have_lxml],
3253 #if 0 /// UNNEEDED by elogind
3257 #if 0 /// UNNEEDED by elogind
3260 # ['adm group', get_option('adm-group')],
3261 # ['wheel group', get_option('wheel-group')],
3267 ['debug mmap cache'],
3270 if tuple.length() >= 2
3273 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3274 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3275 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3280 missing += [tuple[0]]
3286 'enabled features: @0@'.format(', '.join(found)),
3288 'disabled features: @0@'.format(', '.join(missing)),
3290 message('\n '.join(status))
3292 if rootprefixdir != rootprefix_default
3293 message('WARNING:\n' +
3294 ' Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3295 ' elogind used fixed names for unit file directories and other paths, so anything\n' +
3296 ' except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))