chiark / gitweb /
Prep v239: Mask all unneeded functions in the new format-table.[hc] files.
[elogind.git] / src / basic / meson.build
1 # SPDX-License-Identifier: LGPL-2.1+
2
3 #if 0 /// elogind has a shorter list
4 # basic_sources = files('''
5 #         MurmurHash2.c
6 #         MurmurHash2.h
7 #         af-list.c
8 #         af-list.h
9 #         alloc-util.c
10 #         alloc-util.h
11 #         architecture.c
12 #         architecture.h
13 #         arphrd-list.c
14 #         arphrd-list.h
15 #         async.c
16 #         async.h
17 #         audit-util.c
18 #         audit-util.h
19 #         barrier.c
20 #         barrier.h
21 #         bitmap.c
22 #         bitmap.h
23 #         blkid-util.h
24 #         blockdev-util.c
25 #         blockdev-util.h
26 #         bpf-program.c
27 #         bpf-program.h
28 #         btrfs-ctree.h
29 #         btrfs-util.c
30 #         btrfs-util.h
31 #         build.h
32 #         bus-label.c
33 #         bus-label.h
34 #         calendarspec.c
35 #         calendarspec.h
36 #         cap-list.c
37 #         cap-list.h
38 #         capability-util.c
39 #         capability-util.h
40 #         cgroup-util.c
41 #         cgroup-util.h
42 #         chattr-util.c
43 #         chattr-util.h
44 #         clock-util.c
45 #         clock-util.h
46 #         conf-files.c
47 #         conf-files.h
48 #         copy.c
49 #         copy.h
50 #         cpu-set-util.c
51 #         cpu-set-util.h
52 #         crypt-util.c
53 #         crypt-util.h
54 #         def.h
55 #         device-nodes.c
56 #         device-nodes.h
57 #         dirent-util.c
58 #         dirent-util.h
59 #         env-util.c
60 #         env-util.h
61 #         errno-list.c
62 #         errno-list.h
63 #         escape.c
64 #         escape.h
65 #         ether-addr-util.c
66 #         ether-addr-util.h
67 #         exec-util.c
68 #         exec-util.h
69 #         exit-status.c
70 #         exit-status.h
71 #         extract-word.c
72 #         extract-word.h
73 #         fd-util.c
74 #         fd-util.h
75 #         fileio-label.c
76 #         fileio-label.h
77 #         fileio.c
78 #         fileio.h
79 #         format-table.c
80 #         format-table.h
81 #         format-util.h
82 #         fs-util.c
83 #         fs-util.h
84 #         glob-util.c
85 #         glob-util.h
86 #         gunicode.c
87 #         gunicode.h
88 #         hash-funcs.c
89 #         hash-funcs.h
90 #         hashmap.c
91 #         hashmap.h
92 #         hexdecoct.c
93 #         hexdecoct.h
94 #         hostname-util.c
95 #         hostname-util.h
96 #         in-addr-util.c
97 #         in-addr-util.h
98 #         io-util.c
99 #         io-util.h
100 #         ioprio.h
101 #         journal-importer.c
102 #         journal-importer.h
103 #         khash.c
104 #         khash.h
105 #         label.c
106 #         label.h
107 #         list.h
108 #         locale-util.c
109 #         locale-util.h
110 #         lockfile-util.c
111 #         lockfile-util.h
112 #         log.c
113 #         log.h
114 #         login-util.c
115 #         login-util.h
116 #         macro.h
117 #         memfd-util.c
118 #         memfd-util.h
119 #         mempool.c
120 #         mempool.h
121 #         missing_syscall.h
122 #         mkdir-label.c
123 #         mkdir.c
124 #         mkdir.h
125 #         module-util.h
126 #         mount-util.c
127 #         mount-util.h
128 #         nss-util.h
129 #         ordered-set.c
130 #         ordered-set.h
131 #         pager.c
132 #         pager.h
133 #         os-util.c
134 #         os-util.h
135 #         parse-util.c
136 #         parse-util.h
137 #         path-util.c
138 #         path-util.h
139 #         prioq.c
140 #         prioq.h
141 #         proc-cmdline.c
142 #         proc-cmdline.h
143 #         process-util.c
144 #         process-util.h
145 #         procfs-util.c
146 #         procfs-util.h
147 #         random-util.c
148 #         random-util.h
149 #         ratelimit.c
150 #         ratelimit.h
151 #         raw-clone.h
152 #         raw-reboot.h
153 #         reboot-util.c
154 #         reboot-util.h
155 #         refcnt.h
156 #         replace-var.c
157 #         replace-var.h
158 #         rlimit-util.c
159 #         rlimit-util.h
160 #         rm-rf.c
161 #         rm-rf.h
162 #         securebits-util.c
163 #         securebits-util.h
164 #         securebits.h
165 #         selinux-util.c
166 #         selinux-util.h
167 #         set.h
168 #         sigbus.c
169 #         sigbus.h
170 #         signal-util.c
171 #         signal-util.h
172 #         siphash24.c
173 #         siphash24.h
174 #         smack-util.c
175 #         smack-util.h
176 #         socket-label.c
177 #         socket-protocol-list.c
178 #         socket-protocol-list.h
179 #         socket-util.c
180 #         socket-util.h
181 #         sparse-endian.h
182 #         special.h
183 #         stat-util.c
184 #         stat-util.h
185 #         stdio-util.h
186 #         strbuf.c
187 #         strbuf.h
188 #         string-table.c
189 #         string-table.h
190 #         string-util.c
191 #         string-util.h
192 #         strv.c
193 #         strv.h
194 #         strxcpyx.c
195 #         strxcpyx.h
196 #         syslog-util.c
197 #         syslog-util.h
198 #         terminal-util.c
199 #         terminal-util.h
200 #         time-util.c
201 #         time-util.h
202 #         umask-util.h
203 #         unaligned.h
204 #         unit-def.c
205 #         unit-def.h
206 #         unit-name.c
207 #         unit-name.h
208 #         user-util.c
209 #         user-util.h
210 #         utf8.c
211 #         utf8.h
212 #         util.c
213 #         util.h
214 #         verbs.c
215 #         verbs.h
216 #         virt.c
217 #         virt.h
218 #         web-util.c
219 #         web-util.h
220 #         xattr-util.c
221 #         xattr-util.h
222 #         xml.c
223 #         xml.h
224 # '''.split())
225 #else
226 basic_sources = files('''
227         alloc-util.c
228         alloc-util.h
229         audit-util.c
230         audit-util.h
231         build.h
232         bus-label.c
233         bus-label.h
234         capability-util.c
235         capability-util.h
236         cgroup-util.c
237         cap-list.c
238         cap-list.h
239         cgroup-util.h
240         conf-files.c
241         conf-files.h
242         copy.c
243         copy.h
244         def.h
245         dirent-util.c
246         dirent-util.h
247         env-util.c
248         env-util.h
249         errno-list.c
250         errno-list.h
251         escape.c
252         escape.h
253         exec-util.c
254         exec-util.h
255         extract-word.c
256         extract-word.h
257         fd-util.c
258         fd-util.h
259         fileio.c
260         fileio.h
261         fileio-label.c
262         fileio-label.h
263         format-table.c
264         format-table.h
265         format-util.h
266         fs-util.c
267         fs-util.h
268         gunicode.c
269         gunicode.h
270         hash-funcs.c
271         hash-funcs.h
272         hashmap.c
273         hashmap.h
274         hexdecoct.c
275         hexdecoct.h
276         hostname-util.c
277         hostname-util.h
278         io-util.c
279         io-util.h
280         khash.c
281         khash.h
282         label.c
283         label.h
284         list.h
285         locale-util.c
286         locale-util.h
287         log.c
288         log.h
289         login-util.c
290         login-util.h
291         macro.h
292         memfd-util.c
293         memfd-util.h
294         mempool.c
295         mempool.h
296         missing_syscall.h
297         mkdir.c
298         mkdir.h
299         mkdir-label.c
300         mount-util.c
301         mount-util.h
302         pager.c
303         pager.h
304         parse-printf-format.c
305         parse-printf-format.h
306         parse-util.c
307         parse-util.h
308         path-util.c
309         path-util.h
310         prioq.c
311         prioq.h
312         proc-cmdline.c
313         proc-cmdline.h
314         procfs-util.c
315         procfs-util.h
316         process-util.c
317         process-util.h
318         random-util.c
319         random-util.h
320         refcnt.h
321         rm-rf.c
322         rm-rf.h
323         selinux-util.c
324         selinux-util.h
325         set.h
326         sigbus.c
327         sigbus.h
328         signal-util.c
329         signal-util.h
330         siphash24.c
331         siphash24.h
332         smack-util.c
333         smack-util.h
334         socket-util.c
335         socket-util.h
336         sparse-endian.h
337         special.h
338         stat-util.c
339         stat-util.h
340         stdio-util.h
341         string-table.c
342         string-table.h
343         string-util.c
344         string-util.h
345         strv.c
346         strv.h
347         syslog-util.c
348         syslog-util.h
349         terminal-util.c
350         terminal-util.h
351         time-util.c
352         time-util.h
353         umask-util.h
354         unaligned.h
355         unit-def.c
356         unit-def.h
357         unit-name.c
358         unit-name.h
359         user-util.c
360         user-util.h
361         utf8.c
362         utf8.h
363         util.c
364         util.h
365         verbs.c
366         verbs.h
367         virt.c
368         virt.h
369         xattr-util.c
370         xattr-util.h
371 '''.split())
372 #endif // 0
373
374 missing_h = files('missing.h')
375
376 generate_gperfs = find_program('generate-gperfs.py')
377
378 #if 0 /// elogind has only the cap and errno list.
379 # generate_af_list = find_program('generate-af-list.sh')
380 # af_list_txt = custom_target(
381 #         'af-list.txt',
382 #         output : 'af-list.txt',
383 #         command : [generate_af_list, cpp],
384 #         capture : true)
385
386 # generate_arphrd_list = find_program('generate-arphrd-list.sh')
387 # arphrd_list_txt = custom_target(
388 #         'arphrd-list.txt',
389 #         output : 'arphrd-list.txt',
390 #         command : [generate_arphrd_list, cpp],
391 #         capture : true)
392 #endif // 0
393
394 generate_cap_list = find_program('generate-cap-list.sh')
395 cap_list_txt = custom_target(
396         'cap-list.txt',
397         output : 'cap-list.txt',
398 #if 0 /// elogind needs musl_missing.h, so generate_cap_list must know the source root
399 #         command : [generate_cap_list, cpp, config_h, missing_h],
400 #else
401         command : [generate_cap_list, cpp, meson.source_root(), config_h, missing_h],
402 #endif // 0
403         capture : true)
404
405 generate_errno_list = find_program('generate-errno-list.sh')
406 errno_list_txt = custom_target(
407         'errno-list.txt',
408         output : 'errno-list.txt',
409         command : [generate_errno_list, cpp],
410         capture : true)
411
412 generate_socket_protocol_list = find_program('generate-socket-protocol-list.sh')
413 socket_protocol_list_txt = custom_target(
414         'socket-protocol-list.txt',
415         output : 'socket-protocol-list.txt',
416         command : [generate_socket_protocol_list, cpp],
417         capture : true)
418
419 generated_gperf_headers = []
420 #if 0 /// elogind has only the cap and errno list.
421 # foreach item : [['af',     af_list_txt,     'af',         ''],
422 #                 ['arphrd', arphrd_list_txt, 'arphrd',     'ARPHRD_'],
423 #                 ['cap',    cap_list_txt,    'capability', ''],
424 #                 ['errno',  errno_list_txt,  'errno',      ''],
425 #                 ['socket-protocol', socket_protocol_list_txt, 'socket_protocol',     'IPPROTO_']]
426 #else
427 foreach item : [['cap',    cap_list_txt,    'capability', ''],
428                 ['errno',  errno_list_txt,  'errno',      '']]
429 #endif // 0
430
431         fname = '@0@-from-name.gperf'.format(item[0])
432         gperf_file = custom_target(
433                 fname,
434                 input : item[1],
435                 output : fname,
436                 command : [generate_gperfs, item[2], item[3], '@INPUT@'],
437                 capture : true)
438
439         fname = '@0@-from-name.h'.format(item[0])
440         target1 = custom_target(
441                 fname,
442                 input : gperf_file,
443                 output : fname,
444                 command : [gperf,
445                            '-L', 'ANSI-C', '-t', '--ignore-case',
446                            '-N', 'lookup_@0@'.format(item[2]),
447                            '-H', 'hash_@0@_name'.format(item[2]),
448                            '-p', '-C',
449                            '@INPUT@'],
450                 capture : true)
451
452         fname = '@0@-to-name.h'.format(item[0])
453         awkscript = '@0@-to-name.awk'.format(item[0])
454         target2 = custom_target(
455                 fname,
456                 input : [awkscript, item[1]],
457                 output : fname,
458                 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
459                 capture : true)
460
461         generated_gperf_headers += [target1, target2]
462 endforeach
463
464 basic_sources += [missing_h] + generated_gperf_headers
465 #if 0 /// elogind does not need gcrypt
466 # basic_gcrypt_sources = files(
467 #         'gcrypt-util.c',
468 #         'gcrypt-util.h')
469 #endif // 0
470
471 libbasic = static_library(
472         'basic',
473         basic_sources,
474         include_directories : includes,
475         dependencies : [threads,
476                         libcap,
477 #if 0 /// Neither blkid nor libmount in elogind
478 #                         libblkid,
479 #                         libmount,
480 #endif // 0
481                         libselinux],
482         c_args : ['-fvisibility=default'],
483         install : false)
484
485 #if 0 /// elogind does not need gcrypt
486 # # A convenience library that is separate from libbasic to avoid
487 # # unnecessary linking to libgcrypt.
488 # libbasic_gcrypt = static_library(
489 #         'basic-gcrypt',
490 #         basic_gcrypt_sources,
491 #         include_directories : includes,
492 #         dependencies : [libgcrypt],
493 #         c_args : ['-fvisibility=default'])
494 #endif // 0