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