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