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