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