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