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