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