]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/meson.build
meson: make version a dependency and use it in libbasic
[thirdparty/systemd.git] / src / basic / meson.build
1 # SPDX-License-Identifier: LGPL-2.1+
2
3 basic_sources = files('''
4 MurmurHash2.c
5 MurmurHash2.h
6 af-list.c
7 af-list.h
8 alloc-util.c
9 alloc-util.h
10 architecture.c
11 architecture.h
12 arphrd-list.c
13 arphrd-list.h
14 async.c
15 async.h
16 audit-util.c
17 audit-util.h
18 blockdev-util.c
19 blockdev-util.h
20 btrfs-util.c
21 btrfs-util.h
22 build.h
23 bus-label.c
24 bus-label.h
25 cap-list.c
26 cap-list.h
27 capability-util.c
28 capability-util.h
29 cgroup-util.c
30 cgroup-util.h
31 chattr-util.c
32 chattr-util.h
33 conf-files.c
34 conf-files.h
35 copy.c
36 copy.h
37 def.h
38 device-nodes.c
39 device-nodes.h
40 dirent-util.c
41 dirent-util.h
42 env-file.c
43 env-file.h
44 env-util.c
45 env-util.h
46 errno-list.c
47 errno-list.h
48 escape.c
49 escape.h
50 ether-addr-util.c
51 ether-addr-util.h
52 extract-word.c
53 extract-word.h
54 fd-util.c
55 fd-util.h
56 fileio.c
57 fileio.h
58 format-util.h
59 fs-util.c
60 fs-util.h
61 glob-util.c
62 glob-util.h
63 gunicode.c
64 gunicode.h
65 hash-funcs.c
66 hash-funcs.h
67 hashmap.c
68 hashmap.h
69 hexdecoct.c
70 hexdecoct.h
71 hostname-util.c
72 hostname-util.h
73 in-addr-util.c
74 in-addr-util.h
75 io-util.c
76 io-util.h
77 ioprio.h
78 khash.c
79 khash.h
80 label.c
81 label.h
82 list.h
83 locale-util.c
84 locale-util.h
85 log.c
86 log.h
87 login-util.c
88 login-util.h
89 macro.h
90 memfd-util.c
91 memfd-util.h
92 mempool.c
93 mempool.h
94 missing.h
95 missing_audit.h
96 missing_btrfs.h
97 missing_btrfs_tree.h
98 missing_capability.h
99 missing_drm.h
100 missing_ethtool.h
101 missing_fcntl.h
102 missing_fib_rules.h
103 missing_fou.h
104 missing_fs.h
105 missing_if_bridge.h
106 missing_if_link.h
107 missing_if_tunnel.h
108 missing_input.h
109 missing_keyctl.h
110 missing_magic.h
111 missing_mman.h
112 missing_network.h
113 missing_prctl.h
114 missing_random.h
115 missing_resource.h
116 missing_sched.h
117 missing_securebits.h
118 missing_socket.h
119 missing_stat.h
120 missing_stdlib.h
121 missing_syscall.h
122 missing_timerfd.h
123 missing_type.h
124 missing_vxcan.h
125 mkdir-label.c
126 mkdir.c
127 mkdir.h
128 mountpoint-util.c
129 mountpoint-util.h
130 nss-util.h
131 ordered-set.c
132 ordered-set.h
133 parse-util.c
134 parse-util.h
135 path-util.c
136 path-util.h
137 prioq.c
138 prioq.h
139 proc-cmdline.c
140 proc-cmdline.h
141 process-util.c
142 process-util.h
143 procfs-util.c
144 procfs-util.h
145 random-util.c
146 random-util.h
147 ratelimit.c
148 ratelimit.h
149 raw-clone.h
150 raw-reboot.h
151 refcnt.h
152 replace-var.c
153 replace-var.h
154 rlimit-util.c
155 rlimit-util.h
156 rm-rf.c
157 rm-rf.h
158 selinux-util.c
159 selinux-util.h
160 set.h
161 sigbus.c
162 sigbus.h
163 signal-util.c
164 signal-util.h
165 siphash24.c
166 siphash24.h
167 smack-util.c
168 smack-util.h
169 socket-label.c
170 socket-util.c
171 socket-util.h
172 sparse-endian.h
173 special.h
174 stat-util.c
175 stat-util.h
176 static-destruct.h
177 stdio-util.h
178 strbuf.c
179 strbuf.h
180 string-table.c
181 string-table.h
182 string-util.c
183 string-util.h
184 strv.c
185 strv.h
186 strxcpyx.c
187 strxcpyx.h
188 syslog-util.c
189 syslog-util.h
190 terminal-util.c
191 terminal-util.h
192 time-util.c
193 time-util.h
194 tmpfile-util.c
195 tmpfile-util.h
196 umask-util.h
197 unaligned.h
198 unit-def.c
199 unit-def.h
200 unit-name.c
201 unit-name.h
202 user-util.c
203 user-util.h
204 utf8.c
205 utf8.h
206 util.c
207 util.h
208 virt.c
209 virt.h
210 xattr-util.c
211 xattr-util.h
212 '''.split())
213
214 missing_audit_h = files('missing_audit.h')
215 missing_capability_h = files('missing_capability.h')
216 missing_network_h = files('missing_network.h')
217 missing_socket_h = files('missing_socket.h')
218
219 generate_af_list = find_program('generate-af-list.sh')
220 af_list_txt = custom_target(
221 'af-list.txt',
222 output : 'af-list.txt',
223 command : [generate_af_list, cpp, config_h, missing_socket_h],
224 capture : true)
225
226 generate_arphrd_list = find_program('generate-arphrd-list.sh')
227 arphrd_list_txt = custom_target(
228 'arphrd-list.txt',
229 output : 'arphrd-list.txt',
230 command : [generate_arphrd_list, cpp, config_h, missing_network_h],
231 capture : true)
232
233 generate_cap_list = find_program('generate-cap-list.sh')
234 cap_list_txt = custom_target(
235 'cap-list.txt',
236 output : 'cap-list.txt',
237 command : [generate_cap_list, cpp, config_h, missing_capability_h],
238 capture : true)
239
240 generate_errno_list = find_program('generate-errno-list.sh')
241 errno_list_txt = custom_target(
242 'errno-list.txt',
243 output : 'errno-list.txt',
244 command : [generate_errno_list, cpp],
245 capture : true)
246
247 generated_gperf_headers = []
248 foreach item : [['af', af_list_txt, 'af', ''],
249 ['arphrd', arphrd_list_txt, 'arphrd', 'ARPHRD_'],
250 ['cap', cap_list_txt, 'capability', ''],
251 ['errno', errno_list_txt, 'errno', '']]
252
253 fname = '@0@-from-name.gperf'.format(item[0])
254 gperf_file = custom_target(
255 fname,
256 input : item[1],
257 output : fname,
258 command : [generate_gperfs, item[2], item[3], '@INPUT@'],
259 capture : true)
260
261 fname = '@0@-from-name.h'.format(item[0])
262 target1 = custom_target(
263 fname,
264 input : gperf_file,
265 output : fname,
266 command : [gperf,
267 '-L', 'ANSI-C', '-t', '--ignore-case',
268 '-N', 'lookup_@0@'.format(item[2]),
269 '-H', 'hash_@0@_name'.format(item[2]),
270 '-p', '-C',
271 '@INPUT@'],
272 capture : true)
273
274 fname = '@0@-to-name.h'.format(item[0])
275 awkscript = '@0@-to-name.awk'.format(item[0])
276 target2 = custom_target(
277 fname,
278 input : [awkscript, item[1]],
279 output : fname,
280 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
281 capture : true)
282
283 generated_gperf_headers += [target1, target2]
284 endforeach
285
286 basic_sources += generated_gperf_headers
287 basic_gcrypt_sources = files(
288 'gcrypt-util.c',
289 'gcrypt-util.h')
290
291 libbasic = static_library(
292 'basic',
293 basic_sources,
294 include_directories : includes,
295 dependencies : [versiondep,
296 threads,
297 libcap,
298 libselinux,
299 libm],
300 c_args : ['-fvisibility=default'],
301 install : false)
302
303 # A convenience library that is separate from libbasic to avoid
304 # unnecessary linking to libgcrypt.
305 libbasic_gcrypt = static_library(
306 'basic-gcrypt',
307 basic_gcrypt_sources,
308 include_directories : includes,
309 dependencies : [libgcrypt],
310 c_args : ['-fvisibility=default'])