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