]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/meson.build
hexdecoct: make unbase64mem and unhexmem always use SIZE_MAX
[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',
f1b98127 5 'af-list.c',
f1b98127 6 'alloc-util.c',
f1b98127 7 'architecture.c',
ee617a4e 8 'argv-util.c',
f1b98127 9 'arphrd-util.c',
f1b98127 10 'audit-util.c',
e54c79cc 11 'btrfs.c',
f1b98127 12 'build.c',
f1b98127 13 'bus-label.c',
f1b98127 14 'cap-list.c',
f1b98127 15 'capability-util.c',
f1b98127 16 'cgroup-util.c',
f461a28d 17 'chase.c',
f1b98127 18 'chattr-util.c',
f1b98127 19 'conf-files.c',
a577a616 20 'confidential-virt.c',
7176f06c 21 'devnum-util.c',
f1b98127 22 'dirent-util.c',
f1b98127 23 'efivars.c',
f1b98127 24 'env-file.c',
f1b98127 25 'env-util.c',
f1b98127 26 'errno-list.c',
f1b98127 27 'escape.c',
f1b98127 28 'ether-addr-util.c',
f1b98127 29 'extract-word.c',
f1b98127 30 'fd-util.c',
f1b98127 31 'fileio.c',
f1b98127 32 'filesystems.c',
f1b98127 33 'format-util.c',
f1b98127 34 'fs-util.c',
f1b98127 35 'glob-util.c',
f1b98127 36 'glyph-util.c',
f1b98127 37 'gunicode.c',
f1b98127 38 'hash-funcs.c',
f1b98127 39 'hashmap.c',
f1b98127 40 'hexdecoct.c',
f1b98127 41 'hmac.c',
f1b98127 42 'hostname-util.c',
f1b98127 43 'in-addr-util.c',
baa6a42d 44 'initrd-util.c',
f1b98127 45 'inotify-util.c',
f1b98127 46 'io-util.c',
f1b98127 47 'ioprio-util.c',
ea1f3814
LP
48 'iovec-util.c',
49 'iovec-wrapper.c',
a452c807 50 'label.c',
f1b98127 51 'limits-util.c',
f1b98127 52 'locale-util.c',
4dd888dc 53 'lock-util.c',
f1b98127 54 'log.c',
f1b98127 55 'login-util.c',
f1b98127 56 'memfd-util.c',
f1b98127 57 'memory-util.c',
f1b98127 58 'mempool.c',
abe72100 59 'memstream-util.c',
f1b98127 60 'mkdir.c',
f1b98127 61 'mountpoint-util.c',
f1b98127 62 'namespace-util.c',
f1b98127 63 'nulstr-util.c',
f1b98127 64 'ordered-set.c',
f1b98127 65 'os-util.c',
f1b98127 66 'parse-util.c',
f1b98127 67 'path-lookup.c',
f1b98127 68 'path-util.c',
f1b98127 69 'percent-util.c',
3bda3f17 70 'pidref.c',
f1b98127 71 'prioq.c',
f1b98127 72 'proc-cmdline.c',
f1b98127 73 'process-util.c',
f1b98127 74 'procfs-util.c',
d499fdbc 75 'psi-util.c',
f1b98127 76 'random-util.c',
f1b98127 77 'ratelimit.c',
f1b98127 78 'recurse-dir.c',
f1b98127 79 'replace-var.c',
f1b98127 80 'rlimit-util.c',
4870133b 81 'runtime-scope.c',
f1b98127 82 'sigbus.c',
f1b98127 83 'signal-util.c',
f1b98127 84 'siphash24.c',
f1b98127 85 'socket-util.c',
f1b98127 86 'sort-util.c',
f1b98127 87 'stat-util.c',
f1b98127 88 'strbuf.c',
f1b98127 89 'string-table.c',
f1b98127 90 'string-util.c',
f1b98127 91 'strv.c',
f1b98127 92 'strxcpyx.c',
f1b98127 93 'sync-util.c',
f1b98127 94 'sysctl-util.c',
f1b98127 95 'syslog-util.c',
f1b98127 96 'terminal-util.c',
f1b98127 97 'time-util.c',
f1b98127 98 'tmpfile-util.c',
8a8b4a87 99 'uid-alloc-range.c',
a30d3c01 100 'uid-range.c',
f1b98127 101 'unit-def.c',
f1b98127 102 'unit-file.c',
f1b98127 103 'unit-name.c',
f1b98127 104 'user-util.c',
f1b98127 105 'utf8.c',
f1b98127 106 'virt.c',
f1b98127 107 'xattr-util.c',
4a7ee0a5 108)
5c23128d 109
18bf324a 110missing_audit_h = files('missing_audit.h')
54480d64 111missing_capability_h = files('missing_capability.h')
0b7d48f5 112missing_socket_h = files('missing_socket.h')
5c23128d 113
35b42e56
ZJS
114missing_syscall_def_h = files('missing_syscall_def.h')
115basic_sources += missing_syscall_def_h
116
5c23128d
ZJS
117generate_af_list = find_program('generate-af-list.sh')
118af_list_txt = custom_target(
37efbbd8
ZJS
119 'af-list.txt',
120 output : 'af-list.txt',
0b7d48f5 121 command : [generate_af_list, cpp, config_h, missing_socket_h],
37efbbd8 122 capture : true)
5c23128d
ZJS
123
124generate_arphrd_list = find_program('generate-arphrd-list.sh')
125arphrd_list_txt = custom_target(
37efbbd8
ZJS
126 'arphrd-list.txt',
127 output : 'arphrd-list.txt',
01234e1f 128 command : [generate_arphrd_list, cpp, config_h],
37efbbd8 129 capture : true)
5c23128d
ZJS
130
131generate_cap_list = find_program('generate-cap-list.sh')
132cap_list_txt = custom_target(
37efbbd8
ZJS
133 'cap-list.txt',
134 output : 'cap-list.txt',
54480d64 135 command : [generate_cap_list, cpp, config_h, missing_capability_h],
37efbbd8 136 capture : true)
5c23128d
ZJS
137
138generate_errno_list = find_program('generate-errno-list.sh')
139errno_list_txt = custom_target(
37efbbd8
ZJS
140 'errno-list.txt',
141 output : 'errno-list.txt',
142 command : [generate_errno_list, cpp],
143 capture : true)
5c23128d
ZJS
144
145generated_gperf_headers = []
146foreach item : [['af', af_list_txt, 'af', ''],
147 ['arphrd', arphrd_list_txt, 'arphrd', 'ARPHRD_'],
148 ['cap', cap_list_txt, 'capability', ''],
7b5e750d 149 ['errno', errno_list_txt, 'errno', '']]
5c23128d 150
37efbbd8
ZJS
151 fname = '@0@-from-name.gperf'.format(item[0])
152 gperf_file = custom_target(
153 fname,
154 input : item[1],
155 output : fname,
156 command : [generate_gperfs, item[2], item[3], '@INPUT@'],
157 capture : true)
5c23128d 158
37efbbd8
ZJS
159 fname = '@0@-from-name.h'.format(item[0])
160 target1 = custom_target(
161 fname,
162 input : gperf_file,
163 output : fname,
164 command : [gperf,
165 '-L', 'ANSI-C', '-t', '--ignore-case',
166 '-N', 'lookup_@0@'.format(item[2]),
167 '-H', 'hash_@0@_name'.format(item[2]),
168 '-p', '-C',
169 '@INPUT@'],
170 capture : true)
5c23128d 171
37efbbd8
ZJS
172 fname = '@0@-to-name.h'.format(item[0])
173 awkscript = '@0@-to-name.awk'.format(item[0])
174 target2 = custom_target(
175 fname,
176 input : [awkscript, item[1]],
177 output : fname,
178 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
179 capture : true)
5c23128d 180
37efbbd8 181 generated_gperf_headers += [target1, target2]
5c23128d
ZJS
182endforeach
183
18bf324a 184basic_sources += generated_gperf_headers
9a6da617
ZJS
185
186############################################################
187
188arch_list = [
189 'alpha',
190 'arc',
191 'arm',
192 'arm64',
193 'i386',
194 'ia64',
89f60c21 195 'loongarch64',
9a6da617
ZJS
196 'm68k',
197 'mips64',
198 'mips64n32',
199 'mipso32',
d40de37e 200 'parisc',
9a6da617
ZJS
201 'powerpc',
202 'powerpc64',
18adce15 203 'riscv32',
302beee3 204 'riscv64',
9a6da617
ZJS
205 's390',
206 's390x',
207 'sparc',
18adce15
YW
208 'x86_64'
209]
9a6da617
ZJS
210
211run_target(
212 'update-syscall-tables',
d3821a33 213 command : [update_syscall_tables_sh, meson.current_source_dir()] + arch_list)
9a6da617 214
984b5296 215syscall_list_txt = files('syscall-list.txt')
35b42e56
ZJS
216
217syscall_lists = []
218foreach arch: arch_list
1f6f8cc8 219 syscall_lists += files('syscalls-@0@.txt'.format(arch))
35b42e56
ZJS
220endforeach
221
222missing_syscalls_py = find_program('missing_syscalls.py')
223
224run_target(
225 'update-syscall-header',
226 command : [missing_syscalls_py,
227 missing_syscall_def_h,
228 syscall_lists])
229
230############################################################
231
659d1924
ILG
232filesystem_includes = ['linux/magic.h',
233 'linux/gfs2_ondisk.h']
234
235check_filesystems = find_program('check-filesystems.sh')
6c889282 236r = run_command([check_filesystems, cpp, files('filesystems-gperf.gperf')] + filesystem_includes, check: false)
659d1924 237if r.returncode() != 0
0923b425 238 error('Unknown filesystems defined in kernel headers:\n\n' + r.stdout())
659d1924
ILG
239endif
240
241filesystems_gperf_h = custom_target(
242 'filesystems-gperf.h',
243 input : 'filesystems-gperf.gperf',
244 output : 'filesystems-gperf.h',
245 command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
246
247generate_filesystem_list = find_program('generate-filesystem-list.py')
248fname = 'filesystem-list.h'
249filesystem_list_h = custom_target(
250 fname,
251 input : 'filesystems-gperf.gperf',
252 output : fname,
253 command : [generate_filesystem_list,
254 '@INPUT@'],
255 capture : true)
256
6d439321
LP
257generate_filesystem_switch_case_h = find_program('generate-filesystem-switch-case.py')
258fname = 'filesystem-switch-case.h'
259filesystem_switch_case_h = custom_target(
260 fname,
261 input : 'filesystems-gperf.gperf',
262 output : 'filesystem-switch-case.h',
263 command : [generate_filesystem_switch_case_h,
264 '@INPUT@'],
265 capture : true)
266
267basic_sources += [filesystem_list_h, filesystem_switch_case_h, filesystems_gperf_h]
659d1924 268
35b42e56
ZJS
269libbasic = static_library(
270 'basic',
271 basic_sources,
e5bc5f1f 272 fundamental_sources,
8d40961c 273 include_directories : basic_includes,
92148283
JJ
274 dependencies : [libcap,
275 libm,
e5f1e8b8 276 librt,
35b42e56 277 threads,
40c7d3c7 278 userspace],
35b42e56 279 c_args : ['-fvisibility=default'],
03f7ddf0 280 build_by_default : false)
35b42e56
ZJS
281
282############################################################
283
284basic_gcrypt_sources = files(
285 'gcrypt-util.c',
4a7ee0a5 286)
35b42e56
ZJS
287
288# A convenience library that is separate from libbasic to avoid
289# unnecessary linking to libgcrypt.
290libbasic_gcrypt = static_library(
291 'basic-gcrypt',
292 basic_gcrypt_sources,
8d40961c 293 include_directories : basic_includes,
92148283
JJ
294 dependencies : [libgcrypt,
295 userspace],
03f7ddf0
ZJS
296 c_args : ['-fvisibility=default'],
297 build_by_default : false)
acc50c92
LP
298
299############################################################
300
301basic_compress_sources = files(
302 'compress.c',
4a7ee0a5 303)
acc50c92
LP
304
305# A convenience library that is separate from libbasic to avoid unnecessary
306# linking to the compression libraries.
307libbasic_compress = static_library(
308 'basic-compress',
309 basic_compress_sources,
310 include_directories : basic_includes,
92148283
JJ
311 dependencies : [liblz4,
312 libxz,
acc50c92 313 libzstd,
92148283 314 userspace],
acc50c92
LP
315 c_args : ['-fvisibility=default'],
316 build_by_default : false)