]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/meson.build
Rename def.h to constants.h
[thirdparty/systemd.git] / src / basic / meson.build
CommitLineData
db9ecf05 1# SPDX-License-Identifier: LGPL-2.1-or-later
3a726fcd 2
f1b98127
ZJS
3basic_sources = files(
4 'MurmurHash2.c',
5 'MurmurHash2.h',
6 'af-list.c',
7 'af-list.h',
8 'alloc-util.c',
9 'alloc-util.h',
10 'architecture.c',
11 'architecture.h',
ee617a4e
ZJS
12 'argv-util.c',
13 'argv-util.h',
f1b98127
ZJS
14 'arphrd-util.c',
15 'arphrd-util.h',
16 'async.c',
17 'async.h',
18 'audit-util.c',
19 'audit-util.h',
20 'build.c',
21 'build.h',
22 'bus-label.c',
23 'bus-label.h',
24 'cap-list.c',
25 'cap-list.h',
26 'capability-util.c',
27 'capability-util.h',
28 'cgroup-util.c',
29 'cgroup-util.h',
30 'chase-symlinks.c',
31 'chase-symlinks.h',
32 'chattr-util.c',
33 'chattr-util.h',
34 'conf-files.c',
35 'conf-files.h',
28db6fbf 36 'constants.h',
7176f06c
LP
37 'devnum-util.c',
38 'devnum-util.h',
f1b98127
ZJS
39 'dirent-util.c',
40 'dirent-util.h',
41 'dns-def.h',
42 'efivars.c',
43 'efivars.h',
44 'env-file.c',
45 'env-file.h',
46 'env-util.c',
47 'env-util.h',
48 'errno-list.c',
49 'errno-list.h',
50 'errno-util.h',
51 'escape.c',
52 'escape.h',
53 'ether-addr-util.c',
54 'ether-addr-util.h',
55 'extract-word.c',
56 'extract-word.h',
57 'fd-util.c',
58 'fd-util.h',
59 'fileio.c',
60 'fileio.h',
61 'filesystems.c',
62 'filesystems.h',
63 'format-util.c',
64 'format-util.h',
65 'fs-util.c',
66 'fs-util.h',
67 'glob-util.c',
68 'glob-util.h',
69 'glyph-util.c',
70 'glyph-util.h',
71 'gunicode.c',
72 'gunicode.h',
73 'hash-funcs.c',
74 'hash-funcs.h',
75 'hashmap.c',
76 'hashmap.h',
77 'hexdecoct.c',
78 'hexdecoct.h',
79 'hmac.c',
80 'hmac.h',
81 'hostname-util.c',
82 'hostname-util.h',
83 'in-addr-util.c',
84 'in-addr-util.h',
baa6a42d
ZJS
85 'initrd-util.c',
86 'initrd-util.h',
f1b98127
ZJS
87 'inotify-util.c',
88 'inotify-util.h',
89 'io-util.c',
90 'io-util.h',
91 'ioprio-util.c',
92 'ioprio-util.h',
93 'limits-util.c',
94 'limits-util.h',
95 'linux/btrfs.h',
96 'linux/btrfs_tree.h',
97 'linux/can/netlink.h',
98 'linux/can/vxcan.h',
99 'linux/cfm_bridge.h',
100 'linux/fib_rules.h',
101 'linux/fou.h',
102 'linux/genetlink.h',
103 'linux/hdlc/ioctl.h',
104 'linux/if.h',
105 'linux/if_addr.h',
106 'linux/if_bonding.h',
107 'linux/if_bridge.h',
108 'linux/if_ether.h',
109 'linux/if_link.h',
110 'linux/if_macsec.h',
111 'linux/if_tun.h',
112 'linux/if_tunnel.h',
113 'linux/in.h',
114 'linux/in6.h',
115 'linux/ipv6_route.h',
116 'linux/l2tp.h',
117 'linux/libc-compat.h',
118 'linux/mrp_bridge.h',
119 'linux/netdevice.h',
120 'linux/netfilter/nf_tables.h',
121 'linux/netfilter/nfnetlink.h',
122 'linux/netlink.h',
123 'linux/nexthop.h',
124 'linux/nl80211.h',
125 'linux/pkt_sched.h',
126 'linux/rtnetlink.h',
127 'linux/wireguard.h',
128 'list.h',
129 'locale-util.c',
130 'locale-util.h',
131 'log.c',
132 'log.h',
3ae6b3bf 133 'logarithm.h',
f1b98127
ZJS
134 'login-util.c',
135 'login-util.h',
136 'macro.h',
fbccfa95 137 'math-util.h',
f1b98127
ZJS
138 'memfd-util.c',
139 'memfd-util.h',
140 'memory-util.c',
141 'memory-util.h',
142 'mempool.c',
143 'mempool.h',
144 'missing_audit.h',
145 'missing_capability.h',
146 'missing_drm.h',
147 'missing_fcntl.h',
148 'missing_fs.h',
149 'missing_input.h',
150 'missing_ioprio.h',
151 'missing_keyctl.h',
152 'missing_magic.h',
153 'missing_mman.h',
154 'missing_mount.h',
155 'missing_network.h',
156 'missing_prctl.h',
157 'missing_random.h',
158 'missing_resource.h',
159 'missing_sched.h',
160 'missing_securebits.h',
161 'missing_socket.h',
162 'missing_stat.h',
163 'missing_stdlib.h',
164 'missing_syscall.h',
165 'missing_timerfd.h',
166 'missing_type.h',
167 'mkdir.c',
168 'mkdir.h',
169 'mountpoint-util.c',
170 'mountpoint-util.h',
171 'namespace-util.c',
172 'namespace-util.h',
173 'nss-util.h',
174 'nulstr-util.c',
175 'nulstr-util.h',
176 'ordered-set.c',
177 'ordered-set.h',
178 'os-util.c',
179 'os-util.h',
180 'parse-util.c',
181 'parse-util.h',
182 'path-lookup.c',
183 'path-lookup.h',
184 'path-util.c',
185 'path-util.h',
186 'percent-util.c',
187 'percent-util.h',
188 'prioq.c',
189 'prioq.h',
190 'proc-cmdline.c',
191 'proc-cmdline.h',
192 'process-util.c',
193 'process-util.h',
194 'procfs-util.c',
195 'procfs-util.h',
196 'pthread-util.h',
197 'random-util.c',
198 'random-util.h',
199 'ratelimit.c',
200 'ratelimit.h',
201 'raw-clone.h',
202 'raw-reboot.h',
f1b98127
ZJS
203 'recurse-dir.c',
204 'recurse-dir.h',
205 'replace-var.c',
206 'replace-var.h',
207 'rlimit-util.c',
208 'rlimit-util.h',
209 'set.h',
210 'sigbus.c',
211 'sigbus.h',
212 'signal-util.c',
213 'signal-util.h',
214 'siphash24.c',
215 'siphash24.h',
216 'socket-util.c',
217 'socket-util.h',
218 'sort-util.c',
219 'sort-util.h',
220 'sparse-endian.h',
221 'special.h',
222 'stat-util.c',
223 'stat-util.h',
224 'static-destruct.h',
225 'stdio-util.h',
226 'strbuf.c',
227 'strbuf.h',
228 'string-table.c',
229 'string-table.h',
230 'string-util.c',
231 'string-util.h',
232 'strv.c',
233 'strv.h',
234 'strxcpyx.c',
235 'strxcpyx.h',
236 'sync-util.c',
237 'sync-util.h',
238 'sysctl-util.c',
239 'sysctl-util.h',
240 'syslog-util.c',
241 'syslog-util.h',
242 'terminal-util.c',
243 'terminal-util.h',
244 'time-util.c',
245 'time-util.h',
246 'tmpfile-util.c',
247 'tmpfile-util.h',
a30d3c01
YW
248 'uid-range.c',
249 'uid-range.h',
f1b98127
ZJS
250 'umask-util.h',
251 'unaligned.h',
252 'unit-def.c',
253 'unit-def.h',
254 'unit-file.c',
255 'unit-file.h',
256 'unit-name.c',
257 'unit-name.h',
258 'user-util.c',
259 'user-util.h',
260 'utf8.c',
261 'utf8.h',
f1b98127
ZJS
262 'virt.c',
263 'virt.h',
264 'xattr-util.c',
265 'xattr-util.h')
5c23128d 266
18bf324a 267missing_audit_h = files('missing_audit.h')
54480d64 268missing_capability_h = files('missing_capability.h')
0b7d48f5 269missing_socket_h = files('missing_socket.h')
5c23128d 270
35b42e56
ZJS
271missing_syscall_def_h = files('missing_syscall_def.h')
272basic_sources += missing_syscall_def_h
273
5c23128d
ZJS
274generate_af_list = find_program('generate-af-list.sh')
275af_list_txt = custom_target(
37efbbd8
ZJS
276 'af-list.txt',
277 output : 'af-list.txt',
0b7d48f5 278 command : [generate_af_list, cpp, config_h, missing_socket_h],
37efbbd8 279 capture : true)
5c23128d
ZJS
280
281generate_arphrd_list = find_program('generate-arphrd-list.sh')
282arphrd_list_txt = custom_target(
37efbbd8
ZJS
283 'arphrd-list.txt',
284 output : 'arphrd-list.txt',
01234e1f 285 command : [generate_arphrd_list, cpp, config_h],
37efbbd8 286 capture : true)
5c23128d
ZJS
287
288generate_cap_list = find_program('generate-cap-list.sh')
289cap_list_txt = custom_target(
37efbbd8
ZJS
290 'cap-list.txt',
291 output : 'cap-list.txt',
54480d64 292 command : [generate_cap_list, cpp, config_h, missing_capability_h],
37efbbd8 293 capture : true)
5c23128d
ZJS
294
295generate_errno_list = find_program('generate-errno-list.sh')
296errno_list_txt = custom_target(
37efbbd8
ZJS
297 'errno-list.txt',
298 output : 'errno-list.txt',
299 command : [generate_errno_list, cpp],
300 capture : true)
5c23128d
ZJS
301
302generated_gperf_headers = []
303foreach item : [['af', af_list_txt, 'af', ''],
304 ['arphrd', arphrd_list_txt, 'arphrd', 'ARPHRD_'],
305 ['cap', cap_list_txt, 'capability', ''],
7b5e750d 306 ['errno', errno_list_txt, 'errno', '']]
5c23128d 307
37efbbd8
ZJS
308 fname = '@0@-from-name.gperf'.format(item[0])
309 gperf_file = custom_target(
310 fname,
311 input : item[1],
312 output : fname,
313 command : [generate_gperfs, item[2], item[3], '@INPUT@'],
314 capture : true)
5c23128d 315
37efbbd8
ZJS
316 fname = '@0@-from-name.h'.format(item[0])
317 target1 = custom_target(
318 fname,
319 input : gperf_file,
320 output : fname,
321 command : [gperf,
322 '-L', 'ANSI-C', '-t', '--ignore-case',
323 '-N', 'lookup_@0@'.format(item[2]),
324 '-H', 'hash_@0@_name'.format(item[2]),
325 '-p', '-C',
326 '@INPUT@'],
327 capture : true)
5c23128d 328
37efbbd8
ZJS
329 fname = '@0@-to-name.h'.format(item[0])
330 awkscript = '@0@-to-name.awk'.format(item[0])
331 target2 = custom_target(
332 fname,
333 input : [awkscript, item[1]],
334 output : fname,
335 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
336 capture : true)
5c23128d 337
37efbbd8 338 generated_gperf_headers += [target1, target2]
5c23128d
ZJS
339endforeach
340
18bf324a 341basic_sources += generated_gperf_headers
9a6da617
ZJS
342
343############################################################
344
345arch_list = [
346 'alpha',
347 'arc',
348 'arm',
349 'arm64',
350 'i386',
351 'ia64',
89f60c21 352 'loongarch64',
9a6da617
ZJS
353 'm68k',
354 'mips64',
355 'mips64n32',
356 'mipso32',
d40de37e 357 'parisc',
9a6da617
ZJS
358 'powerpc',
359 'powerpc64',
18adce15 360 'riscv32',
302beee3 361 'riscv64',
9a6da617
ZJS
362 's390',
363 's390x',
364 'sparc',
18adce15
YW
365 'x86_64'
366]
9a6da617
ZJS
367
368run_target(
369 'update-syscall-tables',
d3821a33 370 command : [update_syscall_tables_sh, meson.current_source_dir()] + arch_list)
9a6da617 371
984b5296 372syscall_list_txt = files('syscall-list.txt')
35b42e56
ZJS
373
374syscall_lists = []
375foreach arch: arch_list
1f6f8cc8 376 syscall_lists += files('syscalls-@0@.txt'.format(arch))
35b42e56
ZJS
377endforeach
378
379missing_syscalls_py = find_program('missing_syscalls.py')
380
381run_target(
382 'update-syscall-header',
383 command : [missing_syscalls_py,
384 missing_syscall_def_h,
385 syscall_lists])
386
387############################################################
388
659d1924
ILG
389filesystem_includes = ['linux/magic.h',
390 'linux/gfs2_ondisk.h']
391
392check_filesystems = find_program('check-filesystems.sh')
6c889282 393r = run_command([check_filesystems, cpp, files('filesystems-gperf.gperf')] + filesystem_includes, check: false)
659d1924 394if r.returncode() != 0
0923b425 395 error('Unknown filesystems defined in kernel headers:\n\n' + r.stdout())
659d1924
ILG
396endif
397
398filesystems_gperf_h = custom_target(
399 'filesystems-gperf.h',
400 input : 'filesystems-gperf.gperf',
401 output : 'filesystems-gperf.h',
402 command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
403
404generate_filesystem_list = find_program('generate-filesystem-list.py')
405fname = 'filesystem-list.h'
406filesystem_list_h = custom_target(
407 fname,
408 input : 'filesystems-gperf.gperf',
409 output : fname,
410 command : [generate_filesystem_list,
411 '@INPUT@'],
412 capture : true)
413
6d439321
LP
414generate_filesystem_switch_case_h = find_program('generate-filesystem-switch-case.py')
415fname = 'filesystem-switch-case.h'
416filesystem_switch_case_h = custom_target(
417 fname,
418 input : 'filesystems-gperf.gperf',
419 output : 'filesystem-switch-case.h',
420 command : [generate_filesystem_switch_case_h,
421 '@INPUT@'],
422 capture : true)
423
424basic_sources += [filesystem_list_h, filesystem_switch_case_h, filesystems_gperf_h]
659d1924 425
35b42e56
ZJS
426libbasic = static_library(
427 'basic',
428 basic_sources,
e5bc5f1f 429 fundamental_sources,
8d40961c 430 include_directories : basic_includes,
35b42e56
ZJS
431 dependencies : [versiondep,
432 threads,
433 libcap,
2d32453b 434 libm],
35b42e56 435 c_args : ['-fvisibility=default'],
03f7ddf0 436 build_by_default : false)
35b42e56
ZJS
437
438############################################################
439
440basic_gcrypt_sources = files(
441 'gcrypt-util.c',
442 'gcrypt-util.h')
443
444# A convenience library that is separate from libbasic to avoid
445# unnecessary linking to libgcrypt.
446libbasic_gcrypt = static_library(
447 'basic-gcrypt',
448 basic_gcrypt_sources,
8d40961c 449 include_directories : basic_includes,
35b42e56 450 dependencies : [libgcrypt],
03f7ddf0
ZJS
451 c_args : ['-fvisibility=default'],
452 build_by_default : false)
acc50c92
LP
453
454############################################################
455
456basic_compress_sources = files(
457 'compress.c',
458 'compress.h')
459
460# A convenience library that is separate from libbasic to avoid unnecessary
461# linking to the compression libraries.
462libbasic_compress = static_library(
463 'basic-compress',
464 basic_compress_sources,
465 include_directories : basic_includes,
466 dependencies : [libxz,
467 libzstd,
468 liblz4],
469 c_args : ['-fvisibility=default'],
470 build_by_default : false)