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