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.21.0'
32 # libudev_version = '1.6.9'
34 libelogind_version = '0.20.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 split_usr = get_option('split-usr')
74 conf.set10('HAVE_SPLIT_USR', split_usr)
76 rootprefixdir = get_option('rootprefix')
77 # Unusual rootprefixdir values are used by some distros
78 # (see https://github.com/systemd/systemd/pull/7461).
79 rootprefix_default = get_option('split-usr') ? '/' : '/usr'
80 if rootprefixdir == ''
81 rootprefixdir = rootprefix_default
84 #if 0 /// UNNEEDED by elogind
85 # sysvinit_path = get_option('sysvinit-path')
86 # sysvrcnd_path = get_option('sysvrcnd-path')
87 # have = sysvinit_path != '' and sysvrcnd_path != ''
88 # conf.set10('HAVE_SYSV_COMPAT', have,
89 # description : 'SysV init scripts and rcN.d links are supported')
90 # m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
93 # join_paths ignore the preceding arguments if an absolute component is
94 # encountered, so this should canonicalize various paths when they are
95 # absolute or relative.
96 prefixdir = get_option('prefix')
97 if not prefixdir.startswith('/')
98 error('Prefix is not absolute: "@0@"'.format(prefixdir))
100 bindir = join_paths(prefixdir, get_option('bindir'))
101 libdir = join_paths(prefixdir, get_option('libdir'))
102 sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
103 includedir = join_paths(prefixdir, get_option('includedir'))
104 datadir = join_paths(prefixdir, get_option('datadir'))
105 localstatedir = join_paths('/', get_option('localstatedir'))
107 rootbindir = join_paths(rootprefixdir, 'bin')
108 #if 0 /// elogind has a different default
109 # rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd')
111 rootlibexecdir = get_option('rootlibexecdir')
112 rootlibexecdir = rootlibexecdir != '' ? rootlibexecdir : join_paths(rootprefixdir, 'lib/elogind')
115 rootlibdir = get_option('rootlibdir')
117 rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
120 # Dirs of external packages
121 pkgconfigdatadir = join_paths(datadir, 'pkgconfig')
122 pkgconfiglibdir = join_paths(libdir, 'pkgconfig')
123 polkitpolicydir = join_paths(datadir, 'polkit-1/actions')
124 polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d')
125 polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d')
126 varlogdir = join_paths(localstatedir, 'log')
127 #if 0 /// UNNEEDED by elogind
128 # xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d')
129 # rpmmacrosdir = get_option('rpmmacrosdir')
130 # if rpmmacrosdir != 'no'
131 # rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir)
134 modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d')
137 #if 0 /// elogind has a bit different layout and does not need all of theses
138 # pkgdatadir = join_paths(datadir, 'systemd')
139 # environmentdir = join_paths(prefixdir, 'lib/environment.d')
140 # pkgsysconfdir = join_paths(sysconfdir, 'systemd')
141 # userunitdir = join_paths(prefixdir, 'lib/systemd/user')
142 # userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset')
143 # tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d')
144 # sysusersdir = join_paths(prefixdir, 'lib/sysusers.d')
145 # sysctldir = join_paths(prefixdir, 'lib/sysctl.d')
146 # binfmtdir = join_paths(prefixdir, 'lib/binfmt.d')
147 # modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d')
148 # networkdir = join_paths(rootprefixdir, 'lib/systemd/network')
149 # pkgincludedir = join_paths(includedir, 'systemd')
150 # systemgeneratordir = join_paths(rootlibexecdir, 'system-generators')
151 # usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators')
152 # systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators')
153 # userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators')
154 # systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
155 # systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
156 # systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system')
157 # systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset')
158 # udevlibexecdir = join_paths(rootprefixdir, 'lib/udev')
159 # udevhomedir = udevlibexecdir
160 # udevrulesdir = join_paths(udevlibexecdir, 'rules.d')
161 # udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d')
162 # catalogdir = join_paths(prefixdir, 'lib/systemd/catalog')
163 # kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d')
164 # factorydir = join_paths(datadir, 'factory')
165 # bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi')
166 # testsdir = join_paths(prefixdir, 'lib/systemd/tests')
167 # systemdstatedir = join_paths(localstatedir, 'lib/systemd')
168 # catalogstatedir = join_paths(systemdstatedir, 'catalog')
169 # randomseeddir = join_paths(localstatedir, 'lib/systemd')
171 # docdir = get_option('docdir')
173 # docdir = join_paths(datadir, 'doc/systemd')
176 pkgdatadir = join_paths(datadir, 'elogind')
177 pkgsysconfdir = join_paths(sysconfdir, 'elogind')
178 pkgincludedir = join_paths(includedir, 'elogind/systemd')
179 systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown')
180 systemsleepdir = join_paths(rootlibexecdir, 'system-sleep')
182 # in elogind, udev is external and thus configurable
183 udevlibexecdir = get_option('udevbindir')
184 udevlibexecdir = udevlibexecdir != '' ? udevlibexecdir : join_paths(rootprefixdir, 'lib/udev')
185 udevrulesdir = get_option('udevrulesdir')
186 udevrulesdir = udevrulesdir != '' ? udevrulesdir : join_paths(udevlibexecdir, 'rules.d')
187 udevhomedir = udevlibexecdir
188 factorydir = join_paths(datadir, 'factory')
189 docdir = get_option('docdir')
190 docdir = docdir != '' ? docdir: '-'.join([join_paths(datadir, 'doc/elogind'),
191 meson.project_version()])
192 testsdir = join_paths(prefixdir, 'lib/elogind/tests')
193 randomseeddir = join_paths(localstatedir, 'lib/elogind')
196 dbuspolicydir = get_option('dbuspolicydir')
197 if dbuspolicydir == ''
198 dbuspolicydir = join_paths(datadir, 'dbus-1/system.d')
201 dbussessionservicedir = get_option('dbussessionservicedir')
202 if dbussessionservicedir == ''
203 dbussessionservicedir = join_paths(datadir, 'dbus-1/services')
206 dbussystemservicedir = get_option('dbussystemservicedir')
207 if dbussystemservicedir == ''
208 dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services')
211 pamlibdir = get_option('pamlibdir')
213 pamlibdir = join_paths(rootlibdir, 'security')
216 pamconfdir = get_option('pamconfdir')
218 pamconfdir = join_paths(sysconfdir, 'pam.d')
221 memory_accounting_default = get_option('memory-accounting-default')
223 conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir)
224 conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system'))
225 #if 0 /// UNNEEDED by elogind
226 # conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir)
227 # conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path)
228 # conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
229 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
230 # conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
231 # conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user'))
232 # conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir)
233 # conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root'))
234 # conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database'))
235 # conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent'))
236 # conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd'))
237 # conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck'))
238 # conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs'))
239 # conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs'))
240 # conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown'))
241 # conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep'))
242 # conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl'))
243 # conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent'))
244 # conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge'))
246 conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'elogind-cgroups-agent'))
247 conf.set_quoted('ELOGIND_UACCESS_COMMAND_PATH', join_paths(rootlibexecdir, 'elogind-uaccess-command'))
248 conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'elogind'))
250 conf.set_quoted('ROOTPREFIX', rootprefixdir)
251 #if 0 /// UNNEEDED by elogind
252 # conf.set_quoted('RANDOM_SEED_DIR', randomseeddir)
253 # conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
254 # conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup'))
255 # conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir)
256 # conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir)
257 # conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir)
258 # conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir)
260 conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir)
261 conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir)
262 #if 0 /// UNNEEDED by elogind
263 # conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map'))
264 # conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map'))
266 conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir)
267 conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent'))
268 conf.set_quoted('LIBDIR', libdir)
269 conf.set_quoted('ROOTLIBDIR', rootlibdir)
270 conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir)
271 #if 0 /// UNNEEDED by elogind
272 # conf.set_quoted('BOOTLIBDIR', bootlibdir)
273 # conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull'))
274 # conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import'))
275 # conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export'))
276 # conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg'))
277 # conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg'))
278 # conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd'))
280 conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false')
281 conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_ON_OFF', memory_accounting_default ? 'on' : 'off')
283 conf.set_quoted('ABS_BUILD_DIR', meson.build_root())
284 conf.set_quoted('ABS_SRC_DIR', meson.source_root())
286 substs.set('prefix', prefixdir)
287 substs.set('exec_prefix', prefixdir)
288 substs.set('libdir', libdir)
289 substs.set('rootlibdir', rootlibdir)
290 substs.set('includedir', includedir)
291 substs.set('pkgsysconfdir', pkgsysconfdir)
292 substs.set('bindir', bindir)
293 substs.set('rootbindir', rootbindir)
294 substs.set('rootlibexecdir', rootlibexecdir)
295 #if 0 /// UNNEEDED by elogind
296 # substs.set('systemunitdir', systemunitdir)
297 # substs.set('userunitdir', userunitdir)
298 # substs.set('systempresetdir', systempresetdir)
299 # substs.set('userpresetdir', userpresetdir)
300 # substs.set('udevhwdbdir', udevhwdbdir)
302 substs.set('udevrulesdir', udevrulesdir)
303 substs.set('udevlibexecdir', udevlibexecdir)
304 #if 0 /// UNNEEDED by elogind
305 # substs.set('catalogdir', catalogdir)
306 # substs.set('tmpfilesdir', tmpfilesdir)
307 # substs.set('sysusersdir', sysusersdir)
308 # substs.set('sysctldir', sysctldir)
309 # substs.set('binfmtdir', binfmtdir)
310 # substs.set('modulesloaddir', modulesloaddir)
311 # substs.set('systemgeneratordir', systemgeneratordir)
312 # substs.set('usergeneratordir', usergeneratordir)
313 # substs.set('systemenvgeneratordir', systemenvgeneratordir)
314 # substs.set('userenvgeneratordir', userenvgeneratordir)
316 substs.set('systemshutdowndir', systemshutdowndir)
317 substs.set('systemsleepdir', systemsleepdir)
318 substs.set('VARLOGDIR', varlogdir)
319 #if 0 /// UNNEEDED by elogind
320 # substs.set('CERTIFICATEROOT', get_option('certificate-root'))
321 # substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl'))
322 # substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed'))
323 # substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path)
324 # substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path)
325 # substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local'))
326 # substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local'))
328 substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no')
330 #####################################################################
332 cc = meson.get_compiler('c')
333 pkgconfig = import('pkgconfig')
334 check_compilation_sh = find_program('tools/meson-check-compilation.sh')
335 meson_build_sh = find_program('tools/meson-build.sh')
337 if get_option('tests') != 'false'
338 cxx = find_program('c++', required : false)
340 # Used only for tests
345 want_ossfuzz = get_option('oss-fuzz')
346 want_libfuzzer = get_option('llvm-fuzz')
347 fuzzer_build = want_ossfuzz or want_libfuzzer
348 if want_ossfuzz and want_libfuzzer
349 error('only one of oss-fuzz and llvm-fuzz can be specified')
352 fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer')
355 fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
358 foreach arg : ['-Wextra',
361 '-Wmissing-include-dirs',
362 '-Wold-style-definition',
365 '-Wdeclaration-after-statement',
367 '-Wsuggest-attribute=noreturn',
368 '-Werror=missing-prototypes',
369 '-Werror=implicit-function-declaration',
370 '-Werror=missing-declarations',
371 '-Werror=return-type',
372 '-Werror=incompatible-pointer-types',
374 '-Wstrict-prototypes',
376 '-Wmissing-noreturn',
377 '-Wimplicit-fallthrough=5',
380 '-Wstrict-aliasing=2',
387 '-fdiagnostics-show-option',
388 '-fno-strict-aliasing',
389 '-fvisibility=hidden',
391 '-fstack-protector-strong',
392 '--param=ssp-buffer-size=4',
394 if cc.has_argument(arg)
395 add_project_arguments(arg, language : 'c')
399 # the oss-fuzz fuzzers are not built with -fPIE, so don't
400 # enable it when we are linking against them
402 if cc.has_argument('-fPIE')
403 add_project_arguments('-fPIE', language : 'c')
407 # "negative" arguments: gcc on purpose does not return an error for "-Wno-"
408 # arguments, just emits a warnings. So test for the "positive" version instead.
409 foreach arg : ['unused-parameter',
410 'missing-field-initializers',
413 'error=nonnull', # work-around for gcc 7.1 turning this on on its own
415 if cc.has_argument('-W' + arg)
416 add_project_arguments('-Wno-' + arg, language : 'c')
422 #include <inttypes.h>
423 typedef uint64_t usec_t;
424 usec_t now(clockid_t clock);
429 ''', name : '-Werror=shadow with local shadowing')
430 add_project_arguments('-Werror=shadow', language : 'c')
433 if cc.get_id() == 'clang'
434 foreach arg : ['-Wno-typedef-redefinition',
435 '-Wno-gnu-variable-sized-type-not-at-end',
437 if cc.has_argument(arg,
438 name : '@0@ is supported'.format(arg))
439 add_project_arguments(arg, language : 'c')
444 link_test_c = files('tools/meson-link-test.c')
446 # --as-needed and --no-undefined are provided by meson by default,
447 # run mesonconf to see what is enabled
448 foreach arg : ['-Wl,-z,relro',
453 have = run_command(check_compilation_sh,
454 cc.cmd_array(), '-x', 'c', arg,
455 '-include', link_test_c).returncode() == 0
456 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
457 if have and (arg != '-pie' or not fuzzer_build)
458 add_project_link_arguments(arg, language : 'c')
462 # Check if various sanitizers are supported
464 foreach arg : ['address']
466 have = run_command(check_compilation_sh,
467 cc.cmd_array(), '-x', 'c',
468 '-fsanitize=@0@'.format(arg),
469 '-include', link_test_c).returncode() == 0
470 message('@0@ sanitizer supported: @1@'.format(arg, have ? 'yes' : 'no'))
476 if get_option('buildtype') != 'debug'
477 foreach arg : ['-ffunction-sections',
479 if cc.has_argument(arg,
480 name : '@0@ is supported'.format(arg))
481 add_project_arguments(arg, language : 'c')
485 foreach arg : ['-Wl,--gc-sections']
486 have = run_command(check_compilation_sh,
487 cc.cmd_array(), '-x', 'c', arg,
488 '-include', link_test_c).returncode() == 0
489 message('Linking with @0@ supported: @1@'.format(arg, have ? 'yes' : 'no'))
491 add_project_link_arguments(arg, language : 'c')
496 cpp = ' '.join(cc.cmd_array()) + ' -E'
498 #####################################################################
499 # compilation result tests
501 conf.set('_GNU_SOURCE', true)
502 conf.set('__SANE_USERSPACE_TYPES__', true)
504 conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>'))
505 conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>'))
506 conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>'))
507 conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>'))
508 conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>'))
509 conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>'))
510 conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>'))
514 #include <linux/ethtool.h>
515 #include <linux/fib_rules.h>
517 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
519 foreach decl : ['char16_t',
522 'struct ethtool_link_settings',
523 'struct fib_rule_uid_range',
526 # We get -1 if the size cannot be determined
527 have = cc.sizeof(decl, prefix : decl_headers) > 0
528 conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
531 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
532 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
533 ['IFLA_VRF_TABLE', 'linux/if_link.h'],
534 ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'],
535 ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'],
536 ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'],
537 ['IFLA_BOND_AD_INFO', 'linux/if_link.h'],
538 ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'],
539 ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'],
540 ['IFLA_VXLAN_GPE', 'linux/if_link.h'],
541 ['IFLA_GENEVE_LABEL', 'linux/if_link.h'],
542 # if_tunnel.h is buggy and cannot be included on its own
543 ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'],
544 ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
545 ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'],
546 ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'],
547 ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'],
548 ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'],
549 ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'],
550 ['IPVLAN_F_PRIVATE', 'linux/if_link.h'],
551 ['NDA_IFINDEX', 'linux/neighbour.h'],
552 ['IFA_FLAGS', 'linux/if_addr.h'],
553 ['FRA_UID_RANGE', 'linux/fib_rules.h'],
554 ['LO_FLAGS_PARTSCAN', 'linux/loop.h'],
555 ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'],
557 prefix = decl.length() > 2 ? decl[2] : ''
558 have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
559 conf.set10('HAVE_' + decl[0], have)
562 foreach ident : ['secure_getenv', '__secure_getenv']
563 conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
567 ['memfd_create', '''#include <sys/mman.h>'''],
568 ['gettid', '''#include <sys/types.h>
569 // #include <unistd.h>'''],
570 ['pivot_root', '''#include <stdlib.h>
571 #include <unistd.h>'''], # no known header declares pivot_root
572 ['name_to_handle_at', '''#include <sys/types.h>
573 #include <sys/stat.h>
574 #include <fcntl.h>'''],
575 ['setns', '''#include <sched.h>'''],
576 ['renameat2', '''#include <stdio.h>
577 // #include <fcntl.h>'''],
578 ['kcmp', '''#include <linux/kcmp.h>'''],
579 ['keyctl', '''#include <sys/types.h>
580 #include <keyutils.h>'''],
581 ['copy_file_range', '''#include <sys/syscall.h>
582 #include <unistd.h>'''],
583 ['bpf', '''#include <sys/syscall.h>
584 #include <unistd.h>'''],
585 ['explicit_bzero' , '''#include <string.h>'''],
588 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE')
589 conf.set10('HAVE_' + ident[0].to_upper(), have)
592 if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE')
593 conf.set10('USE_SYS_RANDOM_H', true)
594 conf.set10('HAVE_GETRANDOM', true)
596 have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
597 conf.set10('USE_SYS_RANDOM_H', false)
598 conf.set10('HAVE_GETRANDOM', have)
601 #####################################################################
603 sed = find_program('sed')
604 awk = find_program('awk')
605 m4 = find_program('m4')
606 stat = find_program('stat')
607 git = find_program('git', required : false)
608 env = find_program('env')
610 meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh'
611 #if 1 /// Needed by elogind
612 meson_symlink_headers = meson.source_root() + '/tools/meson-symlink_headers.sh'
614 mkdir_p = 'mkdir -p $DESTDIR/@0@'
615 #if 0 /// unneeded by elogind
616 # test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh')
617 # splash_bmp = files('test/splash.bmp')
620 # if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
621 # /usr/sbin, /sbin, and fall back to the default from middle column.
622 #if 0 /// elogind has a bit different list and some adaptions
623 # progs = [['quotaon', '/usr/sbin/quotaon' ],
624 # ['quotacheck', '/usr/sbin/quotacheck' ],
625 # ['kill', '/usr/bin/kill' ],
626 # ['kmod', '/usr/bin/kmod' ],
627 # ['kexec', '/usr/sbin/kexec' ],
628 # ['sulogin', '/usr/sbin/sulogin' ],
629 # ['mount', '/usr/bin/mount', 'MOUNT_PATH'],
630 # ['umount', '/usr/bin/umount', 'UMOUNT_PATH'],
631 # ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'],
632 # ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'],
635 progs = [['kexec', '/usr/sbin/kexec', 'KEXEC'],
636 ['reboot', '/sbin/reboot', 'REBOOT'],
637 ['halt', '/sbin/halt', 'HALT'],
641 path = get_option(prog[0] + '-path')
643 message('Using @1@ for @0@'.format(prog[0], path))
645 exe = find_program(prog[0],
646 '/usr/sbin/' + prog[0],
649 path = exe.found() ? exe.path() : prog[1]
651 name = prog.length() > 2 ? prog[2] : prog[0].to_upper()
652 conf.set_quoted(name, path)
653 substs.set(name, path)
656 conf.set_quoted('TELINIT', get_option('telinit-path'))
658 if run_command('ln', '--relative', '--help').returncode() != 0
659 error('ln does not support --relative')
662 ############################################################
664 gperf = find_program('gperf')
666 gperf_test_format = '''
668 const char * in_word_set(const char *, @0@);
671 gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C'
672 gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path()))
673 gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout())
674 if cc.compiles(gperf_test)
675 gperf_len_type = 'size_t'
677 gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout())
678 if cc.compiles(gperf_test)
679 gperf_len_type = 'unsigned'
681 error('unable to determine gperf len type')
684 message('gperf len type is @0@'.format(gperf_len_type))
685 conf.set('GPERF_LEN_TYPE', gperf_len_type,
686 description : 'The type of gperf "len" parameter')
688 ############################################################
690 if not cc.has_header('sys/capability.h')
691 error('POSIX caps headers not found')
693 foreach header : ['crypt.h',
696 'linux/vm_sockets.h',
698 'valgrind/memcheck.h',
699 'valgrind/valgrind.h',
702 conf.set10('HAVE_' + header.underscorify().to_upper(),
703 cc.has_header(header))
706 ############################################################
708 conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname'))
709 #if 0 /// UNNEEDED by elogind
710 # conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname'))
711 # gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : [])
714 default_hierarchy = get_option('default-hierarchy')
715 conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy,
716 description : 'default cgroup hierarchy as string')
717 if default_hierarchy == 'legacy'
718 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE')
719 elif default_hierarchy == 'hybrid'
720 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD')
722 conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
725 #if 0 /// UNNEEDED by elogind
726 # time_epoch = get_option('time-epoch')
727 # if time_epoch == ''
728 # NEWS = files('NEWS')
729 # time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout()
731 # time_epoch = time_epoch.to_int()
732 # conf.set('TIME_EPOCH', time_epoch)
734 ############################################################
735 # elogind needs to know which cgroups controller to follow.
736 get_cg_ctrl_sh = find_program('tools/meson-get-cg-controller.sh')
737 with_cgroupctrl = get_option('cgroup-controller')
738 if with_cgroupctrl == '' or with_cgroupctrl == 'auto'
739 with_cgroupctrl = run_command(get_cg_ctrl_sh, []).stdout().strip()
740 elif with_cgroupctrl == 'none'
741 with_cgroupctrl = 'elogind'
744 # No controller now is a problem:
745 if with_cgroupctrl == ''
746 error('Unable to determine cgroup controller, but cgroups support is mandatory!')
749 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER', '_'.join(['',with_cgroupctrl]),
750 description : 'name of the cgroup controller to use')
751 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_LEGACY',
752 '='.join(['name', with_cgroupctrl]))
753 conf.set_quoted('SYSTEMD_CGROUP_CONTROLLER_HYBRID',
754 '='.join(['name', with_cgroupctrl]))
755 ############################################################
758 system_uid_max = get_option('system-uid-max')
759 if system_uid_max == ''
760 system_uid_max = run_command(
762 '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
763 '/etc/login.defs').stdout().strip()
764 if system_uid_max == ''
765 system_uid_max = '999'
768 system_uid_max = system_uid_max.to_int()
769 conf.set('SYSTEM_UID_MAX', system_uid_max)
770 substs.set('systemuidmax', system_uid_max)
771 message('maximum system UID is @0@'.format(system_uid_max))
773 system_gid_max = get_option('system-gid-max')
774 if system_gid_max == ''
775 system_gid_max = run_command(
777 '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
778 '/etc/login.defs').stdout().strip()
779 if system_gid_max == ''
780 system_gid_max = '999'
783 system_gid_max = system_gid_max.to_int()
784 conf.set('SYSTEM_GID_MAX', system_gid_max)
785 substs.set('systemgidmax', system_gid_max)
786 message('maximum system GID is @0@'.format(system_gid_max))
788 #if 0 /// UNNEEDED by elogind
789 # dynamic_uid_min = get_option('dynamic-uid-min').to_int()
790 # dynamic_uid_max = get_option('dynamic-uid-max').to_int()
791 # conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
792 # conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
793 # substs.set('dynamicuidmin', dynamic_uid_min)
794 # substs.set('dynamicuidmax', dynamic_uid_max)
796 # container_uid_base_min = get_option('container-uid-base-min').to_int()
797 # container_uid_base_max = get_option('container-uid-base-max').to_int()
798 # conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
799 # conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
800 # substs.set('containeruidbasemin', container_uid_base_min)
801 # substs.set('containeruidbasemax', container_uid_base_max)
804 nobody_user = get_option('nobody-user')
805 nobody_group = get_option('nobody-group')
807 getent_result = run_command('getent', 'passwd', '65534')
808 if getent_result.returncode() == 0
809 name = getent_result.stdout().split(':')[0]
810 if name != nobody_user
811 message('WARNING:\n' +
812 ' 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) +
813 ' Your build will result in an user table setup that is incompatible with the local system.')
816 id_result = run_command('id', '-u', nobody_user)
817 if id_result.returncode() == 0
818 id = id_result.stdout().to_int()
820 message('WARNING:\n' +
821 ' 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) +
822 ' Your build will result in an user table setup that is incompatible with the local system.')
826 getent_result = run_command('getent', 'group', '65534')
827 if getent_result.returncode() == 0
828 name = getent_result.stdout().split(':')[0]
829 if name != nobody_group
830 message('WARNING:\n' +
831 ' 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) +
832 ' Your build will result in an group table setup that is incompatible with the local system.')
835 id_result = run_command('id', '-g', nobody_group)
836 if id_result.returncode() == 0
837 id = id_result.stdout().to_int()
839 message('WARNING:\n' +
840 ' 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) +
841 ' Your build will result in an group table setup that is incompatible with the local system.')
844 if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup')
845 message('WARNING:\n' +
846 ' The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) +
847 ' Please re-check that both "nobody-user" and "nobody-group" options are correctly set.')
850 conf.set_quoted('NOBODY_USER_NAME', nobody_user)
851 conf.set_quoted('NOBODY_GROUP_NAME', nobody_group)
852 substs.set('NOBODY_USER_NAME', nobody_user)
853 substs.set('NOBODY_GROUP_NAME', nobody_group)
855 tty_gid = get_option('tty-gid')
856 conf.set('TTY_GID', tty_gid)
857 substs.set('TTY_GID', tty_gid)
859 #if 0 /// UNNEEDED by elogind
860 # # Ensure provided GID argument is numeric, otherwise fallback to default assignment
861 # if get_option('users-gid') != ''
862 # users_gid = get_option('users-gid').to_int()
866 # substs.set('USERS_GID', users_gid)
868 # if get_option('adm-group')
869 # m4_defines += ['-DENABLE_ADM_GROUP']
872 # if get_option('wheel-group')
873 # m4_defines += ['-DENABLE_WHEEL_GROUP']
876 # substs.set('DEV_KVM_MODE', get_option('dev-kvm-mode'))
877 # substs.set('GROUP_RENDER_MODE', get_option('group-render-mode'))
880 kill_user_processes = get_option('default-kill-user-processes')
881 conf.set10('KILL_USER_PROCESSES', kill_user_processes)
882 substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no')
884 #if 0 /// UNNEEDED by elogind
885 # dns_servers = get_option('dns-servers')
886 # conf.set_quoted('DNS_SERVERS', dns_servers)
887 # substs.set('DNS_SERVERS', dns_servers)
889 # ntp_servers = get_option('ntp-servers')
890 # conf.set_quoted('NTP_SERVERS', ntp_servers)
891 # substs.set('NTP_SERVERS', ntp_servers)
894 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
896 #if 0 /// UNNEEDED by elogind
897 # substs.set('SUSHELL', get_option('debug-shell'))
898 # substs.set('DEBUGTTY', get_option('debug-tty'))
901 debug = get_option('debug')
902 enable_debug_hashmap = false
903 enable_debug_mmap_cache = false
904 #if 1 /// additional elogind debug mode
905 enable_debug_elogind = false
908 foreach name : debug.split(',')
910 enable_debug_hashmap = true
911 elif name == 'mmap-cache'
912 enable_debug_mmap_cache = true
913 #if 1 /// additional elogind debug mode
914 elif name == 'elogind'
915 enable_debug_elogind = true
918 message('unknown debug option "@0@", ignoring'.format(name))
922 conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
923 conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
924 #if 1 /// additional elogind debug mode
925 conf.set10('ENABLE_DEBUG_ELOGIND', enable_debug_elogind)
928 #####################################################################
930 threads = dependency('threads')
931 librt = cc.find_library('rt')
932 libm = cc.find_library('m')
933 libdl = cc.find_library('dl')
934 libcrypt = cc.find_library('crypt')
936 libcap = dependency('libcap', required : false)
937 if not libcap.found()
938 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
939 libcap = cc.find_library('cap')
942 #if 0 /// UNNEEDED by elogind
943 # libmount = dependency('mount',
944 # version : '>= 2.30',
945 # required : not fuzzer_build)
947 # want_seccomp = get_option('seccomp')
948 # if want_seccomp != 'false' and not fuzzer_build
949 # libseccomp = dependency('libseccomp',
950 # version : '>= 2.3.1',
951 # required : want_seccomp == 'true')
952 # have = libseccomp.found()
960 conf.set10('HAVE_SECCOMP', have)
961 m4_defines += have ? ['-DHAVE_SECCOMP'] : []
963 want_selinux = get_option('selinux')
964 if want_selinux != 'false' and not fuzzer_build
965 libselinux = dependency('libselinux',
966 version : '>= 2.1.9',
967 required : want_selinux == 'true')
968 have = libselinux.found()
973 conf.set10('HAVE_SELINUX', have)
974 m4_defines += have ? ['-DHAVE_SELINUX'] : []
976 #if 0 /// UNNEEDED by elogind
977 # want_apparmor = get_option('apparmor')
978 # if want_apparmor != 'false' and not fuzzer_build
979 # libapparmor = dependency('libapparmor',
980 # required : want_apparmor == 'true')
981 # have = libapparmor.found()
989 conf.set10('HAVE_APPARMOR', have)
990 m4_defines += have ? ['-DHAVE_APPARMOR'] : []
992 smack_run_label = get_option('smack-run-label')
993 if smack_run_label != ''
994 conf.set_quoted('SMACK_RUN_LABEL', smack_run_label)
995 m4_defines += ['-DHAVE_SMACK_RUN_LABEL']
998 want_polkit = get_option('polkit')
999 install_polkit = false
1000 install_polkit_pkla = false
1001 if want_polkit != 'false' and not fuzzer_build
1002 install_polkit = true
1004 libpolkit = dependency('polkit-gobject-1',
1006 if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
1007 message('Old polkit detected, will install pkla files')
1008 install_polkit_pkla = true
1011 conf.set10('ENABLE_POLKIT', install_polkit)
1013 want_acl = get_option('acl')
1014 if want_acl != 'false' and not fuzzer_build
1015 libacl = cc.find_library('acl', required : want_acl == 'true')
1016 have = libacl.found()
1021 conf.set10('HAVE_ACL', have)
1022 m4_defines += have ? ['-DHAVE_ACL'] : []
1024 want_audit = get_option('audit')
1025 if want_audit != 'false' and not fuzzer_build
1026 libaudit = dependency('audit', required : want_audit == 'true')
1027 have = libaudit.found()
1032 conf.set10('HAVE_AUDIT', have)
1034 #if 0 /// UNNEEDED by elogind
1035 # want_blkid = get_option('blkid')
1036 # if want_blkid != 'false' and not fuzzer_build
1037 # libblkid = dependency('blkid', required : want_blkid == 'true')
1038 # have = libblkid.found()
1043 # conf.set10('HAVE_BLKID', have)
1045 # want_kmod = get_option('kmod')
1046 # if want_kmod != 'false' and not fuzzer_build
1047 # libkmod = dependency('libkmod',
1048 # version : '>= 15',
1049 # required : want_kmod == 'true')
1050 # have = libkmod.found()
1055 # conf.set10('HAVE_KMOD', have)
1061 want_pam = get_option('pam')
1062 if want_pam != 'false' and not fuzzer_build
1063 libpam = cc.find_library('pam', required : want_pam == 'true')
1064 libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
1065 have = libpam.found() and libpam_misc.found()
1071 conf.set10('HAVE_PAM', have)
1072 m4_defines += have ? ['-DHAVE_PAM'] : []
1074 #if 0 /// UNNEEDED by elogind
1075 # want_microhttpd = get_option('microhttpd')
1076 # if want_microhttpd != 'false' and not fuzzer_build
1077 # libmicrohttpd = dependency('libmicrohttpd',
1078 # version : '>= 0.9.33',
1079 # required : want_microhttpd == 'true')
1080 # have = libmicrohttpd.found()
1083 # libmicrohttpd = []
1085 # conf.set10('HAVE_MICROHTTPD', have)
1086 # m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
1088 # want_libcryptsetup = get_option('libcryptsetup')
1089 # if want_libcryptsetup != 'false' and not fuzzer_build
1090 # libcryptsetup = dependency('libcryptsetup',
1091 # version : '>= 1.6.0',
1092 # required : want_libcryptsetup == 'true')
1093 # have = libcryptsetup.found()
1096 # libcryptsetup = []
1098 # conf.set10('HAVE_LIBCRYPTSETUP', have)
1100 # want_libcurl = get_option('libcurl')
1101 # if want_libcurl != 'false' and not fuzzer_build
1102 # libcurl = dependency('libcurl',
1103 # version : '>= 7.32.0',
1104 # required : want_libcurl == 'true')
1105 # have = libcurl.found()
1110 # conf.set10('HAVE_LIBCURL', have)
1111 # m4_defines += have ? ['-DHAVE_LIBCURL'] : []
1113 # want_libidn = get_option('libidn')
1114 # want_libidn2 = get_option('libidn2')
1115 # if want_libidn == 'true' and want_libidn2 == 'true'
1116 # error('libidn and libidn2 cannot be requested simultaneously')
1119 # if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build
1120 # libidn = dependency('libidn',
1121 # required : want_libidn == 'true')
1122 # have = libidn.found()
1127 # conf.set10('HAVE_LIBIDN', have)
1128 # m4_defines += have ? ['-DHAVE_LIBIDN'] : []
1129 # if not have and want_libidn2 != 'false' and not fuzzer_build
1130 # # libidn is used for both libidn and libidn2 objects
1131 # libidn = dependency('libidn2',
1132 # required : want_libidn2 == 'true')
1133 # have = libidn.found()
1137 # conf.set10('HAVE_LIBIDN2', have)
1138 # m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
1140 # want_libiptc = get_option('libiptc')
1141 # if want_libiptc != 'false' and not fuzzer_build
1142 # libiptc = dependency('libiptc',
1143 # required : want_libiptc == 'true')
1144 # have = libiptc.found()
1149 # conf.set10('HAVE_LIBIPTC', have)
1150 # m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
1152 # want_qrencode = get_option('qrencode')
1153 # if want_qrencode != 'false' and not fuzzer_build
1154 # libqrencode = dependency('libqrencode',
1155 # required : want_qrencode == 'true')
1156 # have = libqrencode.found()
1161 # conf.set10('HAVE_QRENCODE', have)
1163 # want_gcrypt = get_option('gcrypt')
1164 # if want_gcrypt != 'false' and not fuzzer_build
1165 # libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
1166 # libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
1167 # have = libgcrypt.found() and libgpg_error.found()
1172 # # link to neither of the libs if one is not found
1176 # conf.set10('HAVE_GCRYPT', have)
1178 # want_gnutls = get_option('gnutls')
1179 # if want_gnutls != 'false' and not fuzzer_build
1180 # libgnutls = dependency('gnutls',
1181 # version : '>= 3.1.4',
1182 # required : want_gnutls == 'true')
1183 # have = libgnutls.found()
1188 # conf.set10('HAVE_GNUTLS', have)
1190 # want_elfutils = get_option('elfutils')
1191 # if want_elfutils != 'false' and not fuzzer_build
1192 # libdw = dependency('libdw',
1193 # required : want_elfutils == 'true')
1194 # have = libdw.found()
1199 # conf.set10('HAVE_ELFUTILS', have)
1201 # want_zlib = get_option('zlib')
1202 # if want_zlib != 'false' and not fuzzer_build
1203 # libz = dependency('zlib',
1204 # required : want_zlib == 'true')
1205 # have = libz.found()
1210 # conf.set10('HAVE_ZLIB', have)
1212 # want_bzip2 = get_option('bzip2')
1213 # if want_bzip2 != 'false' and not fuzzer_build
1214 # libbzip2 = cc.find_library('bz2',
1215 # required : want_bzip2 == 'true')
1216 # have = libbzip2.found()
1221 # conf.set10('HAVE_BZIP2', have)
1223 # want_xz = get_option('xz')
1224 # if want_xz != 'false' and not fuzzer_build
1225 # libxz = dependency('liblzma',
1226 # required : want_xz == 'true')
1227 # have = libxz.found()
1232 # conf.set10('HAVE_XZ', have)
1234 # want_lz4 = get_option('lz4')
1235 # if want_lz4 != 'false' and not fuzzer_build
1236 # liblz4 = dependency('liblz4',
1237 # required : want_lz4 == 'true')
1238 # have = liblz4.found()
1243 # conf.set10('HAVE_LZ4', have)
1245 # want_xkbcommon = get_option('xkbcommon')
1246 # if want_xkbcommon != 'false' and not fuzzer_build
1247 # libxkbcommon = dependency('xkbcommon',
1248 # version : '>= 0.3.0',
1249 # required : want_xkbcommon == 'true')
1250 # have = libxkbcommon.found()
1272 conf.set10('HAVE_XKBCOMMON', have)
1274 want_pcre2 = get_option('pcre2')
1275 if want_pcre2 != 'false'
1276 libpcre2 = dependency('libpcre2-8',
1277 required : want_pcre2 == 'true')
1278 have = libpcre2.found()
1283 conf.set10('HAVE_PCRE2', have)
1285 want_glib = get_option('glib')
1286 if want_glib != 'false' and not fuzzer_build
1287 libglib = dependency('glib-2.0',
1288 version : '>= 2.22.0',
1289 required : want_glib == 'true')
1290 libgobject = dependency('gobject-2.0',
1291 version : '>= 2.22.0',
1292 required : want_glib == 'true')
1293 libgio = dependency('gio-2.0',
1294 required : want_glib == 'true')
1295 have = libglib.found() and libgobject.found() and libgio.found()
1302 conf.set10('HAVE_GLIB', have)
1304 want_dbus = get_option('dbus')
1305 if want_dbus != 'false' and not fuzzer_build
1306 libdbus = dependency('dbus-1',
1307 version : '>= 1.3.2',
1308 required : want_dbus == 'true')
1309 have = libdbus.found()
1314 conf.set10('HAVE_DBUS', have)
1316 #if 0 /// UNNEEDED by elogind
1317 # default_dnssec = get_option('default-dnssec')
1319 # default_dnssec = 'no'
1321 # if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
1322 # message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
1323 # default_dnssec = 'no'
1325 # conf.set('DEFAULT_DNSSEC_MODE',
1326 # 'DNSSEC_' + default_dnssec.underscorify().to_upper())
1327 # substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
1329 # want_importd = get_option('importd')
1330 # if want_importd != 'false'
1331 # have = (conf.get('HAVE_LIBCURL') == 1 and
1332 # conf.get('HAVE_ZLIB') == 1 and
1333 # conf.get('HAVE_BZIP2') == 1 and
1334 # conf.get('HAVE_XZ') == 1 and
1335 # conf.get('HAVE_GCRYPT') == 1)
1336 # if want_importd == 'true' and not have
1337 # error('importd support was requested, but dependencies are not available')
1342 # conf.set10('ENABLE_IMPORTD', have)
1344 # want_remote = get_option('remote')
1345 # if want_remote != 'false'
1346 # have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
1347 # conf.get('HAVE_LIBCURL') == 1]
1348 # # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
1349 # # it's possible to build one without the other. Complain only if
1350 # # support was explictly requested. The auxiliary files like sysusers
1351 # # config should be installed when any of the programs are built.
1352 # if want_remote == 'true' and not (have_deps[0] and have_deps[1])
1353 # error('remote support was requested, but dependencies are not available')
1355 # have = have_deps[0] or have_deps[1]
1360 conf.set10('ENABLE_REMOTE', have)
1362 foreach term : ['utmp',
1363 #if 0 /// UNNEEDED by elogind
1397 have = get_option(term)
1398 name = 'ENABLE_' + term.underscorify().to_upper()
1399 conf.set10(name, have)
1400 m4_defines += have ? ['-D' + name] : []
1403 want_tests = get_option('tests')
1404 install_tests = get_option('install-tests')
1405 slow_tests = get_option('slow-tests')
1409 conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
1411 #####################################################################
1413 #if 0 /// UNNEEDED by elogind
1414 # if get_option('efi')
1415 # efi_arch = host_machine.cpu_family()
1417 # if efi_arch == 'x86'
1418 # EFI_MACHINE_TYPE_NAME = 'ia32'
1419 # gnu_efi_arch = 'ia32'
1420 # elif efi_arch == 'x86_64'
1421 # EFI_MACHINE_TYPE_NAME = 'x64'
1422 # gnu_efi_arch = 'x86_64'
1423 # elif efi_arch == 'arm'
1424 # EFI_MACHINE_TYPE_NAME = 'arm'
1425 # gnu_efi_arch = 'arm'
1426 # elif efi_arch == 'aarch64'
1427 # EFI_MACHINE_TYPE_NAME = 'aa64'
1428 # gnu_efi_arch = 'aarch64'
1430 # EFI_MACHINE_TYPE_NAME = ''
1435 # conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
1437 # conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
1442 conf.set10('ENABLE_EFI', have)
1444 #####################################################################
1446 config_h = configure_file(
1447 output : 'config.h',
1448 configuration : conf)
1450 includes = include_directories('src/basic',
1453 #if 0 /// UNNEEDED by elogind
1459 #if 0 /// UNNEEDED by elogind
1464 #if 0 /// elogind has a different list
1465 # 'src/libsystemd/sd-bus',
1466 # 'src/libsystemd/sd-device',
1467 # 'src/libsystemd/sd-hwdb',
1468 # 'src/libsystemd/sd-id128',
1469 # 'src/libsystemd/sd-netlink',
1470 # 'src/libsystemd/sd-network',
1471 # 'src/libsystemd-network',
1474 'src/libelogind/sd-bus',
1475 'src/libelogind/sd-id128',
1480 add_project_arguments('-include', 'config.h', language : 'c')
1482 #if 0 /// UNNEEDED by elogind
1485 #if 0 /// UNNEEDED by elogind
1488 subdir('src/systemd')
1490 #if 0 /// UNNEEDED by elogind
1491 # subdir('src/libsystemd')
1492 # subdir('src/libsystemd-network')
1493 # subdir('src/journal')
1496 subdir('src/libelogind')
1498 subdir('src/update-utmp')
1502 #if 0 /// UNNEEDED by elogind
1503 # libjournal_core = static_library(
1505 # libjournal_core_sources,
1507 # include_directories : includes,
1510 # libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym)
1511 # libsystemd = shared_library(
1513 # 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug
1514 # version : libsystemd_version,
1515 # include_directories : includes,
1516 # link_args : ['-shared',
1517 # '-Wl,--version-script=' + libsystemd_sym_path],
1518 # link_with : [libbasic,
1520 # link_whole : [libsystemd_static,
1521 # libjournal_client],
1522 # dependencies : [threads,
1526 # link_depends : libsystemd_sym,
1528 # install_dir : rootlibdir)
1530 libelogind_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libelogind_sym)
1531 libelogind = shared_library(
1533 libelogind_internal_sources,
1534 version : libelogind_version,
1535 include_directories : includes,
1536 link_args : ['-shared',
1537 '-Wl,--version-script=' + libelogind_sym_path],
1538 link_with : [libbasic],
1539 dependencies : [threads],
1540 link_depends : libelogind_sym,
1542 install_dir : rootlibdir)
1545 ############################################################
1547 # binaries that have --help and are intended for use by humans,
1548 # usually, but not always, installed in /bin.
1549 public_programs = []
1551 #if 0 /// UNNEEDED by elogind
1552 # subdir('src/libudev')
1554 # elogind depends on external libudev:
1555 libudev = dependency('libudev', required : true)
1557 subdir('src/shared')
1558 #if 0 /// UNNEEDED by elogind
1559 # subdir('src/core')
1560 # subdir('src/udev')
1561 # subdir('src/network')
1563 # subdir('src/analyze')
1564 # subdir('src/journal-remote')
1565 # subdir('src/coredump')
1566 # subdir('src/hostname')
1567 # subdir('src/import')
1568 # subdir('src/kernel-install')
1569 # subdir('src/locale')
1570 # subdir('src/machine')
1571 # subdir('src/nspawn')
1572 # subdir('src/resolve')
1573 # subdir('src/timedate')
1574 # subdir('src/timesync')
1575 # subdir('src/vconsole')
1576 # subdir('src/boot/efi')
1581 #if 0 /// UNNEEDED in elogind
1586 ############################################################
1588 # only static linking apart from libdl, to make sure that the
1589 # module is linked to all libraries that it uses.
1590 test_dlopen = executable(
1593 include_directories : includes,
1594 link_with : [libbasic],
1595 dependencies : [libdl])
1597 #if 0 /// UNNEEDED by elogind
1598 # foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
1599 # ['systemd', 'ENABLE_NSS_SYSTEMD'],
1600 # ['mymachines', 'ENABLE_MACHINED'],
1601 # ['resolve', 'ENABLE_RESOLVE']]
1603 # condition = tuple[1] == '' or conf.get(tuple[1]) == 1
1607 # sym = 'src/nss-@0@/nss-@0@.sym'.format(module)
1608 # version_script_arg = join_paths(meson.current_source_dir(), sym)
1610 # nss = shared_library(
1612 # 'src/nss-@0@/nss-@0@.c'.format(module),
1614 # include_directories : includes,
1615 # # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
1616 # link_args : ['-Wl,-z,nodelete',
1618 # '-Wl,--version-script=' + version_script_arg,
1619 # '-Wl,--undefined'],
1620 # link_with : [libsystemd_static,
1622 # dependencies : [threads,
1624 # link_depends : sym,
1626 # install_dir : rootlibdir)
1628 # # We cannot use shared_module because it does not support version suffix.
1629 # # Unfortunately shared_library insists on creating the symlink…
1630 # meson.add_install_script('sh', '-c',
1631 # 'rm $DESTDIR@0@/libnss_@1@.so'
1632 # .format(rootlibdir, module))
1634 # test('dlopen-nss_' + module,
1636 # args : [nss.full_path()]) # path to dlopen must include a slash
1641 ############################################################
1643 #if 0 /// UNNEEDED by elogind
1644 # executable('systemd',
1646 # include_directories : includes,
1647 # link_with : [libcore,
1649 # dependencies : [threads,
1655 # install_rpath : rootlibexecdir,
1657 # install_dir : rootlibexecdir)
1659 # exe = executable('systemd-analyze',
1660 # systemd_analyze_sources,
1661 # include_directories : includes,
1662 # link_with : [libcore,
1664 # dependencies : [threads,
1670 # install_rpath : rootlibexecdir,
1672 # public_programs += [exe]
1674 # executable('systemd-journald',
1675 # systemd_journald_sources,
1676 # include_directories : includes,
1677 # link_with : [libjournal_core,
1679 # dependencies : [threads,
1683 # install_rpath : rootlibexecdir,
1685 # install_dir : rootlibexecdir)
1687 # exe = executable('systemd-cat',
1688 # systemd_cat_sources,
1689 # include_directories : includes,
1690 # link_with : [libjournal_core,
1692 # dependencies : [threads],
1693 # install_rpath : rootlibexecdir,
1695 # public_programs += [exe]
1697 # exe = executable('journalctl',
1698 # journalctl_sources,
1699 # include_directories : includes,
1700 # link_with : [libshared],
1701 # dependencies : [threads,
1706 # install_rpath : rootlibexecdir,
1708 # install_dir : rootbindir)
1709 # public_programs += [exe]
1711 # executable('systemd-getty-generator',
1712 # 'src/getty-generator/getty-generator.c',
1713 # include_directories : includes,
1714 # link_with : [libshared],
1715 # install_rpath : rootlibexecdir,
1717 # install_dir : systemgeneratordir)
1719 # executable('systemd-debug-generator',
1720 # 'src/debug-generator/debug-generator.c',
1721 # include_directories : includes,
1722 # link_with : [libshared],
1723 # install_rpath : rootlibexecdir,
1725 # install_dir : systemgeneratordir)
1727 # executable('systemd-fstab-generator',
1728 # 'src/fstab-generator/fstab-generator.c',
1729 # 'src/core/mount-setup.c',
1730 # include_directories : includes,
1731 # link_with : [libshared],
1732 # install_rpath : rootlibexecdir,
1734 # install_dir : systemgeneratordir)
1736 # if conf.get('ENABLE_ENVIRONMENT_D') == 1
1737 # executable('30-systemd-environment-d-generator',
1738 # 'src/environment-d-generator/environment-d-generator.c',
1739 # include_directories : includes,
1740 # link_with : [libshared],
1741 # install_rpath : rootlibexecdir,
1743 # install_dir : userenvgeneratordir)
1745 # meson.add_install_script(meson_make_symlink,
1746 # join_paths(sysconfdir, 'environment'),
1747 # join_paths(environmentdir, '99-environment.conf'))
1750 # if conf.get('ENABLE_HIBERNATE') == 1
1751 # executable('systemd-hibernate-resume-generator',
1752 # 'src/hibernate-resume/hibernate-resume-generator.c',
1753 # include_directories : includes,
1754 # link_with : [libshared],
1755 # install_rpath : rootlibexecdir,
1757 # install_dir : systemgeneratordir)
1759 # executable('systemd-hibernate-resume',
1760 # 'src/hibernate-resume/hibernate-resume.c',
1761 # include_directories : includes,
1762 # link_with : [libshared],
1763 # install_rpath : rootlibexecdir,
1765 # install_dir : rootlibexecdir)
1768 # if conf.get('HAVE_BLKID') == 1
1769 # executable('systemd-gpt-auto-generator',
1770 # 'src/gpt-auto-generator/gpt-auto-generator.c',
1771 # 'src/basic/blkid-util.h',
1772 # include_directories : includes,
1773 # link_with : [libshared],
1774 # dependencies : libblkid,
1775 # install_rpath : rootlibexecdir,
1777 # install_dir : systemgeneratordir)
1779 # exe = executable('systemd-dissect',
1780 # 'src/dissect/dissect.c',
1781 # include_directories : includes,
1782 # link_with : [libshared],
1783 # install_rpath : rootlibexecdir,
1785 # install_dir : rootlibexecdir)
1786 # public_programs += [exe]
1789 # if conf.get('ENABLE_RESOLVE') == 1
1790 # executable('systemd-resolved',
1791 # systemd_resolved_sources,
1792 # include_directories : includes,
1793 # link_with : [libshared,
1795 # libsystemd_resolve_core],
1796 # dependencies : [threads,
1800 # install_rpath : rootlibexecdir,
1802 # install_dir : rootlibexecdir)
1804 # exe = executable('systemd-resolve',
1805 # systemd_resolve_sources,
1806 # include_directories : includes,
1807 # link_with : [libshared,
1809 # libsystemd_resolve_core],
1810 # dependencies : [threads,
1814 # install_rpath : rootlibexecdir,
1816 # public_programs += [exe]
1819 # if conf.get('ENABLE_LOGIND') == 1
1820 # executable('systemd-logind',
1821 # systemd_logind_sources,
1822 # include_directories : includes,
1823 # link_with : [liblogind_core,
1825 # dependencies : [threads,
1827 # install_rpath : rootlibexecdir,
1829 # install_dir : rootlibexecdir)
1831 # exe = executable('loginctl',
1833 # include_directories : includes,
1834 # link_with : [libshared],
1835 # dependencies : [threads,
1838 # install_rpath : rootlibexecdir,
1840 # install_dir : rootbindir)
1841 # public_programs += [exe]
1843 # exe = executable('systemd-inhibit',
1844 # 'src/login/inhibit.c',
1845 # include_directories : includes,
1846 # link_with : [libshared],
1847 # install_rpath : rootlibexecdir,
1849 # install_dir : rootbindir)
1850 # public_programs += [exe]
1852 # if conf.get('HAVE_PAM') == 1
1853 # version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
1854 # pam_systemd = shared_library(
1858 # include_directories : includes,
1859 # link_args : ['-shared',
1860 # '-Wl,--version-script=' + version_script_arg],
1861 # link_with : [libsystemd_static,
1862 # libshared_static],
1863 # dependencies : [threads,
1866 # link_depends : pam_systemd_sym,
1868 # install_dir : pamlibdir)
1870 # test('dlopen-pam_systemd',
1872 # args : [pam_systemd.full_path()]) # path to dlopen must include a slash
1877 executable('elogind',
1879 include_directories : includes,
1880 link_with : [liblogind_core,
1882 dependencies : [threads,
1885 install_rpath : rootlibexecdir,
1887 install_dir : rootlibexecdir)
1889 exe = executable('loginctl',
1891 include_directories : includes,
1892 link_with : [libshared],
1893 dependencies : [threads,
1895 install_rpath : rootlibexecdir,
1897 install_dir : rootbindir)
1898 public_programs += [exe]
1900 exe = executable('elogind-inhibit',
1901 'src/login/inhibit.c',
1902 include_directories : includes,
1903 link_with : [libshared],
1904 dependencies : [threads],
1905 install_rpath : rootlibexecdir,
1907 install_dir : rootbindir)
1908 public_programs += [exe]
1910 if conf.get('HAVE_PAM') == 1
1911 version_script_arg = join_paths(meson.current_source_dir(), pam_elogind_sym)
1912 pam_elogind = shared_library(
1916 include_directories : includes,
1917 link_args : ['-shared',
1918 '-Wl,--version-script=' + version_script_arg],
1919 link_with : [libelogind,
1921 dependencies : [threads,
1924 link_depends : pam_elogind_sym,
1926 install_dir : pamlibdir)
1928 test('dlopen-pam_elogind',
1930 args : [pam_elogind.full_path()]) # path to dlopen must include a slash
1933 #if 0 /// UNNEEDED by elogind
1934 # executable('systemd-user-sessions',
1935 # 'src/user-sessions/user-sessions.c',
1936 # include_directories : includes,
1937 # link_with : [libshared],
1938 # install_rpath : rootlibexecdir,
1940 # install_dir : rootlibexecdir)
1943 # if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
1944 # exe = executable('bootctl',
1945 # 'src/boot/bootctl.c',
1946 # include_directories : includes,
1947 # link_with : [libshared],
1948 # dependencies : [libblkid],
1949 # install_rpath : rootlibexecdir,
1951 # public_programs += [exe]
1954 # exe = executable('systemd-socket-activate', 'src/activate/activate.c',
1955 # include_directories : includes,
1956 # link_with : [libshared],
1957 # dependencies : [threads],
1958 # install_rpath : rootlibexecdir,
1960 # public_programs += [exe]
1962 # exe = executable('systemctl', 'src/systemctl/systemctl.c',
1963 # include_directories : includes,
1964 # link_with : [libshared],
1965 # dependencies : [threads,
1970 # install_rpath : rootlibexecdir,
1972 # install_dir : rootbindir)
1973 # public_programs += [exe]
1975 # if conf.get('ENABLE_BACKLIGHT') == 1
1976 # executable('systemd-backlight',
1977 # 'src/backlight/backlight.c',
1978 # include_directories : includes,
1979 # link_with : [libshared],
1980 # install_rpath : rootlibexecdir,
1982 # install_dir : rootlibexecdir)
1985 # if conf.get('ENABLE_RFKILL') == 1
1986 # executable('systemd-rfkill',
1987 # 'src/rfkill/rfkill.c',
1988 # include_directories : includes,
1989 # link_with : [libshared],
1990 # install_rpath : rootlibexecdir,
1992 # install_dir : rootlibexecdir)
1995 # executable('systemd-system-update-generator',
1996 # 'src/system-update-generator/system-update-generator.c',
1997 # include_directories : includes,
1998 # link_with : [libshared],
1999 # install_rpath : rootlibexecdir,
2001 # install_dir : systemgeneratordir)
2003 # if conf.get('HAVE_LIBCRYPTSETUP') == 1
2004 # executable('systemd-cryptsetup',
2005 # 'src/cryptsetup/cryptsetup.c',
2006 # include_directories : includes,
2007 # link_with : [libshared],
2008 # dependencies : [libcryptsetup],
2009 # install_rpath : rootlibexecdir,
2011 # install_dir : rootlibexecdir)
2013 # executable('systemd-cryptsetup-generator',
2014 # 'src/cryptsetup/cryptsetup-generator.c',
2015 # include_directories : includes,
2016 # link_with : [libshared],
2017 # dependencies : [libcryptsetup],
2018 # install_rpath : rootlibexecdir,
2020 # install_dir : systemgeneratordir)
2022 # executable('systemd-veritysetup',
2023 # 'src/veritysetup/veritysetup.c',
2024 # include_directories : includes,
2025 # link_with : [libshared],
2026 # dependencies : [libcryptsetup],
2027 # install_rpath : rootlibexecdir,
2029 # install_dir : rootlibexecdir)
2031 # executable('systemd-veritysetup-generator',
2032 # 'src/veritysetup/veritysetup-generator.c',
2033 # include_directories : includes,
2034 # link_with : [libshared],
2035 # dependencies : [libcryptsetup],
2036 # install_rpath : rootlibexecdir,
2038 # install_dir : systemgeneratordir)
2041 # if conf.get('HAVE_SYSV_COMPAT') == 1
2042 # executable('systemd-sysv-generator',
2043 # 'src/sysv-generator/sysv-generator.c',
2044 # include_directories : includes,
2045 # link_with : [libshared],
2046 # install_rpath : rootlibexecdir,
2048 # install_dir : systemgeneratordir)
2050 # executable('systemd-rc-local-generator',
2051 # 'src/rc-local-generator/rc-local-generator.c',
2052 # include_directories : includes,
2053 # link_with : [libshared],
2054 # install_rpath : rootlibexecdir,
2056 # install_dir : systemgeneratordir)
2059 # if conf.get('ENABLE_HOSTNAMED') == 1
2060 # executable('systemd-hostnamed',
2061 # 'src/hostname/hostnamed.c',
2062 # include_directories : includes,
2063 # link_with : [libshared],
2064 # install_rpath : rootlibexecdir,
2066 # install_dir : rootlibexecdir)
2068 # exe = executable('hostnamectl',
2069 # 'src/hostname/hostnamectl.c',
2070 # include_directories : includes,
2071 # link_with : [libshared],
2072 # install_rpath : rootlibexecdir,
2074 # public_programs += [exe]
2077 # if conf.get('ENABLE_LOCALED') == 1
2078 # if conf.get('HAVE_XKBCOMMON') == 1
2079 # # logind will load libxkbcommon.so dynamically on its own
2085 # executable('systemd-localed',
2086 # systemd_localed_sources,
2087 # include_directories : includes,
2088 # link_with : [libshared],
2089 # dependencies : deps,
2090 # install_rpath : rootlibexecdir,
2092 # install_dir : rootlibexecdir)
2094 # exe = executable('localectl',
2095 # localectl_sources,
2096 # include_directories : includes,
2097 # link_with : [libshared],
2098 # install_rpath : rootlibexecdir,
2100 # public_programs += [exe]
2103 # if conf.get('ENABLE_TIMEDATED') == 1
2104 # executable('systemd-timedated',
2105 # 'src/timedate/timedated.c',
2106 # include_directories : includes,
2107 # link_with : [libshared],
2108 # install_rpath : rootlibexecdir,
2110 # install_dir : rootlibexecdir)
2112 # exe = executable('timedatectl',
2113 # 'src/timedate/timedatectl.c',
2114 # include_directories : includes,
2115 # install_rpath : rootlibexecdir,
2116 # link_with : [libshared],
2118 # public_programs += [exe]
2121 # if conf.get('ENABLE_TIMESYNCD') == 1
2122 # executable('systemd-timesyncd',
2123 # systemd_timesyncd_sources,
2124 # include_directories : includes,
2125 # link_with : [libshared],
2126 # dependencies : [threads,
2128 # install_rpath : rootlibexecdir,
2130 # install_dir : rootlibexecdir)
2133 # if conf.get('ENABLE_MACHINED') == 1
2134 # executable('systemd-machined',
2135 # systemd_machined_sources,
2136 # include_directories : includes,
2137 # link_with : [libmachine_core,
2139 # install_rpath : rootlibexecdir,
2141 # install_dir : rootlibexecdir)
2143 # exe = executable('machinectl',
2144 # 'src/machine/machinectl.c',
2145 # include_directories : includes,
2146 # link_with : [libshared],
2147 # dependencies : [threads,
2150 # install_rpath : rootlibexecdir,
2152 # install_dir : rootbindir)
2153 # public_programs += [exe]
2156 # if conf.get('ENABLE_IMPORTD') == 1
2157 # executable('systemd-importd',
2158 # systemd_importd_sources,
2159 # include_directories : includes,
2160 # link_with : [libshared],
2161 # dependencies : [threads],
2162 # install_rpath : rootlibexecdir,
2164 # install_dir : rootlibexecdir)
2166 # systemd_pull = executable('systemd-pull',
2167 # systemd_pull_sources,
2168 # include_directories : includes,
2169 # link_with : [libshared],
2170 # dependencies : [libcurl,
2175 # install_rpath : rootlibexecdir,
2177 # install_dir : rootlibexecdir)
2179 # systemd_import = executable('systemd-import',
2180 # systemd_import_sources,
2181 # include_directories : includes,
2182 # link_with : [libshared],
2183 # dependencies : [libcurl,
2187 # install_rpath : rootlibexecdir,
2189 # install_dir : rootlibexecdir)
2191 # systemd_export = executable('systemd-export',
2192 # systemd_export_sources,
2193 # include_directories : includes,
2194 # link_with : [libshared],
2195 # dependencies : [libcurl,
2199 # install_rpath : rootlibexecdir,
2201 # install_dir : rootlibexecdir)
2202 # public_programs += [systemd_pull, systemd_import, systemd_export]
2205 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
2206 # exe = executable('systemd-journal-upload',
2207 # systemd_journal_upload_sources,
2208 # include_directories : includes,
2209 # link_with : [libshared],
2210 # dependencies : [threads,
2215 # install_rpath : rootlibexecdir,
2217 # install_dir : rootlibexecdir)
2218 # public_programs += [exe]
2221 # if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
2222 # s_j_remote = executable('systemd-journal-remote',
2223 # systemd_journal_remote_sources,
2224 # include_directories : includes,
2225 # link_with : [libshared],
2226 # dependencies : [threads,
2231 # install_rpath : rootlibexecdir,
2233 # install_dir : rootlibexecdir)
2235 # s_j_gatewayd = executable('systemd-journal-gatewayd',
2236 # systemd_journal_gatewayd_sources,
2237 # include_directories : includes,
2238 # link_with : [libshared],
2239 # dependencies : [threads,
2244 # install_rpath : rootlibexecdir,
2246 # install_dir : rootlibexecdir)
2247 # public_programs += [s_j_remote, s_j_gatewayd]
2250 # if conf.get('ENABLE_COREDUMP') == 1
2251 # executable('systemd-coredump',
2252 # systemd_coredump_sources,
2253 # include_directories : includes,
2254 # link_with : [libshared],
2255 # dependencies : [threads,
2260 # install_rpath : rootlibexecdir,
2262 # install_dir : rootlibexecdir)
2264 # exe = executable('coredumpctl',
2265 # coredumpctl_sources,
2266 # include_directories : includes,
2267 # link_with : [libshared],
2268 # dependencies : [threads,
2271 # install_rpath : rootlibexecdir,
2273 # public_programs += [exe]
2276 # if conf.get('ENABLE_BINFMT') == 1
2277 # exe = executable('systemd-binfmt',
2278 # 'src/binfmt/binfmt.c',
2279 # include_directories : includes,
2280 # link_with : [libshared],
2281 # install_rpath : rootlibexecdir,
2283 # install_dir : rootlibexecdir)
2284 # public_programs += [exe]
2286 # meson.add_install_script('sh', '-c',
2287 # mkdir_p.format(binfmtdir))
2288 # meson.add_install_script('sh', '-c',
2289 # mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
2292 # if conf.get('ENABLE_VCONSOLE') == 1
2293 # executable('systemd-vconsole-setup',
2294 # 'src/vconsole/vconsole-setup.c',
2295 # include_directories : includes,
2296 # link_with : [libshared],
2297 # install_rpath : rootlibexecdir,
2299 # install_dir : rootlibexecdir)
2302 # if conf.get('ENABLE_RANDOMSEED') == 1
2303 # executable('systemd-random-seed',
2304 # 'src/random-seed/random-seed.c',
2305 # include_directories : includes,
2306 # link_with : [libshared],
2307 # install_rpath : rootlibexecdir,
2309 # install_dir : rootlibexecdir)
2312 # if conf.get('ENABLE_FIRSTBOOT') == 1
2313 # executable('systemd-firstboot',
2314 # 'src/firstboot/firstboot.c',
2315 # include_directories : includes,
2316 # link_with : [libshared],
2317 # dependencies : [libcrypt],
2318 # install_rpath : rootlibexecdir,
2320 # install_dir : rootbindir)
2323 # executable('systemd-remount-fs',
2324 # 'src/remount-fs/remount-fs.c',
2325 # 'src/core/mount-setup.c',
2326 # 'src/core/mount-setup.h',
2327 # include_directories : includes,
2328 # link_with : [libshared],
2329 # install_rpath : rootlibexecdir,
2331 # install_dir : rootlibexecdir)
2333 # executable('systemd-machine-id-setup',
2334 # 'src/machine-id-setup/machine-id-setup-main.c',
2335 # 'src/core/machine-id-setup.c',
2336 # 'src/core/machine-id-setup.h',
2337 # include_directories : includes,
2338 # link_with : [libshared],
2339 # install_rpath : rootlibexecdir,
2341 # install_dir : rootbindir)
2343 # executable('systemd-fsck',
2344 # 'src/fsck/fsck.c',
2345 # include_directories : includes,
2346 # link_with : [libshared],
2347 # install_rpath : rootlibexecdir,
2349 # install_dir : rootlibexecdir)
2351 # executable('elogind-growfs',
2352 # 'src/partition/growfs.c',
2353 # include_directories : includes,
2354 # link_with : [libshared],
2355 # dependencies : [libcryptsetup],
2356 # install_rpath : rootlibexecdir,
2358 # install_dir : rootlibexecdir)
2360 # executable('elogind-makefs',
2361 # 'src/partition/makefs.c',
2362 # include_directories : includes,
2363 # link_with : [libshared],
2364 # install_rpath : rootlibexecdir,
2366 # install_dir : rootlibexecdir)
2368 # executable('systemd-sleep',
2369 # 'src/sleep/sleep.c',
2370 # include_directories : includes,
2371 # link_with : [libshared],
2372 # install_rpath : rootlibexecdir,
2374 # install_dir : rootlibexecdir)
2376 # exe = executable('systemd-sysctl',
2377 # 'src/sysctl/sysctl.c',
2378 # include_directories : includes,
2379 # link_with : [libshared],
2380 # install_rpath : rootlibexecdir,
2382 # install_dir : rootlibexecdir)
2383 # public_programs += [exe]
2385 # executable('systemd-ac-power',
2386 # 'src/ac-power/ac-power.c',
2387 # include_directories : includes,
2388 # link_with : [libshared],
2389 # install_rpath : rootlibexecdir,
2391 # install_dir : rootlibexecdir)
2393 # exe = executable('systemd-detect-virt',
2394 # 'src/detect-virt/detect-virt.c',
2395 # include_directories : includes,
2396 # link_with : [libshared],
2397 # install_rpath : rootlibexecdir,
2399 # public_programs += [exe]
2401 # exe = executable('systemd-delta',
2402 # 'src/delta/delta.c',
2403 # include_directories : includes,
2404 # link_with : [libshared],
2405 # install_rpath : rootlibexecdir,
2407 # public_programs += [exe]
2409 # exe = executable('systemd-escape',
2410 # 'src/escape/escape.c',
2411 # include_directories : includes,
2412 # link_with : [libshared],
2413 # install_rpath : rootlibexecdir,
2415 # install_dir : rootbindir)
2416 # public_programs += [exe]
2418 # exe = executable('systemd-notify',
2419 # 'src/notify/notify.c',
2420 # include_directories : includes,
2421 # link_with : [libshared],
2422 # install_rpath : rootlibexecdir,
2424 # install_dir : rootbindir)
2425 # public_programs += [exe]
2427 # executable('systemd-volatile-root',
2428 # 'src/volatile-root/volatile-root.c',
2429 # include_directories : includes,
2430 # link_with : [libshared],
2431 # install_rpath : rootlibexecdir,
2433 # install_dir : rootlibexecdir)
2435 # executable('systemd-cgroups-agent',
2436 # 'src/cgroups-agent/cgroups-agent.c',
2437 # include_directories : includes,
2438 # link_with : [libshared],
2439 # install_rpath : rootlibexecdir,
2441 # install_dir : rootlibexecdir)
2443 executable('elogind-cgroups-agent',
2444 'src/cgroups-agent/cgroups-agent.c',
2445 include_directories : includes,
2446 link_with : [libshared_static],
2447 install_rpath : rootlibexecdir,
2449 install_dir : rootlibexecdir)
2452 #if 0 /// UNNEEDED by elogind
2453 # exe = executable('systemd-path',
2454 # 'src/path/path.c',
2455 # include_directories : includes,
2456 # link_with : [libshared],
2457 # install_rpath : rootlibexecdir,
2459 # public_programs += [exe]
2461 # exe = executable('systemd-ask-password',
2462 # 'src/ask-password/ask-password.c',
2463 # include_directories : includes,
2464 # link_with : [libshared],
2465 # install_rpath : rootlibexecdir,
2467 # install_dir : rootbindir)
2468 # public_programs += [exe]
2470 # executable('systemd-reply-password',
2471 # 'src/reply-password/reply-password.c',
2472 # include_directories : includes,
2473 # link_with : [libshared],
2474 # install_rpath : rootlibexecdir,
2476 # install_dir : rootlibexecdir)
2478 # exe = executable('systemd-tty-ask-password-agent',
2479 # 'src/tty-ask-password-agent/tty-ask-password-agent.c',
2480 # include_directories : includes,
2481 # link_with : [libshared],
2482 # install_rpath : rootlibexecdir,
2484 # install_dir : rootbindir)
2485 # public_programs += [exe]
2487 # exe = executable('systemd-cgls',
2488 # 'src/cgls/cgls.c',
2489 # include_directories : includes,
2490 # link_with : [libshared],
2491 # install_rpath : rootlibexecdir,
2493 # public_programs += [exe]
2495 # exe = executable('systemd-cgtop',
2496 # 'src/cgtop/cgtop.c',
2497 # include_directories : includes,
2498 # link_with : [libshared],
2499 # install_rpath : rootlibexecdir,
2501 # public_programs += [exe]
2503 # executable('systemd-initctl',
2504 # 'src/initctl/initctl.c',
2505 # include_directories : includes,
2506 # link_with : [libshared],
2507 # install_rpath : rootlibexecdir,
2509 # install_dir : rootlibexecdir)
2511 # exe = executable('systemd-mount',
2512 # 'src/mount/mount-tool.c',
2513 # include_directories : includes,
2514 # link_with : [libshared],
2515 # install_rpath : rootlibexecdir,
2517 # public_programs += [exe]
2519 # meson.add_install_script(meson_make_symlink,
2520 # 'systemd-mount', join_paths(bindir, 'systemd-umount'))
2522 # exe = executable('systemd-run',
2524 # include_directories : includes,
2525 # link_with : [libshared],
2526 # install_rpath : rootlibexecdir,
2528 # public_programs += [exe]
2530 # exe = executable('systemd-stdio-bridge',
2531 # 'src/stdio-bridge/stdio-bridge.c',
2532 # include_directories : includes,
2533 # link_with : [libshared],
2534 # install_rpath : rootlibexecdir,
2536 # public_programs += [exe]
2538 # exe = executable('busctl',
2539 # 'src/busctl/busctl.c',
2540 # 'src/busctl/busctl-introspect.c',
2541 # 'src/busctl/busctl-introspect.h',
2542 # include_directories : includes,
2543 # link_with : [libshared],
2544 # install_rpath : rootlibexecdir,
2546 # public_programs += [exe]
2548 # if conf.get('ENABLE_SYSUSERS') == 1
2549 # exe = executable('systemd-sysusers',
2550 # 'src/sysusers/sysusers.c',
2551 # include_directories : includes,
2552 # link_with : [libshared],
2553 # install_rpath : rootlibexecdir,
2555 # install_dir : rootbindir)
2556 # public_programs += [exe]
2559 # if conf.get('ENABLE_TMPFILES') == 1
2560 # exe = executable('systemd-tmpfiles',
2561 # 'src/tmpfiles/tmpfiles.c',
2562 # include_directories : includes,
2563 # link_with : [libshared],
2564 # dependencies : [libacl],
2565 # install_rpath : rootlibexecdir,
2567 # install_dir : rootbindir)
2568 # public_programs += [exe]
2570 # test('test-systemd-tmpfiles',
2571 # test_systemd_tmpfiles_py,
2572 # args : exe.full_path())
2573 # # https://github.com/mesonbuild/meson/issues/2681
2576 # if conf.get('ENABLE_HWDB') == 1
2577 # exe = executable('systemd-hwdb',
2578 # 'src/hwdb/hwdb.c',
2579 # 'src/libsystemd/sd-hwdb/hwdb-internal.h',
2580 # include_directories : includes,
2581 # link_with : [libudev_static],
2582 # install_rpath : udev_rpath,
2584 # install_dir : rootbindir)
2585 # public_programs += [exe]
2588 # if conf.get('ENABLE_QUOTACHECK') == 1
2589 # executable('systemd-quotacheck',
2590 # 'src/quotacheck/quotacheck.c',
2591 # include_directories : includes,
2592 # link_with : [libshared],
2593 # install_rpath : rootlibexecdir,
2595 # install_dir : rootlibexecdir)
2598 # exe = executable('systemd-socket-proxyd',
2599 # 'src/socket-proxy/socket-proxyd.c',
2600 # include_directories : includes,
2601 # link_with : [libshared],
2602 # dependencies : [threads],
2603 # install_rpath : rootlibexecdir,
2605 # install_dir : rootlibexecdir)
2606 # public_programs += [exe]
2608 # exe = executable('systemd-udevd',
2609 # systemd_udevd_sources,
2610 # include_directories : includes,
2611 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2612 # link_with : [libudev_core,
2613 # libsystemd_network,
2615 # dependencies : [threads,
2620 # install_rpath : udev_rpath,
2622 # install_dir : rootlibexecdir)
2623 # public_programs += [exe]
2625 # exe = executable('udevadm',
2627 # c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
2628 # include_directories : includes,
2629 # link_with : [libudev_core,
2630 # libsystemd_network,
2632 # dependencies : [threads,
2637 # install_rpath : udev_rpath,
2639 # install_dir : rootbindir)
2640 # public_programs += [exe]
2642 # executable('systemd-shutdown',
2643 # systemd_shutdown_sources,
2644 # include_directories : includes,
2645 # link_with : [libshared],
2646 # install_rpath : rootlibexecdir,
2648 # install_dir : rootlibexecdir)
2650 # executable('systemd-update-done',
2651 # 'src/update-done/update-done.c',
2652 # include_directories : includes,
2653 # link_with : [libshared],
2654 # install_rpath : rootlibexecdir,
2656 # install_dir : rootlibexecdir)
2658 # executable('systemd-update-utmp',
2659 # 'src/update-utmp/update-utmp.c',
2660 # include_directories : includes,
2661 # link_with : [libshared],
2662 # dependencies : [libaudit],
2663 # install_rpath : rootlibexecdir,
2665 # install_dir : rootlibexecdir)
2667 # if conf.get('HAVE_KMOD') == 1
2668 # executable('systemd-modules-load',
2669 # 'src/modules-load/modules-load.c',
2670 # include_directories : includes,
2671 # link_with : [libshared],
2672 # dependencies : [libkmod],
2673 # install_rpath : rootlibexecdir,
2675 # install_dir : rootlibexecdir)
2677 # meson.add_install_script('sh', '-c',
2678 # mkdir_p.format(modulesloaddir))
2679 # meson.add_install_script('sh', '-c',
2680 # mkdir_p.format(join_paths(sysconfdir, 'modules-load.d')))
2683 # exe = executable('systemd-nspawn',
2684 # systemd_nspawn_sources,
2685 # 'src/core/mount-setup.c', # FIXME: use a variable?
2686 # 'src/core/mount-setup.h',
2687 # 'src/core/loopback-setup.c',
2688 # 'src/core/loopback-setup.h',
2689 # include_directories : [includes, include_directories('src/nspawn')],
2690 # link_with : [libshared],
2691 # dependencies : [libacl,
2695 # install_rpath : rootlibexecdir,
2697 # public_programs += [exe]
2699 # if conf.get('ENABLE_NETWORKD') == 1
2700 # executable('systemd-networkd',
2701 # systemd_networkd_sources,
2702 # include_directories : includes,
2703 # link_with : [libnetworkd_core,
2704 # libsystemd_network,
2707 # dependencies : [threads],
2708 # install_rpath : rootlibexecdir,
2710 # install_dir : rootlibexecdir)
2712 # executable('systemd-networkd-wait-online',
2713 # systemd_networkd_wait_online_sources,
2714 # include_directories : includes,
2715 # link_with : [libnetworkd_core,
2717 # install_rpath : rootlibexecdir,
2719 # install_dir : rootlibexecdir)
2721 # exe = executable('networkctl',
2722 # networkctl_sources,
2723 # include_directories : includes,
2724 # link_with : [libsystemd_network,
2726 # install_rpath : rootlibexecdir,
2728 # install_dir : rootbindir)
2729 # public_programs += [exe]
2732 # executable('systemd-sulogin-shell',
2733 # ['src/sulogin-shell/sulogin-shell.c'],
2734 # include_directories : includes,
2735 # link_with : [libshared],
2736 # install_rpath : rootlibexecdir,
2738 # install_dir : rootlibexecdir)
2740 executable('elogind-uaccess-command',
2741 'src/uaccess-command/uaccess-command.c',
2742 include_directories : includes,
2743 link_with : [liblogind_core,
2745 dependencies: [libacl,
2747 install_rpath : rootlibexecdir,
2749 install_dir : rootlibexecdir)
2752 ############################################################
2754 foreach tuple : tests
2756 link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2757 dependencies = tuple[2]
2758 condition = tuple.length() >= 4 ? tuple[3] : ''
2759 type = tuple.length() >= 5 ? tuple[4] : ''
2760 defs = tuple.length() >= 6 ? tuple[5] : []
2761 incs = tuple.length() >= 7 ? tuple[6] : includes
2764 name = sources[0].split('/')[-1].split('.')[0]
2765 if type.startswith('timeout=')
2766 timeout = type.split('=')[1].to_int()
2769 if want_tests == 'false'
2770 message('Not compiling @0@ because tests is set to false'.format(name))
2771 elif condition == '' or conf.get(condition) == 1
2775 include_directories : incs,
2776 link_with : link_with,
2777 dependencies : dependencies,
2779 install_rpath : rootlibexecdir,
2780 install : install_tests,
2781 install_dir : join_paths(testsdir, type))
2784 message('@0@ is a manual test'.format(name))
2785 elif type == 'unsafe' and want_tests != 'unsafe'
2786 message('@0@ is an unsafe test'.format(name))
2793 message('Not compiling @0@ because @1@ is not true'.format(name, condition))
2797 #if 0 /// UNNEEDED by elogind
2798 # test_libsystemd_sym = executable(
2799 # 'test-libsystemd-sym',
2800 # test_libsystemd_sym_c,
2801 # include_directories : includes,
2802 # link_with : [libsystemd],
2803 # install : install_tests,
2804 # install_dir : testsdir)
2805 # test('test-libsystemd-sym',
2806 # test_libsystemd_sym)
2808 # test_libudev_sym = executable(
2809 # 'test-libudev-sym',
2810 # test_libudev_sym_c,
2811 # include_directories : includes,
2812 # c_args : ['-Wno-deprecated-declarations'],
2813 # link_with : [libudev],
2814 # install : install_tests,
2815 # install_dir : testsdir)
2816 # test('test-libudev-sym',
2819 # ############################################################
2823 # foreach tuple : fuzzers
2824 # sources = tuple[0]
2825 # link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
2826 # dependencies = tuple[2]
2827 # defs = tuple.length() >= 4 ? tuple[3] : []
2828 # incs = tuple.length() >= 5 ? tuple[4] : includes
2831 # dependencies += fuzzing_engine
2833 # sources += 'src/fuzz/fuzz-main.c'
2836 # name = sources[0].split('/')[-1].split('.')[0]
2838 # fuzzer_exes += executable(
2841 # include_directories : [incs, include_directories('src/fuzz')],
2842 # link_with : link_with,
2843 # dependencies : dependencies,
2848 # run_target('fuzzers',
2849 # depends : fuzzer_exes,
2850 # command : ['true'])
2852 # ############################################################
2855 test_libelogind_sym = executable(
2856 'test-libelogind-sym',
2857 test_libelogind_sym_c,
2858 include_directories : includes,
2859 link_with : [libelogind],
2860 install : install_tests,
2861 install_dir : testsdir)
2862 test('test-libelogind-sym',
2863 test_libelogind_sym)
2865 make_directive_index_py = find_program('tools/make-directive-index.py')
2866 make_man_index_py = find_program('tools/make-man-index.py')
2867 xml_helper_py = find_program('tools/xml_helper.py')
2868 #if 0 /// UNNEEDED by elogind
2869 # hwdb_update_sh = find_program('tools/meson-hwdb-update.sh')
2872 # subdir('sysctl.d')
2873 # subdir('sysusers.d')
2874 # subdir('tmpfiles.d')
2880 subdir('shell-completion/bash')
2881 subdir('shell-completion/zsh')
2882 #if 0 /// UNNEEDED by elogind
2883 # subdir('docs/sysvinit')
2884 # subdir('docs/var-log')
2887 # FIXME: figure out if the warning is true:
2888 # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir
2889 install_subdir('factory/etc',
2890 install_dir : factorydir)
2893 #if 0 /// UNNEEDED by elogind
2894 # install_data('xorg/50-systemd-user.sh',
2895 # install_dir : xinitrcdir)
2896 # install_data('modprobe.d/systemd.conf',
2897 # install_dir : modprobedir)
2899 install_data('README',
2902 #if 0 /// UNNEEDED by elogind
2908 'TRANSIENT-SETTINGS.md',
2910 'src/libelogind/sd-bus/GVARIANT-SERIALIZATION',
2911 install_dir : docdir)
2913 #if 0 /// UNNEEDED by elogind
2914 # meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir))
2916 meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir))
2918 ############################################################
2920 meson_check_help = find_program('tools/meson-check-help.sh')
2922 foreach exec : public_programs
2923 name = exec.full_path().split('/')[-1]
2924 test('check-help-' + name,
2926 args : [exec.full_path()])
2929 ############################################################
2932 foreach p : fuzz_regression_tests
2933 a = p.split('/')[-3]
2934 b = p.split('/')[-2]
2935 c = p.split('/')[-1]
2938 build = sanitize_address
2940 error('unknown sanitizer @0@'.format(a))
2943 name = '@1@:@0@'.format(a, b)
2946 if want_tests == 'false'
2947 message('Not compiling @0@ because tests is set to false'.format(name))
2948 elif not sanitizers.contains(a)
2949 message('Not compiling @0@ because @1@ sanitizer is not available'.format(name, a))
2951 exe = custom_target(
2955 command : [env, 'ln', '-fs',
2956 join_paths(build.full_path(), b),
2958 build_by_default : true)
2960 message('Not compiling @0@ because slow-tests is set to false'.format(name))
2965 if want_tests != 'false' and slow_tests
2966 test(c, env, args : [exe.full_path(),
2967 join_paths(meson.source_root(),
2968 'test/fuzz-regressions',
2973 ############################################################
2976 all_files = run_command(
2978 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
2981 all_files = files(all_files.stdout().split())
2986 command : [env, 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
2990 command : [env, 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
2993 #if 0 /// UNNEEDED by elogind
2995 # meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh')
2998 # command : [meson_git_contrib_sh])
3003 git_head = run_command(
3005 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3006 'rev-parse', 'HEAD']).stdout().strip()
3007 git_head_short = run_command(
3009 ['--git-dir=@0@/.git'.format(meson.current_source_dir()),
3010 'rev-parse', '--short=7', 'HEAD']).stdout().strip()
3014 command : ['git', 'archive',
3015 '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(),
3017 '--prefix', 'systemd-@0@/'.format(git_head),
3021 ############################################################
3023 meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh')
3026 depends : [man, libelogind, libudev],
3027 command : [meson_check_api_docs_sh, libelogind.full_path(), libudev.full_path()])
3029 ############################################################
3032 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
3034 #if 0 /// UNSUPPORTED by elogind
3035 # 'prefix directory: @0@'.format(prefixdir),
3036 # 'rootprefix directory: @0@'.format(rootprefixdir),
3037 # 'sysconf directory: @0@'.format(sysconfdir),
3038 # 'include directory: @0@'.format(includedir),
3039 # 'lib directory: @0@'.format(libdir),
3040 # 'rootlib directory: @0@'.format(rootlibdir),
3041 # 'SysV init scripts: @0@'.format(sysvinit_path),
3042 # 'SysV rc?.d directories: @0@'.format(sysvrcnd_path),
3044 'rootexeclib dir: @0@'.format(rootlibexecdir),
3046 #if 0 /// UNSUPPORTED by elogind
3047 # 'PAM modules directory: @0@'.format(pamlibdir),
3048 # 'PAM configuration directory: @0@'.format(pamconfdir),
3049 # 'RPM macros directory: @0@'.format(rpmmacrosdir),
3050 # 'modprobe.d directory: @0@'.format(modprobedir),
3051 # 'D-Bus policy directory: @0@'.format(dbuspolicydir),
3052 # 'D-Bus session directory: @0@'.format(dbussessionservicedir),
3053 # 'D-Bus system directory: @0@'.format(dbussystemservicedir),
3054 # 'bash completions directory: @0@'.format(bashcompletiondir),
3055 # 'zsh completions directory: @0@'.format(zshcompletiondir),
3056 # 'extra start script: @0@'.format(get_option('rc-local')),
3057 # 'extra stop script: @0@'.format(get_option('halt-local')),
3058 # 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
3059 # get_option('debug-tty')),
3061 'TTY GID: @0@'.format(tty_gid),
3062 #if 0 /// UNSUPPORTED by elogind
3063 # 'users GID: @0@'.format(users_gid),
3065 'maximum system UID: @0@'.format(system_uid_max),
3066 'maximum system GID: @0@'.format(system_gid_max),
3067 #if 0 /// UNSUPPORTED by elogind
3068 # 'minimum dynamic UID: @0@'.format(dynamic_uid_min),
3069 # 'maximum dynamic UID: @0@'.format(dynamic_uid_max),
3070 # 'minimum container UID base: @0@'.format(container_uid_base_min),
3071 # 'maximum container UID base: @0@'.format(container_uid_base_max),
3072 # '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')),
3073 # 'render group access mode: @0@'.format(get_option('group-render-mode')),
3074 # 'certificate root directory: @0@'.format(get_option('certificate-root')),
3075 # 'support URL: @0@'.format(support_url),
3076 # 'nobody user name: @0@'.format(nobody_user),
3077 # 'nobody group name: @0@'.format(nobody_group),
3078 # 'fallback hostname: @0@'.format(get_option('fallback-hostname')),
3079 # 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)),
3081 # 'default DNSSEC mode: @0@'.format(default_dnssec),
3082 # 'default cgroup hierarchy: @0@'.format(default_hierarchy),
3084 'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
3086 #if 0 /// UNSUPPORTED by elogind
3087 # alt_dns_servers = '\n '.join(dns_servers.split(' '))
3088 # alt_ntp_servers = '\n '.join(ntp_servers.split(' '))
3090 # 'default DNS servers: @0@'.format(alt_dns_servers),
3091 # 'default NTP servers: @0@'.format(alt_ntp_servers)]
3093 # alt_time_epoch = run_command('date', '-Is', '-u', '-d',
3094 # '@@0@'.format(time_epoch)).stdout().strip()
3096 # 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
3100 # CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
3101 # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
3102 # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
3104 #if 0 /// UNNEEDED by elogind
3105 # if conf.get('ENABLE_EFI') == 1
3107 # 'efi arch: @0@'.format(efi_arch)]
3111 # 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME),
3112 # 'EFI CC @0@'.format(efi_cc),
3113 # 'EFI lib directory: @0@'.format(efi_libdir),
3114 # 'EFI lds directory: @0@'.format(efi_ldsdir),
3115 # 'EFI include directory: @0@'.format(efi_incdir)]
3124 #if 0 /// UNNEEDED by elogind
3125 # ['libcryptsetup'],
3129 #if 0 /// UNNEEDED by elogind
3134 #if 0 /// UNNEEDED by elogind
3138 #if 0 /// UNNEEDED by elogind
3145 #if 0 /// UNNEEDED by elogind
3161 # ['environment.d'],
3179 ['legacy pkla', install_polkit_pkla],
3180 #if 0 /// UNNEEDED by elogind
3182 # ['gnu-efi', have_gnu_efi],
3190 #if 0 /// UNNEEDED by elogind
3191 # ['nss-myhostname', conf.get('ENABLE_MYHOSTNAME') == 1],
3195 ['man pages', want_man],
3196 ['html pages', want_html],
3197 ['man page indices', want_man and have_lxml],
3198 #if 0 /// UNNEEDED by elogind
3199 # ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
3203 #if 0 /// UNNEEDED by elogind
3206 # ['adm group', get_option('adm-group')],
3207 # ['wheel group', get_option('wheel-group')],
3213 ['debug mmap cache'],
3216 cond = tuple.get(1, '')
3218 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
3219 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
3220 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
3225 missing += [tuple[0]]
3231 'enabled features: @0@'.format(', '.join(found)),
3233 'disabled features: @0@'.format(', '.join(missing)),
3235 message('\n '.join(status))
3237 if rootprefixdir != rootprefix_default
3238 message('WARNING:\n' +
3239 ' Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) +
3240 ' elogind used fixed names for unit file directories and other paths, so anything\n' +
3241 ' except the default ("@0@") is strongly discouraged.'.format(rootprefix_default))