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