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