]>
Commit | Line | Data |
---|---|---|
3a726fcd | 1 | # SPDX-License-Identifier: LGPL-2.1+ |
3a726fcd | 2 | |
5c23128d | 3 | project('systemd', 'c', |
de7436b0 | 4 | version : '239', |
5c23128d ZJS |
5 | license : 'LGPLv2+', |
6 | default_options: [ | |
37efbbd8 ZJS |
7 | 'c_std=gnu99', |
8 | 'prefix=/usr', | |
9 | 'sysconfdir=/etc', | |
10 | 'localstatedir=/var', | |
5c23128d | 11 | ], |
7a6397d2 | 12 | meson_version : '>= 0.46', |
5c23128d ZJS |
13 | ) |
14 | ||
de7436b0 LP |
15 | libsystemd_version = '0.23.0' |
16 | libudev_version = '1.6.11' | |
56d50ab1 | 17 | |
348b4437 | 18 | # We need the same data in two different formats, ugh! |
5c23128d ZJS |
19 | # Also, for hysterical reasons, we use different variable |
20 | # names, sometimes. Not all variables are included in every | |
21 | # set. Ugh, ugh, ugh! | |
22 | conf = configuration_data() | |
23 | conf.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version()) | |
24 | conf.set_quoted('PACKAGE_VERSION', meson.project_version()) | |
25 | ||
26 | substs = configuration_data() | |
27 | substs.set('PACKAGE_URL', 'https://www.freedesktop.org/wiki/Software/systemd') | |
28 | substs.set('PACKAGE_VERSION', meson.project_version()) | |
29 | ||
5c23128d ZJS |
30 | ##################################################################### |
31 | ||
003c8879 ZJS |
32 | # Try to install the git pre-commit hook |
33 | git_hook = run_command(join_paths(meson.source_root(), 'tools/add-git-hook.sh')) | |
34 | if git_hook.returncode() == 0 | |
35 | message(git_hook.stdout().strip()) | |
36 | endif | |
37 | ||
38 | ##################################################################### | |
39 | ||
2675413e ZJS |
40 | if get_option('split-usr') == 'auto' |
41 | split_usr = run_command('test', '-L', '/bin').returncode() != 0 | |
42 | else | |
43 | split_usr = get_option('split-usr') == 'true' | |
44 | endif | |
671f0f8d ZJS |
45 | conf.set10('HAVE_SPLIT_USR', split_usr, |
46 | description : '/usr/bin and /bin directories are separate') | |
9a8e64b0 | 47 | |
157baa87 ZJS |
48 | if get_option('split-bin') == 'auto' |
49 | split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0 | |
50 | else | |
51 | split_bin = get_option('split-bin') == 'true' | |
52 | endif | |
671f0f8d ZJS |
53 | conf.set10('HAVE_SPLIT_BIN', split_bin, |
54 | description : 'bin and sbin directories are separate') | |
157baa87 | 55 | |
74344a17 | 56 | rootprefixdir = get_option('rootprefix') |
74344a17 ZJS |
57 | # Unusual rootprefixdir values are used by some distros |
58 | # (see https://github.com/systemd/systemd/pull/7461). | |
ba7f4ae6 | 59 | rootprefix_default = split_usr ? '/' : '/usr' |
9a8e64b0 ZJS |
60 | if rootprefixdir == '' |
61 | rootprefixdir = rootprefix_default | |
74344a17 | 62 | endif |
5c23128d ZJS |
63 | |
64 | sysvinit_path = get_option('sysvinit-path') | |
65 | sysvrcnd_path = get_option('sysvrcnd-path') | |
348b4437 | 66 | conf.set10('HAVE_SYSV_COMPAT', sysvinit_path != '' and sysvrcnd_path != '', |
349cc4a5 | 67 | description : 'SysV init scripts and rcN.d links are supported') |
5c23128d ZJS |
68 | |
69 | # join_paths ignore the preceding arguments if an absolute component is | |
70 | # encountered, so this should canonicalize various paths when they are | |
71 | # absolute or relative. | |
72 | prefixdir = get_option('prefix') | |
73 | if not prefixdir.startswith('/') | |
37efbbd8 | 74 | error('Prefix is not absolute: "@0@"'.format(prefixdir)) |
5c23128d ZJS |
75 | endif |
76 | bindir = join_paths(prefixdir, get_option('bindir')) | |
77 | libdir = join_paths(prefixdir, get_option('libdir')) | |
78 | sysconfdir = join_paths(prefixdir, get_option('sysconfdir')) | |
79 | includedir = join_paths(prefixdir, get_option('includedir')) | |
80 | datadir = join_paths(prefixdir, get_option('datadir')) | |
81 | localstatedir = join_paths('/', get_option('localstatedir')) | |
82 | ||
83 | rootbindir = join_paths(rootprefixdir, 'bin') | |
157baa87 | 84 | rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin') |
5c23128d ZJS |
85 | rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd') |
86 | ||
87 | rootlibdir = get_option('rootlibdir') | |
88 | if rootlibdir == '' | |
37efbbd8 | 89 | rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1]) |
5c23128d ZJS |
90 | endif |
91 | ||
92 | # Dirs of external packages | |
a95696e3 BM |
93 | pkgconfigdatadir = get_option('pkgconfigdatadir') == '' ? join_paths(datadir, 'pkgconfig') : get_option('pkgconfigdatadir') |
94 | pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgconfig') : get_option('pkgconfiglibdir') | |
e17e5ba9 MB |
95 | polkitpolicydir = join_paths(datadir, 'polkit-1/actions') |
96 | polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d') | |
97 | polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d') | |
98 | varlogdir = join_paths(localstatedir, 'log') | |
99 | xinitrcdir = join_paths(sysconfdir, 'X11/xinit/xinitrc.d') | |
8a38aac3 YW |
100 | rpmmacrosdir = get_option('rpmmacrosdir') |
101 | if rpmmacrosdir != 'no' | |
102 | rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir) | |
103 | endif | |
02fa054d | 104 | modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d') |
5c23128d ZJS |
105 | |
106 | # Our own paths | |
e17e5ba9 MB |
107 | pkgdatadir = join_paths(datadir, 'systemd') |
108 | environmentdir = join_paths(prefixdir, 'lib/environment.d') | |
109 | pkgsysconfdir = join_paths(sysconfdir, 'systemd') | |
110 | userunitdir = join_paths(prefixdir, 'lib/systemd/user') | |
111 | userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset') | |
112 | tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d') | |
113 | sysusersdir = join_paths(prefixdir, 'lib/sysusers.d') | |
114 | sysctldir = join_paths(prefixdir, 'lib/sysctl.d') | |
115 | binfmtdir = join_paths(prefixdir, 'lib/binfmt.d') | |
116 | modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d') | |
117 | networkdir = join_paths(rootprefixdir, 'lib/systemd/network') | |
118 | pkgincludedir = join_paths(includedir, 'systemd') | |
119 | systemgeneratordir = join_paths(rootlibexecdir, 'system-generators') | |
120 | usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators') | |
121 | systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators') | |
122 | userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators') | |
123 | systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown') | |
124 | systemsleepdir = join_paths(rootlibexecdir, 'system-sleep') | |
125 | systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system') | |
126 | systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset') | |
127 | udevlibexecdir = join_paths(rootprefixdir, 'lib/udev') | |
128 | udevhomedir = udevlibexecdir | |
129 | udevrulesdir = join_paths(udevlibexecdir, 'rules.d') | |
130 | udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d') | |
131 | catalogdir = join_paths(prefixdir, 'lib/systemd/catalog') | |
132 | kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d') | |
133 | factorydir = join_paths(datadir, 'factory') | |
e17e5ba9 MB |
134 | bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi') |
135 | testsdir = join_paths(prefixdir, 'lib/systemd/tests') | |
136 | systemdstatedir = join_paths(localstatedir, 'lib/systemd') | |
137 | catalogstatedir = join_paths(systemdstatedir, 'catalog') | |
138 | randomseeddir = join_paths(localstatedir, 'lib/systemd') | |
61d0578b | 139 | profiledir = join_paths(rootlibexecdir, 'portable', 'profile') |
5c23128d | 140 | |
75aaade1 TB |
141 | docdir = get_option('docdir') |
142 | if docdir == '' | |
143 | docdir = join_paths(datadir, 'doc/systemd') | |
144 | endif | |
145 | ||
5c23128d ZJS |
146 | dbuspolicydir = get_option('dbuspolicydir') |
147 | if dbuspolicydir == '' | |
37efbbd8 | 148 | dbuspolicydir = join_paths(datadir, 'dbus-1/system.d') |
5c23128d ZJS |
149 | endif |
150 | ||
151 | dbussessionservicedir = get_option('dbussessionservicedir') | |
152 | if dbussessionservicedir == '' | |
37efbbd8 | 153 | dbussessionservicedir = join_paths(datadir, 'dbus-1/services') |
5c23128d ZJS |
154 | endif |
155 | ||
156 | dbussystemservicedir = get_option('dbussystemservicedir') | |
157 | if dbussystemservicedir == '' | |
37efbbd8 | 158 | dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services') |
5c23128d ZJS |
159 | endif |
160 | ||
161 | pamlibdir = get_option('pamlibdir') | |
162 | if pamlibdir == '' | |
37efbbd8 | 163 | pamlibdir = join_paths(rootlibdir, 'security') |
5c23128d ZJS |
164 | endif |
165 | ||
166 | pamconfdir = get_option('pamconfdir') | |
167 | if pamconfdir == '' | |
37efbbd8 | 168 | pamconfdir = join_paths(sysconfdir, 'pam.d') |
5c23128d ZJS |
169 | endif |
170 | ||
444d5863 ZJS |
171 | memory_accounting_default = get_option('memory-accounting-default') |
172 | ||
5c23128d | 173 | conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir) |
e17e5ba9 | 174 | conf.set_quoted('SYSTEM_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'system')) |
5c23128d ZJS |
175 | conf.set_quoted('SYSTEM_DATA_UNIT_PATH', systemunitdir) |
176 | conf.set_quoted('SYSTEM_SYSVINIT_PATH', sysvinit_path) | |
177 | conf.set_quoted('SYSTEM_SYSVRCND_PATH', sysvrcnd_path) | |
2a4c156d ZJS |
178 | conf.set_quoted('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local')) |
179 | conf.set_quoted('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local')) | |
96164a39 | 180 | |
f7c5427c | 181 | conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper()) |
96164a39 | 182 | |
e17e5ba9 | 183 | conf.set_quoted('USER_CONFIG_UNIT_PATH', join_paths(pkgsysconfdir, 'user')) |
5c23128d ZJS |
184 | conf.set_quoted('USER_DATA_UNIT_PATH', userunitdir) |
185 | conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root')) | |
e17e5ba9 MB |
186 | conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database')) |
187 | conf.set_quoted('SYSTEMD_CGROUP_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent')) | |
188 | conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd')) | |
189 | conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck')) | |
da495a03 | 190 | conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs')) |
7f2806d5 | 191 | conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs')) |
e17e5ba9 MB |
192 | conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown')) |
193 | conf.set_quoted('SYSTEMD_SLEEP_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-sleep')) | |
194 | conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl')) | |
195 | conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent')) | |
196 | conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge')) | |
74344a17 | 197 | conf.set_quoted('ROOTPREFIX', rootprefixdir) |
3131bfe3 | 198 | conf.set_quoted('RANDOM_SEED_DIR', randomseeddir) |
e17e5ba9 MB |
199 | conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed')) |
200 | conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup')) | |
5c23128d ZJS |
201 | conf.set_quoted('SYSTEM_GENERATOR_PATH', systemgeneratordir) |
202 | conf.set_quoted('USER_GENERATOR_PATH', usergeneratordir) | |
203 | conf.set_quoted('SYSTEM_ENV_GENERATOR_PATH', systemenvgeneratordir) | |
204 | conf.set_quoted('USER_ENV_GENERATOR_PATH', userenvgeneratordir) | |
205 | conf.set_quoted('SYSTEM_SHUTDOWN_PATH', systemshutdowndir) | |
206 | conf.set_quoted('SYSTEM_SLEEP_PATH', systemsleepdir) | |
e17e5ba9 MB |
207 | conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map')) |
208 | conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map')) | |
5c23128d | 209 | conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) |
e17e5ba9 | 210 | conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent')) |
5c23128d ZJS |
211 | conf.set_quoted('LIBDIR', libdir) |
212 | conf.set_quoted('ROOTLIBDIR', rootlibdir) | |
213 | conf.set_quoted('ROOTLIBEXECDIR', rootlibexecdir) | |
214 | conf.set_quoted('BOOTLIBDIR', bootlibdir) | |
e17e5ba9 MB |
215 | conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull')) |
216 | conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import')) | |
217 | conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export')) | |
218 | conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg')) | |
219 | conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg')) | |
220 | conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd')) | |
444d5863 | 221 | conf.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'true' : 'false') |
7f672e86 | 222 | conf.set_quoted('MEMORY_ACCOUNTING_DEFAULT_YES_NO', memory_accounting_default ? 'yes' : 'no') |
5c23128d ZJS |
223 | |
224 | conf.set_quoted('ABS_BUILD_DIR', meson.build_root()) | |
225 | conf.set_quoted('ABS_SRC_DIR', meson.source_root()) | |
226 | ||
227 | substs.set('prefix', prefixdir) | |
3131bfe3 ZJS |
228 | substs.set('exec_prefix', prefixdir) |
229 | substs.set('libdir', libdir) | |
230 | substs.set('rootlibdir', rootlibdir) | |
231 | substs.set('includedir', includedir) | |
5c23128d | 232 | substs.set('pkgsysconfdir', pkgsysconfdir) |
3131bfe3 ZJS |
233 | substs.set('bindir', bindir) |
234 | substs.set('rootbindir', rootbindir) | |
5c23128d ZJS |
235 | substs.set('rootlibexecdir', rootlibexecdir) |
236 | substs.set('systemunitdir', systemunitdir) | |
237 | substs.set('userunitdir', userunitdir) | |
238 | substs.set('systempresetdir', systempresetdir) | |
239 | substs.set('userpresetdir', userpresetdir) | |
240 | substs.set('udevhwdbdir', udevhwdbdir) | |
241 | substs.set('udevrulesdir', udevrulesdir) | |
3131bfe3 | 242 | substs.set('udevlibexecdir', udevlibexecdir) |
424e80b4 | 243 | substs.set('environmentdir', environmentdir) |
5c23128d ZJS |
244 | substs.set('catalogdir', catalogdir) |
245 | substs.set('tmpfilesdir', tmpfilesdir) | |
246 | substs.set('sysusersdir', sysusersdir) | |
247 | substs.set('sysctldir', sysctldir) | |
248 | substs.set('binfmtdir', binfmtdir) | |
249 | substs.set('modulesloaddir', modulesloaddir) | |
424e80b4 | 250 | substs.set('modprobedir', modprobedir) |
5c23128d ZJS |
251 | substs.set('systemgeneratordir', systemgeneratordir) |
252 | substs.set('usergeneratordir', usergeneratordir) | |
253 | substs.set('systemenvgeneratordir', systemenvgeneratordir) | |
254 | substs.set('userenvgeneratordir', userenvgeneratordir) | |
255 | substs.set('systemshutdowndir', systemshutdowndir) | |
256 | substs.set('systemsleepdir', systemsleepdir) | |
2a4c156d ZJS |
257 | substs.set('VARLOGDIR', varlogdir) |
258 | substs.set('CERTIFICATEROOT', get_option('certificate-root')) | |
e17e5ba9 MB |
259 | substs.set('SYSTEMCTL', join_paths(rootbindir, 'systemctl')) |
260 | substs.set('RANDOM_SEED', join_paths(randomseeddir, 'random-seed')) | |
2a4c156d ZJS |
261 | substs.set('SYSTEM_SYSVINIT_PATH', sysvinit_path) |
262 | substs.set('SYSTEM_SYSVRCND_PATH', sysvrcnd_path) | |
263 | substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-local')) | |
264 | substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local')) | |
444d5863 | 265 | substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no') |
5c23128d ZJS |
266 | |
267 | ##################################################################### | |
268 | ||
269 | cc = meson.get_compiler('c') | |
270 | pkgconfig = import('pkgconfig') | |
6e2afb1c | 271 | check_compilation_sh = find_program('tools/meson-check-compilation.sh') |
b68dfb9e | 272 | meson_build_sh = find_program('tools/meson-build.sh') |
5c23128d | 273 | |
08318a2c AD |
274 | if get_option('tests') != 'false' |
275 | cxx = find_program('c++', required : false) | |
276 | if cxx.found() | |
277 | # Used only for tests | |
278 | add_languages('cpp') | |
279 | endif | |
94e2523b ZJS |
280 | endif |
281 | ||
31e57a35 JR |
282 | want_ossfuzz = get_option('oss-fuzz') |
283 | want_libfuzzer = get_option('llvm-fuzz') | |
284 | fuzzer_build = want_ossfuzz or want_libfuzzer | |
285 | if want_ossfuzz and want_libfuzzer | |
286 | error('only one of oss-fuzz and llvm-fuzz can be specified') | |
287 | endif | |
288 | if want_libfuzzer | |
289 | fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer') | |
290 | endif | |
291 | if want_ossfuzz | |
7db7d5b7 JR |
292 | fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine') |
293 | endif | |
294 | ||
30a4ddff YW |
295 | possible_cc_flags = [ |
296 | '-Wextra', | |
297 | '-Werror=undef', | |
298 | '-Wlogical-op', | |
299 | '-Wmissing-include-dirs', | |
300 | '-Wold-style-definition', | |
301 | '-Wpointer-arith', | |
302 | '-Winit-self', | |
30a4ddff YW |
303 | '-Wfloat-equal', |
304 | '-Wsuggest-attribute=noreturn', | |
305 | '-Werror=missing-prototypes', | |
306 | '-Werror=implicit-function-declaration', | |
307 | '-Werror=missing-declarations', | |
308 | '-Werror=return-type', | |
309 | '-Werror=incompatible-pointer-types', | |
310 | '-Werror=format=2', | |
311 | '-Wstrict-prototypes', | |
312 | '-Wredundant-decls', | |
313 | '-Wmissing-noreturn', | |
314 | '-Wimplicit-fallthrough=5', | |
315 | '-Wshadow', | |
316 | '-Wendif-labels', | |
317 | '-Wstrict-aliasing=2', | |
318 | '-Wwrite-strings', | |
319 | '-Werror=overflow', | |
b05ecb8c | 320 | '-Werror=shift-count-overflow', |
d28b67d4 | 321 | '-Werror=shift-overflow=2', |
30a4ddff YW |
322 | '-Wdate-time', |
323 | '-Wnested-externs', | |
324 | '-ffast-math', | |
325 | '-fno-common', | |
326 | '-fdiagnostics-show-option', | |
327 | '-fno-strict-aliasing', | |
328 | '-fvisibility=hidden', | |
329 | '-fstack-protector', | |
330 | '-fstack-protector-strong', | |
331 | '--param=ssp-buffer-size=4', | |
332 | ] | |
333 | ||
334 | # --as-needed and --no-undefined are provided by meson by default, | |
335 | # run mesonconf to see what is enabled | |
336 | possible_link_flags = [ | |
337 | '-Wl,-z,relro', | |
338 | '-Wl,-z,now', | |
339 | ] | |
5c23128d | 340 | |
7db7d5b7 JR |
341 | # the oss-fuzz fuzzers are not built with -fPIE, so don't |
342 | # enable it when we are linking against them | |
31e57a35 | 343 | if not fuzzer_build |
30a4ddff YW |
344 | possible_cc_flags += '-fPIE' |
345 | possible_link_flags += '-pie' | |
7db7d5b7 JR |
346 | endif |
347 | ||
30a4ddff YW |
348 | if cc.get_id() == 'clang' |
349 | possible_cc_flags += [ | |
350 | '-Wno-typedef-redefinition', | |
351 | '-Wno-gnu-variable-sized-type-not-at-end', | |
352 | ] | |
353 | endif | |
354 | ||
355 | if get_option('buildtype') != 'debug' | |
356 | possible_cc_flags += [ | |
357 | '-ffunction-sections', | |
358 | '-fdata-sections', | |
359 | ] | |
360 | ||
361 | possible_link_flags += '-Wl,--gc-sections' | |
362 | endif | |
363 | ||
364 | add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c') | |
7a6397d2 | 365 | add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c') |
30a4ddff | 366 | |
2c5434ad | 367 | # "negative" arguments: gcc on purpose does not return an error for "-Wno-" |
d40f5cc4 | 368 | # arguments, just emits a warning. So test for the "positive" version instead. |
2c5434ad ZJS |
369 | foreach arg : ['unused-parameter', |
370 | 'missing-field-initializers', | |
371 | 'unused-result', | |
fb1b5882 ZJS |
372 | 'format-signedness', |
373 | 'error=nonnull', # work-around for gcc 7.1 turning this on on its own | |
374 | ] | |
2c5434ad ZJS |
375 | if cc.has_argument('-W' + arg) |
376 | add_project_arguments('-Wno-' + arg, language : 'c') | |
377 | endif | |
378 | endforeach | |
379 | ||
9e70f2f8 | 380 | if cc.compiles(''' |
5c23128d ZJS |
381 | #include <time.h> |
382 | #include <inttypes.h> | |
383 | typedef uint64_t usec_t; | |
384 | usec_t now(clockid_t clock); | |
385 | int main(void) { | |
386 | struct timespec now; | |
387 | return 0; | |
388 | } | |
9e70f2f8 | 389 | ''', name : '-Werror=shadow with local shadowing') |
37efbbd8 | 390 | add_project_arguments('-Werror=shadow', language : 'c') |
5c23128d ZJS |
391 | endif |
392 | ||
9cc0e6e9 ZJS |
393 | cpp = ' '.join(cc.cmd_array()) + ' -E' |
394 | ||
5c23128d ZJS |
395 | ##################################################################### |
396 | # compilation result tests | |
397 | ||
2c201c21 ZJS |
398 | conf.set('_GNU_SOURCE', true) |
399 | conf.set('__SANE_USERSPACE_TYPES__', true) | |
5c23128d ZJS |
400 | |
401 | conf.set('SIZEOF_PID_T', cc.sizeof('pid_t', prefix : '#include <sys/types.h>')) | |
402 | conf.set('SIZEOF_UID_T', cc.sizeof('uid_t', prefix : '#include <sys/types.h>')) | |
403 | conf.set('SIZEOF_GID_T', cc.sizeof('gid_t', prefix : '#include <sys/types.h>')) | |
404 | conf.set('SIZEOF_DEV_T', cc.sizeof('dev_t', prefix : '#include <sys/types.h>')) | |
405 | conf.set('SIZEOF_INO_T', cc.sizeof('ino_t', prefix : '#include <sys/types.h>')) | |
406 | conf.set('SIZEOF_TIME_T', cc.sizeof('time_t', prefix : '#include <sys/time.h>')) | |
407 | conf.set('SIZEOF_RLIM_T', cc.sizeof('rlim_t', prefix : '#include <sys/resource.h>')) | |
408 | ||
409 | decl_headers = ''' | |
410 | #include <uchar.h> | |
411 | #include <linux/ethtool.h> | |
bce67bbe | 412 | #include <linux/fib_rules.h> |
4c2e1b39 | 413 | #include <sys/stat.h> |
5c23128d | 414 | ''' |
5c23128d ZJS |
415 | |
416 | foreach decl : ['char16_t', | |
417 | 'char32_t', | |
5c23128d | 418 | 'struct ethtool_link_settings', |
bce67bbe | 419 | 'struct fib_rule_uid_range', |
4c2e1b39 | 420 | 'struct statx', |
5c23128d | 421 | ] |
2c201c21 ZJS |
422 | |
423 | # We get -1 if the size cannot be determined | |
9c869d08 ZJS |
424 | have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0 |
425 | ||
426 | if decl == 'struct statx' | |
427 | if have | |
428 | want_linux_stat_h = false | |
429 | else | |
430 | have = cc.sizeof(decl, | |
431 | prefix : decl_headers + '#include <linux/stat.h>', | |
432 | args : '-D_GNU_SOURCE') > 0 | |
433 | want_linux_stat_h = have | |
434 | endif | |
435 | endif | |
436 | ||
349cc4a5 | 437 | conf.set10('HAVE_' + decl.underscorify().to_upper(), have) |
5c23128d ZJS |
438 | endforeach |
439 | ||
9c869d08 | 440 | conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h) |
75720bff | 441 | |
5c23128d ZJS |
442 | foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'], |
443 | ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'], | |
444 | ['IFLA_VRF_TABLE', 'linux/if_link.h'], | |
445 | ['IFLA_MACVLAN_FLAGS', 'linux/if_link.h'], | |
d384826f | 446 | ['IFLA_IPVLAN_FLAGS', 'linux/if_link.h'], |
5c23128d ZJS |
447 | ['IFLA_PHYS_PORT_ID', 'linux/if_link.h'], |
448 | ['IFLA_BOND_AD_INFO', 'linux/if_link.h'], | |
449 | ['IFLA_VLAN_PROTOCOL', 'linux/if_link.h'], | |
450 | ['IFLA_VXLAN_REMCSUM_NOPARTIAL', 'linux/if_link.h'], | |
451 | ['IFLA_VXLAN_GPE', 'linux/if_link.h'], | |
9dfed8dd | 452 | ['IFLA_GENEVE_LABEL', 'linux/if_link.h'], |
5c23128d ZJS |
453 | # if_tunnel.h is buggy and cannot be included on its own |
454 | ['IFLA_VTI_REMOTE', 'linux/if_tunnel.h', '#include <net/if.h>'], | |
455 | ['IFLA_IPTUN_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'], | |
456 | ['IFLA_GRE_ENCAP_DPORT', 'linux/if_tunnel.h', '#include <net/if.h>'], | |
457 | ['IFLA_BRIDGE_VLAN_INFO', 'linux/if_bridge.h'], | |
458 | ['IFLA_BRPORT_PROXYARP', 'linux/if_link.h'], | |
459 | ['IFLA_BRPORT_LEARNING_SYNC', 'linux/if_link.h'], | |
460 | ['IFLA_BR_VLAN_DEFAULT_PVID', 'linux/if_link.h'], | |
d384826f | 461 | ['IPVLAN_F_PRIVATE', 'linux/if_link.h'], |
5c23128d ZJS |
462 | ['NDA_IFINDEX', 'linux/neighbour.h'], |
463 | ['IFA_FLAGS', 'linux/if_addr.h'], | |
bce67bbe | 464 | ['FRA_UID_RANGE', 'linux/fib_rules.h'], |
5c23128d | 465 | ['LO_FLAGS_PARTSCAN', 'linux/loop.h'], |
d6df583c | 466 | ['VXCAN_INFO_PEER', 'linux/can/vxcan.h'], |
53cb501a SS |
467 | ['FOU_ATTR_REMCSUM_NOPARTIAL', 'linux/fou.h'], |
468 | ['FOU_CMD_GET', 'linux/fou.h'], | |
469 | ['FOU_ENCAP_GUE', 'linux/fou.h'], | |
5c23128d | 470 | ] |
37efbbd8 ZJS |
471 | prefix = decl.length() > 2 ? decl[2] : '' |
472 | have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix) | |
4b9545f1 | 473 | conf.set10('HAVE_' + decl[0], have) |
5c23128d ZJS |
474 | endforeach |
475 | ||
5c23128d | 476 | foreach ident : ['secure_getenv', '__secure_getenv'] |
349cc4a5 | 477 | conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident)) |
5c23128d ZJS |
478 | endforeach |
479 | ||
480 | foreach ident : [ | |
85db59b7 | 481 | ['memfd_create', '''#include <sys/mman.h>'''], |
7b961e40 LP |
482 | ['gettid', '''#include <sys/types.h> |
483 | #include <unistd.h>'''], | |
3c042add LP |
484 | ['pivot_root', '''#include <stdlib.h> |
485 | #include <unistd.h>'''], # no known header declares pivot_root | |
85db59b7 | 486 | ['name_to_handle_at', '''#include <sys/types.h> |
37efbbd8 ZJS |
487 | #include <sys/stat.h> |
488 | #include <fcntl.h>'''], | |
85db59b7 | 489 | ['setns', '''#include <sched.h>'''], |
2acfd0ff LP |
490 | ['renameat2', '''#include <stdio.h> |
491 | #include <fcntl.h>'''], | |
37efbbd8 ZJS |
492 | ['kcmp', '''#include <linux/kcmp.h>'''], |
493 | ['keyctl', '''#include <sys/types.h> | |
494 | #include <keyutils.h>'''], | |
85db59b7 | 495 | ['copy_file_range', '''#include <sys/syscall.h> |
37efbbd8 | 496 | #include <unistd.h>'''], |
71e5200f DM |
497 | ['bpf', '''#include <sys/syscall.h> |
498 | #include <unistd.h>'''], | |
4c2e1b39 LP |
499 | ['statx', '''#include <sys/types.h> |
500 | #include <sys/stat.h> | |
501 | #include <unistd.h>'''], | |
aa484f35 ZJS |
502 | ['explicit_bzero' , '''#include <string.h>'''], |
503 | ['reallocarray', '''#include <malloc.h>'''], | |
37efbbd8 ZJS |
504 | ] |
505 | ||
85db59b7 | 506 | have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') |
4b9545f1 | 507 | conf.set10('HAVE_' + ident[0].to_upper(), have) |
5c23128d ZJS |
508 | endforeach |
509 | ||
85db59b7 | 510 | if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''', args : '-D_GNU_SOURCE') |
349cc4a5 | 511 | conf.set10('USE_SYS_RANDOM_H', true) |
4b9545f1 | 512 | conf.set10('HAVE_GETRANDOM', true) |
4984c8be ZJS |
513 | else |
514 | have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''') | |
349cc4a5 | 515 | conf.set10('USE_SYS_RANDOM_H', false) |
4b9545f1 | 516 | conf.set10('HAVE_GETRANDOM', have) |
4984c8be ZJS |
517 | endif |
518 | ||
5c23128d ZJS |
519 | ##################################################################### |
520 | ||
521 | sed = find_program('sed') | |
5c23128d | 522 | awk = find_program('awk') |
d730e2d1 | 523 | m4 = find_program('m4') |
5c23128d | 524 | stat = find_program('stat') |
d68b342b | 525 | git = find_program('git', required : false) |
b68dfb9e | 526 | env = find_program('env') |
b1ffacb6 | 527 | perl = find_program('perl', required : false) |
5c23128d | 528 | |
7b76fce1 | 529 | meson_make_symlink = meson.source_root() + '/tools/meson-make-symlink.sh' |
94e75a54 | 530 | mkdir_p = 'mkdir -p $DESTDIR/@0@' |
d83f4f50 ZJS |
531 | test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh') |
532 | splash_bmp = files('test/splash.bmp') | |
94e75a54 | 533 | |
5c23128d ZJS |
534 | # if -Dxxx-path option is found, use that. Otherwise, check in $PATH, |
535 | # /usr/sbin, /sbin, and fall back to the default from middle column. | |
2fa645f1 | 536 | progs = [['quotaon', '/usr/sbin/quotaon' ], |
5c23128d | 537 | ['quotacheck', '/usr/sbin/quotacheck' ], |
5c23128d ZJS |
538 | ['kmod', '/usr/bin/kmod' ], |
539 | ['kexec', '/usr/sbin/kexec' ], | |
540 | ['sulogin', '/usr/sbin/sulogin' ], | |
541 | ['mount', '/usr/bin/mount', 'MOUNT_PATH'], | |
542 | ['umount', '/usr/bin/umount', 'UMOUNT_PATH'], | |
543 | ['loadkeys', '/usr/bin/loadkeys', 'KBD_LOADKEYS'], | |
544 | ['setfont', '/usr/bin/setfont', 'KBD_SETFONT'], | |
545 | ] | |
546 | foreach prog : progs | |
37efbbd8 ZJS |
547 | path = get_option(prog[0] + '-path') |
548 | if path != '' | |
549 | message('Using @1@ for @0@'.format(prog[0], path)) | |
550 | else | |
551 | exe = find_program(prog[0], | |
552 | '/usr/sbin/' + prog[0], | |
553 | '/sbin/' + prog[0], | |
554 | required: false) | |
555 | path = exe.found() ? exe.path() : prog[1] | |
556 | endif | |
557 | name = prog.length() > 2 ? prog[2] : prog[0].to_upper() | |
558 | conf.set_quoted(name, path) | |
559 | substs.set(name, path) | |
5c23128d ZJS |
560 | endforeach |
561 | ||
2fa645f1 MG |
562 | conf.set_quoted('TELINIT', get_option('telinit-path')) |
563 | ||
1276a9f6 | 564 | if run_command('ln', '--relative', '--help').returncode() != 0 |
cd001016 | 565 | error('ln does not support --relative (added in coreutils 8.16)') |
1276a9f6 | 566 | endif |
5c23128d ZJS |
567 | |
568 | ############################################################ | |
569 | ||
570 | gperf = find_program('gperf') | |
571 | ||
572 | gperf_test_format = ''' | |
573 | #include <string.h> | |
574 | const char * in_word_set(const char *, @0@); | |
575 | @1@ | |
576 | ''' | |
577 | gperf_snippet_format = 'echo foo,bar | @0@ -L ANSI-C' | |
578 | gperf_snippet = run_command('sh', '-c', gperf_snippet_format.format(gperf.path())) | |
579 | gperf_test = gperf_test_format.format('size_t', gperf_snippet.stdout()) | |
580 | if cc.compiles(gperf_test) | |
37efbbd8 | 581 | gperf_len_type = 'size_t' |
5c23128d | 582 | else |
37efbbd8 ZJS |
583 | gperf_test = gperf_test_format.format('unsigned', gperf_snippet.stdout()) |
584 | if cc.compiles(gperf_test) | |
585 | gperf_len_type = 'unsigned' | |
586 | else | |
587 | error('unable to determine gperf len type') | |
588 | endif | |
5c23128d ZJS |
589 | endif |
590 | message('gperf len type is @0@'.format(gperf_len_type)) | |
37efbbd8 ZJS |
591 | conf.set('GPERF_LEN_TYPE', gperf_len_type, |
592 | description : 'The type of gperf "len" parameter') | |
5c23128d ZJS |
593 | |
594 | ############################################################ | |
595 | ||
596 | if not cc.has_header('sys/capability.h') | |
37efbbd8 | 597 | error('POSIX caps headers not found') |
5c23128d | 598 | endif |
9f555bba BE |
599 | foreach header : ['crypt.h', |
600 | 'linux/btrfs.h', | |
5c23128d ZJS |
601 | 'linux/memfd.h', |
602 | 'linux/vm_sockets.h', | |
af8786b1 | 603 | 'sys/auxv.h', |
5c23128d ZJS |
604 | 'valgrind/memcheck.h', |
605 | 'valgrind/valgrind.h', | |
606 | ] | |
2c201c21 | 607 | |
349cc4a5 ZJS |
608 | conf.set10('HAVE_' + header.underscorify().to_upper(), |
609 | cc.has_header(header)) | |
5c23128d ZJS |
610 | endforeach |
611 | ||
612 | ############################################################ | |
613 | ||
614 | conf.set_quoted('FALLBACK_HOSTNAME', get_option('fallback-hostname')) | |
5248e7e1 ZJS |
615 | conf.set10('ENABLE_COMPAT_GATEWAY_HOSTNAME', get_option('compat-gateway-hostname')) |
616 | gateway_hostnames = ['_gateway'] + (conf.get('ENABLE_COMPAT_GATEWAY_HOSTNAME') == 1 ? ['gateway'] : []) | |
5c23128d ZJS |
617 | |
618 | default_hierarchy = get_option('default-hierarchy') | |
619 | conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy, | |
620 | description : 'default cgroup hierarchy as string') | |
621 | if default_hierarchy == 'legacy' | |
37efbbd8 | 622 | conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE') |
5c23128d | 623 | elif default_hierarchy == 'hybrid' |
37efbbd8 | 624 | conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD') |
5c23128d | 625 | else |
37efbbd8 | 626 | conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL') |
5c23128d ZJS |
627 | endif |
628 | ||
629 | time_epoch = get_option('time-epoch') | |
ac09340e | 630 | if time_epoch == -1 |
37efbbd8 | 631 | NEWS = files('NEWS') |
ac09340e | 632 | time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout().to_int() |
5c23128d | 633 | endif |
5c23128d ZJS |
634 | conf.set('TIME_EPOCH', time_epoch) |
635 | ||
636 | system_uid_max = get_option('system-uid-max') | |
ac09340e | 637 | if system_uid_max == -1 |
37efbbd8 ZJS |
638 | system_uid_max = run_command( |
639 | awk, | |
2f62cf35 CMOF |
640 | '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }', |
641 | '/etc/login.defs').stdout().strip() | |
642 | if system_uid_max == '' | |
ac09340e YW |
643 | system_uid_max = 999 |
644 | else | |
645 | system_uid_max = system_uid_max.to_int() | |
2f62cf35 | 646 | endif |
5c23128d | 647 | endif |
5c23128d ZJS |
648 | conf.set('SYSTEM_UID_MAX', system_uid_max) |
649 | substs.set('systemuidmax', system_uid_max) | |
5c23128d | 650 | |
5c23128d | 651 | system_gid_max = get_option('system-gid-max') |
ac09340e | 652 | if system_gid_max == -1 |
37efbbd8 ZJS |
653 | system_gid_max = run_command( |
654 | awk, | |
2f62cf35 CMOF |
655 | '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }', |
656 | '/etc/login.defs').stdout().strip() | |
657 | if system_gid_max == '' | |
ac09340e YW |
658 | system_gid_max = 999 |
659 | else | |
660 | system_gid_max = system_gid_max.to_int() | |
2f62cf35 | 661 | endif |
5c23128d | 662 | endif |
5c23128d ZJS |
663 | conf.set('SYSTEM_GID_MAX', system_gid_max) |
664 | substs.set('systemgidmax', system_gid_max) | |
5c23128d | 665 | |
ac09340e YW |
666 | dynamic_uid_min = get_option('dynamic-uid-min') |
667 | dynamic_uid_max = get_option('dynamic-uid-max') | |
87d5e4f2 LP |
668 | conf.set('DYNAMIC_UID_MIN', dynamic_uid_min) |
669 | conf.set('DYNAMIC_UID_MAX', dynamic_uid_max) | |
670 | substs.set('dynamicuidmin', dynamic_uid_min) | |
671 | substs.set('dynamicuidmax', dynamic_uid_max) | |
672 | ||
ac09340e YW |
673 | container_uid_base_min = get_option('container-uid-base-min') |
674 | container_uid_base_max = get_option('container-uid-base-max') | |
87d5e4f2 LP |
675 | conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min) |
676 | conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max) | |
677 | substs.set('containeruidbasemin', container_uid_base_min) | |
678 | substs.set('containeruidbasemax', container_uid_base_max) | |
679 | ||
afde4574 LP |
680 | nobody_user = get_option('nobody-user') |
681 | nobody_group = get_option('nobody-group') | |
682 | ||
2484bff3 CQ |
683 | if not meson.is_cross_build() |
684 | getent_result = run_command('getent', 'passwd', '65534') | |
685 | if getent_result.returncode() == 0 | |
686 | name = getent_result.stdout().split(':')[0] | |
687 | if name != nobody_user | |
688 | warning('\n' + | |
689 | '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) + | |
690 | 'Your build will result in an user table setup that is incompatible with the local system.') | |
691 | endif | |
afde4574 | 692 | endif |
2484bff3 CQ |
693 | id_result = run_command('id', '-u', nobody_user) |
694 | if id_result.returncode() == 0 | |
695 | id = id_result.stdout().to_int() | |
696 | if id != 65534 | |
697 | warning('\n' + | |
698 | '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) + | |
699 | 'Your build will result in an user table setup that is incompatible with the local system.') | |
700 | endif | |
afde4574 | 701 | endif |
afde4574 | 702 | |
2484bff3 CQ |
703 | getent_result = run_command('getent', 'group', '65534') |
704 | if getent_result.returncode() == 0 | |
705 | name = getent_result.stdout().split(':')[0] | |
706 | if name != nobody_group | |
707 | warning('\n' + | |
708 | '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) + | |
709 | 'Your build will result in an group table setup that is incompatible with the local system.') | |
710 | endif | |
afde4574 | 711 | endif |
2484bff3 CQ |
712 | id_result = run_command('id', '-g', nobody_group) |
713 | if id_result.returncode() == 0 | |
714 | id = id_result.stdout().to_int() | |
715 | if id != 65534 | |
716 | warning('\n' + | |
717 | 'The local group with the configured group name "@0@" of the nobody group does not have UID 65534 (it has @1@).\n'.format(nobody_group, id) + | |
718 | 'Your build will result in an group table setup that is incompatible with the local system.') | |
719 | endif | |
afde4574 LP |
720 | endif |
721 | endif | |
8374cc62 | 722 | if nobody_user != nobody_group and not (nobody_user == 'nobody' and nobody_group == 'nogroup') |
8ea9fad7 YW |
723 | warning('\n' + |
724 | 'The configured user name "@0@" and group name "@0@" of the nobody user/group are not equivalent.\n'.format(nobody_user, nobody_group) + | |
725 | 'Please re-check that both "nobody-user" and "nobody-group" options are correctly set.') | |
8374cc62 | 726 | endif |
afde4574 LP |
727 | |
728 | conf.set_quoted('NOBODY_USER_NAME', nobody_user) | |
729 | conf.set_quoted('NOBODY_GROUP_NAME', nobody_group) | |
60712021 YW |
730 | substs.set('NOBODY_USER_NAME', nobody_user) |
731 | substs.set('NOBODY_GROUP_NAME', nobody_group) | |
87d5e4f2 | 732 | |
5c23128d ZJS |
733 | tty_gid = get_option('tty-gid') |
734 | conf.set('TTY_GID', tty_gid) | |
2a4c156d | 735 | substs.set('TTY_GID', tty_gid) |
5c23128d | 736 | |
84786b8e | 737 | # Ensure provided GID argument is numeric, otherwise fallback to default assignment |
ac09340e YW |
738 | users_gid = get_option('users-gid') |
739 | substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid) | |
84786b8e | 740 | |
348b4437 YW |
741 | conf.set10('ENABLE_ADM_GROUP', get_option('adm-group')) |
742 | conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group')) | |
5c23128d | 743 | |
ace5e311 MB |
744 | dev_kvm_mode = get_option('dev-kvm-mode') |
745 | substs.set('DEV_KVM_MODE', dev_kvm_mode) | |
746 | conf.set10('DEV_KVM_UACCESS', dev_kvm_mode != '0666') | |
4e15a734 | 747 | substs.set('GROUP_RENDER_MODE', get_option('group-render-mode')) |
5c23128d | 748 | |
2a4c156d ZJS |
749 | kill_user_processes = get_option('default-kill-user-processes') |
750 | conf.set10('KILL_USER_PROCESSES', kill_user_processes) | |
c7f7e859 | 751 | conf.set_quoted('KILL_USER_PROCESSES_YES_NO', kill_user_processes ? 'yes' : 'no') |
2a4c156d | 752 | substs.set('KILL_USER_PROCESSES', kill_user_processes ? 'yes' : 'no') |
5c23128d | 753 | |
829257d1 ZJS |
754 | dns_servers = get_option('dns-servers') |
755 | conf.set_quoted('DNS_SERVERS', dns_servers) | |
756 | substs.set('DNS_SERVERS', dns_servers) | |
5c23128d | 757 | |
829257d1 ZJS |
758 | ntp_servers = get_option('ntp-servers') |
759 | conf.set_quoted('NTP_SERVERS', ntp_servers) | |
760 | substs.set('NTP_SERVERS', ntp_servers) | |
5c23128d ZJS |
761 | |
762 | conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) | |
763 | ||
3131bfe3 ZJS |
764 | substs.set('SUSHELL', get_option('debug-shell')) |
765 | substs.set('DEBUGTTY', get_option('debug-tty')) | |
766 | ||
349cc4a5 ZJS |
767 | enable_debug_hashmap = false |
768 | enable_debug_mmap_cache = false | |
8f6b442a | 769 | foreach name : get_option('debug-extra') |
ad7aa760 YW |
770 | if name == 'hashmap' |
771 | enable_debug_hashmap = true | |
772 | elif name == 'mmap-cache' | |
773 | enable_debug_mmap_cache = true | |
774 | else | |
775 | message('unknown debug option "@0@", ignoring'.format(name)) | |
776 | endif | |
777 | endforeach | |
349cc4a5 ZJS |
778 | conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap) |
779 | conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache) | |
671677da | 780 | |
d18cb393 ZJS |
781 | conf.set10('VALGRIND', get_option('valgrind')) |
782 | ||
5c23128d ZJS |
783 | ##################################################################### |
784 | ||
785 | threads = dependency('threads') | |
786 | librt = cc.find_library('rt') | |
787 | libm = cc.find_library('m') | |
788 | libdl = cc.find_library('dl') | |
789 | libcrypt = cc.find_library('crypt') | |
790 | ||
1800cc85 ZJS |
791 | libcap = dependency('libcap', required : false) |
792 | if not libcap.found() | |
793 | # Compat with Ubuntu 14.04 which ships libcap w/o .pc file | |
794 | libcap = cc.find_library('cap') | |
795 | endif | |
796 | ||
5c23128d | 797 | libmount = dependency('mount', |
c0b4b0f8 | 798 | version : fuzzer_build ? '>= 0' : '>= 2.30') |
5c23128d ZJS |
799 | |
800 | want_seccomp = get_option('seccomp') | |
31e57a35 | 801 | if want_seccomp != 'false' and not fuzzer_build |
37efbbd8 | 802 | libseccomp = dependency('libseccomp', |
9f0e9c01 | 803 | version : '>= 2.3.1', |
37efbbd8 | 804 | required : want_seccomp == 'true') |
349cc4a5 | 805 | have = libseccomp.found() |
5c23128d | 806 | else |
349cc4a5 | 807 | have = false |
37efbbd8 | 808 | libseccomp = [] |
5c23128d | 809 | endif |
349cc4a5 | 810 | conf.set10('HAVE_SECCOMP', have) |
5c23128d ZJS |
811 | |
812 | want_selinux = get_option('selinux') | |
31e57a35 | 813 | if want_selinux != 'false' and not fuzzer_build |
37efbbd8 ZJS |
814 | libselinux = dependency('libselinux', |
815 | version : '>= 2.1.9', | |
816 | required : want_selinux == 'true') | |
349cc4a5 | 817 | have = libselinux.found() |
5c23128d | 818 | else |
349cc4a5 | 819 | have = false |
37efbbd8 | 820 | libselinux = [] |
5c23128d | 821 | endif |
349cc4a5 | 822 | conf.set10('HAVE_SELINUX', have) |
5c23128d ZJS |
823 | |
824 | want_apparmor = get_option('apparmor') | |
31e57a35 | 825 | if want_apparmor != 'false' and not fuzzer_build |
37efbbd8 ZJS |
826 | libapparmor = dependency('libapparmor', |
827 | required : want_apparmor == 'true') | |
349cc4a5 | 828 | have = libapparmor.found() |
5c23128d | 829 | else |
349cc4a5 | 830 | have = false |
37efbbd8 | 831 | libapparmor = [] |
5c23128d | 832 | endif |
349cc4a5 | 833 | conf.set10('HAVE_APPARMOR', have) |
5c23128d | 834 | |
5c23128d ZJS |
835 | smack_run_label = get_option('smack-run-label') |
836 | if smack_run_label != '' | |
37efbbd8 | 837 | conf.set_quoted('SMACK_RUN_LABEL', smack_run_label) |
5c23128d ZJS |
838 | endif |
839 | ||
3ca0cb73 ZJS |
840 | want_polkit = get_option('polkit') |
841 | install_polkit = false | |
842 | install_polkit_pkla = false | |
31e57a35 | 843 | if want_polkit != 'false' and not fuzzer_build |
37efbbd8 | 844 | install_polkit = true |
3ca0cb73 | 845 | |
37efbbd8 ZJS |
846 | libpolkit = dependency('polkit-gobject-1', |
847 | required : false) | |
848 | if libpolkit.found() and libpolkit.version().version_compare('< 0.106') | |
849 | message('Old polkit detected, will install pkla files') | |
850 | install_polkit_pkla = true | |
851 | endif | |
3ca0cb73 | 852 | endif |
349cc4a5 | 853 | conf.set10('ENABLE_POLKIT', install_polkit) |
3ca0cb73 | 854 | |
36f0387e | 855 | want_acl = get_option('acl') |
31e57a35 | 856 | if want_acl != 'false' and not fuzzer_build |
36f0387e | 857 | libacl = cc.find_library('acl', required : want_acl == 'true') |
349cc4a5 | 858 | have = libacl.found() |
36f0387e | 859 | else |
349cc4a5 | 860 | have = false |
36f0387e ZJS |
861 | libacl = [] |
862 | endif | |
349cc4a5 | 863 | conf.set10('HAVE_ACL', have) |
36f0387e | 864 | |
5c23128d | 865 | want_audit = get_option('audit') |
31e57a35 | 866 | if want_audit != 'false' and not fuzzer_build |
37efbbd8 | 867 | libaudit = dependency('audit', required : want_audit == 'true') |
349cc4a5 | 868 | have = libaudit.found() |
5c23128d | 869 | else |
349cc4a5 | 870 | have = false |
37efbbd8 | 871 | libaudit = [] |
5c23128d | 872 | endif |
349cc4a5 | 873 | conf.set10('HAVE_AUDIT', have) |
5c23128d ZJS |
874 | |
875 | want_blkid = get_option('blkid') | |
31e57a35 | 876 | if want_blkid != 'false' and not fuzzer_build |
37efbbd8 | 877 | libblkid = dependency('blkid', required : want_blkid == 'true') |
349cc4a5 | 878 | have = libblkid.found() |
5c23128d | 879 | else |
349cc4a5 | 880 | have = false |
37efbbd8 | 881 | libblkid = [] |
5c23128d | 882 | endif |
349cc4a5 | 883 | conf.set10('HAVE_BLKID', have) |
5c23128d ZJS |
884 | |
885 | want_kmod = get_option('kmod') | |
31e57a35 | 886 | if want_kmod != 'false' and not fuzzer_build |
37efbbd8 ZJS |
887 | libkmod = dependency('libkmod', |
888 | version : '>= 15', | |
889 | required : want_kmod == 'true') | |
349cc4a5 | 890 | have = libkmod.found() |
5c23128d | 891 | else |
349cc4a5 | 892 | have = false |
37efbbd8 | 893 | libkmod = [] |
5c23128d | 894 | endif |
349cc4a5 | 895 | conf.set10('HAVE_KMOD', have) |
5c23128d ZJS |
896 | |
897 | want_pam = get_option('pam') | |
31e57a35 | 898 | if want_pam != 'false' and not fuzzer_build |
37efbbd8 ZJS |
899 | libpam = cc.find_library('pam', required : want_pam == 'true') |
900 | libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true') | |
349cc4a5 | 901 | have = libpam.found() and libpam_misc.found() |
5c23128d | 902 | else |
349cc4a5 | 903 | have = false |
37efbbd8 ZJS |
904 | libpam = [] |
905 | libpam_misc = [] | |
5c23128d | 906 | endif |
349cc4a5 | 907 | conf.set10('HAVE_PAM', have) |
5c23128d ZJS |
908 | |
909 | want_microhttpd = get_option('microhttpd') | |
31e57a35 | 910 | if want_microhttpd != 'false' and not fuzzer_build |
37efbbd8 ZJS |
911 | libmicrohttpd = dependency('libmicrohttpd', |
912 | version : '>= 0.9.33', | |
913 | required : want_microhttpd == 'true') | |
349cc4a5 | 914 | have = libmicrohttpd.found() |
5c23128d | 915 | else |
349cc4a5 | 916 | have = false |
37efbbd8 | 917 | libmicrohttpd = [] |
5c23128d | 918 | endif |
349cc4a5 | 919 | conf.set10('HAVE_MICROHTTPD', have) |
5c23128d ZJS |
920 | |
921 | want_libcryptsetup = get_option('libcryptsetup') | |
31e57a35 | 922 | if want_libcryptsetup != 'false' and not fuzzer_build |
37efbbd8 ZJS |
923 | libcryptsetup = dependency('libcryptsetup', |
924 | version : '>= 1.6.0', | |
925 | required : want_libcryptsetup == 'true') | |
349cc4a5 | 926 | have = libcryptsetup.found() |
5c23128d | 927 | else |
349cc4a5 | 928 | have = false |
37efbbd8 | 929 | libcryptsetup = [] |
5c23128d | 930 | endif |
349cc4a5 | 931 | conf.set10('HAVE_LIBCRYPTSETUP', have) |
5c23128d ZJS |
932 | |
933 | want_libcurl = get_option('libcurl') | |
31e57a35 | 934 | if want_libcurl != 'false' and not fuzzer_build |
37efbbd8 ZJS |
935 | libcurl = dependency('libcurl', |
936 | version : '>= 7.32.0', | |
937 | required : want_libcurl == 'true') | |
349cc4a5 | 938 | have = libcurl.found() |
5c23128d | 939 | else |
349cc4a5 | 940 | have = false |
37efbbd8 | 941 | libcurl = [] |
5c23128d | 942 | endif |
349cc4a5 | 943 | conf.set10('HAVE_LIBCURL', have) |
5c23128d ZJS |
944 | |
945 | want_libidn = get_option('libidn') | |
87057e24 ZJS |
946 | want_libidn2 = get_option('libidn2') |
947 | if want_libidn == 'true' and want_libidn2 == 'true' | |
948 | error('libidn and libidn2 cannot be requested simultaneously') | |
949 | endif | |
950 | ||
31e57a35 | 951 | if want_libidn != 'false' and want_libidn2 != 'true' and not fuzzer_build |
7f7ab228 ZJS |
952 | libidn = dependency('libidn', |
953 | required : want_libidn == 'true') | |
349cc4a5 | 954 | have = libidn.found() |
87057e24 | 955 | else |
349cc4a5 | 956 | have = false |
87057e24 ZJS |
957 | libidn = [] |
958 | endif | |
349cc4a5 | 959 | conf.set10('HAVE_LIBIDN', have) |
31e57a35 | 960 | if not have and want_libidn2 != 'false' and not fuzzer_build |
7f7ab228 ZJS |
961 | # libidn is used for both libidn and libidn2 objects |
962 | libidn = dependency('libidn2', | |
963 | required : want_libidn2 == 'true') | |
349cc4a5 ZJS |
964 | have = libidn.found() |
965 | else | |
966 | have = false | |
5c23128d | 967 | endif |
349cc4a5 | 968 | conf.set10('HAVE_LIBIDN2', have) |
5c23128d ZJS |
969 | |
970 | want_libiptc = get_option('libiptc') | |
31e57a35 | 971 | if want_libiptc != 'false' and not fuzzer_build |
37efbbd8 ZJS |
972 | libiptc = dependency('libiptc', |
973 | required : want_libiptc == 'true') | |
349cc4a5 | 974 | have = libiptc.found() |
5c23128d | 975 | else |
349cc4a5 | 976 | have = false |
37efbbd8 | 977 | libiptc = [] |
5c23128d | 978 | endif |
349cc4a5 | 979 | conf.set10('HAVE_LIBIPTC', have) |
5c23128d ZJS |
980 | |
981 | want_qrencode = get_option('qrencode') | |
31e57a35 | 982 | if want_qrencode != 'false' and not fuzzer_build |
37efbbd8 ZJS |
983 | libqrencode = dependency('libqrencode', |
984 | required : want_qrencode == 'true') | |
349cc4a5 | 985 | have = libqrencode.found() |
5c23128d | 986 | else |
349cc4a5 | 987 | have = false |
37efbbd8 | 988 | libqrencode = [] |
5c23128d | 989 | endif |
349cc4a5 | 990 | conf.set10('HAVE_QRENCODE', have) |
5c23128d | 991 | |
a44fb601 | 992 | want_gcrypt = get_option('gcrypt') |
31e57a35 | 993 | if want_gcrypt != 'false' and not fuzzer_build |
a44fb601 ZJS |
994 | libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true') |
995 | libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true') | |
349cc4a5 | 996 | have = libgcrypt.found() and libgpg_error.found() |
a44fb601 | 997 | else |
349cc4a5 ZJS |
998 | have = false |
999 | endif | |
1000 | if not have | |
1001 | # link to neither of the libs if one is not found | |
a44fb601 ZJS |
1002 | libgcrypt = [] |
1003 | libgpg_error = [] | |
1004 | endif | |
349cc4a5 | 1005 | conf.set10('HAVE_GCRYPT', have) |
a44fb601 | 1006 | |
5c23128d | 1007 | want_gnutls = get_option('gnutls') |
31e57a35 | 1008 | if want_gnutls != 'false' and not fuzzer_build |
37efbbd8 ZJS |
1009 | libgnutls = dependency('gnutls', |
1010 | version : '>= 3.1.4', | |
1011 | required : want_gnutls == 'true') | |
349cc4a5 | 1012 | have = libgnutls.found() |
5c23128d | 1013 | else |
349cc4a5 | 1014 | have = false |
37efbbd8 | 1015 | libgnutls = [] |
5c23128d | 1016 | endif |
349cc4a5 | 1017 | conf.set10('HAVE_GNUTLS', have) |
5c23128d | 1018 | |
096cbdce IT |
1019 | want_openssl = get_option('openssl') |
1020 | if want_openssl != 'false' and not fuzzer_build | |
1021 | libopenssl = dependency('openssl', | |
1022 | version : '>= 1.1.0', | |
1023 | required : want_openssl == 'true') | |
1024 | have = libopenssl.found() | |
1025 | else | |
1026 | have = false | |
1027 | libopenssl = [] | |
1028 | endif | |
1029 | conf.set10('HAVE_OPENSSL', have) | |
1030 | ||
5c23128d | 1031 | want_elfutils = get_option('elfutils') |
31e57a35 | 1032 | if want_elfutils != 'false' and not fuzzer_build |
37efbbd8 ZJS |
1033 | libdw = dependency('libdw', |
1034 | required : want_elfutils == 'true') | |
349cc4a5 | 1035 | have = libdw.found() |
5c23128d | 1036 | else |
349cc4a5 | 1037 | have = false |
37efbbd8 | 1038 | libdw = [] |
5c23128d | 1039 | endif |
349cc4a5 | 1040 | conf.set10('HAVE_ELFUTILS', have) |
5c23128d ZJS |
1041 | |
1042 | want_zlib = get_option('zlib') | |
31e57a35 | 1043 | if want_zlib != 'false' and not fuzzer_build |
37efbbd8 ZJS |
1044 | libz = dependency('zlib', |
1045 | required : want_zlib == 'true') | |
349cc4a5 | 1046 | have = libz.found() |
5c23128d | 1047 | else |
349cc4a5 | 1048 | have = false |
37efbbd8 | 1049 | libz = [] |
5c23128d | 1050 | endif |
349cc4a5 | 1051 | conf.set10('HAVE_ZLIB', have) |
5c23128d ZJS |
1052 | |
1053 | want_bzip2 = get_option('bzip2') | |
31e57a35 | 1054 | if want_bzip2 != 'false' and not fuzzer_build |
37efbbd8 ZJS |
1055 | libbzip2 = cc.find_library('bz2', |
1056 | required : want_bzip2 == 'true') | |
349cc4a5 | 1057 | have = libbzip2.found() |
5c23128d | 1058 | else |
349cc4a5 | 1059 | have = false |
37efbbd8 | 1060 | libbzip2 = [] |
5c23128d | 1061 | endif |
349cc4a5 | 1062 | conf.set10('HAVE_BZIP2', have) |
5c23128d ZJS |
1063 | |
1064 | want_xz = get_option('xz') | |
31e57a35 | 1065 | if want_xz != 'false' and not fuzzer_build |
37efbbd8 ZJS |
1066 | libxz = dependency('liblzma', |
1067 | required : want_xz == 'true') | |
349cc4a5 | 1068 | have = libxz.found() |
5c23128d | 1069 | else |
349cc4a5 | 1070 | have = false |
37efbbd8 | 1071 | libxz = [] |
5c23128d | 1072 | endif |
349cc4a5 | 1073 | conf.set10('HAVE_XZ', have) |
5c23128d ZJS |
1074 | |
1075 | want_lz4 = get_option('lz4') | |
31e57a35 | 1076 | if want_lz4 != 'false' and not fuzzer_build |
37efbbd8 ZJS |
1077 | liblz4 = dependency('liblz4', |
1078 | required : want_lz4 == 'true') | |
349cc4a5 | 1079 | have = liblz4.found() |
5c23128d | 1080 | else |
349cc4a5 | 1081 | have = false |
37efbbd8 | 1082 | liblz4 = [] |
5c23128d | 1083 | endif |
349cc4a5 | 1084 | conf.set10('HAVE_LZ4', have) |
5c23128d | 1085 | |
a44fb601 | 1086 | want_xkbcommon = get_option('xkbcommon') |
31e57a35 | 1087 | if want_xkbcommon != 'false' and not fuzzer_build |
a44fb601 ZJS |
1088 | libxkbcommon = dependency('xkbcommon', |
1089 | version : '>= 0.3.0', | |
1090 | required : want_xkbcommon == 'true') | |
349cc4a5 | 1091 | have = libxkbcommon.found() |
a44fb601 | 1092 | else |
349cc4a5 | 1093 | have = false |
a44fb601 ZJS |
1094 | libxkbcommon = [] |
1095 | endif | |
349cc4a5 | 1096 | conf.set10('HAVE_XKBCOMMON', have) |
a44fb601 | 1097 | |
c4c978a0 ZJS |
1098 | want_pcre2 = get_option('pcre2') |
1099 | if want_pcre2 != 'false' | |
1100 | libpcre2 = dependency('libpcre2-8', | |
1101 | required : want_pcre2 == 'true') | |
1102 | have = libpcre2.found() | |
1103 | else | |
1104 | have = false | |
1105 | libpcre2 = [] | |
1106 | endif | |
1107 | conf.set10('HAVE_PCRE2', have) | |
1108 | ||
69e96427 | 1109 | want_glib = get_option('glib') |
31e57a35 | 1110 | if want_glib != 'false' and not fuzzer_build |
37efbbd8 ZJS |
1111 | libglib = dependency('glib-2.0', |
1112 | version : '>= 2.22.0', | |
1113 | required : want_glib == 'true') | |
1114 | libgobject = dependency('gobject-2.0', | |
1115 | version : '>= 2.22.0', | |
1116 | required : want_glib == 'true') | |
1117 | libgio = dependency('gio-2.0', | |
1118 | required : want_glib == 'true') | |
2c201c21 | 1119 | have = libglib.found() and libgobject.found() and libgio.found() |
69e96427 | 1120 | else |
349cc4a5 | 1121 | have = false |
37efbbd8 ZJS |
1122 | libglib = [] |
1123 | libgobject = [] | |
1124 | libgio = [] | |
69e96427 | 1125 | endif |
349cc4a5 | 1126 | conf.set10('HAVE_GLIB', have) |
69e96427 ZJS |
1127 | |
1128 | want_dbus = get_option('dbus') | |
31e57a35 | 1129 | if want_dbus != 'false' and not fuzzer_build |
37efbbd8 ZJS |
1130 | libdbus = dependency('dbus-1', |
1131 | version : '>= 1.3.2', | |
1132 | required : want_dbus == 'true') | |
349cc4a5 | 1133 | have = libdbus.found() |
69e96427 | 1134 | else |
349cc4a5 | 1135 | have = false |
37efbbd8 | 1136 | libdbus = [] |
69e96427 | 1137 | endif |
349cc4a5 | 1138 | conf.set10('HAVE_DBUS', have) |
69e96427 | 1139 | |
42303dcb | 1140 | default_dnssec = get_option('default-dnssec') |
31e57a35 | 1141 | if fuzzer_build |
b4081f3e JR |
1142 | default_dnssec = 'no' |
1143 | endif | |
349cc4a5 | 1144 | if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0 |
42303dcb YW |
1145 | message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.') |
1146 | default_dnssec = 'no' | |
1147 | endif | |
1148 | conf.set('DEFAULT_DNSSEC_MODE', | |
1149 | 'DNSSEC_' + default_dnssec.underscorify().to_upper()) | |
1150 | substs.set('DEFAULT_DNSSEC_MODE', default_dnssec) | |
1151 | ||
56ddbf10 YW |
1152 | dns_over_tls = get_option('dns-over-tls') |
1153 | if dns_over_tls != 'false' | |
096cbdce IT |
1154 | if dns_over_tls == 'openssl' |
1155 | have_gnutls = false | |
1156 | else | |
1157 | have_gnutls = (conf.get('HAVE_GNUTLS') == 1 and libgnutls.version().version_compare('>= 3.5.3')) | |
1158 | if dns_over_tls == 'gnutls' and not have_gnutls | |
1159 | error('DNS-over-TLS support was requested with gnutls, but dependencies are not available') | |
1160 | endif | |
56ddbf10 | 1161 | endif |
096cbdce IT |
1162 | if dns_over_tls == 'gnutls' or have_gnutls |
1163 | have_openssl = false | |
1164 | else | |
1165 | have_openssl = conf.get('HAVE_OPENSSL') == 1 | |
1166 | if dns_over_tls != 'auto' and not have_openssl | |
1167 | str = dns_over_tls == 'openssl' ? ' with openssl' : '' | |
1168 | error('DNS-over-TLS support was requested$0$, but dependencies are not available'.format(str)) | |
1169 | endif | |
1170 | endif | |
1171 | have = have_gnutls or have_openssl | |
56ddbf10 | 1172 | else |
096cbdce | 1173 | have = have_gnutls = have_openssl = false |
56ddbf10 YW |
1174 | endif |
1175 | conf.set10('ENABLE_DNS_OVER_TLS', have) | |
096cbdce IT |
1176 | conf.set10('DNS_OVER_TLS_USE_GNUTLS', have_gnutls) |
1177 | conf.set10('DNS_OVER_TLS_USE_OPENSSL', have_openssl) | |
56ddbf10 | 1178 | |
c9299be2 | 1179 | default_dns_over_tls = get_option('default-dns-over-tls') |
5d67a7ae | 1180 | if fuzzer_build |
c9299be2 | 1181 | default_dns_over_tls = 'no' |
5d67a7ae | 1182 | endif |
56ddbf10 YW |
1183 | if default_dns_over_tls != 'no' and conf.get('ENABLE_DNS_OVER_TLS') == 0 |
1184 | message('default-dns-over-tls cannot be set to opportunistic when DNS-over-TLS support is disabled. Setting default-dns-over-tls to no.') | |
c9299be2 | 1185 | default_dns_over_tls = 'no' |
5d67a7ae | 1186 | endif |
c9299be2 IT |
1187 | conf.set('DEFAULT_DNS_OVER_TLS_MODE', |
1188 | 'DNS_OVER_TLS_' + default_dns_over_tls.underscorify().to_upper()) | |
1189 | substs.set('DEFAULT_DNS_OVER_TLS_MODE', default_dns_over_tls) | |
5d67a7ae | 1190 | |
5c23128d | 1191 | want_importd = get_option('importd') |
4390be30 | 1192 | if want_importd != 'false' |
349cc4a5 ZJS |
1193 | have = (conf.get('HAVE_LIBCURL') == 1 and |
1194 | conf.get('HAVE_ZLIB') == 1 and | |
1195 | conf.get('HAVE_BZIP2') == 1 and | |
1196 | conf.get('HAVE_XZ') == 1 and | |
1197 | conf.get('HAVE_GCRYPT') == 1) | |
1198 | if want_importd == 'true' and not have | |
37efbbd8 ZJS |
1199 | error('importd support was requested, but dependencies are not available') |
1200 | endif | |
349cc4a5 ZJS |
1201 | else |
1202 | have = false | |
5c23128d | 1203 | endif |
349cc4a5 | 1204 | conf.set10('ENABLE_IMPORTD', have) |
5c23128d ZJS |
1205 | |
1206 | want_remote = get_option('remote') | |
4390be30 | 1207 | if want_remote != 'false' |
349cc4a5 ZJS |
1208 | have_deps = [conf.get('HAVE_MICROHTTPD') == 1, |
1209 | conf.get('HAVE_LIBCURL') == 1] | |
37efbbd8 ZJS |
1210 | # sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so |
1211 | # it's possible to build one without the other. Complain only if | |
1212 | # support was explictly requested. The auxiliary files like sysusers | |
1213 | # config should be installed when any of the programs are built. | |
1214 | if want_remote == 'true' and not (have_deps[0] and have_deps[1]) | |
1215 | error('remote support was requested, but dependencies are not available') | |
1216 | endif | |
349cc4a5 ZJS |
1217 | have = have_deps[0] or have_deps[1] |
1218 | else | |
1219 | have = false | |
5c23128d | 1220 | endif |
349cc4a5 | 1221 | conf.set10('ENABLE_REMOTE', have) |
5c23128d | 1222 | |
a9149d87 ZJS |
1223 | foreach term : ['utmp', |
1224 | 'hibernate', | |
1225 | 'environment-d', | |
1226 | 'binfmt', | |
1227 | 'coredump', | |
1228 | 'resolve', | |
1229 | 'logind', | |
1230 | 'hostnamed', | |
1231 | 'localed', | |
1232 | 'machined', | |
61d0578b | 1233 | 'portabled', |
a9149d87 ZJS |
1234 | 'networkd', |
1235 | 'timedated', | |
1236 | 'timesyncd', | |
a9149d87 ZJS |
1237 | 'firstboot', |
1238 | 'randomseed', | |
1239 | 'backlight', | |
1240 | 'vconsole', | |
1241 | 'quotacheck', | |
1242 | 'sysusers', | |
1243 | 'tmpfiles', | |
1244 | 'hwdb', | |
1245 | 'rfkill', | |
1246 | 'ldconfig', | |
1247 | 'efi', | |
1248 | 'tpm', | |
1249 | 'ima', | |
1250 | 'smack', | |
1251 | 'gshadow', | |
1252 | 'idn', | |
08540a95 | 1253 | 'nss-myhostname', |
a9149d87 ZJS |
1254 | 'nss-systemd'] |
1255 | have = get_option(term) | |
1256 | name = 'ENABLE_' + term.underscorify().to_upper() | |
1257 | conf.set10(name, have) | |
5c23128d ZJS |
1258 | endforeach |
1259 | ||
08540a95 YW |
1260 | foreach tuple : [['nss-mymachines', 'machined'], |
1261 | ['nss-resolve', 'resolve']] | |
1262 | want = get_option(tuple[0]) | |
1263 | if want != 'false' | |
1264 | have = get_option(tuple[1]) | |
1265 | if want == 'true' and not have | |
1266 | error('@0@ is requested but @1@ is disabled'.format(tuple[0], tuple[1])) | |
1267 | endif | |
1268 | else | |
1269 | have = false | |
1270 | endif | |
1271 | name = 'ENABLE_' + tuple[0].underscorify().to_upper() | |
1272 | conf.set10(name, have) | |
1273 | endforeach | |
1274 | ||
1275 | enable_nss = false | |
1276 | foreach term : ['ENABLE_NSS_MYHOSTNAME', | |
1277 | 'ENABLE_NSS_MYMACHINES', | |
1278 | 'ENABLE_NSS_RESOLVE', | |
1279 | 'ENABLE_NSS_SYSTEMD'] | |
1280 | if conf.get(term) == 1 | |
1281 | enable_nss = true | |
1282 | endif | |
1283 | endforeach | |
1284 | conf.set10('ENABLE_NSS', enable_nss) | |
1285 | ||
348b4437 | 1286 | conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd')) |
6129ec85 | 1287 | |
69e96427 | 1288 | want_tests = get_option('tests') |
572baca1 | 1289 | install_tests = get_option('install-tests') |
b68dfb9e | 1290 | slow_tests = get_option('slow-tests') |
69e96427 | 1291 | tests = [] |
7db7d5b7 | 1292 | fuzzers = [] |
69e96427 | 1293 | |
b68dfb9e | 1294 | conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests) |
00d82c81 | 1295 | |
5c23128d ZJS |
1296 | ##################################################################### |
1297 | ||
1298 | if get_option('efi') | |
37efbbd8 | 1299 | efi_arch = host_machine.cpu_family() |
b710072d | 1300 | |
6800fe7f | 1301 | if efi_arch == 'x86' |
37efbbd8 | 1302 | EFI_MACHINE_TYPE_NAME = 'ia32' |
6800fe7f | 1303 | gnu_efi_arch = 'ia32' |
37efbbd8 ZJS |
1304 | elif efi_arch == 'x86_64' |
1305 | EFI_MACHINE_TYPE_NAME = 'x64' | |
6800fe7f | 1306 | gnu_efi_arch = 'x86_64' |
37efbbd8 ZJS |
1307 | elif efi_arch == 'arm' |
1308 | EFI_MACHINE_TYPE_NAME = 'arm' | |
6800fe7f | 1309 | gnu_efi_arch = 'arm' |
37efbbd8 ZJS |
1310 | elif efi_arch == 'aarch64' |
1311 | EFI_MACHINE_TYPE_NAME = 'aa64' | |
6800fe7f | 1312 | gnu_efi_arch = 'aarch64' |
37efbbd8 ZJS |
1313 | else |
1314 | EFI_MACHINE_TYPE_NAME = '' | |
6800fe7f | 1315 | gnu_efi_arch = '' |
37efbbd8 | 1316 | endif |
5c23128d | 1317 | |
349cc4a5 | 1318 | have = true |
37efbbd8 | 1319 | conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME) |
80c6fce8 | 1320 | |
ac09340e | 1321 | conf.set('SD_TPM_PCR', get_option('tpm-pcrindex')) |
349cc4a5 ZJS |
1322 | else |
1323 | have = false | |
5c23128d | 1324 | endif |
349cc4a5 | 1325 | conf.set10('ENABLE_EFI', have) |
5c23128d ZJS |
1326 | |
1327 | ##################################################################### | |
1328 | ||
1329 | config_h = configure_file( | |
37efbbd8 ZJS |
1330 | output : 'config.h', |
1331 | configuration : conf) | |
5c23128d | 1332 | |
348b4437 YW |
1333 | meson_apply_m4 = find_program('tools/meson-apply-m4.sh') |
1334 | ||
5c23128d ZJS |
1335 | includes = include_directories('src/basic', |
1336 | 'src/shared', | |
1337 | 'src/systemd', | |
1338 | 'src/journal', | |
a38f7fec | 1339 | 'src/journal-remote', |
97d90615 | 1340 | 'src/nspawn', |
5c23128d ZJS |
1341 | 'src/resolve', |
1342 | 'src/timesync', | |
5c3376ef | 1343 | 'src/time-wait-sync', |
5c23128d ZJS |
1344 | 'src/login', |
1345 | 'src/udev', | |
1346 | 'src/libudev', | |
1347 | 'src/core', | |
1348 | 'src/libsystemd/sd-bus', | |
1349 | 'src/libsystemd/sd-device', | |
1350 | 'src/libsystemd/sd-hwdb', | |
1351 | 'src/libsystemd/sd-id128', | |
1352 | 'src/libsystemd/sd-netlink', | |
1353 | 'src/libsystemd/sd-network', | |
1354 | 'src/libsystemd-network', | |
2d4ceca8 | 1355 | '.') |
5c23128d ZJS |
1356 | |
1357 | add_project_arguments('-include', 'config.h', language : 'c') | |
1358 | ||
5c23128d ZJS |
1359 | subdir('po') |
1360 | subdir('catalog') | |
1361 | subdir('src/systemd') | |
1362 | subdir('src/basic') | |
1363 | subdir('src/libsystemd') | |
1364 | subdir('src/libsystemd-network') | |
5c23128d | 1365 | subdir('src/journal') |
5c23128d | 1366 | subdir('src/login') |
5c23128d ZJS |
1367 | |
1368 | libjournal_core = static_library( | |
37efbbd8 ZJS |
1369 | 'journal-core', |
1370 | libjournal_core_sources, | |
1371 | journald_gperf_c, | |
1372 | include_directories : includes, | |
1373 | install : false) | |
5c23128d | 1374 | |
37ab1a25 | 1375 | libsystemd_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsystemd_sym) |
5c23128d | 1376 | libsystemd = shared_library( |
37efbbd8 | 1377 | 'systemd', |
7f1ea2cc | 1378 | 'src/systemd/sd-id128.h', # pick a header file at random to work around old meson bug |
56d50ab1 | 1379 | version : libsystemd_version, |
37efbbd8 ZJS |
1380 | include_directories : includes, |
1381 | link_args : ['-shared', | |
1382 | '-Wl,--version-script=' + libsystemd_sym_path], | |
34e221a5 ZJS |
1383 | link_with : [libbasic, |
1384 | libbasic_gcrypt], | |
5e3cec87 ZJS |
1385 | link_whole : [libsystemd_static, |
1386 | libjournal_client], | |
37efbbd8 ZJS |
1387 | dependencies : [threads, |
1388 | librt, | |
1389 | libxz, | |
1390 | liblz4], | |
1391 | link_depends : libsystemd_sym, | |
1392 | install : true, | |
1393 | install_dir : rootlibdir) | |
5c23128d | 1394 | |
70848ecf DC |
1395 | static_libsystemd = get_option('static-libsystemd') |
1396 | static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic' | |
1397 | ||
1398 | install_libsystemd_static = static_library( | |
1399 | 'systemd', | |
1400 | libsystemd_sources, | |
1401 | journal_client_sources, | |
975464e0 ZJS |
1402 | basic_sources, |
1403 | basic_gcrypt_sources, | |
70848ecf | 1404 | include_directories : includes, |
70848ecf DC |
1405 | build_by_default : static_libsystemd != 'false', |
1406 | install : static_libsystemd != 'false', | |
1407 | install_dir : rootlibdir, | |
1408 | pic : static_libsystemd == 'true' or static_libsystemd == 'pic', | |
1409 | dependencies : [threads, | |
1410 | librt, | |
1411 | libxz, | |
1412 | liblz4, | |
975464e0 ZJS |
1413 | libcap, |
1414 | libblkid, | |
1415 | libmount, | |
1416 | libselinux, | |
70848ecf DC |
1417 | libgcrypt], |
1418 | c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC'])) | |
1419 | ||
5c23128d ZJS |
1420 | ############################################################ |
1421 | ||
83b6af36 ZJS |
1422 | # binaries that have --help and are intended for use by humans, |
1423 | # usually, but not always, installed in /bin. | |
1424 | public_programs = [] | |
1425 | ||
1426 | subdir('src/libudev') | |
1427 | subdir('src/shared') | |
1428 | subdir('src/core') | |
1429 | subdir('src/udev') | |
1430 | subdir('src/network') | |
1431 | ||
1432 | subdir('src/analyze') | |
1433 | subdir('src/journal-remote') | |
1434 | subdir('src/coredump') | |
1435 | subdir('src/hostname') | |
1436 | subdir('src/import') | |
1437 | subdir('src/kernel-install') | |
1438 | subdir('src/locale') | |
1439 | subdir('src/machine') | |
61d0578b | 1440 | subdir('src/portable') |
83b6af36 ZJS |
1441 | subdir('src/nspawn') |
1442 | subdir('src/resolve') | |
1443 | subdir('src/timedate') | |
1444 | subdir('src/timesync') | |
1445 | subdir('src/vconsole') | |
83b6af36 ZJS |
1446 | subdir('src/boot/efi') |
1447 | ||
1448 | subdir('src/test') | |
7db7d5b7 | 1449 | subdir('src/fuzz') |
6b97bf22 | 1450 | subdir('rules') |
83b6af36 ZJS |
1451 | subdir('test') |
1452 | ||
1453 | ############################################################ | |
1454 | ||
1455 | # only static linking apart from libdl, to make sure that the | |
1456 | # module is linked to all libraries that it uses. | |
1457 | test_dlopen = executable( | |
37efbbd8 ZJS |
1458 | 'test-dlopen', |
1459 | test_dlopen_c, | |
1460 | include_directories : includes, | |
1461 | link_with : [libbasic], | |
1462 | dependencies : [libdl]) | |
83b6af36 | 1463 | |
08540a95 | 1464 | foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'], |
e7e11bbf | 1465 | ['systemd', 'ENABLE_NSS_SYSTEMD'], |
08540a95 YW |
1466 | ['mymachines', 'ENABLE_NSS_MYMACHINES'], |
1467 | ['resolve', 'ENABLE_NSS_RESOLVE']] | |
5c23128d | 1468 | |
349cc4a5 | 1469 | condition = tuple[1] == '' or conf.get(tuple[1]) == 1 |
37efbbd8 ZJS |
1470 | if condition |
1471 | module = tuple[0] | |
37efbbd8 ZJS |
1472 | |
1473 | sym = 'src/nss-@0@/nss-@0@.sym'.format(module) | |
1474 | version_script_arg = join_paths(meson.current_source_dir(), sym) | |
1475 | ||
1476 | nss = shared_library( | |
1477 | 'nss_' + module, | |
1478 | 'src/nss-@0@/nss-@0@.c'.format(module), | |
1479 | version : '2', | |
1480 | include_directories : includes, | |
b4b36f44 LP |
1481 | # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned |
1482 | link_args : ['-Wl,-z,nodelete', | |
1483 | '-shared', | |
37efbbd8 ZJS |
1484 | '-Wl,--version-script=' + version_script_arg, |
1485 | '-Wl,--undefined'], | |
37e4d7a8 | 1486 | link_with : [libsystemd_static, |
37efbbd8 ZJS |
1487 | libbasic], |
1488 | dependencies : [threads, | |
5486a31d | 1489 | librt], |
37efbbd8 ZJS |
1490 | link_depends : sym, |
1491 | install : true, | |
1492 | install_dir : rootlibdir) | |
1493 | ||
1494 | # We cannot use shared_module because it does not support version suffix. | |
1495 | # Unfortunately shared_library insists on creating the symlink… | |
1496 | meson.add_install_script('sh', '-c', | |
1497 | 'rm $DESTDIR@0@/libnss_@1@.so' | |
1498 | .format(rootlibdir, module)) | |
1499 | ||
1500 | test('dlopen-nss_' + module, | |
1501 | test_dlopen, | |
1502 | args : [nss.full_path()]) # path to dlopen must include a slash | |
1503 | endif | |
5c23128d ZJS |
1504 | endforeach |
1505 | ||
1506 | ############################################################ | |
1507 | ||
5c23128d ZJS |
1508 | executable('systemd', |
1509 | systemd_sources, | |
1510 | include_directories : includes, | |
1511 | link_with : [libcore, | |
34ce0a52 | 1512 | libshared], |
5c23128d ZJS |
1513 | dependencies : [threads, |
1514 | librt, | |
1515 | libseccomp, | |
1516 | libselinux, | |
f4ee10a2 ZJS |
1517 | libmount, |
1518 | libblkid], | |
421f0012 | 1519 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
1520 | install : true, |
1521 | install_dir : rootlibexecdir) | |
1522 | ||
ba7f4ae6 ZJS |
1523 | meson.add_install_script(meson_make_symlink, |
1524 | join_paths(rootlibexecdir, 'systemd'), | |
1525 | join_paths(rootsbindir, 'init')) | |
1526 | ||
005a29f2 ZJS |
1527 | exe = executable('systemd-analyze', |
1528 | systemd_analyze_sources, | |
1529 | include_directories : includes, | |
1530 | link_with : [libcore, | |
005a29f2 ZJS |
1531 | libshared], |
1532 | dependencies : [threads, | |
1533 | librt, | |
1534 | libseccomp, | |
1535 | libselinux, | |
1536 | libmount, | |
1537 | libblkid], | |
1538 | install_rpath : rootlibexecdir, | |
1539 | install : true) | |
5a8b1640 | 1540 | public_programs += exe |
5c23128d ZJS |
1541 | |
1542 | executable('systemd-journald', | |
1543 | systemd_journald_sources, | |
1544 | include_directories : includes, | |
aac26058 | 1545 | link_with : [libjournal_core, |
34ce0a52 | 1546 | libshared], |
5c23128d ZJS |
1547 | dependencies : [threads, |
1548 | libxz, | |
aac26058 ZJS |
1549 | liblz4, |
1550 | libselinux], | |
421f0012 | 1551 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
1552 | install : true, |
1553 | install_dir : rootlibexecdir) | |
1554 | ||
005a29f2 ZJS |
1555 | exe = executable('systemd-cat', |
1556 | systemd_cat_sources, | |
1557 | include_directories : includes, | |
1558 | link_with : [libjournal_core, | |
34ce0a52 | 1559 | libshared], |
005a29f2 ZJS |
1560 | dependencies : [threads], |
1561 | install_rpath : rootlibexecdir, | |
1562 | install : true) | |
5a8b1640 | 1563 | public_programs += exe |
005a29f2 ZJS |
1564 | |
1565 | exe = executable('journalctl', | |
1566 | journalctl_sources, | |
1567 | include_directories : includes, | |
34ce0a52 | 1568 | link_with : [libshared], |
005a29f2 ZJS |
1569 | dependencies : [threads, |
1570 | libqrencode, | |
1571 | libxz, | |
6becf48c ZJS |
1572 | liblz4, |
1573 | libpcre2], | |
005a29f2 ZJS |
1574 | install_rpath : rootlibexecdir, |
1575 | install : true, | |
1576 | install_dir : rootbindir) | |
5a8b1640 | 1577 | public_programs += exe |
5c23128d ZJS |
1578 | |
1579 | executable('systemd-getty-generator', | |
1580 | 'src/getty-generator/getty-generator.c', | |
5c23128d | 1581 | include_directories : includes, |
b2fc5836 ZJS |
1582 | link_with : [libshared], |
1583 | install_rpath : rootlibexecdir, | |
1584 | install : true, | |
1585 | install_dir : systemgeneratordir) | |
5c23128d ZJS |
1586 | |
1587 | executable('systemd-debug-generator', | |
1588 | 'src/debug-generator/debug-generator.c', | |
5c23128d | 1589 | include_directories : includes, |
b2fc5836 ZJS |
1590 | link_with : [libshared], |
1591 | install_rpath : rootlibexecdir, | |
1592 | install : true, | |
1593 | install_dir : systemgeneratordir) | |
5c23128d ZJS |
1594 | |
1595 | executable('systemd-fstab-generator', | |
1596 | 'src/fstab-generator/fstab-generator.c', | |
1597 | 'src/core/mount-setup.c', | |
5c23128d | 1598 | include_directories : includes, |
b2fc5836 ZJS |
1599 | link_with : [libshared], |
1600 | install_rpath : rootlibexecdir, | |
1601 | install : true, | |
1602 | install_dir : systemgeneratordir) | |
5c23128d | 1603 | |
349cc4a5 | 1604 | if conf.get('ENABLE_ENVIRONMENT_D') == 1 |
37efbbd8 ZJS |
1605 | executable('30-systemd-environment-d-generator', |
1606 | 'src/environment-d-generator/environment-d-generator.c', | |
1607 | include_directories : includes, | |
1608 | link_with : [libshared], | |
1609 | install_rpath : rootlibexecdir, | |
1610 | install : true, | |
1611 | install_dir : userenvgeneratordir) | |
7b76fce1 | 1612 | |
37efbbd8 ZJS |
1613 | meson.add_install_script(meson_make_symlink, |
1614 | join_paths(sysconfdir, 'environment'), | |
1615 | join_paths(environmentdir, '99-environment.conf')) | |
5c23128d ZJS |
1616 | endif |
1617 | ||
349cc4a5 | 1618 | if conf.get('ENABLE_HIBERNATE') == 1 |
37efbbd8 ZJS |
1619 | executable('systemd-hibernate-resume-generator', |
1620 | 'src/hibernate-resume/hibernate-resume-generator.c', | |
1621 | include_directories : includes, | |
1622 | link_with : [libshared], | |
1623 | install_rpath : rootlibexecdir, | |
1624 | install : true, | |
1625 | install_dir : systemgeneratordir) | |
5c23128d | 1626 | |
37efbbd8 ZJS |
1627 | executable('systemd-hibernate-resume', |
1628 | 'src/hibernate-resume/hibernate-resume.c', | |
005a29f2 ZJS |
1629 | include_directories : includes, |
1630 | link_with : [libshared], | |
1631 | install_rpath : rootlibexecdir, | |
1632 | install : true, | |
1633 | install_dir : rootlibexecdir) | |
37efbbd8 ZJS |
1634 | endif |
1635 | ||
349cc4a5 | 1636 | if conf.get('HAVE_BLKID') == 1 |
37efbbd8 ZJS |
1637 | executable('systemd-gpt-auto-generator', |
1638 | 'src/gpt-auto-generator/gpt-auto-generator.c', | |
1639 | 'src/basic/blkid-util.h', | |
1640 | include_directories : includes, | |
34ce0a52 | 1641 | link_with : [libshared], |
37efbbd8 ZJS |
1642 | dependencies : libblkid, |
1643 | install_rpath : rootlibexecdir, | |
1644 | install : true, | |
1645 | install_dir : systemgeneratordir) | |
1646 | ||
1647 | exe = executable('systemd-dissect', | |
1648 | 'src/dissect/dissect.c', | |
1649 | include_directories : includes, | |
1650 | link_with : [libshared], | |
1651 | install_rpath : rootlibexecdir, | |
1652 | install : true, | |
1653 | install_dir : rootlibexecdir) | |
5a8b1640 | 1654 | public_programs += exe |
5c23128d ZJS |
1655 | endif |
1656 | ||
1ec57f33 | 1657 | if conf.get('ENABLE_RESOLVE') == 1 |
37efbbd8 ZJS |
1658 | executable('systemd-resolved', |
1659 | systemd_resolved_sources, | |
005a29f2 | 1660 | include_directories : includes, |
34e221a5 | 1661 | link_with : [libshared, |
568a4ff8 ZJS |
1662 | libbasic_gcrypt, |
1663 | libsystemd_resolve_core], | |
56ddbf10 | 1664 | dependencies : systemd_resolved_dependencies, |
005a29f2 | 1665 | install_rpath : rootlibexecdir, |
37efbbd8 ZJS |
1666 | install : true, |
1667 | install_dir : rootlibexecdir) | |
1668 | ||
c2e84cab YW |
1669 | exe = executable('resolvectl', |
1670 | resolvectl_sources, | |
37efbbd8 | 1671 | include_directories : includes, |
34e221a5 | 1672 | link_with : [libshared, |
568a4ff8 ZJS |
1673 | libbasic_gcrypt, |
1674 | libsystemd_resolve_core], | |
37efbbd8 | 1675 | dependencies : [threads, |
76c87410 | 1676 | libgpg_error, |
37efbbd8 ZJS |
1677 | libm, |
1678 | libidn], | |
1679 | install_rpath : rootlibexecdir, | |
1680 | install : true) | |
5a8b1640 | 1681 | public_programs += exe |
088c1363 LP |
1682 | |
1683 | meson.add_install_script(meson_make_symlink, | |
c2e84cab | 1684 | join_paths(bindir, 'resolvectl'), |
088c1363 | 1685 | join_paths(rootsbindir, 'resolvconf')) |
c2e84cab YW |
1686 | |
1687 | meson.add_install_script(meson_make_symlink, | |
1688 | join_paths(bindir, 'resolvectl'), | |
1689 | join_paths(bindir, 'systemd-resolve')) | |
5c23128d ZJS |
1690 | endif |
1691 | ||
349cc4a5 | 1692 | if conf.get('ENABLE_LOGIND') == 1 |
37efbbd8 ZJS |
1693 | executable('systemd-logind', |
1694 | systemd_logind_sources, | |
005a29f2 | 1695 | include_directories : includes, |
37efbbd8 | 1696 | link_with : [liblogind_core, |
34ce0a52 | 1697 | libshared], |
005a29f2 | 1698 | dependencies : [threads, |
37efbbd8 | 1699 | libacl], |
005a29f2 ZJS |
1700 | install_rpath : rootlibexecdir, |
1701 | install : true, | |
37efbbd8 ZJS |
1702 | install_dir : rootlibexecdir) |
1703 | ||
1704 | exe = executable('loginctl', | |
1705 | loginctl_sources, | |
1706 | include_directories : includes, | |
34ce0a52 | 1707 | link_with : [libshared], |
37efbbd8 ZJS |
1708 | dependencies : [threads, |
1709 | liblz4, | |
1710 | libxz], | |
1711 | install_rpath : rootlibexecdir, | |
1712 | install : true, | |
1713 | install_dir : rootbindir) | |
5a8b1640 | 1714 | public_programs += exe |
37efbbd8 ZJS |
1715 | |
1716 | exe = executable('systemd-inhibit', | |
1717 | 'src/login/inhibit.c', | |
1718 | include_directories : includes, | |
1719 | link_with : [libshared], | |
1720 | install_rpath : rootlibexecdir, | |
1721 | install : true, | |
1722 | install_dir : rootbindir) | |
5a8b1640 | 1723 | public_programs += exe |
37efbbd8 | 1724 | |
349cc4a5 | 1725 | if conf.get('HAVE_PAM') == 1 |
37efbbd8 ZJS |
1726 | version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym) |
1727 | pam_systemd = shared_library( | |
1728 | 'pam_systemd', | |
1729 | pam_systemd_c, | |
1730 | name_prefix : '', | |
1731 | include_directories : includes, | |
1732 | link_args : ['-shared', | |
1733 | '-Wl,--version-script=' + version_script_arg], | |
37e4d7a8 | 1734 | link_with : [libsystemd_static, |
37efbbd8 ZJS |
1735 | libshared_static], |
1736 | dependencies : [threads, | |
1737 | libpam, | |
1738 | libpam_misc], | |
1739 | link_depends : pam_systemd_sym, | |
1740 | install : true, | |
1741 | install_dir : pamlibdir) | |
1742 | ||
1743 | test('dlopen-pam_systemd', | |
1744 | test_dlopen, | |
1745 | args : [pam_systemd.full_path()]) # path to dlopen must include a slash | |
1746 | endif | |
1747 | endif | |
005a29f2 | 1748 | |
a9f0f5e5 ZJS |
1749 | executable('systemd-user-runtime-dir', |
1750 | user_runtime_dir_sources, | |
1751 | include_directories : includes, | |
1752 | link_with : [libshared, liblogind_core], | |
1753 | install_rpath : rootlibexecdir, | |
1754 | install : true, | |
1755 | install_dir : rootlibexecdir) | |
1756 | ||
349cc4a5 | 1757 | if conf.get('HAVE_PAM') == 1 |
37efbbd8 ZJS |
1758 | executable('systemd-user-sessions', |
1759 | 'src/user-sessions/user-sessions.c', | |
005a29f2 | 1760 | include_directories : includes, |
aac26058 | 1761 | link_with : [libshared], |
005a29f2 ZJS |
1762 | install_rpath : rootlibexecdir, |
1763 | install : true, | |
37efbbd8 | 1764 | install_dir : rootlibexecdir) |
5c23128d ZJS |
1765 | endif |
1766 | ||
349cc4a5 | 1767 | if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1 |
37efbbd8 ZJS |
1768 | exe = executable('bootctl', |
1769 | 'src/boot/bootctl.c', | |
1770 | include_directories : includes, | |
1771 | link_with : [libshared], | |
1772 | dependencies : [libblkid], | |
1773 | install_rpath : rootlibexecdir, | |
1774 | install : true) | |
5a8b1640 | 1775 | public_programs += exe |
005a29f2 ZJS |
1776 | endif |
1777 | ||
1778 | exe = executable('systemd-socket-activate', 'src/activate/activate.c', | |
1779 | include_directories : includes, | |
1780 | link_with : [libshared], | |
1781 | dependencies : [threads], | |
1782 | install_rpath : rootlibexecdir, | |
1783 | install : true) | |
5a8b1640 | 1784 | public_programs += exe |
005a29f2 | 1785 | |
f3794366 FS |
1786 | |
1787 | if get_option('link-systemctl-shared') | |
1788 | systemctl_link_with = [libshared] | |
1789 | else | |
1790 | systemctl_link_with = [libsystemd_static, | |
1791 | libshared_static, | |
1792 | libjournal_client, | |
1793 | libbasic_gcrypt] | |
1794 | endif | |
1795 | ||
005a29f2 ZJS |
1796 | exe = executable('systemctl', 'src/systemctl/systemctl.c', |
1797 | include_directories : includes, | |
f3794366 | 1798 | link_with : systemctl_link_with, |
005a29f2 ZJS |
1799 | dependencies : [threads, |
1800 | libcap, | |
1801 | libselinux, | |
1802 | libxz, | |
1803 | liblz4], | |
1804 | install_rpath : rootlibexecdir, | |
1805 | install : true, | |
1806 | install_dir : rootbindir) | |
5a8b1640 | 1807 | public_programs += exe |
5c23128d | 1808 | |
61d0578b LP |
1809 | if conf.get('ENABLE_PORTABLED') == 1 |
1810 | executable('systemd-portabled', | |
1811 | systemd_portabled_sources, | |
1812 | include_directories : includes, | |
1813 | link_with : [libshared], | |
1814 | dependencies : [threads], | |
1815 | install_rpath : rootlibexecdir, | |
1816 | install : true, | |
1817 | install_dir : rootlibexecdir) | |
1818 | ||
1819 | exe = executable('portablectl', 'src/portable/portablectl.c', | |
1820 | include_directories : includes, | |
1821 | link_with : [libshared], | |
1822 | dependencies : [threads], | |
1823 | install_rpath : rootlibexecdir, | |
1824 | install : true, | |
1825 | install_dir : rootlibexecdir) | |
5a8b1640 | 1826 | public_programs += exe |
61d0578b LP |
1827 | endif |
1828 | ||
ba7f4ae6 ZJS |
1829 | foreach alias : ['halt', 'poweroff', 'reboot', 'runlevel', 'shutdown', 'telinit'] |
1830 | meson.add_install_script(meson_make_symlink, | |
1831 | join_paths(rootbindir, 'systemctl'), | |
1832 | join_paths(rootsbindir, alias)) | |
1833 | endforeach | |
1834 | ||
349cc4a5 | 1835 | if conf.get('ENABLE_BACKLIGHT') == 1 |
37efbbd8 ZJS |
1836 | executable('systemd-backlight', |
1837 | 'src/backlight/backlight.c', | |
1838 | include_directories : includes, | |
34ce0a52 | 1839 | link_with : [libshared], |
37efbbd8 ZJS |
1840 | install_rpath : rootlibexecdir, |
1841 | install : true, | |
1842 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
1843 | endif |
1844 | ||
349cc4a5 | 1845 | if conf.get('ENABLE_RFKILL') == 1 |
37efbbd8 ZJS |
1846 | executable('systemd-rfkill', |
1847 | 'src/rfkill/rfkill.c', | |
1848 | include_directories : includes, | |
34ce0a52 | 1849 | link_with : [libshared], |
37efbbd8 ZJS |
1850 | install_rpath : rootlibexecdir, |
1851 | install : true, | |
1852 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
1853 | endif |
1854 | ||
1855 | executable('systemd-system-update-generator', | |
1856 | 'src/system-update-generator/system-update-generator.c', | |
1857 | include_directories : includes, | |
1858 | link_with : [libshared], | |
b2fc5836 | 1859 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
1860 | install : true, |
1861 | install_dir : systemgeneratordir) | |
1862 | ||
349cc4a5 | 1863 | if conf.get('HAVE_LIBCRYPTSETUP') == 1 |
37efbbd8 ZJS |
1864 | executable('systemd-cryptsetup', |
1865 | 'src/cryptsetup/cryptsetup.c', | |
1866 | include_directories : includes, | |
1867 | link_with : [libshared], | |
1868 | dependencies : [libcryptsetup], | |
1869 | install_rpath : rootlibexecdir, | |
1870 | install : true, | |
1871 | install_dir : rootlibexecdir) | |
1872 | ||
1873 | executable('systemd-cryptsetup-generator', | |
1874 | 'src/cryptsetup/cryptsetup-generator.c', | |
1875 | include_directories : includes, | |
1876 | link_with : [libshared], | |
1877 | dependencies : [libcryptsetup], | |
1878 | install_rpath : rootlibexecdir, | |
1879 | install : true, | |
1880 | install_dir : systemgeneratordir) | |
1881 | ||
1882 | executable('systemd-veritysetup', | |
1883 | 'src/veritysetup/veritysetup.c', | |
1884 | include_directories : includes, | |
1885 | link_with : [libshared], | |
1886 | dependencies : [libcryptsetup], | |
1887 | install_rpath : rootlibexecdir, | |
1888 | install : true, | |
1889 | install_dir : rootlibexecdir) | |
1890 | ||
1891 | executable('systemd-veritysetup-generator', | |
1892 | 'src/veritysetup/veritysetup-generator.c', | |
1893 | include_directories : includes, | |
1894 | link_with : [libshared], | |
1895 | dependencies : [libcryptsetup], | |
1896 | install_rpath : rootlibexecdir, | |
1897 | install : true, | |
1898 | install_dir : systemgeneratordir) | |
5c23128d ZJS |
1899 | endif |
1900 | ||
349cc4a5 | 1901 | if conf.get('HAVE_SYSV_COMPAT') == 1 |
37efbbd8 ZJS |
1902 | executable('systemd-sysv-generator', |
1903 | 'src/sysv-generator/sysv-generator.c', | |
1904 | include_directories : includes, | |
1905 | link_with : [libshared], | |
1906 | install_rpath : rootlibexecdir, | |
1907 | install : true, | |
1908 | install_dir : systemgeneratordir) | |
1909 | ||
1910 | executable('systemd-rc-local-generator', | |
1911 | 'src/rc-local-generator/rc-local-generator.c', | |
1912 | include_directories : includes, | |
1913 | link_with : [libshared], | |
1914 | install_rpath : rootlibexecdir, | |
1915 | install : true, | |
1916 | install_dir : systemgeneratordir) | |
5c23128d ZJS |
1917 | endif |
1918 | ||
349cc4a5 | 1919 | if conf.get('ENABLE_HOSTNAMED') == 1 |
37efbbd8 ZJS |
1920 | executable('systemd-hostnamed', |
1921 | 'src/hostname/hostnamed.c', | |
005a29f2 | 1922 | include_directories : includes, |
aac26058 | 1923 | link_with : [libshared], |
005a29f2 | 1924 | install_rpath : rootlibexecdir, |
37efbbd8 ZJS |
1925 | install : true, |
1926 | install_dir : rootlibexecdir) | |
1927 | ||
1928 | exe = executable('hostnamectl', | |
1929 | 'src/hostname/hostnamectl.c', | |
1930 | include_directories : includes, | |
1931 | link_with : [libshared], | |
1932 | install_rpath : rootlibexecdir, | |
1933 | install : true) | |
5a8b1640 | 1934 | public_programs += exe |
5c23128d ZJS |
1935 | endif |
1936 | ||
349cc4a5 ZJS |
1937 | if conf.get('ENABLE_LOCALED') == 1 |
1938 | if conf.get('HAVE_XKBCOMMON') == 1 | |
37efbbd8 ZJS |
1939 | # logind will load libxkbcommon.so dynamically on its own |
1940 | deps = [libdl] | |
1941 | else | |
1942 | deps = [] | |
1943 | endif | |
1944 | ||
1945 | executable('systemd-localed', | |
1946 | systemd_localed_sources, | |
005a29f2 | 1947 | include_directories : includes, |
aac26058 | 1948 | link_with : [libshared], |
37efbbd8 | 1949 | dependencies : deps, |
005a29f2 | 1950 | install_rpath : rootlibexecdir, |
37efbbd8 ZJS |
1951 | install : true, |
1952 | install_dir : rootlibexecdir) | |
1953 | ||
1954 | exe = executable('localectl', | |
1955 | localectl_sources, | |
1956 | include_directories : includes, | |
1957 | link_with : [libshared], | |
1958 | install_rpath : rootlibexecdir, | |
1959 | install : true) | |
5a8b1640 | 1960 | public_programs += exe |
5c23128d ZJS |
1961 | endif |
1962 | ||
349cc4a5 | 1963 | if conf.get('ENABLE_TIMEDATED') == 1 |
37efbbd8 ZJS |
1964 | executable('systemd-timedated', |
1965 | 'src/timedate/timedated.c', | |
005a29f2 | 1966 | include_directories : includes, |
aac26058 | 1967 | link_with : [libshared], |
37efbbd8 ZJS |
1968 | install_rpath : rootlibexecdir, |
1969 | install : true, | |
1970 | install_dir : rootlibexecdir) | |
6129ec85 | 1971 | endif |
5c23128d | 1972 | |
6129ec85 | 1973 | if conf.get('ENABLE_TIMEDATECTL') == 1 |
37efbbd8 ZJS |
1974 | exe = executable('timedatectl', |
1975 | 'src/timedate/timedatectl.c', | |
1976 | include_directories : includes, | |
1977 | install_rpath : rootlibexecdir, | |
1978 | link_with : [libshared], | |
6129ec85 | 1979 | dependencies : [libm], |
37efbbd8 | 1980 | install : true) |
5a8b1640 | 1981 | public_programs += exe |
5c23128d ZJS |
1982 | endif |
1983 | ||
349cc4a5 | 1984 | if conf.get('ENABLE_TIMESYNCD') == 1 |
37efbbd8 ZJS |
1985 | executable('systemd-timesyncd', |
1986 | systemd_timesyncd_sources, | |
005a29f2 | 1987 | include_directories : includes, |
aac26058 | 1988 | link_with : [libshared], |
005a29f2 | 1989 | dependencies : [threads, |
37efbbd8 | 1990 | libm], |
005a29f2 ZJS |
1991 | install_rpath : rootlibexecdir, |
1992 | install : true, | |
37efbbd8 | 1993 | install_dir : rootlibexecdir) |
5c3376ef PB |
1994 | |
1995 | executable('systemd-time-wait-sync', | |
1996 | 'src/time-wait-sync/time-wait-sync.c', | |
1997 | include_directories : includes, | |
1998 | link_with : [libshared], | |
1999 | install_rpath : rootlibexecdir, | |
2000 | install : true, | |
2001 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2002 | endif |
2003 | ||
349cc4a5 | 2004 | if conf.get('ENABLE_MACHINED') == 1 |
37efbbd8 ZJS |
2005 | executable('systemd-machined', |
2006 | systemd_machined_sources, | |
2007 | include_directories : includes, | |
2008 | link_with : [libmachine_core, | |
2009 | libshared], | |
2010 | install_rpath : rootlibexecdir, | |
2011 | install : true, | |
2012 | install_dir : rootlibexecdir) | |
2013 | ||
2014 | exe = executable('machinectl', | |
2015 | 'src/machine/machinectl.c', | |
2016 | include_directories : includes, | |
2017 | link_with : [libshared], | |
2018 | dependencies : [threads, | |
2019 | libxz, | |
2020 | liblz4], | |
2021 | install_rpath : rootlibexecdir, | |
2022 | install : true, | |
2023 | install_dir : rootbindir) | |
5a8b1640 | 2024 | public_programs += exe |
5c23128d ZJS |
2025 | endif |
2026 | ||
349cc4a5 | 2027 | if conf.get('ENABLE_IMPORTD') == 1 |
37efbbd8 ZJS |
2028 | executable('systemd-importd', |
2029 | systemd_importd_sources, | |
005a29f2 | 2030 | include_directories : includes, |
aac26058 | 2031 | link_with : [libshared], |
37efbbd8 | 2032 | dependencies : [threads], |
005a29f2 ZJS |
2033 | install_rpath : rootlibexecdir, |
2034 | install : true, | |
2035 | install_dir : rootlibexecdir) | |
37efbbd8 ZJS |
2036 | |
2037 | systemd_pull = executable('systemd-pull', | |
2038 | systemd_pull_sources, | |
2039 | include_directories : includes, | |
2040 | link_with : [libshared], | |
2041 | dependencies : [libcurl, | |
2042 | libz, | |
2043 | libbzip2, | |
2044 | libxz, | |
2045 | libgcrypt], | |
2046 | install_rpath : rootlibexecdir, | |
2047 | install : true, | |
2048 | install_dir : rootlibexecdir) | |
2049 | ||
2050 | systemd_import = executable('systemd-import', | |
2051 | systemd_import_sources, | |
2052 | include_directories : includes, | |
2053 | link_with : [libshared], | |
2054 | dependencies : [libcurl, | |
2055 | libz, | |
2056 | libbzip2, | |
2057 | libxz], | |
2058 | install_rpath : rootlibexecdir, | |
2059 | install : true, | |
2060 | install_dir : rootlibexecdir) | |
2061 | ||
2062 | systemd_export = executable('systemd-export', | |
2063 | systemd_export_sources, | |
2064 | include_directories : includes, | |
2065 | link_with : [libshared], | |
2066 | dependencies : [libcurl, | |
2067 | libz, | |
2068 | libbzip2, | |
2069 | libxz], | |
2070 | install_rpath : rootlibexecdir, | |
2071 | install : true, | |
2072 | install_dir : rootlibexecdir) | |
2073 | public_programs += [systemd_pull, systemd_import, systemd_export] | |
2074 | endif | |
2075 | ||
349cc4a5 | 2076 | if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1 |
37efbbd8 ZJS |
2077 | exe = executable('systemd-journal-upload', |
2078 | systemd_journal_upload_sources, | |
2079 | include_directories : includes, | |
2080 | link_with : [libshared], | |
2081 | dependencies : [threads, | |
2082 | libcurl, | |
2083 | libgnutls, | |
2084 | libxz, | |
2085 | liblz4], | |
2086 | install_rpath : rootlibexecdir, | |
2087 | install : true, | |
2088 | install_dir : rootlibexecdir) | |
5a8b1640 | 2089 | public_programs += exe |
5c23128d ZJS |
2090 | endif |
2091 | ||
349cc4a5 | 2092 | if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 |
37efbbd8 ZJS |
2093 | s_j_remote = executable('systemd-journal-remote', |
2094 | systemd_journal_remote_sources, | |
2095 | include_directories : includes, | |
c064d8db ZJS |
2096 | link_with : [libshared, |
2097 | libsystemd_journal_remote], | |
37efbbd8 ZJS |
2098 | dependencies : [threads, |
2099 | libmicrohttpd, | |
2100 | libgnutls, | |
2101 | libxz, | |
2102 | liblz4], | |
2103 | install_rpath : rootlibexecdir, | |
2104 | install : true, | |
2105 | install_dir : rootlibexecdir) | |
2106 | ||
2107 | s_j_gatewayd = executable('systemd-journal-gatewayd', | |
2108 | systemd_journal_gatewayd_sources, | |
2109 | include_directories : includes, | |
2110 | link_with : [libshared], | |
2111 | dependencies : [threads, | |
2112 | libmicrohttpd, | |
2113 | libgnutls, | |
2114 | libxz, | |
2115 | liblz4], | |
2116 | install_rpath : rootlibexecdir, | |
2117 | install : true, | |
2118 | install_dir : rootlibexecdir) | |
2119 | public_programs += [s_j_remote, s_j_gatewayd] | |
5c23128d ZJS |
2120 | endif |
2121 | ||
349cc4a5 | 2122 | if conf.get('ENABLE_COREDUMP') == 1 |
37efbbd8 ZJS |
2123 | executable('systemd-coredump', |
2124 | systemd_coredump_sources, | |
005a29f2 | 2125 | include_directories : includes, |
aac26058 | 2126 | link_with : [libshared], |
005a29f2 | 2127 | dependencies : [threads, |
37efbbd8 ZJS |
2128 | libacl, |
2129 | libdw, | |
005a29f2 ZJS |
2130 | libxz, |
2131 | liblz4], | |
2132 | install_rpath : rootlibexecdir, | |
37efbbd8 ZJS |
2133 | install : true, |
2134 | install_dir : rootlibexecdir) | |
2135 | ||
2136 | exe = executable('coredumpctl', | |
2137 | coredumpctl_sources, | |
2138 | include_directories : includes, | |
2139 | link_with : [libshared], | |
2140 | dependencies : [threads, | |
2141 | libxz, | |
2142 | liblz4], | |
2143 | install_rpath : rootlibexecdir, | |
2144 | install : true) | |
5a8b1640 | 2145 | public_programs += exe |
5c23128d ZJS |
2146 | endif |
2147 | ||
349cc4a5 | 2148 | if conf.get('ENABLE_BINFMT') == 1 |
37efbbd8 ZJS |
2149 | exe = executable('systemd-binfmt', |
2150 | 'src/binfmt/binfmt.c', | |
2151 | include_directories : includes, | |
2152 | link_with : [libshared], | |
2153 | install_rpath : rootlibexecdir, | |
2154 | install : true, | |
2155 | install_dir : rootlibexecdir) | |
5a8b1640 | 2156 | public_programs += exe |
37efbbd8 ZJS |
2157 | |
2158 | meson.add_install_script('sh', '-c', | |
2159 | mkdir_p.format(binfmtdir)) | |
2160 | meson.add_install_script('sh', '-c', | |
2161 | mkdir_p.format(join_paths(sysconfdir, 'binfmt.d'))) | |
2162 | endif | |
2163 | ||
349cc4a5 | 2164 | if conf.get('ENABLE_VCONSOLE') == 1 |
37efbbd8 ZJS |
2165 | executable('systemd-vconsole-setup', |
2166 | 'src/vconsole/vconsole-setup.c', | |
005a29f2 ZJS |
2167 | include_directories : includes, |
2168 | link_with : [libshared], | |
2169 | install_rpath : rootlibexecdir, | |
2170 | install : true, | |
2171 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2172 | endif |
2173 | ||
349cc4a5 | 2174 | if conf.get('ENABLE_RANDOMSEED') == 1 |
37efbbd8 ZJS |
2175 | executable('systemd-random-seed', |
2176 | 'src/random-seed/random-seed.c', | |
2177 | include_directories : includes, | |
2178 | link_with : [libshared], | |
2179 | install_rpath : rootlibexecdir, | |
2180 | install : true, | |
2181 | install_dir : rootlibexecdir) | |
5c23128d ZJS |
2182 | endif |
2183 | ||
349cc4a5 | 2184 | if conf.get('ENABLE_FIRSTBOOT') == 1 |
37efbbd8 ZJS |
2185 | executable('systemd-firstboot', |
2186 | 'src/firstboot/firstboot.c', | |
2187 | include_directories : includes, | |
2188 | link_with : [libshared], | |
2189 | dependencies : [libcrypt], | |
2190 | install_rpath : rootlibexecdir, | |
2191 | install : true, | |
2192 | install_dir : rootbindir) | |
5c23128d ZJS |
2193 | endif |
2194 | ||
2195 | executable('systemd-remount-fs', | |
2196 | 'src/remount-fs/remount-fs.c', | |
2197 | 'src/core/mount-setup.c', | |
2198 | 'src/core/mount-setup.h', | |
2199 | include_directories : includes, | |
2200 | link_with : [libshared], | |
b2fc5836 | 2201 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2202 | install : true, |
2203 | install_dir : rootlibexecdir) | |
2204 | ||
2205 | executable('systemd-machine-id-setup', | |
2206 | 'src/machine-id-setup/machine-id-setup-main.c', | |
2207 | 'src/core/machine-id-setup.c', | |
2208 | 'src/core/machine-id-setup.h', | |
2209 | include_directories : includes, | |
aac26058 | 2210 | link_with : [libshared], |
b2fc5836 | 2211 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2212 | install : true, |
2213 | install_dir : rootbindir) | |
2214 | ||
2215 | executable('systemd-fsck', | |
2216 | 'src/fsck/fsck.c', | |
2217 | include_directories : includes, | |
aac26058 | 2218 | link_with : [libshared], |
421f0012 | 2219 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2220 | install : true, |
2221 | install_dir : rootlibexecdir) | |
2222 | ||
80750adb ZJS |
2223 | executable('systemd-growfs', |
2224 | 'src/partition/growfs.c', | |
2225 | include_directories : includes, | |
2226 | link_with : [libshared], | |
c34b75a1 | 2227 | dependencies : [libcryptsetup], |
80750adb ZJS |
2228 | install_rpath : rootlibexecdir, |
2229 | install : true, | |
2230 | install_dir : rootlibexecdir) | |
2231 | ||
b7f28ac5 ZJS |
2232 | executable('systemd-makefs', |
2233 | 'src/partition/makefs.c', | |
2234 | include_directories : includes, | |
2235 | link_with : [libshared], | |
2236 | install_rpath : rootlibexecdir, | |
2237 | install : true, | |
2238 | install_dir : rootlibexecdir) | |
2239 | ||
5c23128d ZJS |
2240 | executable('systemd-sleep', |
2241 | 'src/sleep/sleep.c', | |
2242 | include_directories : includes, | |
2243 | link_with : [libshared], | |
421f0012 | 2244 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2245 | install : true, |
2246 | install_dir : rootlibexecdir) | |
2247 | ||
005a29f2 ZJS |
2248 | exe = executable('systemd-sysctl', |
2249 | 'src/sysctl/sysctl.c', | |
2250 | include_directories : includes, | |
2251 | link_with : [libshared], | |
2252 | install_rpath : rootlibexecdir, | |
2253 | install : true, | |
2254 | install_dir : rootlibexecdir) | |
5a8b1640 | 2255 | public_programs += exe |
5c23128d ZJS |
2256 | |
2257 | executable('systemd-ac-power', | |
2258 | 'src/ac-power/ac-power.c', | |
2259 | include_directories : includes, | |
2260 | link_with : [libshared], | |
421f0012 | 2261 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2262 | install : true, |
2263 | install_dir : rootlibexecdir) | |
2264 | ||
005a29f2 ZJS |
2265 | exe = executable('systemd-detect-virt', |
2266 | 'src/detect-virt/detect-virt.c', | |
2267 | include_directories : includes, | |
2268 | link_with : [libshared], | |
2269 | install_rpath : rootlibexecdir, | |
2270 | install : true) | |
5a8b1640 | 2271 | public_programs += exe |
005a29f2 ZJS |
2272 | |
2273 | exe = executable('systemd-delta', | |
2274 | 'src/delta/delta.c', | |
2275 | include_directories : includes, | |
2276 | link_with : [libshared], | |
2277 | install_rpath : rootlibexecdir, | |
2278 | install : true) | |
5a8b1640 | 2279 | public_programs += exe |
005a29f2 ZJS |
2280 | |
2281 | exe = executable('systemd-escape', | |
2282 | 'src/escape/escape.c', | |
2283 | include_directories : includes, | |
2284 | link_with : [libshared], | |
2285 | install_rpath : rootlibexecdir, | |
2286 | install : true, | |
2287 | install_dir : rootbindir) | |
5a8b1640 | 2288 | public_programs += exe |
005a29f2 ZJS |
2289 | |
2290 | exe = executable('systemd-notify', | |
2291 | 'src/notify/notify.c', | |
2292 | include_directories : includes, | |
2293 | link_with : [libshared], | |
2294 | install_rpath : rootlibexecdir, | |
2295 | install : true, | |
2296 | install_dir : rootbindir) | |
5a8b1640 | 2297 | public_programs += exe |
5c23128d ZJS |
2298 | |
2299 | executable('systemd-volatile-root', | |
2300 | 'src/volatile-root/volatile-root.c', | |
2301 | include_directories : includes, | |
2302 | link_with : [libshared], | |
421f0012 | 2303 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2304 | install : true, |
2305 | install_dir : rootlibexecdir) | |
2306 | ||
2307 | executable('systemd-cgroups-agent', | |
2308 | 'src/cgroups-agent/cgroups-agent.c', | |
2309 | include_directories : includes, | |
2310 | link_with : [libshared], | |
421f0012 | 2311 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2312 | install : true, |
2313 | install_dir : rootlibexecdir) | |
2314 | ||
005a29f2 ZJS |
2315 | exe = executable('systemd-path', |
2316 | 'src/path/path.c', | |
2317 | include_directories : includes, | |
aac26058 | 2318 | link_with : [libshared], |
005a29f2 ZJS |
2319 | install_rpath : rootlibexecdir, |
2320 | install : true) | |
5a8b1640 | 2321 | public_programs += exe |
005a29f2 ZJS |
2322 | |
2323 | exe = executable('systemd-ask-password', | |
2324 | 'src/ask-password/ask-password.c', | |
2325 | include_directories : includes, | |
aac26058 | 2326 | link_with : [libshared], |
005a29f2 ZJS |
2327 | install_rpath : rootlibexecdir, |
2328 | install : true, | |
2329 | install_dir : rootbindir) | |
5a8b1640 | 2330 | public_programs += exe |
5c23128d ZJS |
2331 | |
2332 | executable('systemd-reply-password', | |
2333 | 'src/reply-password/reply-password.c', | |
2334 | include_directories : includes, | |
aac26058 | 2335 | link_with : [libshared], |
421f0012 | 2336 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2337 | install : true, |
2338 | install_dir : rootlibexecdir) | |
2339 | ||
005a29f2 ZJS |
2340 | exe = executable('systemd-tty-ask-password-agent', |
2341 | 'src/tty-ask-password-agent/tty-ask-password-agent.c', | |
2342 | include_directories : includes, | |
aac26058 | 2343 | link_with : [libshared], |
005a29f2 ZJS |
2344 | install_rpath : rootlibexecdir, |
2345 | install : true, | |
2346 | install_dir : rootbindir) | |
5a8b1640 | 2347 | public_programs += exe |
005a29f2 ZJS |
2348 | |
2349 | exe = executable('systemd-cgls', | |
2350 | 'src/cgls/cgls.c', | |
2351 | include_directories : includes, | |
aac26058 | 2352 | link_with : [libshared], |
005a29f2 ZJS |
2353 | install_rpath : rootlibexecdir, |
2354 | install : true) | |
5a8b1640 | 2355 | public_programs += exe |
005a29f2 ZJS |
2356 | |
2357 | exe = executable('systemd-cgtop', | |
2358 | 'src/cgtop/cgtop.c', | |
2359 | include_directories : includes, | |
aac26058 | 2360 | link_with : [libshared], |
005a29f2 ZJS |
2361 | install_rpath : rootlibexecdir, |
2362 | install : true) | |
5a8b1640 | 2363 | public_programs += exe |
5c23128d ZJS |
2364 | |
2365 | executable('systemd-initctl', | |
2366 | 'src/initctl/initctl.c', | |
2367 | include_directories : includes, | |
aac26058 | 2368 | link_with : [libshared], |
421f0012 | 2369 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2370 | install : true, |
2371 | install_dir : rootlibexecdir) | |
2372 | ||
005a29f2 ZJS |
2373 | exe = executable('systemd-mount', |
2374 | 'src/mount/mount-tool.c', | |
2375 | include_directories : includes, | |
34ce0a52 | 2376 | link_with : [libshared], |
005a29f2 ZJS |
2377 | install_rpath : rootlibexecdir, |
2378 | install : true) | |
5a8b1640 | 2379 | public_programs += exe |
5c23128d | 2380 | |
7b76fce1 | 2381 | meson.add_install_script(meson_make_symlink, |
e17e5ba9 | 2382 | 'systemd-mount', join_paths(bindir, 'systemd-umount')) |
7b76fce1 | 2383 | |
005a29f2 ZJS |
2384 | exe = executable('systemd-run', |
2385 | 'src/run/run.c', | |
2386 | include_directories : includes, | |
aac26058 | 2387 | link_with : [libshared], |
005a29f2 ZJS |
2388 | install_rpath : rootlibexecdir, |
2389 | install : true) | |
5a8b1640 | 2390 | public_programs += exe |
005a29f2 ZJS |
2391 | |
2392 | exe = executable('systemd-stdio-bridge', | |
2393 | 'src/stdio-bridge/stdio-bridge.c', | |
2394 | include_directories : includes, | |
aac26058 | 2395 | link_with : [libshared], |
005a29f2 ZJS |
2396 | install_rpath : rootlibexecdir, |
2397 | install : true) | |
5a8b1640 | 2398 | public_programs += exe |
005a29f2 ZJS |
2399 | |
2400 | exe = executable('busctl', | |
2401 | 'src/busctl/busctl.c', | |
2402 | 'src/busctl/busctl-introspect.c', | |
2403 | 'src/busctl/busctl-introspect.h', | |
2404 | include_directories : includes, | |
aac26058 | 2405 | link_with : [libshared], |
005a29f2 ZJS |
2406 | install_rpath : rootlibexecdir, |
2407 | install : true) | |
5a8b1640 | 2408 | public_programs += exe |
5c23128d | 2409 | |
349cc4a5 | 2410 | if conf.get('ENABLE_SYSUSERS') == 1 |
37efbbd8 ZJS |
2411 | exe = executable('systemd-sysusers', |
2412 | 'src/sysusers/sysusers.c', | |
2413 | include_directories : includes, | |
2414 | link_with : [libshared], | |
2415 | install_rpath : rootlibexecdir, | |
2416 | install : true, | |
2417 | install_dir : rootbindir) | |
5a8b1640 | 2418 | public_programs += exe |
5c23128d ZJS |
2419 | endif |
2420 | ||
349cc4a5 | 2421 | if conf.get('ENABLE_TMPFILES') == 1 |
37efbbd8 ZJS |
2422 | exe = executable('systemd-tmpfiles', |
2423 | 'src/tmpfiles/tmpfiles.c', | |
2424 | include_directories : includes, | |
2425 | link_with : [libshared], | |
2426 | dependencies : [libacl], | |
2427 | install_rpath : rootlibexecdir, | |
2428 | install : true, | |
2429 | install_dir : rootbindir) | |
5a8b1640 | 2430 | public_programs += exe |
d9daae55 ZJS |
2431 | |
2432 | test('test-systemd-tmpfiles', | |
2433 | test_systemd_tmpfiles_py, | |
2434 | args : exe.full_path()) | |
2435 | # https://github.com/mesonbuild/meson/issues/2681 | |
5c23128d ZJS |
2436 | endif |
2437 | ||
349cc4a5 | 2438 | if conf.get('ENABLE_HWDB') == 1 |
37efbbd8 ZJS |
2439 | exe = executable('systemd-hwdb', |
2440 | 'src/hwdb/hwdb.c', | |
2441 | 'src/libsystemd/sd-hwdb/hwdb-internal.h', | |
2442 | include_directories : includes, | |
0c06b506 | 2443 | link_with : [libudev_static], |
0da6f396 | 2444 | install_rpath : udev_rpath, |
37efbbd8 ZJS |
2445 | install : true, |
2446 | install_dir : rootbindir) | |
5a8b1640 | 2447 | public_programs += exe |
37efbbd8 ZJS |
2448 | endif |
2449 | ||
349cc4a5 | 2450 | if conf.get('ENABLE_QUOTACHECK') == 1 |
37efbbd8 ZJS |
2451 | executable('systemd-quotacheck', |
2452 | 'src/quotacheck/quotacheck.c', | |
005a29f2 | 2453 | include_directories : includes, |
aac26058 | 2454 | link_with : [libshared], |
005a29f2 ZJS |
2455 | install_rpath : rootlibexecdir, |
2456 | install : true, | |
37efbbd8 | 2457 | install_dir : rootlibexecdir) |
5c23128d ZJS |
2458 | endif |
2459 | ||
005a29f2 ZJS |
2460 | exe = executable('systemd-socket-proxyd', |
2461 | 'src/socket-proxy/socket-proxyd.c', | |
2462 | include_directories : includes, | |
aac26058 | 2463 | link_with : [libshared], |
005a29f2 ZJS |
2464 | dependencies : [threads], |
2465 | install_rpath : rootlibexecdir, | |
2466 | install : true, | |
2467 | install_dir : rootlibexecdir) | |
5a8b1640 | 2468 | public_programs += exe |
005a29f2 ZJS |
2469 | |
2470 | exe = executable('systemd-udevd', | |
2471 | systemd_udevd_sources, | |
2472 | include_directories : includes, | |
5c72049f | 2473 | c_args : ['-DLOG_REALM=LOG_REALM_UDEV'], |
005a29f2 | 2474 | link_with : [libudev_core, |
005a29f2 | 2475 | libsystemd_network, |
0c06b506 | 2476 | libudev_static], |
3a30f21f ZJS |
2477 | dependencies : [threads, |
2478 | libkmod, | |
005a29f2 | 2479 | libidn, |
aac26058 ZJS |
2480 | libacl, |
2481 | libblkid], | |
1aec3ed9 | 2482 | install_rpath : udev_rpath, |
005a29f2 ZJS |
2483 | install : true, |
2484 | install_dir : rootlibexecdir) | |
5a8b1640 | 2485 | public_programs += exe |
005a29f2 ZJS |
2486 | |
2487 | exe = executable('udevadm', | |
2488 | udevadm_sources, | |
6671e818 | 2489 | c_args : ['-DLOG_REALM=LOG_REALM_UDEV'], |
005a29f2 ZJS |
2490 | include_directories : includes, |
2491 | link_with : [libudev_core, | |
005a29f2 | 2492 | libsystemd_network, |
0c06b506 | 2493 | libudev_static], |
3a30f21f ZJS |
2494 | dependencies : [threads, |
2495 | libkmod, | |
005a29f2 | 2496 | libidn, |
aac26058 ZJS |
2497 | libacl, |
2498 | libblkid], | |
1aec3ed9 | 2499 | install_rpath : udev_rpath, |
005a29f2 ZJS |
2500 | install : true, |
2501 | install_dir : rootbindir) | |
5a8b1640 | 2502 | public_programs += exe |
5c23128d ZJS |
2503 | |
2504 | executable('systemd-shutdown', | |
2505 | systemd_shutdown_sources, | |
2506 | include_directories : includes, | |
34ce0a52 | 2507 | link_with : [libshared], |
95b862b0 | 2508 | dependencies : [libmount], |
421f0012 | 2509 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2510 | install : true, |
2511 | install_dir : rootlibexecdir) | |
2512 | ||
2513 | executable('systemd-update-done', | |
2514 | 'src/update-done/update-done.c', | |
2515 | include_directories : includes, | |
2516 | link_with : [libshared], | |
421f0012 | 2517 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2518 | install : true, |
2519 | install_dir : rootlibexecdir) | |
2520 | ||
2521 | executable('systemd-update-utmp', | |
2522 | 'src/update-utmp/update-utmp.c', | |
2523 | include_directories : includes, | |
aac26058 | 2524 | link_with : [libshared], |
5c23128d | 2525 | dependencies : [libaudit], |
421f0012 | 2526 | install_rpath : rootlibexecdir, |
5c23128d ZJS |
2527 | install : true, |
2528 | install_dir : rootlibexecdir) | |
2529 | ||
349cc4a5 | 2530 | if conf.get('HAVE_KMOD') == 1 |
37efbbd8 ZJS |
2531 | executable('systemd-modules-load', |
2532 | 'src/modules-load/modules-load.c', | |
2533 | include_directories : includes, | |
2534 | link_with : [libshared], | |
2535 | dependencies : [libkmod], | |
2536 | install_rpath : rootlibexecdir, | |
2537 | install : true, | |
2538 | install_dir : rootlibexecdir) | |
94e75a54 | 2539 | |
37efbbd8 ZJS |
2540 | meson.add_install_script('sh', '-c', |
2541 | mkdir_p.format(modulesloaddir)) | |
2542 | meson.add_install_script('sh', '-c', | |
2543 | mkdir_p.format(join_paths(sysconfdir, 'modules-load.d'))) | |
5c23128d ZJS |
2544 | endif |
2545 | ||
005a29f2 ZJS |
2546 | exe = executable('systemd-nspawn', |
2547 | systemd_nspawn_sources, | |
2548 | 'src/core/mount-setup.c', # FIXME: use a variable? | |
2549 | 'src/core/mount-setup.h', | |
2550 | 'src/core/loopback-setup.c', | |
2551 | 'src/core/loopback-setup.h', | |
97d90615 ZJS |
2552 | include_directories : includes, |
2553 | link_with : [libnspawn_core, | |
2554 | libshared], | |
2555 | dependencies : [libblkid], | |
005a29f2 ZJS |
2556 | install_rpath : rootlibexecdir, |
2557 | install : true) | |
5a8b1640 | 2558 | public_programs += exe |
5c23128d | 2559 | |
349cc4a5 | 2560 | if conf.get('ENABLE_NETWORKD') == 1 |
37efbbd8 ZJS |
2561 | executable('systemd-networkd', |
2562 | systemd_networkd_sources, | |
2563 | include_directories : includes, | |
2564 | link_with : [libnetworkd_core, | |
37efbbd8 | 2565 | libsystemd_network, |
0c06b506 | 2566 | libudev_static, |
37efbbd8 | 2567 | libshared], |
4b57a272 | 2568 | dependencies : [threads], |
37efbbd8 ZJS |
2569 | install_rpath : rootlibexecdir, |
2570 | install : true, | |
2571 | install_dir : rootlibexecdir) | |
2572 | ||
2573 | executable('systemd-networkd-wait-online', | |
2574 | systemd_networkd_wait_online_sources, | |
2575 | include_directories : includes, | |
2576 | link_with : [libnetworkd_core, | |
2577 | libshared], | |
2578 | install_rpath : rootlibexecdir, | |
2579 | install : true, | |
2580 | install_dir : rootlibexecdir) | |
5c23128d | 2581 | |
dcfe072a FS |
2582 | exe = executable('networkctl', |
2583 | networkctl_sources, | |
2584 | include_directories : includes, | |
2585 | link_with : [libsystemd_network, | |
aac26058 | 2586 | libshared], |
dcfe072a FS |
2587 | install_rpath : rootlibexecdir, |
2588 | install : true, | |
2589 | install_dir : rootbindir) | |
5a8b1640 | 2590 | public_programs += exe |
dcfe072a | 2591 | endif |
e821f6a9 ZJS |
2592 | |
2593 | executable('systemd-sulogin-shell', | |
2594 | ['src/sulogin-shell/sulogin-shell.c'], | |
2595 | include_directories : includes, | |
2596 | link_with : [libshared], | |
2597 | install_rpath : rootlibexecdir, | |
2598 | install : true, | |
2599 | install_dir : rootlibexecdir) | |
2600 | ||
69e96427 ZJS |
2601 | ############################################################ |
2602 | ||
2603 | foreach tuple : tests | |
37efbbd8 ZJS |
2604 | sources = tuple[0] |
2605 | link_with = tuple[1].length() > 0 ? tuple[1] : [libshared] | |
2606 | dependencies = tuple[2] | |
2607 | condition = tuple.length() >= 4 ? tuple[3] : '' | |
2608 | type = tuple.length() >= 5 ? tuple[4] : '' | |
2609 | defs = tuple.length() >= 6 ? tuple[5] : [] | |
2610 | incs = tuple.length() >= 7 ? tuple[6] : includes | |
2611 | timeout = 30 | |
2612 | ||
2613 | name = sources[0].split('/')[-1].split('.')[0] | |
2614 | if type.startswith('timeout=') | |
2615 | timeout = type.split('=')[1].to_int() | |
2616 | type = '' | |
2617 | endif | |
08318a2c AD |
2618 | if want_tests == 'false' |
2619 | message('Not compiling @0@ because tests is set to false'.format(name)) | |
2620 | elif condition == '' or conf.get(condition) == 1 | |
37efbbd8 ZJS |
2621 | exe = executable( |
2622 | name, | |
2623 | sources, | |
2624 | include_directories : incs, | |
2625 | link_with : link_with, | |
2626 | dependencies : dependencies, | |
2627 | c_args : defs, | |
2628 | install_rpath : rootlibexecdir, | |
7cdd9783 MB |
2629 | install : install_tests, |
2630 | install_dir : join_paths(testsdir, type)) | |
37efbbd8 ZJS |
2631 | |
2632 | if type == 'manual' | |
2633 | message('@0@ is a manual test'.format(name)) | |
2634 | elif type == 'unsafe' and want_tests != 'unsafe' | |
2635 | message('@0@ is an unsafe test'.format(name)) | |
2636 | else | |
2637 | test(name, exe, | |
2638 | env : test_env, | |
2639 | timeout : timeout) | |
2640 | endif | |
2641 | else | |
2642 | message('Not compiling @0@ because @1@ is not true'.format(name, condition)) | |
2643 | endif | |
69e96427 ZJS |
2644 | endforeach |
2645 | ||
0632b4cd | 2646 | exe = executable( |
37efbbd8 ZJS |
2647 | 'test-libsystemd-sym', |
2648 | test_libsystemd_sym_c, | |
2649 | include_directories : includes, | |
2650 | link_with : [libsystemd], | |
2651 | install : install_tests, | |
2652 | install_dir : testsdir) | |
0632b4cd | 2653 | test('test-libsystemd-sym', exe) |
37ab1a25 | 2654 | |
0632b4cd ZJS |
2655 | exe = executable( |
2656 | 'test-libsystemd-static-sym', | |
2657 | test_libsystemd_sym_c, | |
2658 | include_directories : includes, | |
0632b4cd ZJS |
2659 | link_with : [install_libsystemd_static], |
2660 | dependencies : [threads], # threads is already included in dependencies on the library, | |
2661 | # but does not seem to get propagated. Add here as a work-around. | |
20f3d32d DC |
2662 | build_by_default : static_libsystemd_pic, |
2663 | install : install_tests and static_libsystemd_pic, | |
0632b4cd | 2664 | install_dir : testsdir) |
20f3d32d | 2665 | if static_libsystemd_pic |
0632b4cd ZJS |
2666 | test('test-libsystemd-static-sym', exe) |
2667 | endif | |
37ab1a25 | 2668 | |
0632b4cd | 2669 | exe = executable( |
37efbbd8 ZJS |
2670 | 'test-libudev-sym', |
2671 | test_libudev_sym_c, | |
2672 | include_directories : includes, | |
2673 | c_args : ['-Wno-deprecated-declarations'], | |
2674 | link_with : [libudev], | |
2675 | install : install_tests, | |
2676 | install_dir : testsdir) | |
0632b4cd ZJS |
2677 | test('test-libudev-sym', exe) |
2678 | ||
2679 | exe = executable( | |
2680 | 'test-libudev-static-sym', | |
2681 | test_libudev_sym_c, | |
2682 | include_directories : includes, | |
20f3d32d | 2683 | c_args : ['-Wno-deprecated-declarations'], |
0632b4cd | 2684 | link_with : [install_libudev_static], |
20f3d32d DC |
2685 | build_by_default : static_libudev_pic, |
2686 | install : install_tests and static_libudev_pic, | |
0632b4cd | 2687 | install_dir : testsdir) |
20f3d32d | 2688 | if static_libudev_pic |
0632b4cd ZJS |
2689 | test('test-libudev-static-sym', exe) |
2690 | endif | |
e0bec52f | 2691 | |
69e96427 | 2692 | ############################################################ |
5c23128d | 2693 | |
7db7d5b7 JR |
2694 | fuzzer_exes = [] |
2695 | ||
2696 | foreach tuple : fuzzers | |
2697 | sources = tuple[0] | |
2698 | link_with = tuple[1].length() > 0 ? tuple[1] : [libshared] | |
2699 | dependencies = tuple[2] | |
2700 | defs = tuple.length() >= 4 ? tuple[3] : [] | |
2701 | incs = tuple.length() >= 5 ? tuple[4] : includes | |
2702 | ||
31e57a35 | 2703 | if fuzzer_build |
7db7d5b7 JR |
2704 | dependencies += fuzzing_engine |
2705 | else | |
2706 | sources += 'src/fuzz/fuzz-main.c' | |
2707 | endif | |
2708 | ||
2709 | name = sources[0].split('/')[-1].split('.')[0] | |
2710 | ||
2711 | fuzzer_exes += executable( | |
2712 | name, | |
2713 | sources, | |
2714 | include_directories : [incs, include_directories('src/fuzz')], | |
2715 | link_with : link_with, | |
2716 | dependencies : dependencies, | |
2717 | c_args : defs, | |
2718 | install : false) | |
2719 | endforeach | |
2720 | ||
2721 | run_target('fuzzers', | |
2722 | depends : fuzzer_exes, | |
2723 | command : ['true']) | |
2724 | ||
2725 | ############################################################ | |
2726 | ||
5c23128d ZJS |
2727 | make_directive_index_py = find_program('tools/make-directive-index.py') |
2728 | make_man_index_py = find_program('tools/make-man-index.py') | |
b184e8fe | 2729 | xml_helper_py = find_program('tools/xml_helper.py') |
abba22c5 | 2730 | hwdb_update_sh = find_program('tools/meson-hwdb-update.sh') |
5c23128d ZJS |
2731 | |
2732 | subdir('units') | |
2733 | subdir('sysctl.d') | |
2734 | subdir('sysusers.d') | |
2735 | subdir('tmpfiles.d') | |
e783f957 | 2736 | subdir('presets') |
5c23128d ZJS |
2737 | subdir('hwdb') |
2738 | subdir('network') | |
2739 | subdir('man') | |
2740 | subdir('shell-completion/bash') | |
2741 | subdir('shell-completion/zsh') | |
2d684e65 LP |
2742 | subdir('doc/sysvinit') |
2743 | subdir('doc/var-log') | |
5c23128d ZJS |
2744 | |
2745 | # FIXME: figure out if the warning is true: | |
2746 | # https://github.com/mesonbuild/meson/wiki/Reference-manual#install_subdir | |
2747 | install_subdir('factory/etc', | |
2748 | install_dir : factorydir) | |
2749 | ||
2750 | ||
2751 | install_data('xorg/50-systemd-user.sh', | |
2752 | install_dir : xinitrcdir) | |
582faeb4 DJL |
2753 | install_data('modprobe.d/systemd.conf', |
2754 | install_dir : modprobedir) | |
f09eb768 | 2755 | install_data('LICENSE.GPL2', |
5c23128d | 2756 | 'LICENSE.LGPL2.1', |
f09eb768 LP |
2757 | 'NEWS', |
2758 | 'README', | |
2759 | 'doc/CODING_STYLE', | |
2760 | 'doc/DISTRO_PORTING', | |
2761 | 'doc/ENVIRONMENT.md', | |
2762 | 'doc/HACKING', | |
2763 | 'doc/TRANSIENT-SETTINGS.md', | |
2764 | 'doc/TRANSLATORS', | |
2765 | 'doc/UIDS-GIDS.md', | |
5c23128d ZJS |
2766 | 'src/libsystemd/sd-bus/GVARIANT-SERIALIZATION', |
2767 | install_dir : docdir) | |
d68b342b | 2768 | |
94e75a54 ZJS |
2769 | meson.add_install_script('sh', '-c', mkdir_p.format(systemdstatedir)) |
2770 | meson.add_install_script('sh', '-c', 'touch $DESTDIR@0@'.format(prefixdir)) | |
2771 | ||
d68b342b ZJS |
2772 | ############################################################ |
2773 | ||
005a29f2 ZJS |
2774 | meson_check_help = find_program('tools/meson-check-help.sh') |
2775 | ||
2776 | foreach exec : public_programs | |
37efbbd8 ZJS |
2777 | name = exec.full_path().split('/')[-1] |
2778 | test('check-help-' + name, | |
2779 | meson_check_help, | |
2780 | args : [exec.full_path()]) | |
005a29f2 ZJS |
2781 | endforeach |
2782 | ||
2783 | ############################################################ | |
2784 | ||
52d4d1d3 ZJS |
2785 | # Enable tests for all supported sanitizers |
2786 | foreach tuple : sanitizers | |
2787 | sanitizer = tuple[0] | |
2788 | build = tuple[1] | |
b68dfb9e | 2789 | |
7a6397d2 | 2790 | if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer)) |
52d4d1d3 ZJS |
2791 | prev = '' |
2792 | foreach p : fuzz_regression_tests | |
2793 | b = p.split('/')[-2] | |
2794 | c = p.split('/')[-1] | |
2795 | ||
2796 | name = '@0@:@1@'.format(b, sanitizer) | |
2797 | ||
2798 | if name != prev | |
2799 | if want_tests == 'false' | |
2800 | message('Not compiling @0@ because tests is set to false'.format(name)) | |
2801 | elif slow_tests | |
2802 | exe = custom_target( | |
2803 | name, | |
2804 | output : name, | |
2805 | depends : build, | |
2806 | command : [env, 'ln', '-fs', | |
2807 | join_paths(build.full_path(), b), | |
2808 | '@OUTPUT@'], | |
2809 | build_by_default : true) | |
2810 | else | |
2811 | message('Not compiling @0@ because slow-tests is set to false'.format(name)) | |
2812 | endif | |
2813 | endif | |
2814 | prev = name | |
2815 | ||
2816 | if want_tests != 'false' and slow_tests | |
2817 | test('@0@:@1@:@2@'.format(b, c, sanitizer), | |
2818 | env, | |
2819 | args : [exe.full_path(), | |
2820 | join_paths(meson.source_root(), | |
2821 | 'test/fuzz-regressions', | |
2822 | p)]) | |
2823 | endif | |
2824 | endforeach | |
b68dfb9e ZJS |
2825 | endif |
2826 | endforeach | |
2827 | ||
52d4d1d3 | 2828 | |
b68dfb9e ZJS |
2829 | ############################################################ |
2830 | ||
0700e8ba | 2831 | if git.found() |
37efbbd8 ZJS |
2832 | all_files = run_command( |
2833 | git, | |
450b60ba | 2834 | ['--git-dir=@0@/.git'.format(meson.current_source_dir()), |
37efbbd8 ZJS |
2835 | 'ls-files', |
2836 | ':/*.[ch]']) | |
2837 | all_files = files(all_files.stdout().split()) | |
d68b342b | 2838 | |
e85a690b | 2839 | custom_target( |
0700e8ba | 2840 | 'tags', |
e85a690b | 2841 | output : 'tags', |
25a82102 | 2842 | command : [env, 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files) |
2f09974f | 2843 | run_target( |
0700e8ba | 2844 | 'ctags', |
25a82102 | 2845 | command : [env, 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files) |
d68b342b | 2846 | endif |
177929c2 ZJS |
2847 | |
2848 | if git.found() | |
37efbbd8 | 2849 | meson_git_contrib_sh = find_program('tools/meson-git-contrib.sh') |
a923e085 | 2850 | run_target( |
37efbbd8 | 2851 | 'git-contrib', |
37efbbd8 | 2852 | command : [meson_git_contrib_sh]) |
177929c2 | 2853 | endif |
dd6ab3df ZJS |
2854 | |
2855 | if git.found() | |
2856 | git_head = run_command( | |
2857 | git, | |
450b60ba | 2858 | ['--git-dir=@0@/.git'.format(meson.current_source_dir()), |
dd6ab3df ZJS |
2859 | 'rev-parse', 'HEAD']).stdout().strip() |
2860 | git_head_short = run_command( | |
2861 | git, | |
450b60ba | 2862 | ['--git-dir=@0@/.git'.format(meson.current_source_dir()), |
dd6ab3df ZJS |
2863 | 'rev-parse', '--short=7', 'HEAD']).stdout().strip() |
2864 | ||
2865 | run_target( | |
2866 | 'git-snapshot', | |
2867 | command : ['git', 'archive', | |
450b60ba | 2868 | '-o', '@0@/systemd-@1@.tar.gz'.format(meson.current_source_dir(), |
dd6ab3df ZJS |
2869 | git_head_short), |
2870 | '--prefix', 'systemd-@0@/'.format(git_head), | |
2871 | 'HEAD']) | |
2872 | endif | |
829257d1 ZJS |
2873 | |
2874 | ############################################################ | |
2875 | ||
51b13863 LP |
2876 | meson_check_api_docs_sh = find_program('tools/meson-check-api-docs.sh') |
2877 | run_target( | |
2878 | 'check-api-docs', | |
2879 | depends : [man, libsystemd, libudev], | |
2880 | command : [meson_check_api_docs_sh, libsystemd.full_path(), libudev.full_path()]) | |
2881 | ||
2882 | ############################################################ | |
2883 | ||
829257d1 ZJS |
2884 | status = [ |
2885 | '@0@ @1@'.format(meson.project_name(), meson.project_version()), | |
2886 | ||
2675413e | 2887 | 'split /usr: @0@'.format(split_usr), |
157baa87 | 2888 | 'split bin-sbin: @0@'.format(split_bin), |
359b496f YW |
2889 | 'prefix directory: @0@'.format(prefixdir), |
2890 | 'rootprefix directory: @0@'.format(rootprefixdir), | |
2891 | 'sysconf directory: @0@'.format(sysconfdir), | |
2892 | 'include directory: @0@'.format(includedir), | |
2893 | 'lib directory: @0@'.format(libdir), | |
2894 | 'rootlib directory: @0@'.format(rootlibdir), | |
829257d1 ZJS |
2895 | 'SysV init scripts: @0@'.format(sysvinit_path), |
2896 | 'SysV rc?.d directories: @0@'.format(sysvrcnd_path), | |
359b496f YW |
2897 | 'PAM modules directory: @0@'.format(pamlibdir), |
2898 | 'PAM configuration directory: @0@'.format(pamconfdir), | |
2899 | 'RPM macros directory: @0@'.format(rpmmacrosdir), | |
2900 | 'modprobe.d directory: @0@'.format(modprobedir), | |
2901 | 'D-Bus policy directory: @0@'.format(dbuspolicydir), | |
2902 | 'D-Bus session directory: @0@'.format(dbussessionservicedir), | |
2903 | 'D-Bus system directory: @0@'.format(dbussystemservicedir), | |
2904 | 'bash completions directory: @0@'.format(bashcompletiondir), | |
2905 | 'zsh completions directory: @0@'.format(zshcompletiondir), | |
829257d1 ZJS |
2906 | 'extra start script: @0@'.format(get_option('rc-local')), |
2907 | 'extra stop script: @0@'.format(get_option('halt-local')), | |
2908 | 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'), | |
2909 | get_option('debug-tty')), | |
2910 | 'TTY GID: @0@'.format(tty_gid), | |
ac09340e | 2911 | 'users GID: @0@'.format(substs.get('USERS_GID')), |
829257d1 ZJS |
2912 | 'maximum system UID: @0@'.format(system_uid_max), |
2913 | 'maximum system GID: @0@'.format(system_gid_max), | |
87d5e4f2 LP |
2914 | 'minimum dynamic UID: @0@'.format(dynamic_uid_min), |
2915 | 'maximum dynamic UID: @0@'.format(dynamic_uid_max), | |
2916 | 'minimum container UID base: @0@'.format(container_uid_base_min), | |
2917 | 'maximum container UID base: @0@'.format(container_uid_base_max), | |
829257d1 | 2918 | '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')), |
4e15a734 | 2919 | 'render group access mode: @0@'.format(get_option('group-render-mode')), |
359b496f | 2920 | 'certificate root directory: @0@'.format(get_option('certificate-root')), |
829257d1 | 2921 | 'support URL: @0@'.format(support_url), |
afde4574 LP |
2922 | 'nobody user name: @0@'.format(nobody_user), |
2923 | 'nobody group name: @0@'.format(nobody_group), | |
829257d1 | 2924 | 'fallback hostname: @0@'.format(get_option('fallback-hostname')), |
5248e7e1 | 2925 | 'symbolic gateway hostnames: @0@'.format(', '.join(gateway_hostnames)), |
829257d1 ZJS |
2926 | |
2927 | 'default DNSSEC mode: @0@'.format(default_dnssec), | |
c9299be2 | 2928 | 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls), |
829257d1 ZJS |
2929 | 'default cgroup hierarchy: @0@'.format(default_hierarchy), |
2930 | 'default KillUserProcesses setting: @0@'.format(kill_user_processes)] | |
2931 | ||
2932 | alt_dns_servers = '\n '.join(dns_servers.split(' ')) | |
2933 | alt_ntp_servers = '\n '.join(ntp_servers.split(' ')) | |
2934 | status += [ | |
2935 | 'default DNS servers: @0@'.format(alt_dns_servers), | |
2936 | 'default NTP servers: @0@'.format(alt_ntp_servers)] | |
2937 | ||
2938 | alt_time_epoch = run_command('date', '-Is', '-u', '-d', | |
2939 | '@@0@'.format(time_epoch)).stdout().strip() | |
2940 | status += [ | |
2941 | 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)] | |
2942 | ||
2943 | # TODO: | |
2944 | # CFLAGS: ${OUR_CFLAGS} ${CFLAGS} | |
2945 | # CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS} | |
2946 | # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS} | |
2947 | ||
349cc4a5 | 2948 | if conf.get('ENABLE_EFI') == 1 |
5a8b1640 | 2949 | status += 'efi arch: @0@'.format(efi_arch) |
829257d1 ZJS |
2950 | |
2951 | if have_gnu_efi | |
2952 | status += [ | |
2953 | 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME), | |
2954 | 'EFI CC @0@'.format(efi_cc), | |
359b496f YW |
2955 | 'EFI lib directory: @0@'.format(efi_libdir), |
2956 | 'EFI lds directory: @0@'.format(efi_ldsdir), | |
2957 | 'EFI include directory: @0@'.format(efi_incdir)] | |
829257d1 ZJS |
2958 | endif |
2959 | endif | |
2960 | ||
2961 | found = [] | |
2962 | missing = [] | |
2963 | ||
2964 | foreach tuple : [ | |
2965 | ['libcryptsetup'], | |
2966 | ['PAM'], | |
2967 | ['AUDIT'], | |
2968 | ['IMA'], | |
2969 | ['AppArmor'], | |
2970 | ['SELinux'], | |
2971 | ['SECCOMP'], | |
2972 | ['SMACK'], | |
2973 | ['zlib'], | |
2974 | ['xz'], | |
2975 | ['lz4'], | |
2976 | ['bzip2'], | |
2977 | ['ACL'], | |
2978 | ['gcrypt'], | |
2979 | ['qrencode'], | |
2980 | ['microhttpd'], | |
2981 | ['gnutls'], | |
096cbdce | 2982 | ['openssl'], |
829257d1 | 2983 | ['libcurl'], |
d1bf5675 | 2984 | ['idn'], |
87057e24 | 2985 | ['libidn2'], |
829257d1 ZJS |
2986 | ['libidn'], |
2987 | ['libiptc'], | |
2988 | ['elfutils'], | |
2989 | ['binfmt'], | |
2990 | ['vconsole'], | |
2991 | ['quotacheck'], | |
2992 | ['tmpfiles'], | |
2993 | ['environment.d'], | |
2994 | ['sysusers'], | |
2995 | ['firstboot'], | |
2996 | ['randomseed'], | |
2997 | ['backlight'], | |
2998 | ['rfkill'], | |
2999 | ['logind'], | |
3000 | ['machined'], | |
61d0578b | 3001 | ['portabled'], |
829257d1 ZJS |
3002 | ['importd'], |
3003 | ['hostnamed'], | |
3004 | ['timedated'], | |
3005 | ['timesyncd'], | |
3006 | ['localed'], | |
3007 | ['networkd'], | |
a7456af5 | 3008 | ['resolve'], |
096cbdce IT |
3009 | ['DNS-over-TLS(gnutls)', conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1], |
3010 | ['DNS-over-TLS(openssl)', conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1], | |
829257d1 ZJS |
3011 | ['coredump'], |
3012 | ['polkit'], | |
3013 | ['legacy pkla', install_polkit_pkla], | |
3014 | ['efi'], | |
3015 | ['gnu-efi', have_gnu_efi], | |
3016 | ['kmod'], | |
3017 | ['xkbcommon'], | |
c4c978a0 | 3018 | ['pcre2'], |
829257d1 ZJS |
3019 | ['blkid'], |
3020 | ['dbus'], | |
3021 | ['glib'], | |
08540a95 YW |
3022 | ['nss-myhostname', conf.get('ENABLE_NSS_MYHOSTNAME') == 1], |
3023 | ['nss-mymachines', conf.get('ENABLE_NSS_MYMACHINES') == 1], | |
3024 | ['nss-resolve', conf.get('ENABLE_NSS_RESOLVE') == 1], | |
3025 | ['nss-systemd', conf.get('ENABLE_NSS_SYSTEMD') == 1], | |
829257d1 ZJS |
3026 | ['hwdb'], |
3027 | ['tpm'], | |
3028 | ['man pages', want_man], | |
3029 | ['html pages', want_html], | |
3030 | ['man page indices', want_man and have_lxml], | |
829257d1 ZJS |
3031 | ['SysV compat'], |
3032 | ['utmp'], | |
3033 | ['ldconfig'], | |
3034 | ['hibernate'], | |
3035 | ['adm group', get_option('adm-group')], | |
3036 | ['wheel group', get_option('wheel-group')], | |
b14e1b43 | 3037 | ['gshadow'], |
829257d1 ZJS |
3038 | ['debug hashmap'], |
3039 | ['debug mmap cache'], | |
d18cb393 | 3040 | ['valgrind', conf.get('VALGRIND') == 1], |
829257d1 ZJS |
3041 | ] |
3042 | ||
af4d7860 ZJS |
3043 | if tuple.length() >= 2 |
3044 | cond = tuple[1] | |
3045 | else | |
829257d1 ZJS |
3046 | ident1 = 'HAVE_' + tuple[0].underscorify().to_upper() |
3047 | ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper() | |
349cc4a5 | 3048 | cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1 |
829257d1 ZJS |
3049 | endif |
3050 | if cond | |
5a8b1640 | 3051 | found += tuple[0] |
829257d1 | 3052 | else |
5a8b1640 | 3053 | missing += tuple[0] |
829257d1 ZJS |
3054 | endif |
3055 | endforeach | |
3056 | ||
3057 | status += [ | |
9d39c1bf | 3058 | '', |
829257d1 | 3059 | 'enabled features: @0@'.format(', '.join(found)), |
9d39c1bf ZJS |
3060 | '', |
3061 | 'disabled features: @0@'.format(', '.join(missing)), | |
3062 | ''] | |
829257d1 | 3063 | message('\n '.join(status)) |
9a8e64b0 ZJS |
3064 | |
3065 | if rootprefixdir != rootprefix_default | |
8ea9fad7 YW |
3066 | warning('\n' + |
3067 | 'Note that the installation prefix was changed to "@0@".\n'.format(rootprefixdir) + | |
3068 | 'systemd used fixed names for unit file directories and other paths, so anything\n' + | |
3069 | 'except the default ("@0@") is strongly discouraged.'.format(rootprefix_default)) | |
9a8e64b0 | 3070 | endif |