]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | # SPDX-License-Identifier: LGPL-2.1-or-later |
3a726fcd | 2 | |
5c23128d | 3 | project('systemd', 'c', |
a6ea4dc1 | 4 | version : '251', |
5c23128d ZJS |
5 | license : 'LGPLv2+', |
6 | default_options: [ | |
2b2dbcbb | 7 | 'c_std=gnu11', |
37efbbd8 ZJS |
8 | 'prefix=/usr', |
9 | 'sysconfdir=/etc', | |
10 | 'localstatedir=/var', | |
827ca909 | 11 | 'warning_level=2', |
5c23128d | 12 | ], |
9247df5a | 13 | meson_version : '>= 0.53.2', |
5c23128d ZJS |
14 | ) |
15 | ||
a6ea4dc1 ZJS |
16 | libsystemd_version = '0.34.0' |
17 | libudev_version = '1.7.4' | |
56d50ab1 | 18 | |
5c23128d | 19 | conf = configuration_data() |
a8c03388 | 20 | conf.set_quoted('PROJECT_URL', 'https://systemd.io/') |
e11a25ca | 21 | conf.set('PROJECT_VERSION', meson.project_version(), |
6ffeca8c | 22 | description : 'Numerical project version (used where a simple number is expected)') |
5c23128d | 23 | |
1485aacb DC |
24 | # This is to be used instead of meson.source_root(), as the latter will return |
25 | # the wrong result when systemd is being built as a meson subproject | |
26 | project_source_root = meson.current_source_dir() | |
81e06775 | 27 | project_build_root = meson.current_build_dir() |
a0b15b41 | 28 | relative_source_path = run_command('realpath', |
81e06775 | 29 | '--relative-to=@0@'.format(project_build_root), |
e92777d2 ZJS |
30 | project_source_root, |
31 | check : true).stdout().strip() | |
a0b15b41 | 32 | conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path) |
1485aacb | 33 | |
47350c5f ZJS |
34 | conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer', |
35 | description : 'tailor build to development or release builds') | |
011a03a3 ZJS |
36 | verification = get_option('log-message-verification') |
37 | if verification == 'auto' | |
38 | verification = conf.get('BUILD_MODE_DEVELOPER') == 1 | |
39 | else | |
40 | verification = verification == 'true' | |
41 | endif | |
42 | conf.set10('LOG_MESSAGE_VERIFICATION', verification) | |
839bdf25 | 43 | |
c09edc79 ZJS |
44 | want_ossfuzz = get_option('oss-fuzz') |
45 | want_libfuzzer = get_option('llvm-fuzz') | |
c29537f3 | 46 | if want_ossfuzz and want_libfuzzer |
6b8d32ea | 47 | error('only one of oss-fuzz or llvm-fuzz can be specified') |
c09edc79 | 48 | endif |
87ac55a1 | 49 | |
678ba020 | 50 | skip_deps = want_ossfuzz or get_option('skip-deps') |
6b8d32ea | 51 | fuzzer_build = want_ossfuzz or want_libfuzzer |
c09edc79 | 52 | |
c4f883b7 ZJS |
53 | # If we're building *not* for actual fuzzing, allow input samples of any size |
54 | # (for testing and for reproduction of issues discovered with previously-higher | |
55 | # limits). | |
56 | conf.set10('FUZZ_USE_SIZE_LIMIT', fuzzer_build) | |
57 | ||
3f871f12 ZJS |
58 | # Create a title-less summary section early, so it ends up first in the output. |
59 | # More items are added later after they have been detected. | |
60 | summary({'build mode' : get_option('mode')}) | |
61 | ||
5c23128d ZJS |
62 | ##################################################################### |
63 | ||
003c8879 | 64 | # Try to install the git pre-commit hook |
e2d612a8 ZJS |
65 | add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false) |
66 | if add_git_hook_sh.found() | |
e92777d2 | 67 | git_hook = run_command(add_git_hook_sh, check : false) |
e2d612a8 ZJS |
68 | if git_hook.returncode() == 0 |
69 | message(git_hook.stdout().strip()) | |
70 | endif | |
003c8879 ZJS |
71 | endif |
72 | ||
73 | ##################################################################### | |
74 | ||
4cf8a609 | 75 | fs = import('fs') |
2675413e | 76 | if get_option('split-usr') == 'auto' |
4cf8a609 | 77 | split_usr = not fs.is_symlink('/bin') |
2675413e ZJS |
78 | else |
79 | split_usr = get_option('split-usr') == 'true' | |
80 | endif | |
9afd5e7b ZJS |
81 | if split_usr |
82 | warning('\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n' | |
83 | + ' split-usr mode is going to be removed\n' + | |
84 | '\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') | |
85 | endif | |
671f0f8d ZJS |
86 | conf.set10('HAVE_SPLIT_USR', split_usr, |
87 | description : '/usr/bin and /bin directories are separate') | |
9a8e64b0 | 88 | |
157baa87 | 89 | if get_option('split-bin') == 'auto' |
4cf8a609 | 90 | split_bin = not fs.is_symlink('/usr/sbin') |
157baa87 ZJS |
91 | else |
92 | split_bin = get_option('split-bin') == 'true' | |
93 | endif | |
671f0f8d ZJS |
94 | conf.set10('HAVE_SPLIT_BIN', split_bin, |
95 | description : 'bin and sbin directories are separate') | |
157baa87 | 96 | |
74344a17 | 97 | rootprefixdir = get_option('rootprefix') |
74344a17 ZJS |
98 | # Unusual rootprefixdir values are used by some distros |
99 | # (see https://github.com/systemd/systemd/pull/7461). | |
ba7f4ae6 | 100 | rootprefix_default = split_usr ? '/' : '/usr' |
9a8e64b0 ZJS |
101 | if rootprefixdir == '' |
102 | rootprefixdir = rootprefix_default | |
74344a17 | 103 | endif |
23bdba61 | 104 | rootprefixdir_noslash = rootprefixdir == '/' ? '' : rootprefixdir |
5c23128d | 105 | |
8ef8f3d5 FB |
106 | have_standalone_binaries = get_option('standalone-binaries') |
107 | ||
5c23128d ZJS |
108 | sysvinit_path = get_option('sysvinit-path') |
109 | sysvrcnd_path = get_option('sysvrcnd-path') | |
348b4437 | 110 | conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '', |
349cc4a5 | 111 | description : 'SysV init scripts and rcN.d links are supported') |
6fe23ff3 | 112 | conf.set10('CREATE_LOG_DIRS', get_option('create-log-dirs')) |
5c23128d | 113 | |
cdf7ad38 NL |
114 | if get_option('hibernate') and not get_option('initrd') |
115 | error('hibernate depends on initrd') | |
116 | endif | |
117 | ||
a8b627aa LP |
118 | conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max')) |
119 | conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open')) | |
09dad04c | 120 | conf.set('HIGH_RLIMIT_NOFILE', 512*1024) |
a8b627aa | 121 | |
fce9abb2 ZJS |
122 | # Meson ignores the preceding arguments when joining paths if an absolute |
123 | # component is encountered, so this should canonicalize various paths when they | |
124 | # are absolute or relative. | |
5c23128d ZJS |
125 | prefixdir = get_option('prefix') |
126 | if not prefixdir.startswith('/') | |
37efbbd8 | 127 | error('Prefix is not absolute: "@0@"'.format(prefixdir)) |
5c23128d | 128 | endif |
b2d74870 | 129 | if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/') |
d895e10a ZJS |
130 | error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format( |
131 | rootprefixdir, prefixdir)) | |
132 | endif | |
133 | ||
fce9abb2 ZJS |
134 | bindir = prefixdir / get_option('bindir') |
135 | libdir = prefixdir / get_option('libdir') | |
136 | sysconfdir = prefixdir / get_option('sysconfdir') | |
137 | includedir = prefixdir / get_option('includedir') | |
138 | datadir = prefixdir / get_option('datadir') | |
139 | localstatedir = '/' / get_option('localstatedir') | |
5c23128d | 140 | |
fce9abb2 ZJS |
141 | rootbindir = rootprefixdir / 'bin' |
142 | rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin') | |
143 | rootlibexecdir = rootprefixdir / 'lib/systemd' | |
5c23128d ZJS |
144 | |
145 | rootlibdir = get_option('rootlibdir') | |
146 | if rootlibdir == '' | |
e91119c3 MG |
147 | # This will be a relative path if libdir is in prefix. |
148 | rootlibdir = get_option('libdir') | |
149 | endif | |
150 | if not rootlibdir.startswith('/') | |
151 | # If we have a relative path, add rootprefixdir to the front. | |
152 | rootlibdir = rootprefixdir / rootlibdir | |
5c23128d | 153 | endif |
5fb22561 | 154 | rootpkglibdir = rootlibdir / 'systemd' |
5c23128d | 155 | |
225d08b8 JT |
156 | install_sysconfdir = get_option('install-sysconfdir') != 'false' |
157 | install_sysconfdir_samples = get_option('install-sysconfdir') == 'true' | |
5c23128d | 158 | # Dirs of external packages |
fce9abb2 ZJS |
159 | pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig' |
160 | pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig' | |
161 | polkitpolicydir = datadir / 'polkit-1/actions' | |
162 | polkitrulesdir = datadir / 'polkit-1/rules.d' | |
163 | polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d' | |
164 | xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d' | |
8a38aac3 YW |
165 | rpmmacrosdir = get_option('rpmmacrosdir') |
166 | if rpmmacrosdir != 'no' | |
fce9abb2 | 167 | rpmmacrosdir = prefixdir / rpmmacrosdir |
8a38aac3 | 168 | endif |
fce9abb2 | 169 | modprobedir = rootprefixdir / 'lib/modprobe.d' |
5c23128d ZJS |
170 | |
171 | # Our own paths | |
fce9abb2 ZJS |
172 | pkgdatadir = datadir / 'systemd' |
173 | environmentdir = prefixdir / 'lib/environment.d' | |
174 | pkgsysconfdir = sysconfdir / 'systemd' | |
175 | userunitdir = prefixdir / 'lib/systemd/user' | |
176 | userpresetdir = prefixdir / 'lib/systemd/user-preset' | |
177 | tmpfilesdir = prefixdir / 'lib/tmpfiles.d' | |
107795a7 | 178 | usertmpfilesdir = prefixdir / 'share/user-tmpfiles.d' |
fce9abb2 ZJS |
179 | sysusersdir = prefixdir / 'lib/sysusers.d' |
180 | sysctldir = prefixdir / 'lib/sysctl.d' | |
181 | binfmtdir = prefixdir / 'lib/binfmt.d' | |
182 | modulesloaddir = prefixdir / 'lib/modules-load.d' | |
183 | networkdir = rootprefixdir / 'lib/systemd/network' | |
184 | pkgincludedir = includedir / 'systemd' | |
185 | systemgeneratordir = rootlibexecdir / 'system-generators' | |
186 | usergeneratordir = prefixdir / 'lib/systemd/user-generators' | |
187 | systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators' | |
188 | userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators' | |
189 | systemshutdowndir = rootlibexecdir / 'system-shutdown' | |
190 | systemsleepdir = rootlibexecdir / 'system-sleep' | |
191 | systemunitdir = rootprefixdir / 'lib/systemd/system' | |
192 | systempresetdir = rootprefixdir / 'lib/systemd/system-preset' | |
193 | udevlibexecdir = rootprefixdir / 'lib/udev' | |
194 | udevrulesdir = udevlibexecdir / 'rules.d' | |
195 | udevhwdbdir = udevlibexecdir / 'hwdb.d' | |
196 | catalogdir = prefixdir / 'lib/systemd/catalog' | |
641e2124 | 197 | kerneldir = prefixdir / 'lib/kernel' |
198 | kernelinstalldir = kerneldir / 'install.d' | |
fce9abb2 ZJS |
199 | factorydir = datadir / 'factory' |
200 | bootlibdir = prefixdir / 'lib/systemd/boot/efi' | |
201 | testsdir = prefixdir / 'lib/systemd/tests' | |
202 | systemdstatedir = localstatedir / 'lib/systemd' | |
203 | catalogstatedir = systemdstatedir / 'catalog' | |
204 | randomseeddir = localstatedir / 'lib/systemd' | |
205 | profiledir = rootlibexecdir / 'portable' / 'profile' | |
206 | ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d' | |
5c23128d | 207 | |
75aaade1 TB |
208 | docdir = get_option('docdir') |
209 | if docdir == '' | |
fce9abb2 | 210 | docdir = datadir / 'doc/systemd' |
75aaade1 TB |
211 | endif |
212 | ||
5c23128d ZJS |
213 | pamlibdir = get_option('pamlibdir') |
214 | if pamlibdir == '' | |
fce9abb2 | 215 | pamlibdir = rootlibdir / 'security' |
5c23128d ZJS |
216 | endif |
217 | ||
218 | pamconfdir = get_option('pamconfdir') | |
219 | if pamconfdir == '' | |
fce9abb2 | 220 | pamconfdir = prefixdir / 'lib/pam.d' |
5c23128d ZJS |
221 | endif |
222 | ||
d1ae38d8 OK |
223 | libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir') |
224 | if libcryptsetup_plugins_dir == '' | |
fce9abb2 | 225 | libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup' |
d1ae38d8 OK |
226 | endif |
227 | ||
444d5863 | 228 | memory_accounting_default = get_option('memory-accounting-default') |
36cf4507 | 229 | status_unit_format_default = get_option('status-unit-format-default') |
819c0dcb ZJS |
230 | if status_unit_format_default == 'auto' |
231 | status_unit_format_default = conf.get('BUILD_MODE_DEVELOPER') == 1 ? 'name' : 'description' | |
232 | endif | |
444d5863 | 233 | |
491bf10c ZJS |
234 | conf.set_quoted('BINFMT_DIR', binfmtdir) |
235 | conf.set_quoted('BOOTLIBDIR', bootlibdir) | |
fce9abb2 | 236 | conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database') |
491bf10c | 237 | conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root')) |
6fe23ff3 | 238 | conf.set_quoted('DOC_DIR', docdir) |
fce9abb2 | 239 | conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd') |
491bf10c ZJS |
240 | conf.set_quoted('ENVIRONMENT_DIR', environmentdir) |
241 | conf.set_quoted('INCLUDE_DIR', includedir) | |
242 | conf.set_quoted('LIBDIR', libdir) | |
243 | conf.set_quoted('MODPROBE_DIR', modprobedir) | |
244 | conf.set_quoted('MODULESLOAD_DIR', modulesloaddir) | |
5c23128d | 245 | conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir) |
fce9abb2 | 246 | conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent') |
491bf10c | 247 | conf.set_quoted('PREFIX', prefixdir) |
fce9abb2 | 248 | conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed') |
491bf10c | 249 | conf.set_quoted('RANDOM_SEED_DIR', randomseeddir) |
452d2dfd | 250 | conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local')) |
491bf10c ZJS |
251 | conf.set_quoted('ROOTBINDIR', rootbindir) |
252 | conf.set_quoted('ROOTLIBDIR', rootlibdir) | |
253 | conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir) | |
254 | conf.set_quoted('ROOTPREFIX', rootprefixdir) | |
255 | conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash) | |
256 | conf.set_quoted('SYSCONF_DIR', sysconfdir) | |
257 | conf.set_quoted('SYSCTL_DIR', sysctldir) | |
fce9abb2 ZJS |
258 | conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl') |
259 | conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd') | |
491bf10c | 260 | conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir) |
fce9abb2 ZJS |
261 | conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent') |
262 | conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup') | |
263 | conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export') | |
264 | conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck') | |
265 | conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs') | |
266 | conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework') | |
267 | conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs') | |
268 | conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import') | |
1f1a2243 | 269 | conf.set_quoted('SYSTEMD_INTEGRITYSETUP_PATH', rootlibexecdir / 'systemd-integritysetup') |
fce9abb2 ZJS |
270 | conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map') |
271 | conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map') | |
272 | conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs') | |
273 | conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull') | |
274 | conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown') | |
fce9abb2 ZJS |
275 | conf.set_quoted('SYSTEMD_TEST_DATA', testsdir / 'testdata') |
276 | conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent') | |
277 | conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper') | |
278 | conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork') | |
279 | conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup') | |
280 | conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system') | |
491bf10c | 281 | conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir) |
96d33e4a | 282 | conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir) |
491bf10c ZJS |
283 | conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir) |
284 | conf.set_quoted('SYSTEM_PRESET_DIR', systempresetdir) | |
5c23128d ZJS |
285 | conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir) |
286 | conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) | |
491bf10c ZJS |
287 | conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path) |
288 | conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path) | |
835cf75a ZJS |
289 | conf.set_quoted('SYSUSERS_DIR', sysusersdir) |
290 | conf.set_quoted('TMPFILES_DIR', tmpfilesdir) | |
107795a7 | 291 | conf.set_quoted('USER_TMPFILES_DIR', usertmpfilesdir) |
5c23128d | 292 | conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) |
491bf10c ZJS |
293 | conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir) |
294 | conf.set_quoted('UDEV_RULES_DIR', udevrulesdir) | |
36d55958 | 295 | conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout')) |
fce9abb2 | 296 | conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user') |
491bf10c ZJS |
297 | conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir) |
298 | conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir) | |
299 | conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir) | |
fce9abb2 | 300 | conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg') |
491bf10c | 301 | conf.set_quoted('USER_PRESET_DIR', userpresetdir) |
fce9abb2 | 302 | conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg') |
491bf10c ZJS |
303 | |
304 | conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper()) | |
e5d86ebe | 305 | conf.set10('ENABLE_URLIFY', get_option('urlify')) |
491bf10c | 306 | conf.set10('ENABLE_FEXECVE', get_option('fexecve')) |
30538ff1 | 307 | conf.set10('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default) |
36cf4507 | 308 | conf.set('STATUS_UNIT_FORMAT_DEFAULT', 'STATUS_UNIT_FORMAT_' + status_unit_format_default.to_upper()) |
e11a25ca | 309 | conf.set_quoted('STATUS_UNIT_FORMAT_DEFAULT_STR', status_unit_format_default) |
5c23128d | 310 | |
93651582 JL |
311 | conf.set10('FIRST_BOOT_FULL_PRESET', get_option('first-boot-full-preset')) |
312 | ||
6017eee9 LP |
313 | conf.set10('EFI_TPM_PCR_COMPAT', get_option('efi-tpm-pcr-compat')) |
314 | ||
5c23128d ZJS |
315 | ##################################################################### |
316 | ||
317 | cc = meson.get_compiler('c') | |
318 | pkgconfig = import('pkgconfig') | |
b68dfb9e | 319 | meson_build_sh = find_program('tools/meson-build.sh') |
5c23128d | 320 | |
d3da291e ZJS |
321 | want_tests = get_option('tests') |
322 | slow_tests = want_tests != 'false' and get_option('slow-tests') | |
c56463fd | 323 | fuzz_tests = want_tests != 'false' and get_option('fuzz-tests') |
d3da291e ZJS |
324 | install_tests = get_option('install-tests') |
325 | ||
46e63a2a | 326 | if add_languages('cpp', required : fuzzer_build) |
3b2bdd62 | 327 | # Used only for tests |
e9f4f566 ZJS |
328 | cxx = meson.get_compiler('cpp') |
329 | cxx_cmd = ' '.join(cxx.cmd_array()) | |
1b2acaa7 | 330 | else |
9b0ca019 | 331 | cxx_cmd = '' |
94e2523b ZJS |
332 | endif |
333 | ||
31e57a35 | 334 | if want_libfuzzer |
9c5c4677 EV |
335 | fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false) |
336 | if fuzzing_engine.found() | |
337 | add_project_arguments('-fsanitize-coverage=trace-pc-guard,trace-cmp', language : 'c') | |
338 | elif cc.has_argument('-fsanitize=fuzzer-no-link') | |
339 | add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c') | |
340 | else | |
341 | error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported') | |
342 | endif | |
c09edc79 | 343 | elif want_ossfuzz |
7db7d5b7 JR |
344 | fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine') |
345 | endif | |
346 | ||
e9f4f566 ZJS |
347 | # Those generate many false positives, and we do not want to change the code to |
348 | # avoid them. | |
349 | basic_disabled_warnings = [ | |
505ab9dd | 350 | '-Wno-format-signedness', |
e9f4f566 | 351 | '-Wno-missing-field-initializers', |
505ab9dd | 352 | '-Wno-unused-parameter', |
e9f4f566 | 353 | ] |
e9f4f566 | 354 | |
65267363 | 355 | possible_common_cc_flags = [ |
505ab9dd YW |
356 | '-Wdate-time', |
357 | '-Wendif-labels', | |
358 | '-Werror=format=2', | |
359 | '-Werror=implicit-function-declaration', | |
360 | '-Werror=incompatible-pointer-types', | |
ebbb1e36 | 361 | '-Werror=int-conversion', |
505ab9dd | 362 | '-Werror=overflow', |
48c67fdf | 363 | '-Werror=override-init', |
505ab9dd YW |
364 | '-Werror=return-type', |
365 | '-Werror=shift-count-overflow', | |
366 | '-Werror=shift-overflow=2', | |
30a4ddff | 367 | '-Werror=undef', |
505ab9dd | 368 | '-Wfloat-equal', |
c0f5d58c JJ |
369 | # gperf prevents us from enabling this because it does not emit fallthrough |
370 | # attribute with clang. | |
371 | #'-Wimplicit-fallthrough', | |
505ab9dd YW |
372 | '-Wimplicit-fallthrough=5', |
373 | '-Winit-self', | |
30a4ddff YW |
374 | '-Wlogical-op', |
375 | '-Wmissing-include-dirs', | |
505ab9dd YW |
376 | '-Wmissing-noreturn', |
377 | '-Wnested-externs', | |
30a4ddff YW |
378 | '-Wold-style-definition', |
379 | '-Wpointer-arith', | |
30a4ddff | 380 | '-Wredundant-decls', |
30a4ddff | 381 | '-Wshadow', |
30a4ddff | 382 | '-Wstrict-aliasing=2', |
505ab9dd YW |
383 | '-Wstrict-prototypes', |
384 | '-Wsuggest-attribute=noreturn', | |
054ed430 | 385 | '-Wunused-function', |
30a4ddff | 386 | '-Wwrite-strings', |
bf7efeb1 FB |
387 | |
388 | # negative arguments are correctly detected starting with meson 0.46. | |
eed33623 ZJS |
389 | '-Wno-error=#warnings', # clang |
390 | '-Wno-string-plus-int', # clang | |
30a4ddff YW |
391 | ] |
392 | ||
b528a628 ZJS |
393 | c_args = get_option('c_args') |
394 | ||
60f97fee | 395 | # Our json library does not support -ffinite-math-only, which is enabled by -Ofast or -ffast-math. |
32963344 | 396 | if (('-Ofast' in c_args or '-ffast-math' in c_args or '-ffinite-math-only' in c_args) and not ('-fno-finite-math-only' in c_args)) |
60f97fee YW |
397 | error('-Ofast, -ffast-math, or -ffinite-math-only is specified in c_args.') |
398 | endif | |
399 | ||
a17e5478 | 400 | # Disable -Wmaybe-uninitialized when compiling with -Os/-O1/-O3/etc. There are |
68c98a41 ZJS |
401 | # too many false positives with gcc >= 8. Effectively, we only test with -O0 |
402 | # and -O2; this should be enough to catch most important cases without too much | |
403 | # busywork. See https://github.com/systemd/systemd/pull/19226. | |
404 | if cc.get_id() == 'gcc' and (not '02'.contains(get_option('optimization')) or | |
b528a628 ZJS |
405 | cc.version().version_compare('<10') or |
406 | '-Os' in c_args or | |
407 | '-O1' in c_args or | |
408 | '-O3' in c_args or | |
409 | '-Og' in c_args) | |
65267363 | 410 | possible_common_cc_flags += '-Wno-maybe-uninitialized' |
68c98a41 ZJS |
411 | endif |
412 | ||
bc2a4af2 ZJS |
413 | # Disable -Wno-unused-result with gcc, see |
414 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425. | |
415 | if cc.get_id() == 'gcc' | |
416 | possible_common_cc_flags += '-Wno-unused-result' | |
417 | endif | |
418 | ||
30a4ddff | 419 | # --as-needed and --no-undefined are provided by meson by default, |
9247df5a | 420 | # run 'meson configure' to see what is enabled |
30a4ddff | 421 | possible_link_flags = [ |
42e3bb35 | 422 | '-Wl,--fatal-warnings', |
30a4ddff | 423 | '-Wl,-z,now', |
42e3bb35 | 424 | '-Wl,-z,relro', |
68e70ac2 | 425 | '-fstack-protector', |
30a4ddff | 426 | ] |
5c23128d | 427 | |
42e3bb35 JJ |
428 | if get_option('b_sanitize') == 'none' |
429 | possible_link_flags += '-Wl,--warn-common' | |
430 | endif | |
431 | ||
30a4ddff | 432 | if cc.get_id() == 'clang' |
65267363 | 433 | possible_common_cc_flags += [ |
30a4ddff YW |
434 | '-Wno-typedef-redefinition', |
435 | '-Wno-gnu-variable-sized-type-not-at-end', | |
436 | ] | |
437 | endif | |
438 | ||
1a4e3927 JJ |
439 | if get_option('mode') == 'release' |
440 | # We could enable 'pattern' for developer mode, but that can interfere with | |
441 | # valgrind and sanitizer builds. Also, clang does not zero-initialize unions, | |
442 | # breaking some of our code (https://reviews.llvm.org/D68115). | |
443 | possible_common_cc_flags += '-ftrivial-auto-var-init=zero' | |
444 | endif | |
445 | ||
16e09d51 YW |
446 | possible_cc_flags = possible_common_cc_flags + [ |
447 | '-Werror=missing-declarations', | |
448 | '-Werror=missing-prototypes', | |
449 | '-fdiagnostics-show-option', | |
16e09d51 YW |
450 | '-fno-common', |
451 | '-fno-strict-aliasing', | |
452 | '-fstack-protector', | |
453 | '-fstack-protector-strong', | |
454 | '-fvisibility=hidden', | |
455 | '--param=ssp-buffer-size=4', | |
456 | ] | |
457 | ||
30a4ddff | 458 | if get_option('buildtype') != 'debug' |
16e09d51 | 459 | possible_cc_flags += [ |
30a4ddff YW |
460 | '-ffunction-sections', |
461 | '-fdata-sections', | |
462 | ] | |
463 | ||
464 | possible_link_flags += '-Wl,--gc-sections' | |
465 | endif | |
466 | ||
82390022 DDM |
467 | if get_option('mode') == 'developer' |
468 | possible_cc_flags += '-fno-omit-frame-pointer' | |
469 | endif | |
470 | ||
e9f4f566 | 471 | add_project_arguments(cc.get_supported_arguments(basic_disabled_warnings), language : 'c') |
30a4ddff | 472 | add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c') |
7a6397d2 | 473 | add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c') |
30a4ddff | 474 | |
94c0c5b7 ZJS |
475 | have = cc.has_argument('-Wzero-length-bounds') |
476 | conf.set10('HAVE_ZERO_LENGTH_BOUNDS', have) | |
477 | ||
9e70f2f8 | 478 | if cc.compiles(''' |
5c23128d ZJS |
479 | #include <time.h> |
480 | #include <inttypes.h> | |
481 | typedef uint64_t usec_t; | |
482 | usec_t now(clockid_t clock); | |
483 | int main(void) { | |
484 | struct timespec now; | |
485 | return 0; | |
486 | } | |
38c1c96d | 487 | ''', args: '-Werror=shadow', name : '-Werror=shadow with local shadowing') |
37efbbd8 | 488 | add_project_arguments('-Werror=shadow', language : 'c') |
5c23128d ZJS |
489 | endif |
490 | ||
e9f4f566 ZJS |
491 | if cxx_cmd != '' |
492 | add_project_arguments(cxx.get_supported_arguments(basic_disabled_warnings), language : 'cpp') | |
493 | endif | |
494 | ||
0e3cc902 | 495 | cpp = ' '.join(cc.cmd_array()) + ' -E' |
9cc0e6e9 | 496 | |
6695c200 ZJS |
497 | has_wstringop_truncation = cc.has_argument('-Wstringop-truncation') |
498 | ||
5c23128d ZJS |
499 | ##################################################################### |
500 | # compilation result tests | |
501 | ||
2c201c21 ZJS |
502 | conf.set('_GNU_SOURCE', true) |
503 | conf.set('__SANE_USERSPACE_TYPES__', true) | |
6695c200 | 504 | conf.set10('HAVE_WSTRINGOP_TRUNCATION', has_wstringop_truncation) |
5c23128d | 505 | |
5c23128d ZJS |
506 | conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>')) |
507 | conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>')) | |
508 | conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>')) | |
509 | conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>')) | |
3112d756 | 510 | conf.set('SIZEOF_TIMEX_MEMBER', cc.sizeof('typeof(((struct timex *)0)->freq)', prefix : '#include <sys/timex.h>')) |
5c23128d ZJS |
511 | |
512 | decl_headers = ''' | |
513 | #include <uchar.h> | |
84e8edec | 514 | #include <sys/mount.h> |
4c2e1b39 | 515 | #include <sys/stat.h> |
5c23128d | 516 | ''' |
5c23128d ZJS |
517 | |
518 | foreach decl : ['char16_t', | |
519 | 'char32_t', | |
84e8edec | 520 | 'struct mount_attr', |
4c2e1b39 | 521 | 'struct statx', |
5c23128d | 522 | ] |
2c201c21 ZJS |
523 | |
524 | # We get -1 if the size cannot be determined | |
9c869d08 ZJS |
525 | have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 |
526 | ||
3657d3a0 RH |
527 | if decl == 'struct mount_attr' |
528 | if have | |
529 | want_linux_fs_h = false | |
530 | else | |
531 | have = cc.sizeof(decl, | |
532 | prefix : decl_headers + '#include <linux/fs.h>', | |
533 | args : '-D_GNU_SOURCE') > 0 | |
534 | want_linux_fs_h = have | |
535 | endif | |
536 | endif | |
537 | ||
9c869d08 ZJS |
538 | if decl == 'struct statx' |
539 | if have | |
540 | want_linux_stat_h = false | |
541 | else | |
542 | have = cc.sizeof(decl, | |
543 | prefix : decl_headers + '#include <linux/stat.h>', | |
544 | args : '-D_GNU_SOURCE') > 0 | |
545 | want_linux_stat_h = have | |
546 | endif | |
547 | endif | |
548 | ||
349cc4a5 | 549 | conf.set10('HAVE_' + decl.underscorify().to_upper(), have) |
5c23128d ZJS |
550 | endforeach |
551 | ||
9c869d08 | 552 | conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h) |
3657d3a0 | 553 | conf.set10('WANT_LINUX_FS_H', want_linux_fs_h) |
75720bff | 554 | |
5c23128d | 555 | foreach ident : ['secure_getenv', '__secure_getenv'] |
349cc4a5 | 556 | conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident)) |
5c23128d ZJS |
557 | endforeach |
558 | ||
559 | foreach ident : [ | |
85db59b7 | 560 | ['memfd_create', '''#include <sys/mman.h>'''], |
7b961e40 LP |
561 | ['gettid', '''#include <sys/types.h> |
562 | #include <unistd.h>'''], | |
3c042add LP |
563 | ['pivot_root', '''#include <stdlib.h> |
564 | #include <unistd.h>'''], # no known header declares pivot_root | |
51fe206f ZJS |
565 | ['ioprio_get', '''#include <sched.h>'''], # no known header declares ioprio_get |
566 | ['ioprio_set', '''#include <sched.h>'''], # no known header declares ioprio_set | |
85db59b7 | 567 | ['name_to_handle_at', '''#include <sys/types.h> |
37efbbd8 ZJS |
568 | #include <sys/stat.h> |
569 | #include <fcntl.h>'''], | |
85db59b7 | 570 | ['setns', '''#include <sched.h>'''], |
2acfd0ff LP |
571 | ['renameat2', '''#include <stdio.h> |
572 | #include <fcntl.h>'''], | |
37efbbd8 ZJS |
573 | ['kcmp', '''#include <linux/kcmp.h>'''], |
574 | ['keyctl', '''#include <sys/types.h> | |
575 | #include <keyutils.h>'''], | |
85db59b7 | 576 | ['copy_file_range', '''#include <sys/syscall.h> |
37efbbd8 | 577 | #include <unistd.h>'''], |
71e5200f DM |
578 | ['bpf', '''#include <sys/syscall.h> |
579 | #include <unistd.h>'''], | |
4c2e1b39 LP |
580 | ['statx', '''#include <sys/types.h> |
581 | #include <sys/stat.h> | |
582 | #include <unistd.h>'''], | |
aa484f35 | 583 | ['explicit_bzero' , '''#include <string.h>'''], |
5bb20fd3 | 584 | ['reallocarray', '''#include <stdlib.h>'''], |
b070c7c0 MS |
585 | ['set_mempolicy', '''#include <stdlib.h> |
586 | #include <unistd.h>'''], | |
587 | ['get_mempolicy', '''#include <stdlib.h> | |
588 | #include <unistd.h>'''], | |
5f152f43 LP |
589 | ['pidfd_send_signal', '''#include <stdlib.h> |
590 | #include <unistd.h> | |
591 | #include <signal.h> | |
592 | #include <sys/wait.h>'''], | |
593 | ['pidfd_open', '''#include <stdlib.h> | |
594 | #include <unistd.h> | |
595 | #include <signal.h> | |
596 | #include <sys/wait.h>'''], | |
5ead4e85 LP |
597 | ['rt_sigqueueinfo', '''#include <stdlib.h> |
598 | #include <unistd.h> | |
599 | #include <signal.h> | |
600 | #include <sys/wait.h>'''], | |
4b6f74f5 | 601 | ['mallinfo', '''#include <malloc.h>'''], |
1885169c | 602 | ['mallinfo2', '''#include <malloc.h>'''], |
8939eeae | 603 | ['execveat', '''#include <unistd.h>'''], |
441e0fdb | 604 | ['close_range', '''#include <unistd.h>'''], |
420297c9 | 605 | ['epoll_pwait2', '''#include <sys/epoll.h>'''], |
84e8edec LP |
606 | ['mount_setattr', '''#include <sys/mount.h>'''], |
607 | ['move_mount', '''#include <sys/mount.h>'''], | |
608 | ['open_tree', '''#include <sys/mount.h>'''], | |
aab35b1e | 609 | ['getdents64', '''#include <dirent.h>'''], |
37efbbd8 ZJS |
610 | ] |
611 | ||
85db59b7 | 612 | have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') |
4b9545f1 | 613 | conf.set10('HAVE_' + ident[0].to_upper(), have) |
5c23128d ZJS |
614 | endforeach |
615 | ||
85db59b7 | 616 | if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE') |
349cc4a5 | 617 | conf.set10('USE_SYS_RANDOM_H', true) |
4b9545f1 | 618 | conf.set10('HAVE_GETRANDOM', true) |
4984c8be ZJS |
619 | else |
620 | have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''') | |
349cc4a5 | 621 | conf.set10('USE_SYS_RANDOM_H', false) |
4b9545f1 | 622 | conf.set10('HAVE_GETRANDOM', have) |
4984c8be ZJS |
623 | endif |
624 | ||
5c23128d ZJS |
625 | ##################################################################### |
626 | ||
064b8e2c DDM |
627 | version_tag = get_option('version-tag') |
628 | if version_tag != '' | |
629 | vcs_data = configuration_data() | |
630 | vcs_data.set('VCS_TAG', version_tag) | |
631 | version_h = configure_file(configuration : vcs_data, | |
632 | input : 'src/version/version.h.in', | |
633 | output : 'version.h') | |
634 | else | |
635 | vcs_tagger = [ | |
636 | project_source_root + '/tools/meson-vcs-tag.sh', | |
637 | project_source_root, | |
638 | meson.project_version()] | |
639 | ||
640 | version_h = vcs_tag( | |
641 | input : 'src/version/version.h.in', | |
642 | output : 'version.h', | |
643 | command: vcs_tagger) | |
644 | endif | |
d1084aa2 LT |
645 | |
646 | versiondep = declare_dependency(sources: version_h) | |
647 | ||
a2b0cd3f ZJS |
648 | shared_lib_tag = get_option('shared-lib-tag') |
649 | if shared_lib_tag == '' | |
650 | shared_lib_tag = meson.project_version() | |
651 | endif | |
652 | ||
0f4c4f38 ZJS |
653 | sh = find_program('sh') |
654 | echo = find_program('echo') | |
5c23128d | 655 | sed = find_program('sed') |
5c23128d | 656 | awk = find_program('awk') |
5c23128d | 657 | stat = find_program('stat') |
0f4c4f38 | 658 | ln = find_program('ln') |
d68b342b | 659 | git = find_program('git', required : false) |
b68dfb9e | 660 | env = find_program('env') |
b1ffacb6 | 661 | perl = find_program('perl', required : false) |
0f4c4f38 | 662 | rsync = find_program('rsync', required : false) |
7c22f07c | 663 | meson_make_symlink = project_source_root + '/tools/meson-make-symlink.sh' |
5c23128d | 664 | |
94e75a54 ZJS |
665 | mkdir_p = 'mkdir -p $DESTDIR/@0@' |
666 | ||
9247df5a | 667 | # If -Dxxx-path option is found, use that. Otherwise, check in $PATH, |
5c23128d | 668 | # /usr/sbin, /sbin, and fall back to the default from middle column. |
2fa645f1 | 669 | progs = [['quotaon', '/usr/sbin/quotaon' ], |
5c23128d | 670 | ['quotacheck', '/usr/sbin/quotacheck' ], |
5c23128d ZJS |
671 | ['kmod', '/usr/bin/kmod' ], |
672 | ['kexec', '/usr/sbin/kexec' ], | |
673 | ['sulogin', '/usr/sbin/sulogin' ], | |
674 | ['mount', '/usr/bin/mount', 'MOUNT_PATH'], | |
675 | ['umount', '/usr/bin/umount', 'UMOUNT_PATH'], | |
676 | ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'], | |
677 | ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'], | |
6db90462 | 678 | ['nologin', '/usr/sbin/nologin', ], |
5c23128d ZJS |
679 | ] |
680 | foreach prog : progs | |
37efbbd8 ZJS |
681 | path = get_option(prog[0] + '-path') |
682 | if path != '' | |
683 | message('Using @1@ for @0@'.format(prog[0], path)) | |
684 | else | |
685 | exe = find_program(prog[0], | |
686 | '/usr/sbin/' + prog[0], | |
687 | '/sbin/' + prog[0], | |
688 | required: false) | |
689 | path = exe.found() ? exe.path() : prog[1] | |
690 | endif | |
691 | name = prog.length() > 2 ? prog[2] : prog[0].to_upper() | |
692 | conf.set_quoted(name, path) | |
5c23128d ZJS |
693 | endforeach |
694 | ||
2fa645f1 MG |
695 | conf.set_quoted('TELINIT', get_option('telinit-path')) |
696 | ||
e92777d2 | 697 | if run_command(ln, '--relative', '--help', check : false).returncode() != 0 |
cd001016 | 698 | error('ln does not support --relative (added in coreutils 8.16)') |
1276a9f6 | 699 | endif |
5c23128d ZJS |
700 | |
701 | ############################################################ | |
702 | ||
43a5fd98 HB |
703 | python = find_program('python3') |
704 | if run_command(python, '-c', 'import jinja2', check : false).returncode() != 0 | |
e0698c66 ZJS |
705 | error('python3 jinja2 missing') |
706 | endif | |
707 | ||
708 | ############################################################ | |
709 | ||
5c23128d ZJS |
710 | gperf = find_program('gperf') |
711 | ||
712 | gperf_test_format = ''' | |
713 | #include <string.h> | |
714 | const char * in_word_set(const char *, @0@); | |
715 | @1@ | |
716 | ''' | |
ac3eda34 | 717 | gperf_snippet = run_command(sh, '-c', 'echo foo,bar | "$1" -L ANSI-C', '_', gperf, |
e92777d2 | 718 | check : true) |
5c23128d ZJS |
719 | gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout()) |
720 | if cc.compiles(gperf_test) | |
37efbbd8 | 721 | gperf_len_type = 'size_t' |
5c23128d | 722 | else |
37efbbd8 ZJS |
723 | gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout()) |
724 | if cc.compiles(gperf_test) | |
725 | gperf_len_type = 'unsigned' | |
726 | else | |
727 | error('unable to determine gperf len type') | |
728 | endif | |
5c23128d ZJS |
729 | endif |
730 | message('gperf len type is @0@'.format(gperf_len_type)) | |
37efbbd8 ZJS |
731 | conf.set('GPERF_LEN_TYPE', gperf_len_type, |
732 | description : 'The type of gperf "len" parameter') | |
5c23128d ZJS |
733 | |
734 | ############################################################ | |
735 | ||
736 | if not cc.has_header('sys/capability.h') | |
37efbbd8 | 737 | error('POSIX caps headers not found') |
5c23128d | 738 | endif |
9f555bba | 739 | foreach header : ['crypt.h', |
5c23128d ZJS |
740 | 'linux/memfd.h', |
741 | 'linux/vm_sockets.h', | |
af8786b1 | 742 | 'sys/auxv.h', |
5c23128d ZJS |
743 | 'valgrind/memcheck.h', |
744 | 'valgrind/valgrind.h', | |
420297c9 | 745 | 'linux/time_types.h', |
b428efa5 | 746 | 'sys/sdt.h', |
5c23128d | 747 | ] |
2c201c21 | 748 | |
349cc4a5 ZJS |
749 | conf.set10('HAVE_' + header.underscorify().to_upper(), |
750 | cc.has_header(header)) | |
5c23128d ZJS |
751 | endforeach |
752 | ||
753 | ############################################################ | |
754 | ||
eef4b800 ZJS |
755 | fallback_hostname = get_option('fallback-hostname') |
756 | if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-' | |
757 | error('Invalid fallback-hostname configuration') | |
758 | # A more extensive test is done in test-hostname-util. Let's catch | |
759 | # the most obvious errors here so we don't fail with an assert later. | |
760 | endif | |
761 | conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname) | |
762 | ||
5c23128d ZJS |
763 | default_hierarchy = get_option('default-hierarchy') |
764 | conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy, | |
765 | description : 'default cgroup hierarchy as string') | |
766 | if default_hierarchy == 'legacy' | |
37efbbd8 | 767 | conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE') |
5c23128d | 768 | elif default_hierarchy == 'hybrid' |
37efbbd8 | 769 | conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD') |
5c23128d | 770 | else |
37efbbd8 | 771 | conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL') |
5c23128d ZJS |
772 | endif |
773 | ||
681cb84a ZJS |
774 | extra_net_naming_schemes = [] |
775 | extra_net_naming_map = [] | |
776 | foreach scheme: get_option('extra-net-naming-schemes').split(',') | |
777 | if scheme != '' | |
778 | name = scheme.split('=')[0] | |
779 | value = scheme.split('=')[1] | |
780 | NAME = name.underscorify().to_upper() | |
781 | VALUE = [] | |
782 | foreach field: value.split('+') | |
783 | VALUE += 'NAMING_' + field.underscorify().to_upper() | |
784 | endforeach | |
785 | extra_net_naming_schemes += 'NAMING_@0@ = @1@,'.format(NAME, '|'.join(VALUE)) | |
786 | extra_net_naming_map += '{ "@0@", NAMING_@1@ },'.format(name, NAME) | |
787 | endif | |
788 | endforeach | |
789 | conf.set('EXTRA_NET_NAMING_SCHEMES', ' '.join(extra_net_naming_schemes)) | |
790 | conf.set('EXTRA_NET_NAMING_MAP', ' '.join(extra_net_naming_map)) | |
791 | ||
06da5c63 ZJS |
792 | default_net_naming_scheme = get_option('default-net-naming-scheme') |
793 | conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme) | |
77faadfd ZJS |
794 | if default_net_naming_scheme != 'latest' |
795 | conf.set('_DEFAULT_NET_NAMING_SCHEME_TEST', | |
796 | 'NAMING_' + default_net_naming_scheme.underscorify().to_upper()) | |
797 | endif | |
06da5c63 | 798 | |
5c23128d | 799 | time_epoch = get_option('time-epoch') |
a36be3e5 | 800 | if time_epoch <= 0 |
e92777d2 | 801 | time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check : true).stdout().strip() |
4cf8a609 | 802 | if time_epoch == '' and git.found() and fs.exists('.git') |
bd190899 | 803 | # If we're in a git repository, use the creation time of the latest git tag. |
e92777d2 ZJS |
804 | latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags', |
805 | check : false) | |
806 | if latest_tag.returncode() == 0 | |
807 | time_epoch = run_command( | |
808 | git, 'log', '--no-show-signature', '-1', '--format=%at', | |
809 | latest_tag.stdout().strip(), | |
810 | check : false).stdout() | |
811 | endif | |
0390b094 ZJS |
812 | endif |
813 | if time_epoch == '' | |
6dbf352c | 814 | NEWS = files('NEWS') |
e92777d2 ZJS |
815 | time_epoch = run_command(stat, '-c', '%Y', NEWS, |
816 | check : true).stdout() | |
6dbf352c | 817 | endif |
89cdbe1f | 818 | time_epoch = time_epoch.strip().to_int() |
5c23128d | 819 | endif |
5c23128d ZJS |
820 | conf.set('TIME_EPOCH', time_epoch) |
821 | ||
b10abe4b EI |
822 | conf.set('CLOCK_VALID_RANGE_USEC_MAX', get_option('clock-valid-range-usec-max')) |
823 | ||
53350c7b | 824 | default_user_shell = get_option('default-user-shell') |
825 | conf.set_quoted('DEFAULT_USER_SHELL', default_user_shell) | |
826 | conf.set_quoted('DEFAULT_USER_SHELL_NAME', fs.name(default_user_shell)) | |
827 | ||
fc1a5d1a ZJS |
828 | foreach tuple : [['system-alloc-uid-min', 'SYS_UID_MIN', 1], # Also see login.defs(5). |
829 | ['system-uid-max', 'SYS_UID_MAX', 999], | |
830 | ['system-alloc-gid-min', 'SYS_GID_MIN', 1], | |
831 | ['system-gid-max', 'SYS_GID_MAX', 999]] | |
832 | v = get_option(tuple[0]) | |
a36be3e5 | 833 | if v <= 0 |
fc1a5d1a ZJS |
834 | v = run_command( |
835 | awk, | |
836 | '/^\s*@0@\s+/ { uid=$2 } END { print uid }'.format(tuple[1]), | |
e92777d2 ZJS |
837 | '/etc/login.defs', |
838 | check : false).stdout().strip() | |
fc1a5d1a ZJS |
839 | if v == '' |
840 | v = tuple[2] | |
841 | else | |
842 | v = v.to_int() | |
843 | endif | |
2f62cf35 | 844 | endif |
fc1a5d1a | 845 | conf.set(tuple[0].underscorify().to_upper(), v) |
fc1a5d1a ZJS |
846 | endforeach |
847 | if conf.get('SYSTEM_ALLOC_UID_MIN') >= conf.get('SYSTEM_UID_MAX') | |
848 | error('Invalid uid allocation range') | |
5c23128d | 849 | endif |
fc1a5d1a ZJS |
850 | if conf.get('SYSTEM_ALLOC_GID_MIN') >= conf.get('SYSTEM_GID_MAX') |
851 | error('Invalid gid allocation range') | |
5c23128d | 852 | endif |
5c23128d | 853 | |
ac09340e YW |
854 | dynamic_uid_min = get_option('dynamic-uid-min') |
855 | dynamic_uid_max = get_option('dynamic-uid-max') | |
87d5e4f2 LP |
856 | conf.set('DYNAMIC_UID_MIN', dynamic_uid_min) |
857 | conf.set('DYNAMIC_UID_MAX', dynamic_uid_max) | |
87d5e4f2 | 858 | |
ac09340e YW |
859 | container_uid_base_min = get_option('container-uid-base-min') |
860 | container_uid_base_max = get_option('container-uid-base-max') | |
87d5e4f2 LP |
861 | conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min) |
862 | conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max) | |
87d5e4f2 | 863 | |
afde4574 LP |
864 | nobody_user = get_option('nobody-user') |
865 | nobody_group = get_option('nobody-group') | |
866 | ||
2484bff3 | 867 | if not meson.is_cross_build() |
e92777d2 | 868 | getent_result = run_command('getent', 'passwd', '65534', check : false) |
2484bff3 CQ |
869 | if getent_result.returncode() == 0 |
870 | name = getent_result.stdout().split(':')[0] | |
871 | if name != nobody_user | |
872 | warning('\n' + | |
873 | '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) + | |
874 | 'Your build will result in an user table setup that is incompatible with the local system.') | |
875 | endif | |
afde4574 | 876 | endif |
e92777d2 | 877 | id_result = run_command('id', '-u', nobody_user, check : false) |
2484bff3 | 878 | if id_result.returncode() == 0 |
89cdbe1f | 879 | id = id_result.stdout().strip().to_int() |
2484bff3 CQ |
880 | if id != 65534 |
881 | warning('\n' + | |
882 | '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) + | |
883 | 'Your build will result in an user table setup that is incompatible with the local system.') | |
884 | endif | |
afde4574 | 885 | endif |
afde4574 | 886 | |
e92777d2 | 887 | getent_result = run_command('getent', 'group', '65534', check : false) |
2484bff3 CQ |
888 | if getent_result.returncode() == 0 |
889 | name = getent_result.stdout().split(':')[0] | |
890 | if name != nobody_group | |
891 | warning('\n' + | |
892 | '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) + | |
893 | 'Your build will result in an group table setup that is incompatible with the local system.') | |
894 | endif | |
afde4574 | 895 | endif |
e92777d2 | 896 | id_result = run_command('id', '-g', nobody_group, check : false) |
2484bff3 | 897 | if id_result.returncode() == 0 |
89cdbe1f | 898 | id = id_result.stdout().strip().to_int() |
2484bff3 CQ |
899 | if id != 65534 |
900 | warning('\n' + | |
d5b3e510 | 901 | 'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n'.format(nobody_group, id) + |
2484bff3 CQ |
902 | 'Your build will result in an group table setup that is incompatible with the local system.') |
903 | endif | |
afde4574 LP |
904 | endif |
905 | endif | |
8374cc62 | 906 | if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup') |
8ea9fad7 YW |
907 | warning('\n' + |
908 | 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) + | |
909 | 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.') | |
8374cc62 | 910 | endif |
afde4574 LP |
911 | |
912 | conf.set_quoted('NOBODY_USER_NAME', nobody_user) | |
913 | conf.set_quoted('NOBODY_GROUP_NAME', nobody_group) | |
87d5e4f2 | 914 | |
9a797ddc ZJS |
915 | static_ugids = [] |
916 | foreach option : ['adm-gid', | |
917 | 'audio-gid', | |
918 | 'cdrom-gid', | |
919 | 'dialout-gid', | |
920 | 'disk-gid', | |
921 | 'input-gid', | |
922 | 'kmem-gid', | |
923 | 'kvm-gid', | |
924 | 'lp-gid', | |
925 | 'render-gid', | |
926 | 'sgx-gid', | |
927 | 'tape-gid', | |
928 | 'tty-gid', | |
929 | 'users-gid', | |
930 | 'utmp-gid', | |
931 | 'video-gid', | |
932 | 'wheel-gid', | |
933 | 'systemd-journal-gid', | |
934 | 'systemd-network-uid', | |
935 | 'systemd-resolve-uid', | |
936 | 'systemd-timesync-uid'] | |
937 | name = option.underscorify().to_upper() | |
938 | val = get_option(option) | |
939 | ||
940 | # Ensure provided GID argument is numeric, otherwise fall back to default assignment | |
a36be3e5 YW |
941 | conf.set(name, val > 0 ? val : '-') |
942 | if val > 0 | |
9a797ddc ZJS |
943 | static_ugids += '@0@:@1@'.format(option, val) |
944 | endif | |
945 | endforeach | |
84786b8e | 946 | |
348b4437 YW |
947 | conf.set10('ENABLE_ADM_GROUP', get_option('adm-group')) |
948 | conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group')) | |
5c23128d | 949 | |
ace5e311 | 950 | dev_kvm_mode = get_option('dev-kvm-mode') |
d924a938 | 951 | conf.set_quoted('DEV_KVM_MODE', dev_kvm_mode) # FIXME: convert to 0o… notation |
ace5e311 | 952 | conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666') |
055a083a | 953 | group_render_mode = get_option('group-render-mode') |
8feaea5e | 954 | conf.set_quoted('GROUP_RENDER_MODE', group_render_mode) |
055a083a | 955 | conf.set10('GROUP_RENDER_UACCESS', group_render_mode != '0666') |
5c23128d | 956 | |
2a4c156d ZJS |
957 | kill_user_processes = get_option('default-kill-user-processes') |
958 | conf.set10('KILL_USER_PROCESSES', kill_user_processes) | |
5c23128d | 959 | |
829257d1 ZJS |
960 | dns_servers = get_option('dns-servers') |
961 | conf.set_quoted('DNS_SERVERS', dns_servers) | |
5c23128d | 962 | |
829257d1 ZJS |
963 | ntp_servers = get_option('ntp-servers') |
964 | conf.set_quoted('NTP_SERVERS', ntp_servers) | |
5c23128d | 965 | |
8ca9e92c DR |
966 | default_locale = get_option('default-locale') |
967 | conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale) | |
968 | ||
a22f5186 DDM |
969 | nspawn_locale = get_option('nspawn-locale') |
970 | conf.set_quoted('SYSTEMD_NSPAWN_LOCALE', nspawn_locale) | |
971 | ||
8f20232f | 972 | localegen_path = get_option('localegen-path') |
8f20232f MK |
973 | if localegen_path != '' |
974 | conf.set_quoted('LOCALEGEN_PATH', localegen_path) | |
8f20232f | 975 | endif |
71ae5ce5 | 976 | conf.set10('HAVE_LOCALEGEN', localegen_path != '') |
8f20232f | 977 | |
5c23128d ZJS |
978 | conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) |
979 | ||
21d0dd5a | 980 | service_watchdog = get_option('service-watchdog') |
7bc9ea51 | 981 | watchdog_value = service_watchdog == '' ? '' : 'WatchdogSec=' + service_watchdog |
059cc610 | 982 | conf.set_quoted('SERVICE_WATCHDOG', watchdog_value) |
21d0dd5a | 983 | |
059cc610 | 984 | conf.set_quoted('SUSHELL', get_option('debug-shell')) |
93912e87 | 985 | conf.set_quoted('DEBUGTTY', get_option('debug-tty')) |
3131bfe3 | 986 | |
349cc4a5 ZJS |
987 | enable_debug_hashmap = false |
988 | enable_debug_mmap_cache = false | |
d6601495 | 989 | enable_debug_siphash = false |
8f6b442a | 990 | foreach name : get_option('debug-extra') |
ad7aa760 YW |
991 | if name == 'hashmap' |
992 | enable_debug_hashmap = true | |
993 | elif name == 'mmap-cache' | |
994 | enable_debug_mmap_cache = true | |
d6601495 YW |
995 | elif name == 'siphash' |
996 | enable_debug_siphash = true | |
ad7aa760 YW |
997 | else |
998 | message('unknown debug option "@0@", ignoring'.format(name)) | |
999 | endif | |
1000 | endforeach | |
349cc4a5 ZJS |
1001 | conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap) |
1002 | conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache) | |
d6601495 | 1003 | conf.set10('ENABLE_DEBUG_SIPHASH', enable_debug_siphash) |
671677da | 1004 | |
d18cb393 | 1005 | conf.set10('VALGRIND', get_option('valgrind')) |
fd5dec9a | 1006 | conf.set10('LOG_TRACE', get_option('log-trace')) |
d18cb393 | 1007 | |
3602ca6f ZJS |
1008 | default_user_path = get_option('user-path') |
1009 | if default_user_path != '' | |
1010 | conf.set_quoted('DEFAULT_USER_PATH', default_user_path) | |
1011 | endif | |
1012 | ||
5bc655cd | 1013 | |
5c23128d ZJS |
1014 | ##################################################################### |
1015 | ||
1016 | threads = dependency('threads') | |
1017 | librt = cc.find_library('rt') | |
1018 | libm = cc.find_library('m') | |
1019 | libdl = cc.find_library('dl') | |
1020 | libcrypt = cc.find_library('crypt') | |
1021 | ||
06ca077b | 1022 | crypt_header = conf.get('HAVE_CRYPT_H') == 1 ? '''#include <crypt.h>''' : '''#include <unistd.h>''' |
e8644a41 | 1023 | foreach ident : [ |
feee7f62 LB |
1024 | ['crypt_ra', crypt_header], |
1025 | ['crypt_preferred_method', crypt_header], | |
1026 | ['crypt_gensalt_ra', crypt_header]] | |
e8644a41 ZJS |
1027 | |
1028 | have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE', | |
1029 | dependencies : libcrypt) | |
1030 | conf.set10('HAVE_' + ident[0].to_upper(), have) | |
1031 | endforeach | |
1032 | ||
1800cc85 ZJS |
1033 | libcap = dependency('libcap', required : false) |
1034 | if not libcap.found() | |
1035 | # Compat with Ubuntu 14.04 which ships libcap w/o .pc file | |
1036 | libcap = cc.find_library('cap') | |
1037 | endif | |
1038 | ||
7d861e12 JK |
1039 | want_bpf_framework = get_option('bpf-framework') |
1040 | bpf_framework_required = want_bpf_framework == 'true' | |
1041 | ||
1042 | libbpf = dependency('libbpf', required : bpf_framework_required, version : '>= 0.2') | |
1043 | conf.set10('HAVE_LIBBPF', libbpf.found()) | |
1044 | ||
3d954ef1 | 1045 | if want_bpf_framework == 'false' or not libbpf.found() or skip_deps |
cf2dc690 | 1046 | conf.set10('BPF_FRAMEWORK', false) |
7d861e12 | 1047 | else |
76abad4d JH |
1048 | bpf_compiler = get_option('bpf-compiler') |
1049 | clang_found = false | |
1050 | clang_supports_bpf = false | |
1051 | bpf_gcc_found = false | |
1052 | deps_found = false | |
1053 | ||
1054 | if bpf_compiler == 'clang' | |
1055 | # Support 'versioned' clang/llvm-strip binaries, as seen on Debian/Ubuntu | |
1056 | # (like clang-10/llvm-strip-10) | |
1057 | if meson.is_cross_build() or cc.get_id() != 'clang' or cc.cmd_array()[0].contains('afl-clang') or cc.cmd_array()[0].contains('hfuzz-clang') | |
1058 | r = find_program('clang', required : bpf_framework_required, version : '>= 10.0.0') | |
1059 | clang_found = r.found() | |
1060 | if clang_found | |
1061 | clang = r.path() | |
1062 | endif | |
1063 | # Assume that the required flags are supported by the found clang. | |
1064 | clang_supports_flags = clang_found | |
1065 | else | |
1066 | clang_found = true | |
1067 | clang = cc.cmd_array() | |
1068 | clang_supports_flags = cc.has_argument('-Wno-compare-distinct-pointer-types') | |
dc7e9c1b | 1069 | endif |
a6ac8b5a | 1070 | |
76abad4d JH |
1071 | if clang_found |
1072 | # Check if 'clang -target bpf' is supported. | |
1073 | clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0 | |
1074 | endif | |
1075 | elif bpf_compiler == 'gcc' | |
1076 | warning('GCC BPF Compiler support is experimental and not recommended.') | |
1077 | bpf_gcc = find_program('bpf-gcc', | |
1078 | required : true, | |
1079 | version : '>= 12.1.0') | |
1080 | bpf_gcc_found = bpf_gcc.found() | |
a6ac8b5a YW |
1081 | endif |
1082 | ||
76abad4d JH |
1083 | if clang_supports_bpf or bpf_gcc_found |
1084 | # Debian installs this in /usr/sbin/ which is not in $PATH. | |
1085 | # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian. | |
1086 | # We use 'bpftool gen object' subcommand for bpftool strip, it was added by d80b2fcbe0a023619e0fc73112f2a02c2662f6ab (v5.13). | |
e3759ac4 JH |
1087 | bpftool = find_program('bpftool', |
1088 | '/usr/sbin/bpftool', | |
76abad4d JH |
1089 | required : false, |
1090 | version : '>= 5.13.0') | |
e3759ac4 | 1091 | |
76abad4d JH |
1092 | if bpftool.found() |
1093 | bpftool_strip = true | |
1094 | deps_found = true | |
e3759ac4 | 1095 | else |
76abad4d JH |
1096 | bpftool_strip = false |
1097 | # We require the 'bpftool gen skeleton' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6). | |
1098 | bpftool = find_program('bpftool', | |
1099 | '/usr/sbin/bpftool', | |
1100 | required : bpf_framework_required, | |
1101 | version : '>= 5.6.0') | |
e3759ac4 | 1102 | endif |
68e101da | 1103 | |
76abad4d JH |
1104 | # We use `llvm-strip` as a fallback if `bpftool gen object` strip support is not available. |
1105 | if not bpftool_strip and bpftool.found() and clang_supports_bpf | |
1106 | if not meson.is_cross_build() | |
1107 | llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip', | |
1108 | check : true).stdout().strip() | |
1109 | else | |
1110 | llvm_strip_bin = 'llvm-strip' | |
1111 | endif | |
1112 | llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0') | |
1113 | deps_found = llvm_strip.found() | |
1114 | endif | |
1115 | endif | |
68e101da | 1116 | |
7d861e12 | 1117 | # Can build BPF program from source code in restricted C |
d40ce018 | 1118 | conf.set10('BPF_FRAMEWORK', deps_found) |
7d861e12 JK |
1119 | endif |
1120 | ||
5c23128d | 1121 | libmount = dependency('mount', |
c0b4b0f8 | 1122 | version : fuzzer_build ? '>= 0' : '>= 2.30') |
5c23128d | 1123 | |
e594a3b1 LP |
1124 | want_libfdisk = get_option('fdisk') |
1125 | if want_libfdisk != 'false' and not skip_deps | |
1126 | libfdisk = dependency('fdisk', | |
baec7d78 | 1127 | version : '>= 2.32', |
e594a3b1 LP |
1128 | required : want_libfdisk == 'true') |
1129 | have = libfdisk.found() | |
1130 | else | |
1131 | have = false | |
1132 | libfdisk = [] | |
1133 | endif | |
1134 | conf.set10('HAVE_LIBFDISK', have) | |
1135 | ||
70a5db58 LP |
1136 | want_pwquality = get_option('pwquality') |
1137 | if want_pwquality != 'false' and not skip_deps | |
1138 | libpwquality = dependency('pwquality', required : want_pwquality == 'true') | |
1139 | have = libpwquality.found() | |
1140 | else | |
1141 | have = false | |
1142 | libpwquality = [] | |
1143 | endif | |
1144 | conf.set10('HAVE_PWQUALITY', have) | |
1145 | ||
5c23128d | 1146 | want_seccomp = get_option('seccomp') |
87ac55a1 | 1147 | if want_seccomp != 'false' and not skip_deps |
37efbbd8 | 1148 | libseccomp = dependency('libseccomp', |
9f0e9c01 | 1149 | version : '>= 2.3.1', |
37efbbd8 | 1150 | required : want_seccomp == 'true') |
349cc4a5 | 1151 | have = libseccomp.found() |
5c23128d | 1152 | else |
349cc4a5 | 1153 | have = false |
37efbbd8 | 1154 | libseccomp = [] |
5c23128d | 1155 | endif |
349cc4a5 | 1156 | conf.set10('HAVE_SECCOMP', have) |
5c23128d ZJS |
1157 | |
1158 | want_selinux = get_option('selinux') | |
87ac55a1 | 1159 | if want_selinux != 'false' and not skip_deps |
37efbbd8 ZJS |
1160 | libselinux = dependency('libselinux', |
1161 | version : '>= 2.1.9', | |
1162 | required : want_selinux == 'true') | |
349cc4a5 | 1163 | have = libselinux.found() |
5c23128d | 1164 | else |
349cc4a5 | 1165 | have = false |
37efbbd8 | 1166 | libselinux = [] |
5c23128d | 1167 | endif |
349cc4a5 | 1168 | conf.set10('HAVE_SELINUX', have) |
5c23128d ZJS |
1169 | |
1170 | want_apparmor = get_option('apparmor') | |
87ac55a1 | 1171 | if want_apparmor != 'false' and not skip_deps |
37efbbd8 | 1172 | libapparmor = dependency('libapparmor', |
2ffadd3c | 1173 | version : '>= 2.13', |
37efbbd8 | 1174 | required : want_apparmor == 'true') |
349cc4a5 | 1175 | have = libapparmor.found() |
5c23128d | 1176 | else |
349cc4a5 | 1177 | have = false |
37efbbd8 | 1178 | libapparmor = [] |
5c23128d | 1179 | endif |
349cc4a5 | 1180 | conf.set10('HAVE_APPARMOR', have) |
5c23128d | 1181 | |
07b382cc ZJS |
1182 | have = get_option('smack') and get_option('smack-run-label') != '' |
1183 | conf.set10('HAVE_SMACK_RUN_LABEL', have) | |
1184 | if have | |
1185 | conf.set_quoted('SMACK_RUN_LABEL', get_option('smack-run-label')) | |
1186 | endif | |
5c23128d | 1187 | |
aa5ae971 ŁS |
1188 | have = get_option('smack') and get_option('smack-default-process-label') != '' |
1189 | if have | |
1190 | conf.set_quoted('SMACK_DEFAULT_PROCESS_LABEL', get_option('smack-default-process-label')) | |
1191 | endif | |
1192 | ||
3ca0cb73 ZJS |
1193 | want_polkit = get_option('polkit') |
1194 | install_polkit = false | |
1195 | install_polkit_pkla = false | |
87ac55a1 | 1196 | if want_polkit != 'false' and not skip_deps |
37efbbd8 | 1197 | install_polkit = true |
3ca0cb73 | 1198 | |
37efbbd8 ZJS |
1199 | libpolkit = dependency('polkit-gobject-1', |
1200 | required : false) | |
1201 | if libpolkit.found() and libpolkit.version().version_compare('< 0.106') | |
1202 | message('Old polkit detected, will install pkla files') | |
1203 | install_polkit_pkla = true | |
1204 | endif | |
3ca0cb73 | 1205 | endif |
349cc4a5 | 1206 | conf.set10('ENABLE_POLKIT', install_polkit) |
3ca0cb73 | 1207 | |
36f0387e | 1208 | want_acl = get_option('acl') |
87ac55a1 | 1209 | if want_acl != 'false' and not skip_deps |
36f0387e | 1210 | libacl = cc.find_library('acl', required : want_acl == 'true') |
349cc4a5 | 1211 | have = libacl.found() |
36f0387e | 1212 | else |
349cc4a5 | 1213 | have = false |
36f0387e ZJS |
1214 | libacl = [] |
1215 | endif | |
349cc4a5 | 1216 | conf.set10('HAVE_ACL', have) |
36f0387e | 1217 | |
5c23128d | 1218 | want_audit = get_option('audit') |
87ac55a1 | 1219 | if want_audit != 'false' and not skip_deps |
37efbbd8 | 1220 | libaudit = dependency('audit', required : want_audit == 'true') |
349cc4a5 | 1221 | have = libaudit.found() |
5c23128d | 1222 | else |
349cc4a5 | 1223 | have = false |
37efbbd8 | 1224 | libaudit = [] |
5c23128d | 1225 | endif |
349cc4a5 | 1226 | conf.set10('HAVE_AUDIT', have) |
5c23128d ZJS |
1227 | |
1228 | want_blkid = get_option('blkid') | |
87ac55a1 | 1229 | if want_blkid != 'false' and not skip_deps |
37efbbd8 | 1230 | libblkid = dependency('blkid', required : want_blkid == 'true') |
349cc4a5 | 1231 | have = libblkid.found() |
4fcc033b KZ |
1232 | |
1233 | conf.set10('HAVE_BLKID_PROBE_SET_HINT', | |
1234 | have and cc.has_function('blkid_probe_set_hint', dependencies : libblkid)) | |
5c23128d | 1235 | else |
349cc4a5 | 1236 | have = false |
37efbbd8 | 1237 | libblkid = [] |
5c23128d | 1238 | endif |
349cc4a5 | 1239 | conf.set10('HAVE_BLKID', have) |
5c23128d ZJS |
1240 | |
1241 | want_kmod = get_option('kmod') | |
87ac55a1 | 1242 | if want_kmod != 'false' and not skip_deps |
37efbbd8 ZJS |
1243 | libkmod = dependency('libkmod', |
1244 | version : '>= 15', | |
1245 | required : want_kmod == 'true') | |
349cc4a5 | 1246 | have = libkmod.found() |
5c23128d | 1247 | else |
349cc4a5 | 1248 | have = false |
37efbbd8 | 1249 | libkmod = [] |
5c23128d | 1250 | endif |
349cc4a5 | 1251 | conf.set10('HAVE_KMOD', have) |
5c23128d ZJS |
1252 | |
1253 | want_pam = get_option('pam') | |
87ac55a1 | 1254 | if want_pam != 'false' and not skip_deps |
37efbbd8 ZJS |
1255 | libpam = cc.find_library('pam', required : want_pam == 'true') |
1256 | libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true') | |
349cc4a5 | 1257 | have = libpam.found() and libpam_misc.found() |
5c23128d | 1258 | else |
349cc4a5 | 1259 | have = false |
37efbbd8 ZJS |
1260 | libpam = [] |
1261 | libpam_misc = [] | |
5c23128d | 1262 | endif |
349cc4a5 | 1263 | conf.set10('HAVE_PAM', have) |
5c23128d ZJS |
1264 | |
1265 | want_microhttpd = get_option('microhttpd') | |
87ac55a1 | 1266 | if want_microhttpd != 'false' and not skip_deps |
37efbbd8 ZJS |
1267 | libmicrohttpd = dependency('libmicrohttpd', |
1268 | version : '>= 0.9.33', | |
1269 | required : want_microhttpd == 'true') | |
349cc4a5 | 1270 | have = libmicrohttpd.found() |
5c23128d | 1271 | else |
349cc4a5 | 1272 | have = false |
37efbbd8 | 1273 | libmicrohttpd = [] |
5c23128d | 1274 | endif |
349cc4a5 | 1275 | conf.set10('HAVE_MICROHTTPD', have) |
5c23128d ZJS |
1276 | |
1277 | want_libcryptsetup = get_option('libcryptsetup') | |
d1ae38d8 OK |
1278 | want_libcryptsetup_plugins = get_option('libcryptsetup-plugins') |
1279 | ||
1280 | if want_libcryptsetup_plugins == 'true' and want_libcryptsetup == 'false' | |
1281 | error('libcryptsetup-plugins can not be requested without libcryptsetup') | |
1282 | endif | |
1283 | ||
87ac55a1 | 1284 | if want_libcryptsetup != 'false' and not skip_deps |
37efbbd8 | 1285 | libcryptsetup = dependency('libcryptsetup', |
d1ae38d8 OK |
1286 | version : want_libcryptsetup_plugins == 'true' ? '>= 2.4.0' : '>= 2.0.1', |
1287 | required : want_libcryptsetup == 'true' or want_libcryptsetup_plugins == 'true') | |
349cc4a5 | 1288 | have = libcryptsetup.found() |
70a5db58 | 1289 | |
aac80717 ZJS |
1290 | foreach ident : ['crypt_set_metadata_size', |
1291 | 'crypt_activate_by_signed_key', | |
1292 | 'crypt_token_max'] | |
1293 | have_ident = have and cc.has_function( | |
1294 | ident, | |
1295 | prefix : '#include <libcryptsetup.h>', | |
1296 | dependencies : libcryptsetup) | |
1297 | conf.set10('HAVE_' + ident.to_upper(), have_ident) | |
1298 | endforeach | |
5c23128d | 1299 | else |
349cc4a5 | 1300 | have = false |
37efbbd8 | 1301 | libcryptsetup = [] |
5c23128d | 1302 | endif |
349cc4a5 | 1303 | conf.set10('HAVE_LIBCRYPTSETUP', have) |
5c23128d | 1304 | |
d1ae38d8 | 1305 | if want_libcryptsetup_plugins != 'false' and not skip_deps |
aac80717 ZJS |
1306 | have = (cc.has_function( |
1307 | 'crypt_activate_by_token_pin', | |
1308 | prefix : '#include <libcryptsetup.h>', | |
1309 | dependencies : libcryptsetup) and | |
1310 | cc.has_function( | |
1311 | 'crypt_token_external_path', | |
1312 | prefix : '#include <libcryptsetup.h>', | |
1313 | dependencies : libcryptsetup)) | |
d1ae38d8 OK |
1314 | else |
1315 | have = false | |
1316 | endif | |
1317 | conf.set10('HAVE_LIBCRYPTSETUP_PLUGINS', have) | |
1318 | ||
5c23128d | 1319 | want_libcurl = get_option('libcurl') |
87ac55a1 | 1320 | if want_libcurl != 'false' and not skip_deps |
37efbbd8 ZJS |
1321 | libcurl = dependency('libcurl', |
1322 | version : '>= 7.32.0', | |
1323 | required : want_libcurl == 'true') | |
349cc4a5 | 1324 | have = libcurl.found() |
5c23128d | 1325 | else |
349cc4a5 | 1326 | have = false |
37efbbd8 | 1327 | libcurl = [] |
5c23128d | 1328 | endif |
349cc4a5 | 1329 | conf.set10('HAVE_LIBCURL', have) |
47350c5f | 1330 | conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1) |
5c23128d ZJS |
1331 | |
1332 | want_libidn = get_option('libidn') | |
87057e24 ZJS |
1333 | want_libidn2 = get_option('libidn2') |
1334 | if want_libidn == 'true' and want_libidn2 == 'true' | |
1335 | error('libidn and libidn2 cannot be requested simultaneously') | |
1336 | endif | |
1337 | ||
1b931399 YW |
1338 | if want_libidn2 != 'false' and want_libidn != 'true' and not skip_deps |
1339 | libidn = dependency('libidn2', | |
1340 | required : want_libidn2 == 'true') | |
349cc4a5 | 1341 | have = libidn.found() |
87057e24 | 1342 | else |
349cc4a5 | 1343 | have = false |
87057e24 ZJS |
1344 | libidn = [] |
1345 | endif | |
1b931399 YW |
1346 | conf.set10('HAVE_LIBIDN2', have) |
1347 | if not have and want_libidn != 'false' and not skip_deps | |
7f7ab228 | 1348 | # libidn is used for both libidn and libidn2 objects |
1b931399 YW |
1349 | libidn = dependency('libidn', |
1350 | required : want_libidn == 'true') | |
349cc4a5 ZJS |
1351 | have = libidn.found() |
1352 | else | |
1353 | have = false | |
5c23128d | 1354 | endif |
1b931399 | 1355 | conf.set10('HAVE_LIBIDN', have) |
5c23128d ZJS |
1356 | |
1357 | want_libiptc = get_option('libiptc') | |
87ac55a1 | 1358 | if want_libiptc != 'false' and not skip_deps |
37efbbd8 ZJS |
1359 | libiptc = dependency('libiptc', |
1360 | required : want_libiptc == 'true') | |
349cc4a5 | 1361 | have = libiptc.found() |
5c23128d | 1362 | else |
349cc4a5 | 1363 | have = false |
37efbbd8 | 1364 | libiptc = [] |
5c23128d | 1365 | endif |
349cc4a5 | 1366 | conf.set10('HAVE_LIBIPTC', have) |
5c23128d ZJS |
1367 | |
1368 | want_qrencode = get_option('qrencode') | |
87ac55a1 | 1369 | if want_qrencode != 'false' and not skip_deps |
37efbbd8 | 1370 | libqrencode = dependency('libqrencode', |
a6c7811f | 1371 | version : '>= 4', |
37efbbd8 | 1372 | required : want_qrencode == 'true') |
349cc4a5 | 1373 | have = libqrencode.found() |
5c23128d | 1374 | else |
349cc4a5 | 1375 | have = false |
37efbbd8 | 1376 | libqrencode = [] |
5c23128d | 1377 | endif |
349cc4a5 | 1378 | conf.set10('HAVE_QRENCODE', have) |
5c23128d | 1379 | |
a44fb601 | 1380 | want_gcrypt = get_option('gcrypt') |
87ac55a1 | 1381 | if want_gcrypt != 'false' and not skip_deps |
a44fb601 ZJS |
1382 | libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true') |
1383 | libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true') | |
349cc4a5 | 1384 | have = libgcrypt.found() and libgpg_error.found() |
a44fb601 | 1385 | else |
349cc4a5 ZJS |
1386 | have = false |
1387 | endif | |
1388 | if not have | |
1389 | # link to neither of the libs if one is not found | |
a44fb601 ZJS |
1390 | libgcrypt = [] |
1391 | libgpg_error = [] | |
1392 | endif | |
349cc4a5 | 1393 | conf.set10('HAVE_GCRYPT', have) |
a44fb601 | 1394 | |
5c23128d | 1395 | want_gnutls = get_option('gnutls') |
87ac55a1 | 1396 | if want_gnutls != 'false' and not skip_deps |
37efbbd8 ZJS |
1397 | libgnutls = dependency('gnutls', |
1398 | version : '>= 3.1.4', | |
1399 | required : want_gnutls == 'true') | |
349cc4a5 | 1400 | have = libgnutls.found() |
5c23128d | 1401 | else |
349cc4a5 | 1402 | have = false |
37efbbd8 | 1403 | libgnutls = [] |
5c23128d | 1404 | endif |
349cc4a5 | 1405 | conf.set10('HAVE_GNUTLS', have) |
5c23128d | 1406 | |
096cbdce | 1407 | want_openssl = get_option('openssl') |
87ac55a1 | 1408 | if want_openssl != 'false' and not skip_deps |
096cbdce IT |
1409 | libopenssl = dependency('openssl', |
1410 | version : '>= 1.1.0', | |
1411 | required : want_openssl == 'true') | |
1412 | have = libopenssl.found() | |
1413 | else | |
1414 | have = false | |
1415 | libopenssl = [] | |
1416 | endif | |
1417 | conf.set10('HAVE_OPENSSL', have) | |
1418 | ||
839fddbe LP |
1419 | want_p11kit = get_option('p11kit') |
1420 | if want_p11kit != 'false' and not skip_deps | |
1421 | libp11kit = dependency('p11-kit-1', | |
6164ec4c ZJS |
1422 | version : '>= 0.23.3', |
1423 | required : want_p11kit == 'true') | |
839fddbe LP |
1424 | have = libp11kit.found() |
1425 | else | |
1426 | have = false | |
1427 | libp11kit = [] | |
1428 | endif | |
1429 | conf.set10('HAVE_P11KIT', have) | |
1430 | ||
af4fbd46 LP |
1431 | want_libfido2 = get_option('libfido2') |
1432 | if want_libfido2 != 'false' and not skip_deps | |
1433 | libfido2 = dependency('libfido2', | |
1434 | required : want_libfido2 == 'true') | |
1435 | have = libfido2.found() | |
1436 | else | |
1437 | have = false | |
1438 | libfido2 = [] | |
1439 | endif | |
1440 | conf.set10('HAVE_LIBFIDO2', have) | |
1441 | ||
5e521624 LP |
1442 | want_tpm2 = get_option('tpm2') |
1443 | if want_tpm2 != 'false' and not skip_deps | |
1444 | tpm2 = dependency('tss2-esys tss2-rc tss2-mu', | |
ba081955 | 1445 | required : want_tpm2 == 'true') |
5e521624 LP |
1446 | have = tpm2.found() |
1447 | else | |
1448 | have = false | |
1449 | tpm2 = [] | |
1450 | endif | |
1451 | conf.set10('HAVE_TPM2', have) | |
1452 | ||
5c23128d | 1453 | want_elfutils = get_option('elfutils') |
87ac55a1 | 1454 | if want_elfutils != 'false' and not skip_deps |
37efbbd8 ZJS |
1455 | libdw = dependency('libdw', |
1456 | required : want_elfutils == 'true') | |
349cc4a5 | 1457 | have = libdw.found() |
d48c2721 LB |
1458 | |
1459 | # New in elfutils 0.177 | |
1460 | conf.set10('HAVE_DWELF_ELF_E_MACHINE_STRING', | |
1461 | have and cc.has_function('dwelf_elf_e_machine_string', dependencies : libdw)) | |
5c23128d | 1462 | else |
349cc4a5 | 1463 | have = false |
37efbbd8 | 1464 | libdw = [] |
5c23128d | 1465 | endif |
349cc4a5 | 1466 | conf.set10('HAVE_ELFUTILS', have) |
5c23128d ZJS |
1467 | |
1468 | want_zlib = get_option('zlib') | |
87ac55a1 | 1469 | if want_zlib != 'false' and not skip_deps |
37efbbd8 ZJS |
1470 | libz = dependency('zlib', |
1471 | required : want_zlib == 'true') | |
349cc4a5 | 1472 | have = libz.found() |
5c23128d | 1473 | else |
349cc4a5 | 1474 | have = false |
37efbbd8 | 1475 | libz = [] |
5c23128d | 1476 | endif |
349cc4a5 | 1477 | conf.set10('HAVE_ZLIB', have) |
5c23128d ZJS |
1478 | |
1479 | want_bzip2 = get_option('bzip2') | |
87ac55a1 | 1480 | if want_bzip2 != 'false' and not skip_deps |
37efbbd8 ZJS |
1481 | libbzip2 = cc.find_library('bz2', |
1482 | required : want_bzip2 == 'true') | |
349cc4a5 | 1483 | have = libbzip2.found() |
5c23128d | 1484 | else |
349cc4a5 | 1485 | have = false |
37efbbd8 | 1486 | libbzip2 = [] |
5c23128d | 1487 | endif |
349cc4a5 | 1488 | conf.set10('HAVE_BZIP2', have) |
5c23128d ZJS |
1489 | |
1490 | want_xz = get_option('xz') | |
87ac55a1 | 1491 | if want_xz != 'false' and not skip_deps |
37efbbd8 ZJS |
1492 | libxz = dependency('liblzma', |
1493 | required : want_xz == 'true') | |
d80b051c | 1494 | have_xz = libxz.found() |
5c23128d | 1495 | else |
d80b051c | 1496 | have_xz = false |
37efbbd8 | 1497 | libxz = [] |
5c23128d | 1498 | endif |
d80b051c | 1499 | conf.set10('HAVE_XZ', have_xz) |
5c23128d ZJS |
1500 | |
1501 | want_lz4 = get_option('lz4') | |
87ac55a1 | 1502 | if want_lz4 != 'false' and not skip_deps |
37efbbd8 | 1503 | liblz4 = dependency('liblz4', |
e0a1d4b0 | 1504 | version : '>= 1.3.0', |
37efbbd8 | 1505 | required : want_lz4 == 'true') |
d80b051c | 1506 | have_lz4 = liblz4.found() |
5c23128d | 1507 | else |
d80b051c | 1508 | have_lz4 = false |
37efbbd8 | 1509 | liblz4 = [] |
5c23128d | 1510 | endif |
d80b051c | 1511 | conf.set10('HAVE_LZ4', have_lz4) |
5c23128d | 1512 | |
ef5924aa NL |
1513 | want_zstd = get_option('zstd') |
1514 | if want_zstd != 'false' and not skip_deps | |
1515 | libzstd = dependency('libzstd', | |
1516 | required : want_zstd == 'true', | |
1517 | version : '>= 1.4.0') | |
d80b051c | 1518 | have_zstd = libzstd.found() |
ef5924aa | 1519 | else |
d80b051c | 1520 | have_zstd = false |
ef5924aa NL |
1521 | libzstd = [] |
1522 | endif | |
d80b051c LP |
1523 | conf.set10('HAVE_ZSTD', have_zstd) |
1524 | ||
1525 | conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd) | |
ef5924aa | 1526 | |
cd3c6322 LB |
1527 | compression = get_option('default-compression') |
1528 | if compression == 'auto' | |
1529 | if have_zstd | |
1530 | compression = 'zstd' | |
1531 | elif have_lz4 | |
1532 | compression = 'lz4' | |
1533 | elif have_xz | |
1534 | compression = 'xz' | |
1535 | else | |
1536 | compression = 'none' | |
1537 | endif | |
1538 | elif compression == 'zstd' and not have_zstd | |
1539 | error('default-compression=zstd requires zstd') | |
1540 | elif compression == 'lz4' and not have_lz4 | |
1541 | error('default-compression=lz4 requires lz4') | |
1542 | elif compression == 'xz' and not have_xz | |
1543 | error('default-compression=xz requires xz') | |
1544 | endif | |
1788c6f3 | 1545 | conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper())) |
cd3c6322 | 1546 | |
a44fb601 | 1547 | want_xkbcommon = get_option('xkbcommon') |
87ac55a1 | 1548 | if want_xkbcommon != 'false' and not skip_deps |
a44fb601 ZJS |
1549 | libxkbcommon = dependency('xkbcommon', |
1550 | version : '>= 0.3.0', | |
1551 | required : want_xkbcommon == 'true') | |
349cc4a5 | 1552 | have = libxkbcommon.found() |
a44fb601 | 1553 | else |
349cc4a5 | 1554 | have = false |
a44fb601 ZJS |
1555 | libxkbcommon = [] |
1556 | endif | |
349cc4a5 | 1557 | conf.set10('HAVE_XKBCOMMON', have) |
a44fb601 | 1558 | |
c4c978a0 | 1559 | want_pcre2 = get_option('pcre2') |
8739f309 | 1560 | if want_pcre2 != 'false' and not skip_deps |
c4c978a0 ZJS |
1561 | libpcre2 = dependency('libpcre2-8', |
1562 | required : want_pcre2 == 'true') | |
1563 | have = libpcre2.found() | |
1564 | else | |
1565 | have = false | |
1566 | libpcre2 = [] | |
1567 | endif | |
1568 | conf.set10('HAVE_PCRE2', have) | |
1569 | ||
69e96427 | 1570 | want_glib = get_option('glib') |
87ac55a1 | 1571 | if want_glib != 'false' and not skip_deps |
37efbbd8 ZJS |
1572 | libglib = dependency('glib-2.0', |
1573 | version : '>= 2.22.0', | |
1574 | required : want_glib == 'true') | |
1575 | libgobject = dependency('gobject-2.0', | |
1576 | version : '>= 2.22.0', | |
1577 | required : want_glib == 'true') | |
1578 | libgio = dependency('gio-2.0', | |
1579 | required : want_glib == 'true') | |
2c201c21 | 1580 | have = libglib.found() and libgobject.found() and libgio.found() |
69e96427 | 1581 | else |
349cc4a5 | 1582 | have = false |
37efbbd8 ZJS |
1583 | libglib = [] |
1584 | libgobject = [] | |
1585 | libgio = [] | |
69e96427 | 1586 | endif |
349cc4a5 | 1587 | conf.set10('HAVE_GLIB', have) |
69e96427 ZJS |
1588 | |
1589 | want_dbus = get_option('dbus') | |
87ac55a1 | 1590 | if want_dbus != 'false' and not skip_deps |
37efbbd8 ZJS |
1591 | libdbus = dependency('dbus-1', |
1592 | version : '>= 1.3.2', | |
1593 | required : want_dbus == 'true') | |
349cc4a5 | 1594 | have = libdbus.found() |
69e96427 | 1595 | else |
349cc4a5 | 1596 | have = false |
37efbbd8 | 1597 | libdbus = [] |
69e96427 | 1598 | endif |
349cc4a5 | 1599 | conf.set10('HAVE_DBUS', have) |
69e96427 | 1600 | |
1bd0cc45 YW |
1601 | dbusdatadir = datadir / 'dbus-1' |
1602 | if conf.get('HAVE_DBUS') == 1 | |
1603 | dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1' | |
1604 | endif | |
1605 | ||
1606 | dbuspolicydir = get_option('dbuspolicydir') | |
1607 | if dbuspolicydir == '' | |
1608 | dbuspolicydir = dbusdatadir / 'system.d' | |
1609 | endif | |
1610 | ||
1611 | dbussessionservicedir = get_option('dbussessionservicedir') | |
1612 | if dbussessionservicedir == '' | |
1613 | dbussessionservicedir = dbusdatadir / 'services' | |
1614 | if conf.get('HAVE_DBUS') == 1 | |
1615 | dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir) | |
1616 | endif | |
1617 | endif | |
1618 | ||
1619 | dbussystemservicedir = get_option('dbussystemservicedir') | |
1620 | if dbussystemservicedir == '' | |
1621 | dbussystemservicedir = dbusdatadir / 'system-services' | |
1622 | if conf.get('HAVE_DBUS') == 1 | |
1623 | dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir) | |
1624 | endif | |
1625 | endif | |
1626 | ||
1627 | dbus_interfaces_dir = get_option('dbus-interfaces-dir') | |
1628 | if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes' | |
1629 | if meson.is_cross_build() and dbus_interfaces_dir != 'yes' | |
1630 | dbus_interfaces_dir = 'no' | |
1631 | warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.') | |
1632 | else | |
1633 | dbus_interfaces_dir = dbusdatadir / 'interfaces' | |
1634 | if conf.get('HAVE_DBUS') == 1 | |
1635 | dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir) | |
1636 | endif | |
1637 | endif | |
1638 | endif | |
1bd0cc45 | 1639 | |
e37ad765 ZJS |
1640 | # We support one or the other. If gcrypt is available, we assume it's there to |
1641 | # be used, and use it in preference. | |
1642 | opt = get_option('cryptolib') | |
1643 | if opt == 'openssl' and conf.get('HAVE_OPENSSL') == 0 | |
1644 | error('openssl requested as the default cryptolib, but not available') | |
1645 | endif | |
1646 | conf.set10('PREFER_OPENSSL', | |
1647 | opt == 'openssl' or (opt == 'auto' and conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_GCRYPT') == 0)) | |
1648 | conf.set10('HAVE_OPENSSL_OR_GCRYPT', | |
1649 | conf.get('HAVE_OPENSSL') == 1 or conf.get('HAVE_GCRYPT') == 1) | |
9bcf483b | 1650 | lib_openssl_or_gcrypt = conf.get('PREFER_OPENSSL') == 1 ? [libopenssl] : [libgcrypt, libgpg_error] |
42303dcb | 1651 | |
56ddbf10 YW |
1652 | dns_over_tls = get_option('dns-over-tls') |
1653 | if dns_over_tls != 'false' | |
e37ad765 ZJS |
1654 | if dns_over_tls == 'gnutls' and conf.get('PREFER_OPENSSL') == 1 |
1655 | error('Sorry, -Ddns-over-tls=gnutls is not supported when openssl is used as the cryptolib') | |
1656 | endif | |
1657 | ||
1f9aa3d2 LB |
1658 | if dns_over_tls == 'gnutls' |
1659 | have_openssl = false | |
096cbdce | 1660 | else |
1f9aa3d2 LB |
1661 | have_openssl = conf.get('HAVE_OPENSSL') == 1 |
1662 | if dns_over_tls == 'openssl' and not have_openssl | |
1663 | error('DNS-over-TLS support was requested with openssl, but dependencies are not available') | |
096cbdce | 1664 | endif |
56ddbf10 | 1665 | endif |
1f9aa3d2 LB |
1666 | if dns_over_tls == 'openssl' or have_openssl |
1667 | have_gnutls = false | |
096cbdce | 1668 | else |
1f9aa3d2 LB |
1669 | have_gnutls = conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.6.0') |
1670 | if dns_over_tls != 'auto' and not have_gnutls | |
1671 | str = dns_over_tls == 'gnutls' ? ' with gnutls' : '' | |
b349bc59 | 1672 | error('DNS-over-TLS support was requested@0@, but dependencies are not available'.format(str)) |
096cbdce IT |
1673 | endif |
1674 | endif | |
1675 | have = have_gnutls or have_openssl | |
56ddbf10 | 1676 | else |
be5536a6 MO |
1677 | have = false |
1678 | have_gnutls = false | |
1679 | have_openssl = false | |
56ddbf10 YW |
1680 | endif |
1681 | conf.set10('ENABLE_DNS_OVER_TLS', have) | |
096cbdce IT |
1682 | conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls) |
1683 | conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl) | |
56ddbf10 | 1684 | |
c9299be2 | 1685 | default_dns_over_tls = get_option('default-dns-over-tls') |
87ac55a1 | 1686 | if skip_deps |
c9299be2 | 1687 | default_dns_over_tls = 'no' |
5d67a7ae | 1688 | endif |
56ddbf10 | 1689 | if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0 |
4310bfc2 | 1690 | message('default-dns-over-tls cannot be enabled or set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.') |
c9299be2 | 1691 | default_dns_over_tls = 'no' |
5d67a7ae | 1692 | endif |
c9299be2 IT |
1693 | conf.set('DEFAULT_DNS_OVER_TLS_MODE', |
1694 | 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper()) | |
411d1f4c | 1695 | conf.set_quoted('DEFAULT_DNS_OVER_TLS_MODE_STR', default_dns_over_tls) |
5d67a7ae | 1696 | |
3614df05 ZJS |
1697 | default_mdns = get_option('default-mdns') |
1698 | conf.set('DEFAULT_MDNS_MODE', | |
1699 | 'RESOLVE_SUPPORT_' + default_mdns.to_upper()) | |
411d1f4c | 1700 | conf.set_quoted('DEFAULT_MDNS_MODE_STR', default_mdns) |
3614df05 ZJS |
1701 | |
1702 | default_llmnr = get_option('default-llmnr') | |
1703 | conf.set('DEFAULT_LLMNR_MODE', | |
1704 | 'RESOLVE_SUPPORT_' + default_llmnr.to_upper()) | |
411d1f4c | 1705 | conf.set_quoted('DEFAULT_LLMNR_MODE_STR', default_llmnr) |
3614df05 | 1706 | |
e594a3b1 LP |
1707 | want_repart = get_option('repart') |
1708 | if want_repart != 'false' | |
6b12086e | 1709 | have = conf.get('HAVE_LIBFDISK') == 1 |
e594a3b1 LP |
1710 | if want_repart == 'true' and not have |
1711 | error('repart support was requested, but dependencies are not available') | |
1712 | endif | |
1713 | else | |
1714 | have = false | |
1715 | endif | |
1716 | conf.set10('ENABLE_REPART', have) | |
1717 | ||
7e8facb3 ZJS |
1718 | default_dnssec = get_option('default-dnssec') |
1719 | if skip_deps | |
1720 | default_dnssec = 'no' | |
1721 | endif | |
1722 | if default_dnssec != 'no' and conf.get('HAVE_OPENSSL_OR_GCRYPT') == 0 | |
1723 | message('default-dnssec cannot be set to yes or allow-downgrade openssl and gcrypt are disabled. Setting default-dnssec to no.') | |
1724 | default_dnssec = 'no' | |
1725 | endif | |
1726 | conf.set('DEFAULT_DNSSEC_MODE', | |
1727 | 'DNSSEC_' + default_dnssec.underscorify().to_upper()) | |
1728 | conf.set_quoted('DEFAULT_DNSSEC_MODE_STR', default_dnssec) | |
1729 | ||
43cc7a3e LP |
1730 | want_sysupdate = get_option('sysupdate') |
1731 | if want_sysupdate != 'false' | |
1732 | have = (conf.get('HAVE_OPENSSL') == 1 and | |
1733 | conf.get('HAVE_LIBFDISK') == 1) | |
1734 | if want_sysupdate == 'true' and not have | |
1735 | error('sysupdate support was requested, but dependencies are not available') | |
1736 | endif | |
1737 | else | |
1738 | have = false | |
1739 | endif | |
1740 | conf.set10('ENABLE_SYSUPDATE', have) | |
1741 | ||
5c23128d | 1742 | want_importd = get_option('importd') |
4390be30 | 1743 | if want_importd != 'false' |
349cc4a5 | 1744 | have = (conf.get('HAVE_LIBCURL') == 1 and |
6214d42b | 1745 | conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and |
349cc4a5 | 1746 | conf.get('HAVE_ZLIB') == 1 and |
6214d42b | 1747 | conf.get('HAVE_XZ') == 1) |
349cc4a5 | 1748 | if want_importd == 'true' and not have |
37efbbd8 ZJS |
1749 | error('importd support was requested, but dependencies are not available') |
1750 | endif | |
349cc4a5 ZJS |
1751 | else |
1752 | have = false | |
5c23128d | 1753 | endif |
349cc4a5 | 1754 | conf.set10('ENABLE_IMPORTD', have) |
5c23128d | 1755 | |
f887eab1 FB |
1756 | want_kernel_install = get_option('kernel-install') |
1757 | conf.set10('ENABLE_KERNEL_INSTALL', want_kernel_install) | |
1758 | ||
70a5db58 LP |
1759 | want_homed = get_option('homed') |
1760 | if want_homed != 'false' | |
1761 | have = (conf.get('HAVE_OPENSSL') == 1 and | |
1762 | conf.get('HAVE_LIBFDISK') == 1 and | |
1763 | conf.get('HAVE_LIBCRYPTSETUP') == 1) | |
1764 | if want_homed == 'true' and not have | |
1765 | error('homed support was requested, but dependencies are not available') | |
1766 | endif | |
1767 | else | |
1768 | have = false | |
1769 | endif | |
1770 | conf.set10('ENABLE_HOMED', have) | |
1771 | ||
af06ddf5 YW |
1772 | have = have and conf.get('HAVE_PAM') == 1 |
1773 | conf.set10('ENABLE_PAM_HOME', have) | |
1774 | ||
d58c5f0f | 1775 | have = get_option('oomd') |
c199dd3f AZ |
1776 | conf.set10('ENABLE_OOMD', have) |
1777 | ||
5c23128d | 1778 | want_remote = get_option('remote') |
4390be30 | 1779 | if want_remote != 'false' |
349cc4a5 ZJS |
1780 | have_deps = [conf.get('HAVE_MICROHTTPD') == 1, |
1781 | conf.get('HAVE_LIBCURL') == 1] | |
37efbbd8 ZJS |
1782 | # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so |
1783 | # it's possible to build one without the other. Complain only if | |
5238e957 | 1784 | # support was explicitly requested. The auxiliary files like sysusers |
37efbbd8 ZJS |
1785 | # config should be installed when any of the programs are built. |
1786 | if want_remote == 'true' and not (have_deps[0] and have_deps[1]) | |
1787 | error('remote support was requested, but dependencies are not available') | |
1788 | endif | |
349cc4a5 ZJS |
1789 | have = have_deps[0] or have_deps[1] |
1790 | else | |
1791 | have = false | |
5c23128d | 1792 | endif |
349cc4a5 | 1793 | conf.set10('ENABLE_REMOTE', have) |
5c23128d | 1794 | |
b3259a6e ZJS |
1795 | foreach term : ['analyze', |
1796 | 'backlight', | |
a9149d87 ZJS |
1797 | 'binfmt', |
1798 | 'coredump', | |
b3259a6e ZJS |
1799 | 'efi', |
1800 | 'environment-d', | |
1801 | 'firstboot', | |
1802 | 'gshadow', | |
1803 | 'hibernate', | |
a9149d87 | 1804 | 'hostnamed', |
b3259a6e ZJS |
1805 | 'hwdb', |
1806 | 'idn', | |
1807 | 'ima', | |
1808 | 'initrd', | |
53393c89 | 1809 | 'compat-mutable-uid-boundaries', |
7e0079f9 | 1810 | 'nscd', |
b3259a6e | 1811 | 'ldconfig', |
a9149d87 | 1812 | 'localed', |
b3259a6e | 1813 | 'logind', |
a9149d87 ZJS |
1814 | 'machined', |
1815 | 'networkd', | |
b3259a6e ZJS |
1816 | 'nss-myhostname', |
1817 | 'nss-systemd', | |
1818 | 'portabled', | |
9bca4ae4 | 1819 | 'sysext', |
b3259a6e | 1820 | 'pstore', |
a9149d87 | 1821 | 'quotacheck', |
b3259a6e ZJS |
1822 | 'randomseed', |
1823 | 'resolve', | |
1824 | 'rfkill', | |
1825 | 'smack', | |
a9149d87 | 1826 | 'sysusers', |
b3259a6e ZJS |
1827 | 'timedated', |
1828 | 'timesyncd', | |
a9149d87 | 1829 | 'tmpfiles', |
a9149d87 | 1830 | 'tpm', |
b3259a6e ZJS |
1831 | 'userdb', |
1832 | 'utmp', | |
1833 | 'vconsole', | |
1834 | 'xdg-autostart'] | |
a9149d87 ZJS |
1835 | have = get_option(term) |
1836 | name = 'ENABLE_' + term.underscorify().to_upper() | |
1837 | conf.set10(name, have) | |
5c23128d ZJS |
1838 | endforeach |
1839 | ||
bd7e6aa7 ZJS |
1840 | enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1 |
1841 | ||
08540a95 YW |
1842 | foreach tuple : [['nss-mymachines', 'machined'], |
1843 | ['nss-resolve', 'resolve']] | |
1844 | want = get_option(tuple[0]) | |
1845 | if want != 'false' | |
1846 | have = get_option(tuple[1]) | |
1847 | if want == 'true' and not have | |
1848 | error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1])) | |
1849 | endif | |
1850 | else | |
1851 | have = false | |
1852 | endif | |
1853 | name = 'ENABLE_' + tuple[0].underscorify().to_upper() | |
1854 | conf.set10(name, have) | |
1855 | endforeach | |
1856 | ||
1857 | enable_nss = false | |
1858 | foreach term : ['ENABLE_NSS_MYHOSTNAME', | |
1859 | 'ENABLE_NSS_MYMACHINES', | |
1860 | 'ENABLE_NSS_RESOLVE', | |
1861 | 'ENABLE_NSS_SYSTEMD'] | |
1862 | if conf.get(term) == 1 | |
1863 | enable_nss = true | |
1864 | endif | |
1865 | endforeach | |
1866 | conf.set10('ENABLE_NSS', enable_nss) | |
1867 | ||
348b4437 | 1868 | conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd')) |
6129ec85 | 1869 | |
b68dfb9e | 1870 | conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests) |
00d82c81 | 1871 | |
db7f5ab6 JJ |
1872 | ############################################################ |
1873 | ||
1874 | tests = [] | |
1875 | fuzzers = [] | |
e93ada98 | 1876 | catalogs = [] |
db7f5ab6 JJ |
1877 | |
1878 | ############################################################ | |
5c23128d | 1879 | |
db7f5ab6 | 1880 | # Include these now as they provide gnu-efi detection. |
34357545 MS |
1881 | subdir('src/fundamental') |
1882 | subdir('src/boot/efi') | |
34357545 | 1883 | |
f6fe732f YW |
1884 | ############################################################ |
1885 | ||
d3821a33 | 1886 | generate_gperfs = find_program('tools/generate-gperfs.py') |
f6fe732f YW |
1887 | make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py') |
1888 | make_directive_index_py = find_program('tools/make-directive-index.py') | |
1889 | make_man_index_py = find_program('tools/make-man-index.py') | |
6b1aac3c | 1890 | meson_render_jinja2 = find_program('tools/meson-render-jinja2.py') |
d3821a33 | 1891 | update_dbus_docs_py = find_program('tools/update-dbus-docs.py') |
77d45f1f | 1892 | update_man_rules_py = find_program('tools/update-man-rules.py') |
d3821a33 ZJS |
1893 | update_hwdb_sh = find_program('tools/update-hwdb.sh') |
1894 | update_hwdb_autosuspend_sh = find_program('tools/update-hwdb-autosuspend.sh') | |
1895 | update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh') | |
1896 | xml_helper_py = find_program('tools/xml_helper.py') | |
e3c68924 | 1897 | export_dbus_interfaces_py = find_program('tools/dbus_exporter.py') |
f6fe732f | 1898 | |
db7f5ab6 | 1899 | ############################################################ |
5c23128d | 1900 | |
7e43be7d FS |
1901 | if get_option('b_coverage') |
1902 | add_project_arguments('-include', 'src/basic/coverage.h', language : 'c') | |
1903 | endif | |
1904 | ||
1905 | ############################################################ | |
1906 | ||
5c23128d | 1907 | config_h = configure_file( |
37efbbd8 ZJS |
1908 | output : 'config.h', |
1909 | configuration : conf) | |
5c23128d | 1910 | |
f6fe732f YW |
1911 | add_project_arguments('-include', 'config.h', language : 'c') |
1912 | ||
8f04a1ca ZJS |
1913 | jinja2_cmdline = [meson_render_jinja2, config_h, version_h] |
1914 | ||
f6fe732f | 1915 | ############################################################ |
348b4437 | 1916 | |
b61016f2 YW |
1917 | # binaries that have --help and are intended for use by humans, |
1918 | # usually, but not always, installed in /bin. | |
1919 | public_programs = [] | |
1920 | ||
e3c68924 | 1921 | # D-Bus introspection XML export |
1922 | dbus_programs = [] | |
e3c68924 | 1923 | |
8d40961c YW |
1924 | basic_includes = include_directories( |
1925 | 'src/basic', | |
e5bc5f1f | 1926 | 'src/fundamental', |
8d40961c YW |
1927 | 'src/systemd', |
1928 | '.') | |
1929 | ||
1930 | libsystemd_includes = [basic_includes, include_directories( | |
1931 | 'src/libsystemd/sd-bus', | |
1932 | 'src/libsystemd/sd-device', | |
1933 | 'src/libsystemd/sd-event', | |
1934 | 'src/libsystemd/sd-hwdb', | |
1935 | 'src/libsystemd/sd-id128', | |
1936 | 'src/libsystemd/sd-journal', | |
1937 | 'src/libsystemd/sd-netlink', | |
1938 | 'src/libsystemd/sd-network', | |
1939 | 'src/libsystemd/sd-resolve')] | |
1940 | ||
1941 | includes = [libsystemd_includes, include_directories('src/shared')] | |
5c23128d | 1942 | |
5c23128d ZJS |
1943 | subdir('po') |
1944 | subdir('catalog') | |
5c23128d ZJS |
1945 | subdir('src/basic') |
1946 | subdir('src/libsystemd') | |
3976f372 YW |
1947 | subdir('src/shared') |
1948 | subdir('src/udev') | |
1949 | subdir('src/libudev') | |
d1ae38d8 | 1950 | subdir('src/cryptsetup/cryptsetup-tokens') |
5c23128d | 1951 | |
039f1673 LB |
1952 | alias_target('devel', libsystemd_pc, libudev_pc) |
1953 | ||
5c23128d | 1954 | libsystemd = shared_library( |
37efbbd8 | 1955 | 'systemd', |
56d50ab1 | 1956 | version : libsystemd_version, |
8d40961c | 1957 | include_directories : libsystemd_includes, |
37efbbd8 ZJS |
1958 | link_args : ['-shared', |
1959 | '-Wl,--version-script=' + libsystemd_sym_path], | |
34e221a5 | 1960 | link_with : [libbasic, |
acc50c92 LP |
1961 | libbasic_gcrypt, |
1962 | libbasic_compress], | |
99b9f8fd | 1963 | link_whole : [libsystemd_static], |
37efbbd8 | 1964 | dependencies : [threads, |
acc50c92 | 1965 | librt], |
37efbbd8 ZJS |
1966 | link_depends : libsystemd_sym, |
1967 | install : true, | |
0a5e638c | 1968 | install_tag: 'libsystemd', |
37efbbd8 | 1969 | install_dir : rootlibdir) |
5c23128d | 1970 | |
039f1673 LB |
1971 | alias_target('libsystemd', libsystemd) |
1972 | ||
70848ecf DC |
1973 | install_libsystemd_static = static_library( |
1974 | 'systemd', | |
1975 | libsystemd_sources, | |
975464e0 ZJS |
1976 | basic_sources, |
1977 | basic_gcrypt_sources, | |
acc50c92 | 1978 | basic_compress_sources, |
e5bc5f1f | 1979 | fundamental_sources, |
8d40961c | 1980 | include_directories : libsystemd_includes, |
70848ecf DC |
1981 | build_by_default : static_libsystemd != 'false', |
1982 | install : static_libsystemd != 'false', | |
0a5e638c | 1983 | install_tag: 'libsystemd', |
70848ecf | 1984 | install_dir : rootlibdir, |
40dbce36 | 1985 | pic : static_libsystemd_pic, |
70848ecf DC |
1986 | dependencies : [threads, |
1987 | librt, | |
1988 | libxz, | |
ef5924aa | 1989 | libzstd, |
70848ecf | 1990 | liblz4, |
c5fd89ad | 1991 | libdl, |
975464e0 ZJS |
1992 | libcap, |
1993 | libblkid, | |
1994 | libmount, | |
011d129c LP |
1995 | libgcrypt, |
1996 | libopenssl], | |
70848ecf DC |
1997 | c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC'])) |
1998 | ||
3976f372 YW |
1999 | libudev = shared_library( |
2000 | 'udev', | |
3976f372 YW |
2001 | version : libudev_version, |
2002 | include_directories : includes, | |
2003 | link_args : ['-shared', | |
2004 | '-Wl,--version-script=' + libudev_sym_path], | |
2005 | link_with : [libsystemd_static, libshared_static], | |
2006 | link_whole : libudev_basic, | |
2007 | dependencies : [threads], | |
2008 | link_depends : libudev_sym, | |
2009 | install : true, | |
0a5e638c | 2010 | install_tag: 'libudev', |
3976f372 YW |
2011 | install_dir : rootlibdir) |
2012 | ||
039f1673 LB |
2013 | alias_target('libudev', libudev) |
2014 | ||
3976f372 YW |
2015 | install_libudev_static = static_library( |
2016 | 'udev', | |
2017 | basic_sources, | |
e5bc5f1f | 2018 | fundamental_sources, |
3976f372 YW |
2019 | shared_sources, |
2020 | libsystemd_sources, | |
2021 | libudev_sources, | |
3976f372 YW |
2022 | include_directories : includes, |
2023 | build_by_default : static_libudev != 'false', | |
2024 | install : static_libudev != 'false', | |
0a5e638c | 2025 | install_tag: 'libudev', |
3976f372 YW |
2026 | install_dir : rootlibdir, |
2027 | link_depends : libudev_sym, | |
2028 | dependencies : libshared_deps + [libmount], | |
2029 | c_args : static_libudev_pic ? [] : ['-fno-PIC'], | |
2030 | pic : static_libudev_pic) | |
2031 | ||
d1ae38d8 OK |
2032 | if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1 |
2033 | if conf.get('HAVE_TPM2') == 1 | |
2034 | cryptsetup_token_systemd_tpm2 = shared_library( | |
2035 | 'cryptsetup-token-systemd-tpm2', | |
c01543fd ZJS |
2036 | cryptsetup_token_systemd_tpm2_sources, |
2037 | include_directories : includes, | |
d1ae38d8 OK |
2038 | link_args : ['-shared', |
2039 | '-Wl,--version-script=' + cryptsetup_token_sym_path], | |
c01543fd ZJS |
2040 | link_with : [lib_cryptsetup_token_common, |
2041 | libshared], | |
2042 | dependencies : [libcryptsetup, | |
2043 | tpm2, | |
2044 | versiondep], | |
d1ae38d8 | 2045 | link_depends : cryptsetup_token_sym, |
5fb22561 | 2046 | install_rpath : rootpkglibdir, |
d1ae38d8 OK |
2047 | install : true, |
2048 | install_dir : libcryptsetup_plugins_dir) | |
2049 | endif | |
351716e1 OK |
2050 | |
2051 | if conf.get('HAVE_LIBFIDO2') == 1 | |
2052 | cryptsetup_token_systemd_fido2 = shared_library( | |
2053 | 'cryptsetup-token-systemd-fido2', | |
c01543fd ZJS |
2054 | cryptsetup_token_systemd_fido2_sources, |
2055 | include_directories : includes, | |
351716e1 OK |
2056 | link_args : ['-shared', |
2057 | '-Wl,--version-script=' + cryptsetup_token_sym_path], | |
c01543fd ZJS |
2058 | link_with : [lib_cryptsetup_token_common, |
2059 | libshared], | |
2060 | dependencies : [libcryptsetup, | |
2061 | libfido2, | |
2062 | versiondep], | |
351716e1 | 2063 | link_depends : cryptsetup_token_sym, |
5fb22561 | 2064 | install_rpath : rootpkglibdir, |
351716e1 OK |
2065 | install : true, |
2066 | install_dir : libcryptsetup_plugins_dir) | |
2067 | endif | |
8186022c OK |
2068 | |
2069 | if conf.get('HAVE_P11KIT') == 1 | |
2070 | cryptsetup_token_systemd_pkcs11 = shared_library( | |
2071 | 'cryptsetup-token-systemd-pkcs11', | |
c01543fd ZJS |
2072 | cryptsetup_token_systemd_pkcs11_sources, |
2073 | include_directories : includes, | |
8186022c OK |
2074 | link_args : ['-shared', |
2075 | '-Wl,--version-script=' + cryptsetup_token_sym_path], | |
c01543fd ZJS |
2076 | link_with : [lib_cryptsetup_token_common, |
2077 | libshared], | |
2078 | dependencies : [libcryptsetup, | |
2079 | libp11kit, | |
2080 | versiondep], | |
8186022c | 2081 | link_depends : cryptsetup_token_sym, |
5fb22561 | 2082 | install_rpath : rootpkglibdir, |
8186022c OK |
2083 | install : true, |
2084 | install_dir : libcryptsetup_plugins_dir) | |
2085 | endif | |
d1ae38d8 OK |
2086 | endif |
2087 | ||
47354b44 ZJS |
2088 | ############################################################ |
2089 | ||
b61016f2 | 2090 | # systemd-analyze requires 'libcore' |
83b6af36 | 2091 | subdir('src/core') |
b61016f2 YW |
2092 | # systemd-journal-remote requires 'libjournal_core' |
2093 | subdir('src/journal') | |
2094 | # systemd-networkd requires 'libsystemd_network' | |
2095 | subdir('src/libsystemd-network') | |
83b6af36 ZJS |
2096 | |
2097 | subdir('src/analyze') | |
f98df767 | 2098 | subdir('src/busctl') |
b61016f2 | 2099 | subdir('src/coredump') |
2ad279cf | 2100 | subdir('src/cryptenroll') |
b4d1892a | 2101 | subdir('src/cryptsetup') |
b61016f2 | 2102 | subdir('src/home') |
83b6af36 ZJS |
2103 | subdir('src/hostname') |
2104 | subdir('src/import') | |
b61016f2 | 2105 | subdir('src/journal-remote') |
83b6af36 ZJS |
2106 | subdir('src/kernel-install') |
2107 | subdir('src/locale') | |
b61016f2 | 2108 | subdir('src/login') |
83b6af36 | 2109 | subdir('src/machine') |
b61016f2 | 2110 | subdir('src/network') |
83b6af36 | 2111 | subdir('src/nspawn') |
b61016f2 YW |
2112 | subdir('src/oom') |
2113 | subdir('src/partition') | |
2114 | subdir('src/portable') | |
2115 | subdir('src/pstore') | |
83b6af36 | 2116 | subdir('src/resolve') |
2a9b4bbe | 2117 | subdir('src/rpm') |
b61016f2 | 2118 | subdir('src/shutdown') |
9bca4ae4 | 2119 | subdir('src/sysext') |
c3512573 | 2120 | subdir('src/systemctl') |
43cc7a3e | 2121 | subdir('src/sysupdate') |
83b6af36 ZJS |
2122 | subdir('src/timedate') |
2123 | subdir('src/timesync') | |
db64ba81 | 2124 | subdir('src/tmpfiles') |
b61016f2 | 2125 | subdir('src/userdb') |
0275e918 | 2126 | subdir('src/xdg-autostart-generator') |
83b6af36 | 2127 | |
3976f372 YW |
2128 | subdir('src/systemd') |
2129 | ||
83b6af36 | 2130 | subdir('src/test') |
7db7d5b7 | 2131 | subdir('src/fuzz') |
ef2ad30a | 2132 | subdir('rules.d') |
83b6af36 ZJS |
2133 | subdir('test') |
2134 | ||
2135 | ############################################################ | |
2136 | ||
2137 | # only static linking apart from libdl, to make sure that the | |
2138 | # module is linked to all libraries that it uses. | |
2139 | test_dlopen = executable( | |
37efbbd8 ZJS |
2140 | 'test-dlopen', |
2141 | test_dlopen_c, | |
2142 | include_directories : includes, | |
2143 | link_with : [libbasic], | |
fd1939fb YW |
2144 | dependencies : [libdl], |
2145 | build_by_default : want_tests != 'false') | |
83b6af36 | 2146 | |
08540a95 | 2147 | foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'], |
cbaaf7b9 | 2148 | ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']], |
08540a95 | 2149 | ['mymachines', 'ENABLE_NSS_MYMACHINES'], |
8d40961c | 2150 | ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]] |
5c23128d | 2151 | |
349cc4a5 | 2152 | condition = tuple[1] == '' or conf.get(tuple[1]) == 1 |
37efbbd8 ZJS |
2153 | if condition |
2154 | module = tuple[0] | |
37efbbd8 ZJS |
2155 | |
2156 | sym = 'src/nss-@0@/nss-@0@.sym'.format(module) | |
fce9abb2 | 2157 | version_script_arg = project_source_root / sym |
37efbbd8 | 2158 | |
1684c56f LP |
2159 | sources = ['src/nss-@0@/nss-@0@.c'.format(module)] |
2160 | if tuple.length() > 2 | |
cbaaf7b9 YW |
2161 | foreach s : tuple[2] |
2162 | sources += ['src/nss-@0@/@1@'.format(module, s)] | |
2163 | endforeach | |
1684c56f LP |
2164 | endif |
2165 | ||
8d40961c YW |
2166 | incs = tuple.length() > 3 ? tuple[3] : includes |
2167 | ||
37efbbd8 ZJS |
2168 | nss = shared_library( |
2169 | 'nss_' + module, | |
1684c56f | 2170 | sources, |
37efbbd8 | 2171 | version : '2', |
8d40961c | 2172 | include_directories : incs, |
b4b36f44 LP |
2173 | # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned |
2174 | link_args : ['-Wl,-z,nodelete', | |
2175 | '-shared', | |
700805f6 | 2176 | '-Wl,--version-script=' + version_script_arg], |
37e4d7a8 | 2177 | link_with : [libsystemd_static, |
733cbd00 | 2178 | libshared_static, |
37efbbd8 ZJS |
2179 | libbasic], |
2180 | dependencies : [threads, | |
5486a31d | 2181 | librt], |
37efbbd8 ZJS |
2182 | link_depends : sym, |
2183 | install : true, | |
35d17e15 | 2184 | install_tag : 'nss', |
37efbbd8 ZJS |
2185 | install_dir : rootlibdir) |
2186 | ||
2187 | # We cannot use shared_module because it does not support version suffix. | |
2188 | # Unfortunately shared_library insists on creating the symlink… | |
7c22f07c | 2189 | meson.add_install_script('sh', '-c', |
37efbbd8 | 2190 | 'rm $DESTDIR@0@/libnss_@1@.so' |
35d17e15 MG |
2191 | .format(rootlibdir, module), |
2192 | install_tag : 'nss' | |
2193 | ) | |
37efbbd8 | 2194 | |
938be089 ZJS |
2195 | if want_tests != 'false' |
2196 | test('dlopen-nss_' + module, | |
2197 | test_dlopen, | |
2198 | # path to dlopen must include a slash | |
e93ada98 DDM |
2199 | args : nss.full_path(), |
2200 | depends : nss) | |
938be089 | 2201 | endif |
37efbbd8 | 2202 | endif |
5c23128d ZJS |
2203 | endforeach |
2204 | ||
2205 | ############################################################ | |
2206 | ||
3761002e | 2207 | exe = executable( |
6164ec4c ZJS |
2208 | 'systemd', |
2209 | systemd_sources, | |
2210 | include_directories : includes, | |
2211 | link_with : [libcore, | |
2212 | libshared], | |
2213 | dependencies : [versiondep, | |
4287c855 | 2214 | libseccomp], |
5fb22561 | 2215 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2216 | install : true, |
2217 | install_dir : rootlibexecdir) | |
3761002e ZJS |
2218 | dbus_programs += exe |
2219 | public_programs += exe | |
5c23128d | 2220 | |
ba7f4ae6 | 2221 | meson.add_install_script(meson_make_symlink, |
fce9abb2 ZJS |
2222 | rootlibexecdir / 'systemd', |
2223 | rootsbindir / 'init') | |
ba7f4ae6 | 2224 | |
4e8295f4 | 2225 | exe = executable( |
6164ec4c ZJS |
2226 | 'systemd-analyze', |
2227 | systemd_analyze_sources, | |
8d40961c | 2228 | include_directories : core_includes, |
6164ec4c ZJS |
2229 | link_with : [libcore, |
2230 | libshared], | |
2231 | dependencies : [versiondep, | |
4287c855 | 2232 | libseccomp], |
5fb22561 | 2233 | install_rpath : rootpkglibdir, |
9e4a50bc | 2234 | install : conf.get('ENABLE_ANALYZE') == 1) |
4e8295f4 ZJS |
2235 | public_programs += exe |
2236 | ||
2237 | if want_tests != 'false' | |
2238 | test('test-compare-versions', | |
2239 | test_compare_versions_sh, | |
2240 | args : exe.full_path()) | |
2241 | endif | |
5c23128d | 2242 | |
6164ec4c ZJS |
2243 | executable( |
2244 | 'systemd-journald', | |
2245 | systemd_journald_sources, | |
2246 | include_directories : includes, | |
2247 | link_with : [libjournal_core, | |
2248 | libshared], | |
2249 | dependencies : [threads, | |
2250 | libxz, | |
2251 | liblz4, | |
ef5924aa NL |
2252 | libselinux, |
2253 | libzstd], | |
5fb22561 | 2254 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2255 | install : true, |
2256 | install_dir : rootlibexecdir) | |
5c23128d | 2257 | |
6164ec4c ZJS |
2258 | public_programs += executable( |
2259 | 'systemd-cat', | |
2260 | systemd_cat_sources, | |
2261 | include_directories : includes, | |
2262 | link_with : [libjournal_core, | |
2263 | libshared], | |
2264 | dependencies : [threads], | |
5fb22561 | 2265 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2266 | install : true) |
2267 | ||
0a0d4899 JH |
2268 | if get_option('link-journalctl-shared') |
2269 | journalctl_link_with = [libshared] | |
2270 | else | |
2271 | journalctl_link_with = [libsystemd_static, | |
2272 | libshared_static, | |
2273 | libbasic_gcrypt] | |
2274 | endif | |
2275 | ||
6164ec4c ZJS |
2276 | public_programs += executable( |
2277 | 'journalctl', | |
2278 | journalctl_sources, | |
2279 | include_directories : includes, | |
0a0d4899 | 2280 | link_with : [journalctl_link_with], |
6164ec4c | 2281 | dependencies : [threads, |
e44b5004 | 2282 | libdl, |
6164ec4c ZJS |
2283 | libxz, |
2284 | liblz4, | |
9200bb30 LP |
2285 | libzstd, |
2286 | libdl], | |
5fb22561 | 2287 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2288 | install : true, |
2289 | install_dir : rootbindir) | |
35a1ff4c | 2290 | |
6164ec4c ZJS |
2291 | executable( |
2292 | 'systemd-getty-generator', | |
2293 | 'src/getty-generator/getty-generator.c', | |
2294 | include_directories : includes, | |
2295 | link_with : [libshared], | |
5fb22561 | 2296 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2297 | install : true, |
2298 | install_dir : systemgeneratordir) | |
5c23128d | 2299 | |
6164ec4c ZJS |
2300 | executable( |
2301 | 'systemd-debug-generator', | |
2302 | 'src/debug-generator/debug-generator.c', | |
2303 | include_directories : includes, | |
2304 | link_with : [libshared], | |
5fb22561 | 2305 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2306 | install : true, |
2307 | install_dir : systemgeneratordir) | |
2308 | ||
2309 | executable( | |
2310 | 'systemd-run-generator', | |
2311 | 'src/run-generator/run-generator.c', | |
2312 | include_directories : includes, | |
2313 | link_with : [libshared], | |
5fb22561 | 2314 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2315 | install : true, |
2316 | install_dir : systemgeneratordir) | |
2317 | ||
8cc8a073 | 2318 | exe = executable( |
6164ec4c ZJS |
2319 | 'systemd-fstab-generator', |
2320 | 'src/fstab-generator/fstab-generator.c', | |
2321 | include_directories : includes, | |
bac11cd6 | 2322 | link_with : [libshared], |
5fb22561 | 2323 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2324 | install : true, |
2325 | install_dir : systemgeneratordir) | |
5c23128d | 2326 | |
8cc8a073 YW |
2327 | if want_tests != 'false' |
2328 | test('test-fstab-generator', | |
2329 | test_fstab_generator_sh, | |
2330 | # https://github.com/mesonbuild/meson/issues/2681 | |
e93ada98 DDM |
2331 | args : exe.full_path(), |
2332 | depends : exe) | |
8cc8a073 YW |
2333 | endif |
2334 | ||
349cc4a5 | 2335 | if conf.get('ENABLE_ENVIRONMENT_D') == 1 |
6164ec4c ZJS |
2336 | executable( |
2337 | '30-systemd-environment-d-generator', | |
2338 | 'src/environment-d-generator/environment-d-generator.c', | |
2339 | include_directories : includes, | |
2340 | link_with : [libshared], | |
5fb22561 | 2341 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2342 | install : true, |
2343 | install_dir : userenvgeneratordir) | |
7b76fce1 | 2344 | |
37efbbd8 | 2345 | meson.add_install_script(meson_make_symlink, |
fce9abb2 ZJS |
2346 | sysconfdir / 'environment', |
2347 | environmentdir / '99-environment.conf') | |
5c23128d ZJS |
2348 | endif |
2349 | ||
349cc4a5 | 2350 | if conf.get('ENABLE_HIBERNATE') == 1 |
6164ec4c ZJS |
2351 | executable( |
2352 | 'systemd-hibernate-resume-generator', | |
2353 | 'src/hibernate-resume/hibernate-resume-generator.c', | |
2354 | include_directories : includes, | |
2355 | link_with : [libshared], | |
5fb22561 | 2356 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2357 | install : true, |
2358 | install_dir : systemgeneratordir) | |
2359 | ||
2360 | executable( | |
2361 | 'systemd-hibernate-resume', | |
2362 | 'src/hibernate-resume/hibernate-resume.c', | |
2363 | include_directories : includes, | |
2364 | link_with : [libshared], | |
5fb22561 | 2365 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2366 | install : true, |
2367 | install_dir : rootlibexecdir) | |
37efbbd8 ZJS |
2368 | endif |
2369 | ||
349cc4a5 | 2370 | if conf.get('HAVE_BLKID') == 1 |
6164ec4c ZJS |
2371 | executable( |
2372 | 'systemd-gpt-auto-generator', | |
2373 | 'src/gpt-auto-generator/gpt-auto-generator.c', | |
6164ec4c ZJS |
2374 | include_directories : includes, |
2375 | link_with : [libshared], | |
2376 | dependencies : libblkid, | |
5fb22561 | 2377 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2378 | install : true, |
2379 | install_dir : systemgeneratordir) | |
2380 | ||
2381 | public_programs += executable( | |
2382 | 'systemd-dissect', | |
2383 | 'src/dissect/dissect.c', | |
2384 | include_directories : includes, | |
2385 | link_with : [libshared], | |
5fb22561 | 2386 | install_rpath : rootpkglibdir, |
5a151082 | 2387 | install : true) |
5c23128d ZJS |
2388 | endif |
2389 | ||
1ec57f33 | 2390 | if conf.get('ENABLE_RESOLVE') == 1 |
e3c68924 | 2391 | dbus_programs += executable( |
6164ec4c ZJS |
2392 | 'systemd-resolved', |
2393 | systemd_resolved_sources, | |
8d40961c | 2394 | include_directories : resolve_includes, |
6164ec4c ZJS |
2395 | link_with : [libshared, |
2396 | libbasic_gcrypt, | |
2397 | libsystemd_resolve_core], | |
2398 | dependencies : systemd_resolved_dependencies, | |
5fb22561 | 2399 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2400 | install : true, |
2401 | install_dir : rootlibexecdir) | |
2402 | ||
2403 | public_programs += executable( | |
2404 | 'resolvectl', | |
2405 | resolvectl_sources, | |
2406 | include_directories : includes, | |
2407 | link_with : [libshared, | |
2408 | libbasic_gcrypt, | |
2409 | libsystemd_resolve_core], | |
2410 | dependencies : [threads, | |
0351cbb9 | 2411 | lib_openssl_or_gcrypt, |
6164ec4c ZJS |
2412 | libm, |
2413 | libidn], | |
5fb22561 | 2414 | install_rpath : rootpkglibdir, |
6164ec4c | 2415 | install : true) |
088c1363 LP |
2416 | |
2417 | meson.add_install_script(meson_make_symlink, | |
fce9abb2 ZJS |
2418 | bindir / 'resolvectl', |
2419 | rootsbindir / 'resolvconf') | |
c2e84cab YW |
2420 | |
2421 | meson.add_install_script(meson_make_symlink, | |
fce9abb2 ZJS |
2422 | bindir / 'resolvectl', |
2423 | bindir / 'systemd-resolve') | |
5c23128d ZJS |
2424 | endif |
2425 | ||
349cc4a5 | 2426 | if conf.get('ENABLE_LOGIND') == 1 |
e3c68924 | 2427 | dbus_programs += executable( |
6164ec4c ZJS |
2428 | 'systemd-logind', |
2429 | systemd_logind_sources, | |
2430 | include_directories : includes, | |
2431 | link_with : [liblogind_core, | |
2432 | libshared], | |
2433 | dependencies : [threads, | |
2434 | libacl], | |
5fb22561 | 2435 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2436 | install : true, |
2437 | install_dir : rootlibexecdir) | |
2438 | ||
2439 | public_programs += executable( | |
2440 | 'loginctl', | |
2441 | loginctl_sources, | |
2442 | include_directories : includes, | |
2443 | link_with : [libshared], | |
2444 | dependencies : [threads, | |
2445 | liblz4, | |
ef5924aa NL |
2446 | libxz, |
2447 | libzstd], | |
5fb22561 | 2448 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2449 | install : true, |
2450 | install_dir : rootbindir) | |
2451 | ||
2452 | public_programs += executable( | |
2453 | 'systemd-inhibit', | |
2454 | 'src/login/inhibit.c', | |
2455 | include_directories : includes, | |
2456 | link_with : [libshared], | |
5fb22561 | 2457 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2458 | install : true, |
2459 | install_dir : rootbindir) | |
37efbbd8 | 2460 | |
349cc4a5 | 2461 | if conf.get('HAVE_PAM') == 1 |
fce9abb2 | 2462 | version_script_arg = project_source_root / pam_systemd_sym |
37efbbd8 ZJS |
2463 | pam_systemd = shared_library( |
2464 | 'pam_systemd', | |
2465 | pam_systemd_c, | |
2466 | name_prefix : '', | |
2467 | include_directories : includes, | |
2468 | link_args : ['-shared', | |
2469 | '-Wl,--version-script=' + version_script_arg], | |
37e4d7a8 | 2470 | link_with : [libsystemd_static, |
37efbbd8 ZJS |
2471 | libshared_static], |
2472 | dependencies : [threads, | |
2473 | libpam, | |
2474 | libpam_misc], | |
2475 | link_depends : pam_systemd_sym, | |
2476 | install : true, | |
48139c7c | 2477 | install_tag : 'pam', |
37efbbd8 ZJS |
2478 | install_dir : pamlibdir) |
2479 | ||
938be089 ZJS |
2480 | if want_tests != 'false' |
2481 | test('dlopen-pam_systemd', | |
2482 | test_dlopen, | |
2483 | # path to dlopen must include a slash | |
e93ada98 DDM |
2484 | args : pam_systemd.full_path(), |
2485 | depends : pam_systemd) | |
938be089 | 2486 | endif |
37efbbd8 | 2487 | endif |
005a29f2 | 2488 | |
6164ec4c ZJS |
2489 | executable( |
2490 | 'systemd-user-runtime-dir', | |
2491 | user_runtime_dir_sources, | |
2492 | include_directories : includes, | |
2493 | link_with : [libshared], | |
5fb22561 | 2494 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2495 | install : true, |
2496 | install_dir : rootlibexecdir) | |
07ee5adb | 2497 | endif |
a9f0f5e5 | 2498 | |
349cc4a5 | 2499 | if conf.get('HAVE_PAM') == 1 |
6164ec4c ZJS |
2500 | executable( |
2501 | 'systemd-user-sessions', | |
2502 | 'src/user-sessions/user-sessions.c', | |
2503 | include_directories : includes, | |
2504 | link_with : [libshared], | |
5fb22561 | 2505 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2506 | install : true, |
2507 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2508 | endif |
2509 | ||
34357545 | 2510 | if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1 |
79647020 RS |
2511 | if get_option('link-boot-shared') |
2512 | boot_link_with = [libshared] | |
2513 | else | |
2514 | boot_link_with = [libsystemd_static, libshared_static] | |
2515 | endif | |
2516 | ||
6164ec4c ZJS |
2517 | public_programs += executable( |
2518 | 'bootctl', | |
2519 | 'src/boot/bootctl.c', | |
2520 | include_directories : includes, | |
79647020 | 2521 | link_with : [boot_link_with], |
6164ec4c | 2522 | dependencies : [libblkid], |
5fb22561 | 2523 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2524 | install : true) |
2525 | ||
2526 | public_programs += executable( | |
2527 | 'systemd-bless-boot', | |
2528 | 'src/boot/bless-boot.c', | |
2529 | include_directories : includes, | |
79647020 | 2530 | link_with : [boot_link_with], |
6164ec4c | 2531 | dependencies : [libblkid], |
5fb22561 | 2532 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2533 | install : true, |
2534 | install_dir : rootlibexecdir) | |
2535 | ||
2536 | executable( | |
2537 | 'systemd-bless-boot-generator', | |
2538 | 'src/boot/bless-boot-generator.c', | |
2539 | include_directories : includes, | |
79647020 | 2540 | link_with : [boot_link_with], |
5fb22561 | 2541 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2542 | install : true, |
2543 | install_dir : systemgeneratordir) | |
2544 | endif | |
2545 | ||
2546 | executable( | |
2547 | 'systemd-boot-check-no-failures', | |
2548 | 'src/boot/boot-check-no-failures.c', | |
2549 | include_directories : includes, | |
2550 | link_with : [libshared], | |
2551 | dependencies : [libblkid], | |
5fb22561 | 2552 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2553 | install : true, |
2554 | install_dir : rootlibexecdir) | |
005a29f2 | 2555 | |
6164ec4c ZJS |
2556 | public_programs += executable( |
2557 | 'systemd-socket-activate', | |
2558 | 'src/activate/activate.c', | |
2559 | include_directories : includes, | |
2560 | link_with : [libshared], | |
2561 | dependencies : [threads], | |
5fb22561 | 2562 | install_rpath : rootpkglibdir, |
6164ec4c | 2563 | install : true) |
f3794366 | 2564 | |
2a2d002f | 2565 | systemctl = executable( |
6164ec4c | 2566 | 'systemctl', |
c3512573 | 2567 | systemctl_sources, |
6164ec4c ZJS |
2568 | include_directories : includes, |
2569 | link_with : systemctl_link_with, | |
2570 | dependencies : [threads, | |
2571 | libcap, | |
2572 | libselinux, | |
2573 | libxz, | |
ef5924aa NL |
2574 | liblz4, |
2575 | libzstd], | |
5fb22561 | 2576 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2577 | install : true, |
2578 | install_dir : rootbindir) | |
2a2d002f | 2579 | public_programs += systemctl |
5c23128d | 2580 | |
61d0578b | 2581 | if conf.get('ENABLE_PORTABLED') == 1 |
e3c68924 | 2582 | dbus_programs += executable( |
6164ec4c ZJS |
2583 | 'systemd-portabled', |
2584 | systemd_portabled_sources, | |
2585 | include_directories : includes, | |
2586 | link_with : [libshared], | |
409f4cf1 | 2587 | dependencies : [threads, libselinux], |
5fb22561 | 2588 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2589 | install : true, |
2590 | install_dir : rootlibexecdir) | |
2591 | ||
2592 | public_programs += executable( | |
2593 | 'portablectl', | |
2594 | 'src/portable/portablectl.c', | |
2595 | include_directories : includes, | |
2596 | link_with : [libshared], | |
2597 | dependencies : [threads], | |
5fb22561 | 2598 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2599 | install : true, |
2600 | install_dir : rootbindir) | |
61d0578b LP |
2601 | endif |
2602 | ||
9bca4ae4 LP |
2603 | if conf.get('ENABLE_SYSEXT') == 1 |
2604 | public_programs += executable( | |
2605 | 'systemd-sysext', | |
2606 | systemd_sysext_sources, | |
2607 | include_directories : includes, | |
2608 | link_with : [libshared], | |
5fb22561 | 2609 | install_rpath : rootpkglibdir, |
9bca4ae4 | 2610 | install : true, |
aac5fbff | 2611 | install_dir : rootbindir) |
9bca4ae4 LP |
2612 | endif |
2613 | ||
d093b62c | 2614 | if conf.get('ENABLE_USERDB') == 1 |
6164ec4c ZJS |
2615 | executable( |
2616 | 'systemd-userwork', | |
2617 | systemd_userwork_sources, | |
2618 | include_directories : includes, | |
2619 | link_with : [libshared], | |
2620 | dependencies : [threads], | |
5fb22561 | 2621 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2622 | install : true, |
2623 | install_dir : rootlibexecdir) | |
2624 | ||
2625 | executable( | |
2626 | 'systemd-userdbd', | |
2627 | systemd_userdbd_sources, | |
2628 | include_directories : includes, | |
2629 | link_with : [libshared], | |
2630 | dependencies : [threads], | |
5fb22561 | 2631 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2632 | install : true, |
2633 | install_dir : rootlibexecdir) | |
2634 | ||
460e5af0 | 2635 | public_programs += executable( |
6164ec4c ZJS |
2636 | 'userdbctl', |
2637 | userdbctl_sources, | |
2638 | include_directories : includes, | |
2639 | link_with : [libshared], | |
2640 | dependencies : [threads], | |
5fb22561 | 2641 | install_rpath : rootpkglibdir, |
003a6761 | 2642 | install : true) |
d093b62c LP |
2643 | endif |
2644 | ||
70a5db58 | 2645 | if conf.get('ENABLE_HOMED') == 1 |
6164ec4c ZJS |
2646 | executable( |
2647 | 'systemd-homework', | |
2648 | systemd_homework_sources, | |
2649 | include_directories : includes, | |
2650 | link_with : [libshared], | |
2651 | dependencies : [threads, | |
6164ec4c ZJS |
2652 | libblkid, |
2653 | libcrypt, | |
2654 | libopenssl, | |
2655 | libfdisk, | |
69cb2896 | 2656 | libp11kit], |
5fb22561 | 2657 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2658 | install : true, |
2659 | install_dir : rootlibexecdir) | |
2660 | ||
e3c68924 | 2661 | dbus_programs += executable( |
6164ec4c ZJS |
2662 | 'systemd-homed', |
2663 | systemd_homed_sources, | |
8d40961c | 2664 | include_directories : home_includes, |
6164ec4c ZJS |
2665 | link_with : [libshared], |
2666 | dependencies : [threads, | |
2667 | libcrypt, | |
d357b80d LP |
2668 | libopenssl, |
2669 | libm], | |
5fb22561 | 2670 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2671 | install : true, |
2672 | install_dir : rootlibexecdir) | |
2673 | ||
460e5af0 | 2674 | public_programs += executable( |
6164ec4c ZJS |
2675 | 'homectl', |
2676 | homectl_sources, | |
2677 | include_directories : includes, | |
2678 | link_with : [libshared], | |
2679 | dependencies : [threads, | |
2680 | libcrypt, | |
2681 | libopenssl, | |
2682 | libp11kit, | |
da3920c3 | 2683 | libdl], |
5fb22561 | 2684 | install_rpath : rootpkglibdir, |
003a6761 | 2685 | install : true) |
26cf9fb7 LP |
2686 | |
2687 | if conf.get('HAVE_PAM') == 1 | |
fce9abb2 | 2688 | version_script_arg = project_source_root / pam_systemd_home_sym |
a7127884 | 2689 | pam_systemd_home = shared_library( |
26cf9fb7 LP |
2690 | 'pam_systemd_home', |
2691 | pam_systemd_home_c, | |
2692 | name_prefix : '', | |
2693 | include_directories : includes, | |
2694 | link_args : ['-shared', | |
2695 | '-Wl,--version-script=' + version_script_arg], | |
2696 | link_with : [libsystemd_static, | |
2697 | libshared_static], | |
2698 | dependencies : [threads, | |
2699 | libpam, | |
2700 | libpam_misc, | |
2701 | libcrypt], | |
2702 | link_depends : pam_systemd_home_sym, | |
2703 | install : true, | |
48139c7c | 2704 | install_tag : 'pam', |
26cf9fb7 | 2705 | install_dir : pamlibdir) |
a7127884 YW |
2706 | |
2707 | if want_tests != 'false' | |
2708 | test('dlopen-pam_systemd_home', | |
2709 | test_dlopen, | |
2710 | # path to dlopen must include a slash | |
2711 | args : pam_systemd_home.full_path(), | |
2712 | depends : pam_systemd_home) | |
2713 | endif | |
26cf9fb7 | 2714 | endif |
70a5db58 LP |
2715 | endif |
2716 | ||
6589a569 | 2717 | foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] + |
ba081955 | 2718 | (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : [])) |
ba7f4ae6 | 2719 | meson.add_install_script(meson_make_symlink, |
fce9abb2 ZJS |
2720 | rootbindir / 'systemctl', |
2721 | rootsbindir / alias) | |
ba7f4ae6 ZJS |
2722 | endforeach |
2723 | ||
63e2d171 | 2724 | meson.add_install_script(meson_make_symlink, |
fce9abb2 ZJS |
2725 | rootbindir / 'udevadm', |
2726 | rootlibexecdir / 'systemd-udevd') | |
63e2d171 | 2727 | |
349cc4a5 | 2728 | if conf.get('ENABLE_BACKLIGHT') == 1 |
6164ec4c ZJS |
2729 | executable( |
2730 | 'systemd-backlight', | |
2731 | 'src/backlight/backlight.c', | |
2732 | include_directories : includes, | |
2733 | link_with : [libshared], | |
5fb22561 | 2734 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2735 | install : true, |
2736 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2737 | endif |
2738 | ||
349cc4a5 | 2739 | if conf.get('ENABLE_RFKILL') == 1 |
6164ec4c ZJS |
2740 | executable( |
2741 | 'systemd-rfkill', | |
2742 | 'src/rfkill/rfkill.c', | |
2743 | include_directories : includes, | |
2744 | link_with : [libshared], | |
5fb22561 | 2745 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2746 | install : true, |
2747 | install_dir : rootlibexecdir) | |
2748 | endif | |
2749 | ||
2750 | executable( | |
2751 | 'systemd-system-update-generator', | |
2752 | 'src/system-update-generator/system-update-generator.c', | |
2753 | include_directories : includes, | |
2754 | link_with : [libshared], | |
5fb22561 | 2755 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2756 | install : true, |
2757 | install_dir : systemgeneratordir) | |
5c23128d | 2758 | |
349cc4a5 | 2759 | if conf.get('HAVE_LIBCRYPTSETUP') == 1 |
6164ec4c ZJS |
2760 | executable( |
2761 | 'systemd-cryptsetup', | |
2762 | systemd_cryptsetup_sources, | |
2763 | include_directories : includes, | |
2764 | link_with : [libshared], | |
2765 | dependencies : [libcryptsetup, | |
2766 | libp11kit], | |
5fb22561 | 2767 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2768 | install : true, |
2769 | install_dir : rootlibexecdir) | |
2770 | ||
2771 | executable( | |
2772 | 'systemd-cryptsetup-generator', | |
2773 | 'src/cryptsetup/cryptsetup-generator.c', | |
2774 | include_directories : includes, | |
2775 | link_with : [libshared], | |
5fb22561 | 2776 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2777 | install : true, |
2778 | install_dir : systemgeneratordir) | |
2779 | ||
2780 | executable( | |
2781 | 'systemd-veritysetup', | |
2782 | 'src/veritysetup/veritysetup.c', | |
2783 | include_directories : includes, | |
2784 | link_with : [libshared], | |
2785 | dependencies : [libcryptsetup], | |
5fb22561 | 2786 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2787 | install : true, |
2788 | install_dir : rootlibexecdir) | |
2789 | ||
2790 | executable( | |
2791 | 'systemd-veritysetup-generator', | |
2792 | 'src/veritysetup/veritysetup-generator.c', | |
2793 | include_directories : includes, | |
2794 | link_with : [libshared], | |
5fb22561 | 2795 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2796 | install : true, |
2797 | install_dir : systemgeneratordir) | |
8710a681 | 2798 | |
3761002e | 2799 | public_programs += executable( |
8710a681 LP |
2800 | 'systemd-cryptenroll', |
2801 | systemd_cryptenroll_sources, | |
2802 | include_directories : includes, | |
2803 | link_with : [libshared], | |
2804 | dependencies : [libcryptsetup, | |
5e521624 | 2805 | libdl, |
8710a681 LP |
2806 | libopenssl, |
2807 | libp11kit], | |
5fb22561 | 2808 | install_rpath : rootpkglibdir, |
a1fd722b | 2809 | install : true) |
1f1a2243 TA |
2810 | |
2811 | executable( | |
2812 | 'systemd-integritysetup', | |
2813 | ['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'], | |
2814 | include_directories : includes, | |
2815 | link_with : [libshared], | |
2816 | dependencies : [libcryptsetup], | |
5fb22561 | 2817 | install_rpath : rootpkglibdir, |
1f1a2243 TA |
2818 | install : true, |
2819 | install_dir : rootlibexecdir) | |
2820 | ||
2821 | executable( | |
2822 | 'systemd-integritysetup-generator', | |
2823 | ['src/integritysetup/integritysetup-generator.c', 'src/integritysetup/integrity-util.c'], | |
2824 | include_directories : includes, | |
2825 | link_with : [libshared], | |
5fb22561 | 2826 | install_rpath : rootpkglibdir, |
1f1a2243 TA |
2827 | install : true, |
2828 | install_dir : systemgeneratordir) | |
5c23128d ZJS |
2829 | endif |
2830 | ||
349cc4a5 | 2831 | if conf.get('HAVE_SYSV_COMPAT') == 1 |
e93ada98 | 2832 | exe = executable( |
6164ec4c ZJS |
2833 | 'systemd-sysv-generator', |
2834 | 'src/sysv-generator/sysv-generator.c', | |
2835 | include_directories : includes, | |
2836 | link_with : [libshared], | |
5fb22561 | 2837 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2838 | install : true, |
2839 | install_dir : systemgeneratordir) | |
2840 | ||
e93ada98 DDM |
2841 | sysv_generator_test_py = find_program('test/sysv-generator-test.py') |
2842 | if want_tests != 'false' | |
2843 | test('sysv-generator-test', | |
2844 | sysv_generator_test_py, | |
2845 | depends : exe) | |
2846 | endif | |
2847 | ||
6164ec4c ZJS |
2848 | executable( |
2849 | 'systemd-rc-local-generator', | |
2850 | 'src/rc-local-generator/rc-local-generator.c', | |
2851 | include_directories : includes, | |
2852 | link_with : [libshared], | |
5fb22561 | 2853 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2854 | install : true, |
2855 | install_dir : systemgeneratordir) | |
5c23128d ZJS |
2856 | endif |
2857 | ||
8feca247 BB |
2858 | if conf.get('ENABLE_XDG_AUTOSTART') == 1 |
2859 | executable( | |
2860 | 'systemd-xdg-autostart-generator', | |
0275e918 | 2861 | systemd_xdg_autostart_generator_sources, |
8feca247 BB |
2862 | include_directories : includes, |
2863 | link_with : [libshared], | |
5fb22561 | 2864 | install_rpath : rootpkglibdir, |
8feca247 BB |
2865 | install : true, |
2866 | install_dir : usergeneratordir) | |
2867 | ||
2868 | executable( | |
2869 | 'systemd-xdg-autostart-condition', | |
2870 | 'src/xdg-autostart-generator/xdg-autostart-condition.c', | |
2871 | include_directories : includes, | |
2872 | link_with : [libshared], | |
5fb22561 | 2873 | install_rpath : rootpkglibdir, |
8feca247 BB |
2874 | install : true, |
2875 | install_dir : rootlibexecdir) | |
2876 | endif | |
2877 | ||
349cc4a5 | 2878 | if conf.get('ENABLE_HOSTNAMED') == 1 |
e3c68924 | 2879 | dbus_programs += executable( |
6164ec4c ZJS |
2880 | 'systemd-hostnamed', |
2881 | 'src/hostname/hostnamed.c', | |
2882 | include_directories : includes, | |
2883 | link_with : [libshared], | |
5fb22561 | 2884 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2885 | install : true, |
2886 | install_dir : rootlibexecdir) | |
2887 | ||
2888 | public_programs += executable( | |
2889 | 'hostnamectl', | |
2890 | 'src/hostname/hostnamectl.c', | |
2891 | include_directories : includes, | |
2892 | link_with : [libshared], | |
5fb22561 | 2893 | install_rpath : rootpkglibdir, |
6164ec4c | 2894 | install : true) |
5c23128d ZJS |
2895 | endif |
2896 | ||
349cc4a5 ZJS |
2897 | if conf.get('ENABLE_LOCALED') == 1 |
2898 | if conf.get('HAVE_XKBCOMMON') == 1 | |
bfa0ade9 AK |
2899 | # logind will load libxkbcommon.so dynamically on its own, but we still |
2900 | # need to specify where the headers are | |
2901 | deps = [libdl, libxkbcommon.partial_dependency(compile_args: true)] | |
37efbbd8 ZJS |
2902 | else |
2903 | deps = [] | |
2904 | endif | |
2905 | ||
e3c68924 | 2906 | dbus_programs += executable( |
6164ec4c ZJS |
2907 | 'systemd-localed', |
2908 | systemd_localed_sources, | |
bfa0ade9 | 2909 | include_directories : includes, |
6164ec4c ZJS |
2910 | link_with : [libshared], |
2911 | dependencies : deps, | |
5fb22561 | 2912 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2913 | install : true, |
2914 | install_dir : rootlibexecdir) | |
2915 | ||
2916 | public_programs += executable( | |
2917 | 'localectl', | |
2918 | localectl_sources, | |
2919 | include_directories : includes, | |
2920 | link_with : [libshared], | |
5fb22561 | 2921 | install_rpath : rootpkglibdir, |
6164ec4c | 2922 | install : true) |
5c23128d ZJS |
2923 | endif |
2924 | ||
349cc4a5 | 2925 | if conf.get('ENABLE_TIMEDATED') == 1 |
e3c68924 | 2926 | dbus_programs += executable( |
6164ec4c ZJS |
2927 | 'systemd-timedated', |
2928 | 'src/timedate/timedated.c', | |
2929 | include_directories : includes, | |
2930 | link_with : [libshared], | |
5fb22561 | 2931 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2932 | install : true, |
2933 | install_dir : rootlibexecdir) | |
6129ec85 | 2934 | endif |
5c23128d | 2935 | |
6129ec85 | 2936 | if conf.get('ENABLE_TIMEDATECTL') == 1 |
6164ec4c ZJS |
2937 | public_programs += executable( |
2938 | 'timedatectl', | |
2939 | 'src/timedate/timedatectl.c', | |
2940 | include_directories : includes, | |
5fb22561 | 2941 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2942 | link_with : [libshared], |
2943 | dependencies : [libm], | |
2944 | install : true) | |
5c23128d ZJS |
2945 | endif |
2946 | ||
349cc4a5 | 2947 | if conf.get('ENABLE_TIMESYNCD') == 1 |
6164ec4c ZJS |
2948 | executable( |
2949 | 'systemd-timesyncd', | |
2950 | systemd_timesyncd_sources, | |
2951 | include_directories : includes, | |
f5a5284e | 2952 | link_with : [libtimesyncd_core], |
6164ec4c ZJS |
2953 | dependencies : [threads, |
2954 | libm], | |
5fb22561 | 2955 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2956 | install : true, |
2957 | install_dir : rootlibexecdir) | |
2958 | ||
2959 | executable( | |
2960 | 'systemd-time-wait-sync', | |
cf242350 | 2961 | 'src/timesync/wait-sync.c', |
6164ec4c | 2962 | include_directories : includes, |
f5a5284e | 2963 | link_with : [libtimesyncd_core], |
5fb22561 | 2964 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2965 | install : true, |
2966 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2967 | endif |
2968 | ||
349cc4a5 | 2969 | if conf.get('ENABLE_MACHINED') == 1 |
e3c68924 | 2970 | dbus_programs += executable( |
6164ec4c ZJS |
2971 | 'systemd-machined', |
2972 | systemd_machined_sources, | |
2973 | include_directories : includes, | |
2974 | link_with : [libmachine_core, | |
2975 | libshared], | |
5fb22561 | 2976 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2977 | install : true, |
2978 | install_dir : rootlibexecdir) | |
2979 | ||
2980 | public_programs += executable( | |
2981 | 'machinectl', | |
2982 | 'src/machine/machinectl.c', | |
2983 | include_directories : includes, | |
2984 | link_with : [libshared], | |
2985 | dependencies : [threads, | |
2986 | libxz, | |
ef5924aa NL |
2987 | liblz4, |
2988 | libzstd], | |
5fb22561 | 2989 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
2990 | install : true, |
2991 | install_dir : rootbindir) | |
5c23128d ZJS |
2992 | endif |
2993 | ||
349cc4a5 | 2994 | if conf.get('ENABLE_IMPORTD') == 1 |
e3c68924 | 2995 | dbus_programs += executable( |
6164ec4c ZJS |
2996 | 'systemd-importd', |
2997 | systemd_importd_sources, | |
2998 | include_directories : includes, | |
2999 | link_with : [libshared], | |
3000 | dependencies : [threads], | |
5fb22561 | 3001 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3002 | install : true, |
3003 | install_dir : rootlibexecdir) | |
3004 | ||
3005 | systemd_pull = executable( | |
3006 | 'systemd-pull', | |
3007 | systemd_pull_sources, | |
3008 | include_directories : includes, | |
b93f018f ZJS |
3009 | link_with : [libshared, |
3010 | lib_import_common], | |
6164ec4c ZJS |
3011 | dependencies : [versiondep, |
3012 | libcurl, | |
6214d42b | 3013 | lib_openssl_or_gcrypt, |
6164ec4c ZJS |
3014 | libz, |
3015 | libbzip2, | |
6214d42b | 3016 | libxz], |
5fb22561 | 3017 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3018 | install : true, |
3019 | install_dir : rootlibexecdir) | |
3020 | ||
3021 | systemd_import = executable( | |
3022 | 'systemd-import', | |
3023 | systemd_import_sources, | |
3024 | include_directories : includes, | |
b93f018f ZJS |
3025 | link_with : [libshared, |
3026 | lib_import_common], | |
6164ec4c ZJS |
3027 | dependencies : [libcurl, |
3028 | libz, | |
3029 | libbzip2, | |
3030 | libxz], | |
5fb22561 | 3031 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3032 | install : true, |
3033 | install_dir : rootlibexecdir) | |
3034 | ||
3035 | systemd_import_fs = executable( | |
3036 | 'systemd-import-fs', | |
3037 | systemd_import_fs_sources, | |
3038 | include_directories : includes, | |
b93f018f ZJS |
3039 | link_with : [libshared, |
3040 | lib_import_common], | |
5fb22561 | 3041 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3042 | install : true, |
3043 | install_dir : rootlibexecdir) | |
3044 | ||
3045 | systemd_export = executable( | |
3046 | 'systemd-export', | |
3047 | systemd_export_sources, | |
3048 | include_directories : includes, | |
b93f018f ZJS |
3049 | link_with : [libshared, |
3050 | lib_import_common], | |
6164ec4c ZJS |
3051 | dependencies : [libcurl, |
3052 | libz, | |
3053 | libbzip2, | |
3054 | libxz], | |
5fb22561 | 3055 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3056 | install : true, |
3057 | install_dir : rootlibexecdir) | |
1d7579c4 LP |
3058 | |
3059 | public_programs += [systemd_pull, systemd_import, systemd_import_fs, systemd_export] | |
37efbbd8 ZJS |
3060 | endif |
3061 | ||
349cc4a5 | 3062 | if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1 |
6164ec4c ZJS |
3063 | public_programs += executable( |
3064 | 'systemd-journal-upload', | |
3065 | systemd_journal_upload_sources, | |
3066 | include_directories : includes, | |
3067 | link_with : [libshared], | |
3068 | dependencies : [versiondep, | |
3069 | threads, | |
3070 | libcurl, | |
3071 | libgnutls, | |
3072 | libxz, | |
ef5924aa NL |
3073 | liblz4, |
3074 | libzstd], | |
5fb22561 | 3075 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3076 | install : true, |
3077 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
3078 | endif |
3079 | ||
349cc4a5 | 3080 | if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 |
6164ec4c ZJS |
3081 | public_programs += executable( |
3082 | 'systemd-journal-remote', | |
3083 | systemd_journal_remote_sources, | |
035b0f8f | 3084 | include_directories : journal_includes, |
6164ec4c ZJS |
3085 | link_with : [libshared, |
3086 | libsystemd_journal_remote], | |
3087 | dependencies : [threads, | |
3088 | libmicrohttpd, | |
3089 | libgnutls, | |
3090 | libxz, | |
ef5924aa NL |
3091 | liblz4, |
3092 | libzstd], | |
5fb22561 | 3093 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3094 | install : true, |
3095 | install_dir : rootlibexecdir) | |
3096 | ||
3097 | public_programs += executable( | |
3098 | 'systemd-journal-gatewayd', | |
3099 | systemd_journal_gatewayd_sources, | |
035b0f8f | 3100 | include_directories : journal_includes, |
6164ec4c ZJS |
3101 | link_with : [libshared], |
3102 | dependencies : [threads, | |
3103 | libmicrohttpd, | |
3104 | libgnutls, | |
3105 | libxz, | |
ef5924aa NL |
3106 | liblz4, |
3107 | libzstd], | |
5fb22561 | 3108 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3109 | install : true, |
3110 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
3111 | endif |
3112 | ||
349cc4a5 | 3113 | if conf.get('ENABLE_COREDUMP') == 1 |
6164ec4c ZJS |
3114 | executable( |
3115 | 'systemd-coredump', | |
3116 | systemd_coredump_sources, | |
3117 | include_directories : includes, | |
acc50c92 LP |
3118 | link_with : [libshared, |
3119 | libbasic_compress], | |
6164ec4c ZJS |
3120 | dependencies : [threads, |
3121 | libacl, | |
6164ec4c | 3122 | libxz, |
ef5924aa NL |
3123 | liblz4, |
3124 | libzstd], | |
5fb22561 | 3125 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3126 | install : true, |
3127 | install_dir : rootlibexecdir) | |
3128 | ||
3129 | public_programs += executable( | |
3130 | 'coredumpctl', | |
3131 | coredumpctl_sources, | |
3132 | include_directories : includes, | |
acc50c92 LP |
3133 | link_with : [libshared, |
3134 | libbasic_compress], | |
6164ec4c ZJS |
3135 | dependencies : [threads, |
3136 | libxz, | |
ef5924aa NL |
3137 | liblz4, |
3138 | libzstd], | |
5fb22561 | 3139 | install_rpath : rootpkglibdir, |
6164ec4c | 3140 | install : true) |
5c23128d ZJS |
3141 | endif |
3142 | ||
9b4abc69 | 3143 | if conf.get('ENABLE_PSTORE') == 1 |
6164ec4c ZJS |
3144 | executable( |
3145 | 'systemd-pstore', | |
3146 | systemd_pstore_sources, | |
3147 | include_directories : includes, | |
3148 | link_with : [libshared], | |
3149 | dependencies : [threads, | |
3150 | libacl, | |
6164ec4c | 3151 | libxz, |
ef5924aa NL |
3152 | liblz4, |
3153 | libzstd], | |
5fb22561 | 3154 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3155 | install : true, |
3156 | install_dir : rootlibexecdir) | |
9b4abc69 ED |
3157 | endif |
3158 | ||
9de5e321 | 3159 | if conf.get('ENABLE_OOMD') == 1 |
e3c68924 | 3160 | dbus_programs += executable('systemd-oomd', |
9de5e321 AZ |
3161 | systemd_oomd_sources, |
3162 | include_directories : includes, | |
3163 | link_with : [libshared], | |
3164 | dependencies : [], | |
5fb22561 | 3165 | install_rpath : rootpkglibdir, |
9de5e321 AZ |
3166 | install : true, |
3167 | install_dir : rootlibexecdir) | |
5c616ecf AZ |
3168 | |
3169 | public_programs += executable( | |
ba081955 ZJS |
3170 | 'oomctl', |
3171 | oomctl_sources, | |
3172 | include_directories : includes, | |
3173 | link_with : [libshared], | |
3174 | dependencies : [], | |
5fb22561 | 3175 | install_rpath : rootpkglibdir, |
cfd4c84a | 3176 | install : true) |
9de5e321 AZ |
3177 | endif |
3178 | ||
349cc4a5 | 3179 | if conf.get('ENABLE_BINFMT') == 1 |
6164ec4c ZJS |
3180 | public_programs += executable( |
3181 | 'systemd-binfmt', | |
3182 | 'src/binfmt/binfmt.c', | |
3183 | include_directories : includes, | |
3184 | link_with : [libshared], | |
5fb22561 | 3185 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3186 | install : true, |
3187 | install_dir : rootlibexecdir) | |
37efbbd8 | 3188 | |
7c22f07c ZJS |
3189 | meson.add_install_script('sh', '-c', |
3190 | mkdir_p.format(binfmtdir)) | |
d7aa78c3 | 3191 | if install_sysconfdir |
7c22f07c | 3192 | meson.add_install_script('sh', '-c', |
fce9abb2 | 3193 | mkdir_p.format(sysconfdir / 'binfmt.d')) |
d7aa78c3 | 3194 | endif |
37efbbd8 ZJS |
3195 | endif |
3196 | ||
43cc7a3e LP |
3197 | if conf.get('ENABLE_SYSUPDATE') == 1 |
3198 | exe = executable( | |
3199 | 'systemd-sysupdate', | |
3200 | systemd_sysupdate_sources, | |
3201 | include_directories : includes, | |
3202 | link_with : [libshared], | |
3203 | dependencies : [threads, | |
3204 | libblkid, | |
3205 | libfdisk, | |
3206 | libopenssl], | |
5fb22561 | 3207 | install_rpath : rootpkglibdir, |
43cc7a3e LP |
3208 | install : true, |
3209 | install_dir : rootlibexecdir) | |
3210 | public_programs += exe | |
3211 | endif | |
3212 | ||
349cc4a5 | 3213 | if conf.get('ENABLE_VCONSOLE') == 1 |
6164ec4c ZJS |
3214 | executable( |
3215 | 'systemd-vconsole-setup', | |
3216 | 'src/vconsole/vconsole-setup.c', | |
3217 | include_directories : includes, | |
3218 | link_with : [libshared], | |
5fb22561 | 3219 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3220 | install : true, |
3221 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
3222 | endif |
3223 | ||
349cc4a5 | 3224 | if conf.get('ENABLE_RANDOMSEED') == 1 |
6164ec4c ZJS |
3225 | executable( |
3226 | 'systemd-random-seed', | |
3227 | 'src/random-seed/random-seed.c', | |
3228 | include_directories : includes, | |
3229 | link_with : [libshared], | |
5fb22561 | 3230 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3231 | install : true, |
3232 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
3233 | endif |
3234 | ||
349cc4a5 | 3235 | if conf.get('ENABLE_FIRSTBOOT') == 1 |
3761002e | 3236 | public_programs += executable( |
6164ec4c ZJS |
3237 | 'systemd-firstboot', |
3238 | 'src/firstboot/firstboot.c', | |
3239 | include_directories : includes, | |
3240 | link_with : [libshared], | |
3241 | dependencies : [libcrypt], | |
5fb22561 | 3242 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3243 | install : true, |
3244 | install_dir : rootbindir) | |
3245 | endif | |
3246 | ||
3247 | executable( | |
3248 | 'systemd-remount-fs', | |
3249 | 'src/remount-fs/remount-fs.c', | |
3250 | include_directories : includes, | |
bac11cd6 | 3251 | link_with : [libshared], |
5fb22561 | 3252 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3253 | install : true, |
3254 | install_dir : rootlibexecdir) | |
5c23128d | 3255 | |
6164ec4c ZJS |
3256 | executable( |
3257 | 'systemd-machine-id-setup', | |
3258 | 'src/machine-id-setup/machine-id-setup-main.c', | |
3259 | include_directories : includes, | |
bac11cd6 | 3260 | link_with : [libshared], |
5fb22561 | 3261 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3262 | install : true, |
3263 | install_dir : rootbindir) | |
5c23128d | 3264 | |
6164ec4c ZJS |
3265 | executable( |
3266 | 'systemd-fsck', | |
3267 | 'src/fsck/fsck.c', | |
3268 | include_directories : includes, | |
3269 | link_with : [libshared], | |
5fb22561 | 3270 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3271 | install : true, |
3272 | install_dir : rootlibexecdir) | |
5c23128d | 3273 | |
80750adb ZJS |
3274 | executable('systemd-growfs', |
3275 | 'src/partition/growfs.c', | |
3276 | include_directories : includes, | |
3277 | link_with : [libshared], | |
5fb22561 | 3278 | install_rpath : rootpkglibdir, |
80750adb ZJS |
3279 | install : true, |
3280 | install_dir : rootlibexecdir) | |
3281 | ||
6164ec4c ZJS |
3282 | executable( |
3283 | 'systemd-makefs', | |
3284 | 'src/partition/makefs.c', | |
3285 | include_directories : includes, | |
3286 | link_with : [libshared], | |
5fb22561 | 3287 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3288 | install : true, |
3289 | install_dir : rootlibexecdir) | |
b7f28ac5 | 3290 | |
6164ec4c ZJS |
3291 | executable( |
3292 | 'systemd-sleep', | |
3293 | 'src/sleep/sleep.c', | |
3294 | include_directories : includes, | |
3295 | link_with : [libshared], | |
5fb22561 | 3296 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3297 | install : true, |
3298 | install_dir : rootlibexecdir) | |
5c23128d | 3299 | |
225d08b8 | 3300 | if install_sysconfdir_samples |
d7aa78c3 JT |
3301 | install_data('src/sleep/sleep.conf', |
3302 | install_dir : pkgsysconfdir) | |
3303 | endif | |
d25e127d | 3304 | |
6164ec4c ZJS |
3305 | public_programs += executable( |
3306 | 'systemd-sysctl', | |
3307 | 'src/sysctl/sysctl.c', | |
3308 | include_directories : includes, | |
3309 | link_with : [libshared], | |
5fb22561 | 3310 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3311 | install : true, |
3312 | install_dir : rootlibexecdir) | |
5c23128d | 3313 | |
6164ec4c ZJS |
3314 | executable( |
3315 | 'systemd-ac-power', | |
3316 | 'src/ac-power/ac-power.c', | |
3317 | include_directories : includes, | |
3318 | link_with : [libshared], | |
5fb22561 | 3319 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3320 | install : true, |
3321 | install_dir : rootlibexecdir) | |
5c23128d | 3322 | |
6164ec4c ZJS |
3323 | public_programs += executable( |
3324 | 'systemd-detect-virt', | |
3325 | 'src/detect-virt/detect-virt.c', | |
3326 | include_directories : includes, | |
3327 | link_with : [libshared], | |
5fb22561 | 3328 | install_rpath : rootpkglibdir, |
6164ec4c | 3329 | install : true) |
5c23128d | 3330 | |
6164ec4c ZJS |
3331 | public_programs += executable( |
3332 | 'systemd-delta', | |
3333 | 'src/delta/delta.c', | |
3334 | include_directories : includes, | |
3335 | link_with : [libshared], | |
5fb22561 | 3336 | install_rpath : rootpkglibdir, |
6164ec4c | 3337 | install : true) |
5c23128d | 3338 | |
6164ec4c ZJS |
3339 | public_programs += executable( |
3340 | 'systemd-escape', | |
3341 | 'src/escape/escape.c', | |
3342 | include_directories : includes, | |
3343 | link_with : [libshared], | |
5fb22561 | 3344 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3345 | install : true, |
3346 | install_dir : rootbindir) | |
3347 | ||
3348 | public_programs += executable( | |
3349 | 'systemd-notify', | |
3350 | 'src/notify/notify.c', | |
3351 | include_directories : includes, | |
3352 | link_with : [libshared], | |
5fb22561 | 3353 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3354 | install : true, |
3355 | install_dir : rootbindir) | |
3356 | ||
5945640e LP |
3357 | public_programs += executable( |
3358 | 'systemd-creds', | |
3359 | 'src/creds/creds.c', | |
3360 | include_directories : includes, | |
3361 | link_with : [libshared], | |
3362 | dependencies : [threads, | |
3363 | libopenssl], | |
5fb22561 | 3364 | install_rpath : rootpkglibdir, |
5945640e LP |
3365 | install : true, |
3366 | install_dir : rootbindir) | |
3367 | ||
6164ec4c ZJS |
3368 | executable( |
3369 | 'systemd-volatile-root', | |
3370 | 'src/volatile-root/volatile-root.c', | |
3371 | include_directories : includes, | |
3372 | link_with : [libshared], | |
5fb22561 | 3373 | install_rpath : rootpkglibdir, |
cdf7ad38 | 3374 | install : conf.get('ENABLE_INITRD') == 1, |
6164ec4c ZJS |
3375 | install_dir : rootlibexecdir) |
3376 | ||
3377 | executable( | |
3378 | 'systemd-cgroups-agent', | |
3379 | 'src/cgroups-agent/cgroups-agent.c', | |
3380 | include_directories : includes, | |
3381 | link_with : [libshared], | |
5fb22561 | 3382 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3383 | install : true, |
3384 | install_dir : rootlibexecdir) | |
3385 | ||
2a2d002f | 3386 | systemd_id128 = executable( |
6164ec4c ZJS |
3387 | 'systemd-id128', |
3388 | 'src/id128/id128.c', | |
3389 | include_directories : includes, | |
3390 | link_with : [libshared], | |
5fb22561 | 3391 | install_rpath : rootpkglibdir, |
6164ec4c | 3392 | install : true) |
2a2d002f ZJS |
3393 | public_programs += systemd_id128 |
3394 | ||
3395 | if want_tests != 'false' | |
3396 | test('test-systemctl-enable', | |
3397 | test_systemctl_enable_sh, | |
3398 | # https://github.com/mesonbuild/meson/issues/2681 | |
3399 | args : [systemctl.full_path(), | |
3400 | systemd_id128.full_path()]) | |
3401 | endif | |
6164ec4c ZJS |
3402 | |
3403 | public_programs += executable( | |
3404 | 'systemd-path', | |
3405 | 'src/path/path.c', | |
3406 | include_directories : includes, | |
3407 | link_with : [libshared], | |
5fb22561 | 3408 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3409 | install : true) |
3410 | ||
3411 | public_programs += executable( | |
3412 | 'systemd-ask-password', | |
3413 | 'src/ask-password/ask-password.c', | |
3414 | include_directories : includes, | |
3415 | link_with : [libshared], | |
5fb22561 | 3416 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3417 | install : true, |
3418 | install_dir : rootbindir) | |
3419 | ||
3420 | executable( | |
3421 | 'systemd-reply-password', | |
3422 | 'src/reply-password/reply-password.c', | |
3423 | include_directories : includes, | |
3424 | link_with : [libshared], | |
5fb22561 | 3425 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3426 | install : true, |
3427 | install_dir : rootlibexecdir) | |
3428 | ||
3429 | public_programs += executable( | |
3430 | 'systemd-tty-ask-password-agent', | |
3431 | 'src/tty-ask-password-agent/tty-ask-password-agent.c', | |
3432 | include_directories : includes, | |
3433 | link_with : [libshared], | |
5fb22561 | 3434 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3435 | install : true, |
3436 | install_dir : rootbindir) | |
3437 | ||
3438 | public_programs += executable( | |
3439 | 'systemd-cgls', | |
3440 | 'src/cgls/cgls.c', | |
3441 | include_directories : includes, | |
3442 | link_with : [libshared], | |
5fb22561 | 3443 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3444 | install : true) |
3445 | ||
3446 | public_programs += executable( | |
3447 | 'systemd-cgtop', | |
3448 | 'src/cgtop/cgtop.c', | |
3449 | include_directories : includes, | |
3450 | link_with : [libshared], | |
5fb22561 | 3451 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3452 | install : true) |
3453 | ||
3454 | executable( | |
3455 | 'systemd-initctl', | |
3456 | 'src/initctl/initctl.c', | |
3457 | include_directories : includes, | |
3458 | link_with : [libshared], | |
5fb22561 | 3459 | install_rpath : rootpkglibdir, |
6589a569 | 3460 | install : (conf.get('HAVE_SYSV_COMPAT') == 1), |
6164ec4c | 3461 | install_dir : rootlibexecdir) |
5c23128d | 3462 | |
6164ec4c ZJS |
3463 | public_programs += executable( |
3464 | 'systemd-mount', | |
3465 | 'src/mount/mount-tool.c', | |
3466 | include_directories : includes, | |
3467 | link_with : [libshared], | |
3468 | dependencies: [libmount], | |
5fb22561 | 3469 | install_rpath : rootpkglibdir, |
6164ec4c | 3470 | install : true) |
5c23128d | 3471 | |
7b76fce1 | 3472 | meson.add_install_script(meson_make_symlink, |
fce9abb2 | 3473 | 'systemd-mount', bindir / 'systemd-umount') |
7b76fce1 | 3474 | |
6164ec4c ZJS |
3475 | public_programs += executable( |
3476 | 'systemd-run', | |
3477 | 'src/run/run.c', | |
3478 | include_directories : includes, | |
3479 | link_with : [libshared], | |
5fb22561 | 3480 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3481 | install : true) |
3482 | ||
3483 | public_programs += executable( | |
3484 | 'systemd-stdio-bridge', | |
3485 | 'src/stdio-bridge/stdio-bridge.c', | |
3486 | include_directories : includes, | |
3487 | link_with : [libshared], | |
3488 | dependencies : [versiondep], | |
5fb22561 | 3489 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3490 | install : true) |
3491 | ||
3492 | public_programs += executable( | |
3493 | 'busctl', | |
f98df767 | 3494 | busctl_sources, |
6164ec4c ZJS |
3495 | include_directories : includes, |
3496 | link_with : [libshared], | |
7c4bd9ac | 3497 | dependencies : [versiondep], |
5fb22561 | 3498 | install_rpath : rootpkglibdir, |
6164ec4c | 3499 | install : true) |
5c23128d | 3500 | |
bd7e6aa7 ZJS |
3501 | if enable_sysusers |
3502 | exe = executable( | |
6164ec4c ZJS |
3503 | 'systemd-sysusers', |
3504 | 'src/sysusers/sysusers.c', | |
3505 | include_directories : includes, | |
3506 | link_with : [libshared], | |
5fb22561 | 3507 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3508 | install : true, |
3509 | install_dir : rootbindir) | |
bd7e6aa7 ZJS |
3510 | public_programs += exe |
3511 | ||
3512 | if want_tests != 'false' | |
3513 | test('test-sysusers', | |
3514 | test_sysusers_sh, | |
3515 | # https://github.com/mesonbuild/meson/issues/2681 | |
3516 | args : exe.full_path()) | |
3517 | endif | |
8ef8f3d5 FB |
3518 | |
3519 | if have_standalone_binaries | |
bd7e6aa7 | 3520 | exe = executable( |
8ef8f3d5 FB |
3521 | 'systemd-sysusers.standalone', |
3522 | 'src/sysusers/sysusers.c', | |
3523 | include_directories : includes, | |
3537577c | 3524 | c_args : '-DSTANDALONE', |
8ef8f3d5 FB |
3525 | link_with : [libshared_static, |
3526 | libbasic, | |
3527 | libbasic_gcrypt, | |
99b9f8fd | 3528 | libsystemd_static], |
8ef8f3d5 FB |
3529 | install : true, |
3530 | install_dir : rootbindir) | |
bd7e6aa7 ZJS |
3531 | public_programs += exe |
3532 | ||
3533 | if want_tests != 'false' | |
3534 | test('test-sysusers.standalone', | |
3535 | test_sysusers_sh, | |
3536 | # https://github.com/mesonbuild/meson/issues/2681 | |
3537 | args : exe.full_path()) | |
3538 | endif | |
8ef8f3d5 | 3539 | endif |
5c23128d ZJS |
3540 | endif |
3541 | ||
349cc4a5 | 3542 | if conf.get('ENABLE_TMPFILES') == 1 |
6164ec4c ZJS |
3543 | exe = executable( |
3544 | 'systemd-tmpfiles', | |
db64ba81 | 3545 | systemd_tmpfiles_sources, |
6164ec4c ZJS |
3546 | include_directories : includes, |
3547 | link_with : [libshared], | |
3548 | dependencies : [libacl], | |
5fb22561 | 3549 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3550 | install : true, |
3551 | install_dir : rootbindir) | |
5a8b1640 | 3552 | public_programs += exe |
d9daae55 | 3553 | |
938be089 ZJS |
3554 | if want_tests != 'false' |
3555 | test('test-systemd-tmpfiles', | |
3556 | test_systemd_tmpfiles_py, | |
3557 | # https://github.com/mesonbuild/meson/issues/2681 | |
3558 | args : exe.full_path()) | |
3559 | endif | |
db64ba81 FB |
3560 | |
3561 | if have_standalone_binaries | |
bf93f24a | 3562 | exe = executable( |
db64ba81 FB |
3563 | 'systemd-tmpfiles.standalone', |
3564 | systemd_tmpfiles_sources, | |
3565 | include_directories : includes, | |
3537577c | 3566 | c_args : '-DSTANDALONE', |
db64ba81 FB |
3567 | link_with : [libshared_static, |
3568 | libbasic, | |
3569 | libbasic_gcrypt, | |
99b9f8fd | 3570 | libsystemd_static], |
db64ba81 FB |
3571 | dependencies : [libacl], |
3572 | install : true, | |
3573 | install_dir : rootbindir) | |
bf93f24a MG |
3574 | public_programs += exe |
3575 | ||
3576 | if want_tests != 'false' | |
3577 | test('test-systemd-tmpfiles.standalone', | |
3578 | test_systemd_tmpfiles_py, | |
3579 | # https://github.com/mesonbuild/meson/issues/2681 | |
3580 | args : exe.full_path()) | |
3581 | endif | |
db64ba81 | 3582 | endif |
5c23128d ZJS |
3583 | endif |
3584 | ||
349cc4a5 | 3585 | if conf.get('ENABLE_HWDB') == 1 |
ecd1bfdd | 3586 | systemd_hwdb = executable( |
6164ec4c ZJS |
3587 | 'systemd-hwdb', |
3588 | 'src/hwdb/hwdb.c', | |
6164ec4c | 3589 | include_directories : includes, |
e4b127e2 | 3590 | link_with : udev_link_with, |
6164ec4c ZJS |
3591 | install_rpath : udev_rpath, |
3592 | install : true, | |
3593 | install_dir : rootbindir) | |
ecd1bfdd ZJS |
3594 | public_programs += systemd_hwdb |
3595 | ||
3596 | if want_tests != 'false' | |
3597 | test('hwdb-test', | |
3598 | hwdb_test_sh, | |
14056a52 | 3599 | suite : 'dist-check', |
ecd1bfdd ZJS |
3600 | args : [systemd_hwdb.full_path()], |
3601 | timeout : 90) | |
3602 | endif | |
37efbbd8 ZJS |
3603 | endif |
3604 | ||
349cc4a5 | 3605 | if conf.get('ENABLE_QUOTACHECK') == 1 |
6164ec4c ZJS |
3606 | executable( |
3607 | 'systemd-quotacheck', | |
3608 | 'src/quotacheck/quotacheck.c', | |
3609 | include_directories : includes, | |
3610 | link_with : [libshared], | |
5fb22561 | 3611 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3612 | install : true, |
3613 | install_dir : rootlibexecdir) | |
3614 | endif | |
3615 | ||
3616 | public_programs += executable( | |
3617 | 'systemd-socket-proxyd', | |
3618 | 'src/socket-proxy/socket-proxyd.c', | |
3619 | include_directories : includes, | |
3620 | link_with : [libshared], | |
3621 | dependencies : [threads], | |
5fb22561 | 3622 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3623 | install : true, |
3624 | install_dir : rootlibexecdir) | |
5c23128d | 3625 | |
9b264c1d | 3626 | udevadm = executable( |
6164ec4c ZJS |
3627 | 'udevadm', |
3628 | udevadm_sources, | |
6164ec4c | 3629 | include_directories : includes, |
e4b127e2 | 3630 | link_with : [libudevd_core], |
6164ec4c ZJS |
3631 | dependencies : [versiondep, |
3632 | threads, | |
3633 | libkmod, | |
3634 | libidn, | |
3635 | libacl, | |
3636 | libblkid], | |
3637 | install_rpath : udev_rpath, | |
3638 | install : true, | |
3639 | install_dir : rootbindir) | |
9b264c1d FS |
3640 | public_programs += udevadm |
3641 | ||
3642 | if conf.get('ENABLE_REPART') == 1 | |
3643 | exe = executable( | |
3644 | 'systemd-repart', | |
3645 | systemd_repart_sources, | |
3646 | include_directories : includes, | |
3647 | link_with : [libshared], | |
3648 | dependencies : [threads, | |
3649 | libblkid, | |
3650 | libfdisk], | |
5fb22561 | 3651 | install_rpath : rootpkglibdir, |
9b264c1d FS |
3652 | install : true, |
3653 | install_dir : rootbindir) | |
3654 | public_programs += exe | |
3655 | ||
3656 | if want_tests != 'false' | |
3657 | test('test-repart', | |
3658 | test_repart_sh, | |
3659 | args : [exe.full_path(), udevadm.full_path()]) | |
3660 | endif | |
3661 | endif | |
6164ec4c ZJS |
3662 | |
3663 | executable( | |
3664 | 'systemd-shutdown', | |
3665 | systemd_shutdown_sources, | |
3666 | include_directories : includes, | |
bac11cd6 | 3667 | link_with : [libshared], |
6164ec4c | 3668 | dependencies : [libmount], |
5fb22561 | 3669 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3670 | install : true, |
3671 | install_dir : rootlibexecdir) | |
3672 | ||
3673 | executable( | |
3674 | 'systemd-update-done', | |
3675 | 'src/update-done/update-done.c', | |
3676 | include_directories : includes, | |
3677 | link_with : [libshared], | |
5fb22561 | 3678 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3679 | install : true, |
3680 | install_dir : rootlibexecdir) | |
3681 | ||
3682 | executable( | |
3683 | 'systemd-update-utmp', | |
3684 | 'src/update-utmp/update-utmp.c', | |
3685 | include_directories : includes, | |
3686 | link_with : [libshared], | |
3687 | dependencies : [libaudit], | |
5fb22561 | 3688 | install_rpath : rootpkglibdir, |
55678b9e | 3689 | install : (conf.get('ENABLE_UTMP') == 1), |
6164ec4c | 3690 | install_dir : rootlibexecdir) |
5c23128d | 3691 | |
349cc4a5 | 3692 | if conf.get('HAVE_KMOD') == 1 |
6164ec4c ZJS |
3693 | executable( |
3694 | 'systemd-modules-load', | |
3695 | 'src/modules-load/modules-load.c', | |
3696 | include_directories : includes, | |
3697 | link_with : [libshared], | |
3698 | dependencies : [libkmod], | |
5fb22561 | 3699 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3700 | install : true, |
3701 | install_dir : rootlibexecdir) | |
94e75a54 | 3702 | |
7c22f07c ZJS |
3703 | meson.add_install_script('sh', '-c', |
3704 | mkdir_p.format(modulesloaddir)) | |
d7aa78c3 | 3705 | if install_sysconfdir |
7c22f07c | 3706 | meson.add_install_script('sh', '-c', |
fce9abb2 | 3707 | mkdir_p.format(sysconfdir / 'modules-load.d')) |
d7aa78c3 | 3708 | endif |
5c23128d ZJS |
3709 | endif |
3710 | ||
6164ec4c ZJS |
3711 | public_programs += executable( |
3712 | 'systemd-nspawn', | |
3713 | systemd_nspawn_sources, | |
3714 | include_directories : includes, | |
bac11cd6 | 3715 | link_with : [libnspawn_core, |
6164ec4c ZJS |
3716 | libshared], |
3717 | dependencies : [libblkid, | |
3718 | libseccomp], | |
5fb22561 | 3719 | install_rpath : rootpkglibdir, |
6164ec4c | 3720 | install : true) |
5c23128d | 3721 | |
349cc4a5 | 3722 | if conf.get('ENABLE_NETWORKD') == 1 |
9ff2b35f | 3723 | dbus_programs += executable( |
6164ec4c ZJS |
3724 | 'systemd-networkd', |
3725 | systemd_networkd_sources, | |
8d40961c | 3726 | include_directories : network_includes, |
6164ec4c ZJS |
3727 | link_with : [libnetworkd_core, |
3728 | libsystemd_network, | |
6164ec4c ZJS |
3729 | networkd_link_with], |
3730 | dependencies : [threads], | |
5fb22561 | 3731 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3732 | install : true, |
3733 | install_dir : rootlibexecdir) | |
3734 | ||
3761002e | 3735 | public_programs += executable( |
6164ec4c ZJS |
3736 | 'systemd-networkd-wait-online', |
3737 | systemd_networkd_wait_online_sources, | |
3738 | include_directories : includes, | |
8d40961c | 3739 | link_with : [networkd_link_with], |
5fb22561 | 3740 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3741 | install : true, |
3742 | install_dir : rootlibexecdir) | |
3743 | ||
3744 | public_programs += executable( | |
3745 | 'networkctl', | |
3746 | networkctl_sources, | |
8d40961c | 3747 | include_directories : libsystemd_network_includes, |
6164ec4c ZJS |
3748 | link_with : [libsystemd_network, |
3749 | networkd_link_with], | |
5fb22561 | 3750 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3751 | install : true, |
3752 | install_dir : rootbindir) | |
987dd89c | 3753 | endif |
6164ec4c | 3754 | |
987dd89c YW |
3755 | exe = executable( |
3756 | 'systemd-network-generator', | |
3757 | network_generator_sources, | |
3758 | include_directories : includes, | |
3759 | link_with : [networkd_link_with], | |
5fb22561 | 3760 | install_rpath : rootpkglibdir, |
987dd89c YW |
3761 | install : true, |
3762 | install_dir : rootlibexecdir) | |
fbaa1137 | 3763 | |
987dd89c YW |
3764 | if want_tests != 'false' |
3765 | test('test-network-generator-conversion', | |
3766 | test_network_generator_conversion_sh, | |
3767 | # https://github.com/mesonbuild/meson/issues/2681 | |
e93ada98 DDM |
3768 | args : exe.full_path(), |
3769 | depends : exe) | |
dcfe072a | 3770 | endif |
e821f6a9 | 3771 | |
6164ec4c ZJS |
3772 | executable( |
3773 | 'systemd-sulogin-shell', | |
73e994f2 | 3774 | 'src/sulogin-shell/sulogin-shell.c', |
6164ec4c ZJS |
3775 | include_directories : includes, |
3776 | link_with : [libshared], | |
5fb22561 | 3777 | install_rpath : rootpkglibdir, |
6164ec4c ZJS |
3778 | install : true, |
3779 | install_dir : rootlibexecdir) | |
e821f6a9 | 3780 | |
f875e6bc | 3781 | exe = custom_target( |
99d8cbce ZJS |
3782 | 'kernel-install', |
3783 | input : kernel_install_in, | |
3784 | output : 'kernel-install', | |
3785 | command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], | |
3786 | install : want_kernel_install, | |
3787 | install_mode : 'rwxr-xr-x', | |
3788 | install_dir : bindir) | |
f875e6bc ZJS |
3789 | public_programs += exe |
3790 | ||
3791 | if want_tests != 'false' | |
3792 | test('test-kernel-install', | |
3793 | test_kernel_install_sh, | |
3794 | args : [exe.full_path(), loaderentry_install]) | |
3795 | endif | |
99d8cbce | 3796 | |
69e96427 ZJS |
3797 | ############################################################ |
3798 | ||
e93ada98 | 3799 | runtest_env = custom_target( |
e2d41370 FB |
3800 | 'systemd-runtest.env', |
3801 | output : 'systemd-runtest.env', | |
0f4c4f38 ZJS |
3802 | command : [sh, '-c', |
3803 | '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format( | |
fce9abb2 ZJS |
3804 | project_source_root / 'test', |
3805 | project_build_root / 'catalog')], | |
e93ada98 | 3806 | depends : catalogs, |
e2d41370 FB |
3807 | build_by_default : true) |
3808 | ||
a626cb15 ZJS |
3809 | test_cflags = ['-DTEST_CODE=1'] |
3810 | # We intentionally do not do inline initializations with definitions for a | |
3811 | # bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we | |
3812 | # use the variable unexpectedly. This triggers a lot of maybe-uninitialized | |
3813 | # false positives when the combination of -O2 and -flto is used. Suppress them. | |
b528a628 | 3814 | if '-O2' in c_args and '-flto=auto' in c_args |
a626cb15 ZJS |
3815 | test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized') |
3816 | endif | |
3817 | ||
69e96427 | 3818 | foreach tuple : tests |
37efbbd8 | 3819 | sources = tuple[0] |
5acb3cab YW |
3820 | link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared] |
3821 | dependencies = tuple.length() > 2 ? tuple[2] : [] | |
3822 | incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes | |
3823 | condition = tuple.length() > 4 ? tuple[4] : '' | |
3824 | type = tuple.length() > 5 ? tuple[5] : '' | |
3825 | defs = tuple.length() > 6 ? tuple[6] : [] | |
a626cb15 | 3826 | defs += test_cflags |
5acb3cab | 3827 | parallel = tuple.length() > 7 ? tuple[7] : true |
37efbbd8 ZJS |
3828 | timeout = 30 |
3829 | ||
e1eeebbb JJ |
3830 | # FIXME: Use fs.stem() with meson >= 0.54.0 |
3831 | name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0] | |
37efbbd8 ZJS |
3832 | if type.startswith('timeout=') |
3833 | timeout = type.split('=')[1].to_int() | |
3834 | type = '' | |
3835 | endif | |
3b2bdd62 | 3836 | |
c3191c6d DDM |
3837 | suite = fs.name(fs.parent('@0@'.format(sources[0]))) |
3838 | # FIXME: Use str.replace() with meson >= 0.58.0 | |
3839 | suite = suite.split('sd-')[-1] | |
3840 | ||
3b2bdd62 | 3841 | if condition == '' or conf.get(condition) == 1 |
37efbbd8 ZJS |
3842 | exe = executable( |
3843 | name, | |
3844 | sources, | |
3845 | include_directories : incs, | |
3846 | link_with : link_with, | |
60722ad7 ZJS |
3847 | dependencies : [versiondep, |
3848 | dependencies], | |
37efbbd8 | 3849 | c_args : defs, |
3b2bdd62 | 3850 | build_by_default : want_tests != 'false', |
5fb22561 | 3851 | install_rpath : rootpkglibdir, |
7cdd9783 | 3852 | install : install_tests, |
e93ada98 DDM |
3853 | install_dir : testsdir / type, |
3854 | link_depends : runtest_env) | |
37efbbd8 ZJS |
3855 | |
3856 | if type == 'manual' | |
3857 | message('@0@ is a manual test'.format(name)) | |
3858 | elif type == 'unsafe' and want_tests != 'unsafe' | |
3859 | message('@0@ is an unsafe test'.format(name)) | |
3b2bdd62 | 3860 | elif want_tests != 'false' |
37efbbd8 ZJS |
3861 | test(name, exe, |
3862 | env : test_env, | |
c3191c6d DDM |
3863 | timeout : timeout, |
3864 | suite : suite) | |
37efbbd8 ZJS |
3865 | endif |
3866 | else | |
3867 | message('Not compiling @0@ because @1@ is not true'.format(name, condition)) | |
3868 | endif | |
69e96427 ZJS |
3869 | endforeach |
3870 | ||
0632b4cd | 3871 | exe = executable( |
37efbbd8 ZJS |
3872 | 'test-libsystemd-sym', |
3873 | test_libsystemd_sym_c, | |
3874 | include_directories : includes, | |
3875 | link_with : [libsystemd], | |
fd1939fb | 3876 | build_by_default : want_tests != 'false', |
37efbbd8 ZJS |
3877 | install : install_tests, |
3878 | install_dir : testsdir) | |
938be089 ZJS |
3879 | if want_tests != 'false' |
3880 | test('test-libsystemd-sym', exe) | |
3881 | endif | |
37ab1a25 | 3882 | |
0632b4cd ZJS |
3883 | exe = executable( |
3884 | 'test-libsystemd-static-sym', | |
3885 | test_libsystemd_sym_c, | |
3886 | include_directories : includes, | |
0632b4cd ZJS |
3887 | link_with : [install_libsystemd_static], |
3888 | dependencies : [threads], # threads is already included in dependencies on the library, | |
3889 | # but does not seem to get propagated. Add here as a work-around. | |
fd1939fb | 3890 | build_by_default : want_tests != 'false' and static_libsystemd_pic, |
20f3d32d | 3891 | install : install_tests and static_libsystemd_pic, |
0632b4cd | 3892 | install_dir : testsdir) |
938be089 | 3893 | if want_tests != 'false' and static_libsystemd_pic |
0632b4cd ZJS |
3894 | test('test-libsystemd-static-sym', exe) |
3895 | endif | |
37ab1a25 | 3896 | |
0632b4cd | 3897 | exe = executable( |
37efbbd8 ZJS |
3898 | 'test-libudev-sym', |
3899 | test_libudev_sym_c, | |
e4b127e2 | 3900 | include_directories : libudev_includes, |
a626cb15 | 3901 | c_args : ['-Wno-deprecated-declarations'] + test_cflags, |
37efbbd8 | 3902 | link_with : [libudev], |
fd1939fb | 3903 | build_by_default : want_tests != 'false', |
37efbbd8 ZJS |
3904 | install : install_tests, |
3905 | install_dir : testsdir) | |
938be089 ZJS |
3906 | if want_tests != 'false' |
3907 | test('test-libudev-sym', exe) | |
3908 | endif | |
0632b4cd ZJS |
3909 | |
3910 | exe = executable( | |
3911 | 'test-libudev-static-sym', | |
3912 | test_libudev_sym_c, | |
e4b127e2 | 3913 | include_directories : libudev_includes, |
a626cb15 | 3914 | c_args : ['-Wno-deprecated-declarations'] + test_cflags, |
0632b4cd | 3915 | link_with : [install_libudev_static], |
fd1939fb | 3916 | build_by_default : want_tests != 'false' and static_libudev_pic, |
20f3d32d | 3917 | install : install_tests and static_libudev_pic, |
0632b4cd | 3918 | install_dir : testsdir) |
938be089 | 3919 | if want_tests != 'false' and static_libudev_pic |
0632b4cd ZJS |
3920 | test('test-libudev-static-sym', exe) |
3921 | endif | |
e0bec52f | 3922 | |
69e96427 | 3923 | ############################################################ |
5c23128d | 3924 | |
7db7d5b7 JR |
3925 | fuzzer_exes = [] |
3926 | ||
7e299ffe ZJS |
3927 | foreach tuple : fuzzers |
3928 | sources = tuple[0] | |
5acb3cab YW |
3929 | link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared] |
3930 | dependencies = tuple.length() > 2 ? tuple[2] : [] | |
3931 | incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes | |
3932 | defs = tuple.length() > 4 ? tuple[4] : [] | |
7e299ffe ZJS |
3933 | link_args = [] |
3934 | ||
3935 | if want_ossfuzz | |
3936 | dependencies += fuzzing_engine | |
3937 | elif want_libfuzzer | |
3938 | if fuzzing_engine.found() | |
9c5c4677 EV |
3939 | dependencies += fuzzing_engine |
3940 | else | |
7e299ffe | 3941 | link_args += ['-fsanitize=fuzzer'] |
9c5c4677 | 3942 | endif |
7e299ffe ZJS |
3943 | else |
3944 | sources += 'src/fuzz/fuzz-main.c' | |
3945 | endif | |
7db7d5b7 | 3946 | |
bbec46c8 JJ |
3947 | # FIXME: Use fs.stem() with meson >= 0.54.0 |
3948 | name = '@0@'.format(sources[0]).split('/')[-1].split('.')[0] | |
7db7d5b7 | 3949 | |
f78ad5f0 | 3950 | exe = executable( |
7e299ffe ZJS |
3951 | name, |
3952 | sources, | |
3953 | include_directories : [incs, include_directories('src/fuzz')], | |
3954 | link_with : link_with, | |
3955 | dependencies : dependencies, | |
a626cb15 | 3956 | c_args : defs + test_cflags, |
7e299ffe ZJS |
3957 | link_args: link_args, |
3958 | install : false, | |
f78ad5f0 ZJS |
3959 | build_by_default : fuzzer_build) |
3960 | fuzzer_exes += exe | |
3961 | ||
3962 | if want_tests != 'false' | |
3963 | # Run the fuzz regression tests without any sanitizers enabled. | |
3964 | # Additional invocations with sanitizers may be added below. | |
3965 | foreach p : fuzz_regression_tests | |
3966 | b = p.split('/')[-2] | |
3967 | c = p.split('/')[-1] | |
3968 | ||
3969 | if b == name | |
3970 | test('@0@_@1@'.format(b, c), | |
3971 | exe, | |
14056a52 | 3972 | suite : 'fuzzers', |
fce9abb2 | 3973 | args : [project_source_root / p]) |
f78ad5f0 ZJS |
3974 | endif |
3975 | endforeach | |
3976 | endif | |
7e299ffe | 3977 | endforeach |
7db7d5b7 | 3978 | |
6839ce33 | 3979 | alias_target('fuzzers', fuzzer_exes) |
7db7d5b7 JR |
3980 | |
3981 | ############################################################ | |
3982 | ||
378e9d2b | 3983 | subdir('modprobe.d') |
5c23128d ZJS |
3984 | subdir('sysctl.d') |
3985 | subdir('sysusers.d') | |
3986 | subdir('tmpfiles.d') | |
4f10b807 ZJS |
3987 | subdir('hwdb.d') |
3988 | subdir('units') | |
e783f957 | 3989 | subdir('presets') |
5c23128d ZJS |
3990 | subdir('network') |
3991 | subdir('man') | |
3992 | subdir('shell-completion/bash') | |
3993 | subdir('shell-completion/zsh') | |
9e825ebf FB |
3994 | subdir('docs/sysvinit') |
3995 | subdir('docs/var-log') | |
5c23128d | 3996 | |
5c23128d ZJS |
3997 | install_subdir('factory/etc', |
3998 | install_dir : factorydir) | |
623370e6 | 3999 | subdir('factory/templates') |
5c23128d | 4000 | |
d7aa78c3 JT |
4001 | if install_sysconfdir |
4002 | install_data('xorg/50-systemd-user.sh', | |
4003 | install_dir : xinitrcdir) | |
4004 | endif | |
f09eb768 | 4005 | install_data('LICENSE.GPL2', |
5c23128d | 4006 | 'LICENSE.LGPL2.1', |
f09eb768 LP |
4007 | 'NEWS', |
4008 | 'README', | |
eea98402 | 4009 | 'docs/CODING_STYLE.md', |
1d1cb168 | 4010 | 'docs/DISTRO_PORTING.md', |
9e825ebf | 4011 | 'docs/ENVIRONMENT.md', |
5425f8a5 | 4012 | 'docs/HACKING.md', |
9e825ebf | 4013 | 'docs/TRANSIENT-SETTINGS.md', |
b6dc0d7d | 4014 | 'docs/TRANSLATORS.md', |
9e825ebf | 4015 | 'docs/UIDS-GIDS.md', |
5c23128d | 4016 | install_dir : docdir) |
d68b342b | 4017 | |
9c6e32a2 LB |
4018 | install_subdir('LICENSES', |
4019 | install_dir : docdir) | |
4020 | ||
7c22f07c ZJS |
4021 | meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir)) |
4022 | meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir)) | |
94e75a54 | 4023 | |
d68b342b ZJS |
4024 | ############################################################ |
4025 | ||
2d4efd1d LB |
4026 | # Ensure that changes to the docs/ directory do not break the |
4027 | # basic Github pages build. But only run it in developer mode, | |
4028 | # as it might be fragile due to changes in the tooling, and it is | |
4029 | # not generally useful for users. | |
4030 | jekyll = find_program('jekyll', required : false) | |
4031 | if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found() | |
4032 | test('github-pages', | |
4033 | jekyll, | |
14056a52 | 4034 | suite : 'dist-check', |
2d4efd1d | 4035 | args : ['build', |
fce9abb2 ZJS |
4036 | '--source', project_source_root / 'docs', |
4037 | '--destination', project_build_root / '_site']) | |
2d4efd1d LB |
4038 | endif |
4039 | ||
4040 | ############################################################ | |
4041 | ||
dd1e33c8 | 4042 | check_help = find_program('tools/check-help.sh') |
ffb7406b | 4043 | check_version = find_program('tools/check-version.sh') |
005a29f2 ZJS |
4044 | |
4045 | foreach exec : public_programs | |
37efbbd8 | 4046 | name = exec.full_path().split('/')[-1] |
938be089 ZJS |
4047 | if want_tests != 'false' |
4048 | test('check-help-' + name, | |
dd1e33c8 | 4049 | check_help, |
14056a52 | 4050 | suite : 'dist-check', |
e93ada98 DDM |
4051 | args : exec.full_path(), |
4052 | depends: exec) | |
ffb7406b ZJS |
4053 | |
4054 | test('check-version-' + name, | |
4055 | check_version, | |
14056a52 | 4056 | suite : 'dist-check', |
ffb7406b ZJS |
4057 | args : [exec.full_path(), |
4058 | meson.project_version()], | |
4059 | depends: exec) | |
938be089 | 4060 | endif |
005a29f2 ZJS |
4061 | endforeach |
4062 | ||
4063 | ############################################################ | |
4064 | ||
c6448ee3 ZJS |
4065 | check_directives_sh = find_program('tools/check-directives.sh') |
4066 | ||
4067 | if want_tests != 'false' | |
4068 | test('check-directives', | |
4069 | check_directives_sh, | |
14056a52 | 4070 | suite : 'dist-check', |
34fde9f8 | 4071 | args : [project_source_root, project_build_root]) |
c6448ee3 ZJS |
4072 | endif |
4073 | ||
4074 | ############################################################ | |
4075 | ||
52d4d1d3 ZJS |
4076 | # Enable tests for all supported sanitizers |
4077 | foreach tuple : sanitizers | |
4078 | sanitizer = tuple[0] | |
4079 | build = tuple[1] | |
b68dfb9e | 4080 | |
7a6397d2 | 4081 | if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer)) |
52d4d1d3 ZJS |
4082 | prev = '' |
4083 | foreach p : fuzz_regression_tests | |
4084 | b = p.split('/')[-2] | |
4085 | c = p.split('/')[-1] | |
4086 | ||
4087 | name = '@0@:@1@'.format(b, sanitizer) | |
4088 | ||
4089 | if name != prev | |
4090 | if want_tests == 'false' | |
4091 | message('Not compiling @0@ because tests is set to false'.format(name)) | |
1763ef1d | 4092 | elif fuzz_tests |
52d4d1d3 ZJS |
4093 | exe = custom_target( |
4094 | name, | |
4095 | output : name, | |
4096 | depends : build, | |
0f4c4f38 | 4097 | command : [ln, '-fs', |
fce9abb2 | 4098 | build.full_path() / b, |
52d4d1d3 ZJS |
4099 | '@OUTPUT@'], |
4100 | build_by_default : true) | |
4101 | else | |
1763ef1d | 4102 | message('Not compiling @0@ because fuzz-tests is set to false'.format(name)) |
52d4d1d3 ZJS |
4103 | endif |
4104 | endif | |
4105 | prev = name | |
4106 | ||
1763ef1d | 4107 | if fuzz_tests |
0f82a2ab | 4108 | test('@0@_@1@_@2@'.format(b, c, sanitizer), |
52d4d1d3 | 4109 | env, |
14056a52 | 4110 | suite : 'fuzz+san', |
89767158 EV |
4111 | env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'], |
4112 | timeout : 60, | |
52d4d1d3 | 4113 | args : [exe.full_path(), |
fce9abb2 | 4114 | project_source_root / p]) |
52d4d1d3 ZJS |
4115 | endif |
4116 | endforeach | |
b68dfb9e ZJS |
4117 | endif |
4118 | endforeach | |
4119 | ||
52d4d1d3 | 4120 | |
b68dfb9e ZJS |
4121 | ############################################################ |
4122 | ||
0700e8ba | 4123 | if git.found() |
37efbbd8 | 4124 | all_files = run_command( |
0f4c4f38 ZJS |
4125 | env, '-u', 'GIT_WORK_TREE', |
4126 | git, '--git-dir=@0@/.git'.format(project_source_root), | |
e92777d2 ZJS |
4127 | 'ls-files', ':/*.[ch]', |
4128 | check : false) | |
4129 | if all_files.returncode() == 0 | |
4130 | all_files = files(all_files.stdout().split()) | |
4131 | ||
4132 | custom_target( | |
4133 | 'tags', | |
4134 | output : 'tags', | |
4135 | command : [env, 'etags', '-o', '@0@/TAGS'.format(project_source_root)] + all_files) | |
4136 | run_target( | |
4137 | 'ctags', | |
691db9a7 | 4138 | command : [env, 'ctags', '--tag-relative=never', '-o', '@0@/tags'.format(project_source_root)] + all_files) |
e92777d2 | 4139 | endif |
d68b342b | 4140 | endif |
177929c2 ZJS |
4141 | |
4142 | if git.found() | |
dd1e33c8 | 4143 | git_contrib_sh = find_program('tools/git-contrib.sh') |
a923e085 | 4144 | run_target( |
37efbbd8 | 4145 | 'git-contrib', |
dd1e33c8 | 4146 | command : [git_contrib_sh]) |
177929c2 | 4147 | endif |
dd6ab3df ZJS |
4148 | |
4149 | if git.found() | |
4150 | git_head = run_command( | |
e92777d2 ZJS |
4151 | git, '--git-dir=@0@/.git'.format(project_source_root), |
4152 | 'rev-parse', 'HEAD', | |
4153 | check : false).stdout().strip() | |
dd6ab3df | 4154 | git_head_short = run_command( |
e92777d2 ZJS |
4155 | git, '--git-dir=@0@/.git'.format(project_source_root), |
4156 | 'rev-parse', '--short=7', 'HEAD', | |
4157 | check : false).stdout().strip() | |
dd6ab3df ZJS |
4158 | |
4159 | run_target( | |
4160 | 'git-snapshot', | |
0f4c4f38 | 4161 | command : [git, 'archive', |
1485aacb | 4162 | '-o', '@0@/systemd-@1@.tar.gz'.format(project_source_root, |
dd6ab3df ZJS |
4163 | git_head_short), |
4164 | '--prefix', 'systemd-@0@/'.format(git_head), | |
4165 | 'HEAD']) | |
4166 | endif | |
829257d1 ZJS |
4167 | |
4168 | ############################################################ | |
4169 | ||
dd1e33c8 | 4170 | check_api_docs_sh = find_program('tools/check-api-docs.sh') |
51b13863 LP |
4171 | run_target( |
4172 | 'check-api-docs', | |
4173 | depends : [man, libsystemd, libudev], | |
dd1e33c8 | 4174 | command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()]) |
51b13863 | 4175 | |
f12c5d36 ZJS |
4176 | alias_target('update-dbus-docs', update_dbus_docs) |
4177 | alias_target('update-man-rules', update_man_rules) | |
e3c368f6 | 4178 | |
0628d48e LB |
4179 | if not meson.is_cross_build() |
4180 | custom_target( | |
4181 | 'export-dbus-interfaces', | |
4645074e | 4182 | output : fs.name(dbus_interfaces_dir), |
0628d48e | 4183 | install : dbus_interfaces_dir != 'no', |
4645074e | 4184 | install_dir : fs.parent(dbus_interfaces_dir), |
0628d48e LB |
4185 | command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs]) |
4186 | endif | |
e3c68924 | 4187 | |
51b13863 | 4188 | ############################################################ |
829257d1 | 4189 | |
e92777d2 ZJS |
4190 | alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch), |
4191 | check : true).stdout().strip() | |
12085ebb ZJS |
4192 | |
4193 | summary({ | |
12085ebb ZJS |
4194 | 'split /usr' : split_usr, |
4195 | 'split bin-sbin' : split_bin, | |
4196 | 'prefix directory' : prefixdir, | |
4197 | 'rootprefix directory' : rootprefixdir, | |
4198 | 'sysconf directory' : sysconfdir, | |
4199 | 'include directory' : includedir, | |
4200 | 'lib directory' : libdir, | |
4201 | 'rootlib directory' : rootlibdir, | |
4202 | 'SysV init scripts' : sysvinit_path, | |
4203 | 'SysV rc?.d directories' : sysvrcnd_path, | |
4204 | 'PAM modules directory' : pamlibdir, | |
4205 | 'PAM configuration directory' : pamconfdir, | |
4206 | 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir, | |
4207 | 'RPM macros directory' : rpmmacrosdir, | |
4208 | 'modprobe.d directory' : modprobedir, | |
4209 | 'D-Bus policy directory' : dbuspolicydir, | |
4210 | 'D-Bus session directory' : dbussessionservicedir, | |
4211 | 'D-Bus system directory' : dbussystemservicedir, | |
7e560e79 | 4212 | 'D-Bus interfaces directory' : dbus_interfaces_dir, |
12085ebb ZJS |
4213 | 'bash completions directory' : bashcompletiondir, |
4214 | 'zsh completions directory' : zshcompletiondir, | |
a2b0cd3f | 4215 | 'private shared lib version tag' : shared_lib_tag, |
12085ebb ZJS |
4216 | 'extra start script' : get_option('rc-local'), |
4217 | 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'), | |
4218 | get_option('debug-tty')), | |
4219 | 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'), | |
4220 | conf.get('SYSTEM_ALLOC_UID_MIN')), | |
4221 | 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'), | |
4222 | conf.get('SYSTEM_ALLOC_GID_MIN')), | |
4223 | 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max), | |
4224 | 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max), | |
4225 | 'static UID/GID allocations' : ' '.join(static_ugids), | |
4226 | '/dev/kvm access mode' : get_option('dev-kvm-mode'), | |
4227 | 'render group access mode' : get_option('group-render-mode'), | |
4228 | 'certificate root directory' : get_option('certificate-root'), | |
4229 | 'support URL' : support_url, | |
4230 | 'nobody user name' : nobody_user, | |
4231 | 'nobody group name' : nobody_group, | |
4232 | 'fallback hostname' : get_option('fallback-hostname'), | |
9798deaf | 4233 | 'default compression method' : compression, |
12085ebb ZJS |
4234 | 'default DNSSEC mode' : default_dnssec, |
4235 | 'default DNS-over-TLS mode' : default_dns_over_tls, | |
4236 | 'default mDNS mode' : default_mdns, | |
4237 | 'default LLMNR mode' : default_llmnr, | |
4238 | 'default DNS servers' : dns_servers.split(' '), | |
4239 | 'default NTP servers' : ntp_servers.split(' '), | |
4240 | 'default cgroup hierarchy' : default_hierarchy, | |
4241 | 'default net.naming-scheme value' : default_net_naming_scheme, | |
4242 | 'default KillUserProcesses value' : kill_user_processes, | |
4243 | 'default locale' : default_locale, | |
88b6f0de | 4244 | 'default nspawn locale' : nspawn_locale, |
79dec86a | 4245 | 'default status unit format' : status_unit_format_default, |
12085ebb ZJS |
4246 | 'default user $PATH' : |
4247 | default_user_path != '' ? default_user_path : '(same as system services)', | |
4248 | 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog, | |
4249 | 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)}) | |
829257d1 ZJS |
4250 | |
4251 | # TODO: | |
4252 | # CFLAGS: ${OUR_CFLAGS} ${CFLAGS} | |
4253 | # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS} | |
4254 | # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS} | |
4255 | ||
829257d1 ZJS |
4256 | found = [] |
4257 | missing = [] | |
4258 | ||
4259 | foreach tuple : [ | |
56d68e71 ZJS |
4260 | # dependencies |
4261 | ['ACL'], | |
829257d1 | 4262 | ['AUDIT'], |
829257d1 | 4263 | ['AppArmor'], |
56d68e71 ZJS |
4264 | ['IMA'], |
4265 | ['PAM'], | |
829257d1 | 4266 | ['SECCOMP'], |
56d68e71 | 4267 | ['SELinux'], |
829257d1 | 4268 | ['SMACK'], |
56d68e71 ZJS |
4269 | ['blkid'], |
4270 | ['elfutils'], | |
829257d1 | 4271 | ['gcrypt'], |
829257d1 | 4272 | ['gnutls'], |
7d861e12 | 4273 | ['libbpf'], |
56d68e71 | 4274 | ['libcryptsetup'], |
d1ae38d8 | 4275 | ['libcryptsetup-plugins'], |
829257d1 | 4276 | ['libcurl'], |
56d68e71 ZJS |
4277 | ['libfdisk'], |
4278 | ['libfido2'], | |
829257d1 | 4279 | ['libidn'], |
56d68e71 | 4280 | ['libidn2'], |
829257d1 | 4281 | ['libiptc'], |
56d68e71 ZJS |
4282 | ['microhttpd'], |
4283 | ['openssl'], | |
4284 | ['p11kit'], | |
4285 | ['pcre2'], | |
4286 | ['pwquality'], | |
4287 | ['qrencode'], | |
4288 | ['tpm2'], | |
4289 | ['xkbcommon'], | |
4290 | ||
4291 | # compression libs | |
4292 | ['zstd'], | |
4293 | ['lz4'], | |
4294 | ['xz'], | |
4295 | ['zlib'], | |
4296 | ['bzip2'], | |
4297 | ||
4298 | # components | |
4299 | ['backlight'], | |
829257d1 | 4300 | ['binfmt'], |
0a0d4899 | 4301 | ['bpf-framework', conf.get('BPF_FRAMEWORK') == 1], |
56d68e71 | 4302 | ['coredump'], |
829257d1 | 4303 | ['environment.d'], |
56d68e71 | 4304 | ['efi'], |
9cf75222 | 4305 | ['gnu-efi'], |
829257d1 | 4306 | ['firstboot'], |
56d68e71 ZJS |
4307 | ['hibernate'], |
4308 | ['homed'], | |
4309 | ['hostnamed'], | |
4310 | ['hwdb'], | |
4311 | ['importd'], | |
4312 | ['initrd'], | |
f887eab1 | 4313 | ['kernel-install'], |
56d68e71 | 4314 | ['localed'], |
829257d1 ZJS |
4315 | ['logind'], |
4316 | ['machined'], | |
56d68e71 ZJS |
4317 | ['networkd'], |
4318 | ['nss-myhostname'], | |
4319 | ['nss-mymachines'], | |
4320 | ['nss-resolve'], | |
4321 | ['nss-systemd'], | |
4322 | ['oomd'], | |
61d0578b | 4323 | ['portabled'], |
56d68e71 ZJS |
4324 | ['pstore'], |
4325 | ['quotacheck'], | |
4326 | ['randomseed'], | |
4327 | ['repart'], | |
4328 | ['resolve'], | |
4329 | ['rfkill'], | |
9bca4ae4 | 4330 | ['sysext'], |
0a0d4899 | 4331 | ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1], |
43cc7a3e | 4332 | ['sysupdate'], |
56d68e71 | 4333 | ['sysusers'], |
829257d1 ZJS |
4334 | ['timedated'], |
4335 | ['timesyncd'], | |
56d68e71 ZJS |
4336 | ['tmpfiles'], |
4337 | ['userdb'], | |
4338 | ['vconsole'], | |
4339 | ['xdg-autostart'], | |
4340 | ||
4341 | # optional features | |
56d68e71 | 4342 | ['idn'], |
829257d1 | 4343 | ['polkit'], |
56d68e71 | 4344 | ['nscd'], |
0a0d4899 | 4345 | ['legacy-pkla', install_polkit_pkla], |
829257d1 | 4346 | ['kmod'], |
829257d1 ZJS |
4347 | ['dbus'], |
4348 | ['glib'], | |
829257d1 | 4349 | ['tpm'], |
0a0d4899 JH |
4350 | ['man pages', want_man], |
4351 | ['html pages', want_html], | |
4352 | ['man page indices', want_man and have_lxml], | |
829257d1 | 4353 | ['SysV compat'], |
56d68e71 | 4354 | ['compat-mutable-uid-boundaries'], |
829257d1 ZJS |
4355 | ['utmp'], |
4356 | ['ldconfig'], | |
0a0d4899 JH |
4357 | ['adm group', get_option('adm-group')], |
4358 | ['wheel group', get_option('wheel-group')], | |
b14e1b43 | 4359 | ['gshadow'], |
829257d1 ZJS |
4360 | ['debug hashmap'], |
4361 | ['debug mmap cache'], | |
d6601495 | 4362 | ['debug siphash'], |
0a0d4899 JH |
4363 | ['valgrind', conf.get('VALGRIND') == 1], |
4364 | ['trace logging', conf.get('LOG_TRACE') == 1], | |
4365 | ['install tests', install_tests], | |
4366 | ['link-udev-shared', get_option('link-udev-shared')], | |
4367 | ['link-systemctl-shared', get_option('link-systemctl-shared')], | |
4368 | ['link-networkd-shared', get_option('link-networkd-shared')], | |
4369 | ['link-timesyncd-shared', get_option('link-timesyncd-shared')], | |
4370 | ['link-journalctl-shared', get_option('link-journalctl-shared')], | |
4371 | ['link-boot-shared', get_option('link-boot-shared')], | |
93651582 | 4372 | ['first-boot-full-preset'], |
ceedbf81 | 4373 | ['fexecve'], |
0a0d4899 JH |
4374 | ['standalone-binaries', get_option('standalone-binaries')], |
4375 | ['coverage', get_option('b_coverage')], | |
829257d1 ZJS |
4376 | ] |
4377 | ||
af4d7860 ZJS |
4378 | if tuple.length() >= 2 |
4379 | cond = tuple[1] | |
4380 | else | |
829257d1 ZJS |
4381 | ident1 = 'HAVE_' + tuple[0].underscorify().to_upper() |
4382 | ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper() | |
349cc4a5 | 4383 | cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1 |
829257d1 ZJS |
4384 | endif |
4385 | if cond | |
5a8b1640 | 4386 | found += tuple[0] |
829257d1 | 4387 | else |
5a8b1640 | 4388 | missing += tuple[0] |
829257d1 ZJS |
4389 | endif |
4390 | endforeach | |
4391 | ||
c716c253 ZJS |
4392 | if static_libsystemd == 'false' |
4393 | missing += 'static-libsystemd' | |
4394 | else | |
4395 | found += 'static-libsystemd(@0@)'.format(static_libsystemd) | |
4396 | endif | |
4397 | ||
4398 | if static_libudev == 'false' | |
4399 | missing += 'static-libudev' | |
4400 | else | |
4401 | found += 'static-libudev(@0@)'.format(static_libudev) | |
4402 | endif | |
4403 | ||
57633d23 ZJS |
4404 | if conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 and conf.get('PREFER_OPENSSL') == 1 |
4405 | found += 'cryptolib(openssl)' | |
4406 | elif conf.get('HAVE_OPENSSL_OR_GCRYPT') == 1 | |
4407 | found += 'cryptolib(gcrypt)' | |
4408 | else | |
4409 | missing += 'cryptolib' | |
4410 | endif | |
4411 | ||
237f2da9 ZJS |
4412 | if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1 |
4413 | found += 'DNS-over-TLS(gnutls)' | |
4414 | elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1 | |
4415 | found += 'DNS-over-TLS(openssl)' | |
4416 | else | |
4417 | missing += 'DNS-over-TLS' | |
4418 | endif | |
4419 | ||
12085ebb ZJS |
4420 | summary({ |
4421 | 'enabled' : ', '.join(found), | |
4422 | 'disabled' : ', '.join(missing)}, | |
4423 | section : 'Features') | |
9a8e64b0 ZJS |
4424 | |
4425 | if rootprefixdir != rootprefix_default | |
8ea9fad7 YW |
4426 | warning('\n' + |
4427 | 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) + | |
4428 | 'systemd used fixed names for unit file directories and other paths, so anything\n' + | |
4429 | 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default)) | |
9a8e64b0 | 4430 | endif |