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