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