]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/meson.build
io-util: split out iovw_xyz into iovec-wrapper.h
[thirdparty/systemd.git] / src / basic / meson.build
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2
3 basic_sources = files(
4 'MurmurHash2.c',
5 'af-list.c',
6 'alloc-util.c',
7 'architecture.c',
8 'argv-util.c',
9 'arphrd-util.c',
10 'audit-util.c',
11 'btrfs.c',
12 'build.c',
13 'bus-label.c',
14 'cap-list.c',
15 'capability-util.c',
16 'cgroup-util.c',
17 'chase.c',
18 'chattr-util.c',
19 'conf-files.c',
20 'confidential-virt.c',
21 'devnum-util.c',
22 'dirent-util.c',
23 'efivars.c',
24 'env-file.c',
25 'env-util.c',
26 'errno-list.c',
27 'escape.c',
28 'ether-addr-util.c',
29 'extract-word.c',
30 'fd-util.c',
31 'fileio.c',
32 'filesystems.c',
33 'format-util.c',
34 'fs-util.c',
35 'glob-util.c',
36 'glyph-util.c',
37 'gunicode.c',
38 'hash-funcs.c',
39 'hashmap.c',
40 'hexdecoct.c',
41 'hmac.c',
42 'hostname-util.c',
43 'in-addr-util.c',
44 'initrd-util.c',
45 'inotify-util.c',
46 'io-util.c',
47 'ioprio-util.c',
48 'iovec-util.c',
49 'iovec-wrapper.c',
50 'label.c',
51 'limits-util.c',
52 'locale-util.c',
53 'lock-util.c',
54 'log.c',
55 'login-util.c',
56 'memfd-util.c',
57 'memory-util.c',
58 'mempool.c',
59 'memstream-util.c',
60 'mkdir.c',
61 'mountpoint-util.c',
62 'namespace-util.c',
63 'nulstr-util.c',
64 'ordered-set.c',
65 'os-util.c',
66 'parse-util.c',
67 'path-lookup.c',
68 'path-util.c',
69 'percent-util.c',
70 'pidref.c',
71 'prioq.c',
72 'proc-cmdline.c',
73 'process-util.c',
74 'procfs-util.c',
75 'psi-util.c',
76 'random-util.c',
77 'ratelimit.c',
78 'recurse-dir.c',
79 'replace-var.c',
80 'rlimit-util.c',
81 'runtime-scope.c',
82 'sigbus.c',
83 'signal-util.c',
84 'siphash24.c',
85 'socket-util.c',
86 'sort-util.c',
87 'stat-util.c',
88 'strbuf.c',
89 'string-table.c',
90 'string-util.c',
91 'strv.c',
92 'strxcpyx.c',
93 'sync-util.c',
94 'sysctl-util.c',
95 'syslog-util.c',
96 'terminal-util.c',
97 'time-util.c',
98 'tmpfile-util.c',
99 'uid-alloc-range.c',
100 'uid-range.c',
101 'unit-def.c',
102 'unit-file.c',
103 'unit-name.c',
104 'user-util.c',
105 'utf8.c',
106 'virt.c',
107 'xattr-util.c',
108 )
109
110 missing_audit_h = files('missing_audit.h')
111 missing_capability_h = files('missing_capability.h')
112 missing_socket_h = files('missing_socket.h')
113
114 missing_syscall_def_h = files('missing_syscall_def.h')
115 basic_sources += missing_syscall_def_h
116
117 generate_af_list = find_program('generate-af-list.sh')
118 af_list_txt = custom_target(
119 'af-list.txt',
120 output : 'af-list.txt',
121 command : [generate_af_list, cpp, config_h, missing_socket_h],
122 capture : true)
123
124 generate_arphrd_list = find_program('generate-arphrd-list.sh')
125 arphrd_list_txt = custom_target(
126 'arphrd-list.txt',
127 output : 'arphrd-list.txt',
128 command : [generate_arphrd_list, cpp, config_h],
129 capture : true)
130
131 generate_cap_list = find_program('generate-cap-list.sh')
132 cap_list_txt = custom_target(
133 'cap-list.txt',
134 output : 'cap-list.txt',
135 command : [generate_cap_list, cpp, config_h, missing_capability_h],
136 capture : true)
137
138 generate_errno_list = find_program('generate-errno-list.sh')
139 errno_list_txt = custom_target(
140 'errno-list.txt',
141 output : 'errno-list.txt',
142 command : [generate_errno_list, cpp],
143 capture : true)
144
145 generated_gperf_headers = []
146 foreach item : [['af', af_list_txt, 'af', ''],
147 ['arphrd', arphrd_list_txt, 'arphrd', 'ARPHRD_'],
148 ['cap', cap_list_txt, 'capability', ''],
149 ['errno', errno_list_txt, 'errno', '']]
150
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)
158
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)
171
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)
180
181 generated_gperf_headers += [target1, target2]
182 endforeach
183
184 basic_sources += generated_gperf_headers
185
186 ############################################################
187
188 arch_list = [
189 'alpha',
190 'arc',
191 'arm',
192 'arm64',
193 'i386',
194 'ia64',
195 'loongarch64',
196 'm68k',
197 'mips64',
198 'mips64n32',
199 'mipso32',
200 'parisc',
201 'powerpc',
202 'powerpc64',
203 'riscv32',
204 'riscv64',
205 's390',
206 's390x',
207 'sparc',
208 'x86_64'
209 ]
210
211 run_target(
212 'update-syscall-tables',
213 command : [update_syscall_tables_sh, meson.current_source_dir()] + arch_list)
214
215 syscall_list_txt = files('syscall-list.txt')
216
217 syscall_lists = []
218 foreach arch: arch_list
219 syscall_lists += files('syscalls-@0@.txt'.format(arch))
220 endforeach
221
222 missing_syscalls_py = find_program('missing_syscalls.py')
223
224 run_target(
225 'update-syscall-header',
226 command : [missing_syscalls_py,
227 missing_syscall_def_h,
228 syscall_lists])
229
230 ############################################################
231
232 filesystem_includes = ['linux/magic.h',
233 'linux/gfs2_ondisk.h']
234
235 check_filesystems = find_program('check-filesystems.sh')
236 r = run_command([check_filesystems, cpp, files('filesystems-gperf.gperf')] + filesystem_includes, check: false)
237 if r.returncode() != 0
238 error('Unknown filesystems defined in kernel headers:\n\n' + r.stdout())
239 endif
240
241 filesystems_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
247 generate_filesystem_list = find_program('generate-filesystem-list.py')
248 fname = 'filesystem-list.h'
249 filesystem_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
257 generate_filesystem_switch_case_h = find_program('generate-filesystem-switch-case.py')
258 fname = 'filesystem-switch-case.h'
259 filesystem_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
267 basic_sources += [filesystem_list_h, filesystem_switch_case_h, filesystems_gperf_h]
268
269 libbasic = static_library(
270 'basic',
271 basic_sources,
272 fundamental_sources,
273 include_directories : basic_includes,
274 dependencies : [libcap,
275 libm,
276 threads,
277 userspace],
278 c_args : ['-fvisibility=default'],
279 build_by_default : false)
280
281 ############################################################
282
283 basic_gcrypt_sources = files(
284 'gcrypt-util.c',
285 )
286
287 # A convenience library that is separate from libbasic to avoid
288 # unnecessary linking to libgcrypt.
289 libbasic_gcrypt = static_library(
290 'basic-gcrypt',
291 basic_gcrypt_sources,
292 include_directories : basic_includes,
293 dependencies : [libgcrypt,
294 userspace],
295 c_args : ['-fvisibility=default'],
296 build_by_default : false)
297
298 ############################################################
299
300 basic_compress_sources = files(
301 'compress.c',
302 )
303
304 # A convenience library that is separate from libbasic to avoid unnecessary
305 # linking to the compression libraries.
306 libbasic_compress = static_library(
307 'basic-compress',
308 basic_compress_sources,
309 include_directories : basic_includes,
310 dependencies : [liblz4,
311 libxz,
312 libzstd,
313 userspace],
314 c_args : ['-fvisibility=default'],
315 build_by_default : false)