Debian Codegraph @

src/basic/meson.build

raw
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 'ansi-color.c',
8 'architecture.c',
9 'argv-util.c',
10 'arphrd-util.c',
11 'assert-util.c',
12 'audit-util.c',
13 'btrfs-util.c',
14 'build.c',
15 'build-path.c',
16 'bus-label.c',
17 'capability-list.c',
18 'capability-util.c',
19 'capsule-util.c',
20 'cgroup-util.c',
21 'chase.c',
22 'chattr-util.c',
23 'compress.c',
24 'conf-files.c',
25 'confidential-virt.c',
26 'device-nodes.c',
27 'devnum-util.c',
28 'dirent-util.c',
29 'dlfcn-util.c',
30 'efivars.c',
31 'env-file.c',
32 'env-util.c',
33 'errno-list.c',
34 'errno-util.c',
35 'escape.c',
36 'ether-addr-util.c',
37 'extract-word.c',
38 'fd-util.c',
39 'fiber-ops.c',
40 'fileio.c',
41 'filesystems.c',
42 'format-ifname.c',
43 'format-util.c',
44 'fs-util.c',
45 'gcrypt-util.c',
46 'glob-util.c',
47 'glyph-util.c',
48 'gunicode.c',
49 'hash-funcs.c',
50 'hashmap.c',
51 'hexdecoct.c',
52 'hmac.c',
53 'hostname-util.c',
54 'in-addr-util.c',
55 'initrd-util.c',
56 'inotify-util.c',
57 'io-util.c',
58 'iovec-util.c',
59 'iovec-wrapper.c',
60 'keyring-util.c',
61 'label-util.c',
62 'limits-util.c',
63 'locale-util.c',
64 'lock-util.c',
65 'log.c',
66 'log-context.c',
67 'login-util.c',
68 'math-util.c',
69 'memfd-util.c',
70 'memory-util.c',
71 'mempool.c',
72 'memstream-util.c',
73 'mkdir.c',
74 'mountpoint-util.c',
75 'namespace-util.c',
76 'nulstr-util.c',
77 'ordered-set.c',
78 'os-util.c',
79 'parse-util.c',
80 'path-util.c',
81 'percent-util.c',
82 'pidfd-util.c',
83 'pidref.c',
84 'prioq.c',
85 'proc-cmdline.c',
86 'process-util.c',
87 'procfs-util.c',
88 'psi-util.c',
89 'random-util.c',
90 'ratelimit.c',
91 'raw-clone.c',
92 'recurse-dir.c',
93 'replace-var.c',
94 'rlimit-util.c',
95 'runtime-scope.c',
96 'sha256.c',
97 'sigbus.c',
98 'signal-util.c',
99 'siphash24.c',
100 'socket-util.c',
101 'sort-util.c',
102 'stat-util.c',
103 'static-destruct.c',
104 'stdio-util.c',
105 'strbuf.c',
106 'string-table.c',
107 'string-util.c',
108 'strv.c',
109 'strxcpyx.c',
110 'sync-util.c',
111 'sysctl-util.c',
112 'syslog-util.c',
113 'terminal-util.c',
114 'time-util.c',
115 'tmpfile-util.c',
116 'uid-classification.c',
117 'uid-range.c',
118 'unit-def.c',
119 'unit-name.c',
120 'user-util.c',
121 'utf8.c',
122 'virt.c',
123 'xattr-util.c',
124 )
125
126 sources += basic_sources
127
128 generated_gperf_headers = []
129 foreach item : [
130 # name, source, prefix, headers
131 ['af', af_sources, '', ['<sys/socket.h>'], ],
132 ['arphrd', arphrd_sources, 'ARPHRD_', ['<linux/if_arp.h>'], ],
133 ['capability', capability_sources, '', ['<linux/capability.h>'], ],
134 ['errno', [], '', ['<errno.h>'], ],
135 ['statx-mask', statx_sources ],
136 ['statx-attribute', statx_sources ],
137 ]
138
139 generate_list = files('generate-@[email protected]'.format(item[0]))
140 list_txt = custom_target(
141 input : [generate_list, item[1]],
142 output : '@[email protected]'.format(item[0]),
143 command : [env, 'bash', generate_list, cpp, system_include_args],
144 capture : true)
145
146 awkscript = '@[email protected]'.format(item[0])
147 target = custom_target(
148 input : [awkscript, list_txt],
149 output : '@[email protected]'.format(item[0]),
150 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
151 capture : true)
152
153 generated_gperf_headers += [target]
154
155 if item.length() > 2
156 gperf_file = custom_target(
157 input : list_txt,
158 output : '@[email protected]'.format(item[0]),
159 command : [generate_gperfs, item[0], item[2], '@INPUT@'] + item[3],
160 capture : true)
161
162 target = custom_target(
163 input : gperf_file,
164 output : '@[email protected]'.format(item[0]),
165 command : [gperf,
166 '-L', 'ANSI-C', '-t', '--ignore-case',
167 '-N', 'lookup_@0@'.format(item[0]),
168 '-H', 'hash_@0@_name'.format(item[0]),
169 '-p', '-C',
170 '@INPUT@'],
171 capture : true)
172
173 generated_gperf_headers += [target]
174 endif
175 endforeach
176
177 generated_sources += generated_gperf_headers
178 basic_sources += generated_gperf_headers
179
180 ############################################################
181
182 filesystem_sets_py = files('filesystem-sets.py')
183 filesystem_sets_c = custom_target(
184 output : 'filesystem-sets.c',
185 command : [filesystem_sets_py,
186 'fs-type-to-string',
187 'filesystem-sets',
188 'fs-in-group'],
189 capture : true)
190
191 filesystems_gperf_gperf = custom_target(
192 output : 'filesystems-gperf.gperf',
193 command : [filesystem_sets_py,
194 'gperf'],
195 capture : true)
196
197 filesystems_gperf_h = custom_target(
198 input : filesystems_gperf_gperf,
199 output : 'filesystems-gperf.h',
200 command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
201
202 generated_sources += [filesystem_sets_c, filesystems_gperf_gperf, filesystems_gperf_h]
203 basic_sources += [filesystem_sets_c, filesystems_gperf_h]
204
205 test('kernel-filesystem-magics',
206 filesystem_sets_py,
207 args : ['check'],
208 env : ['CPP=@0@'.format(cpp)])
209
210 libbasic_static = static_library(
211 'basic',
212 basic_sources,
213 fundamental_sources,
214 include_directories : basic_includes,
215 implicit_include_directories : false,
216 dependencies : [libbzip2_cflags,
217 libgcrypt_cflags,
218 liblz4_cflags,
219 libxz_cflags,
220 libz_cflags,
221 libzstd_cflags,
222 userspace],
223 c_args : ['-fvisibility=default'],
224 build_by_default : false)