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