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