chiark / gitweb /
Prep v239: Remove basic/set.c - No longer needed.
[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-util.h
264         fs-util.c
265         fs-util.h
266         gunicode.c
267         gunicode.h
268         hash-funcs.c
269         hash-funcs.h
270         hashmap.c
271         hashmap.h
272         hexdecoct.c
273         hexdecoct.h
274         hostname-util.c
275         hostname-util.h
276         io-util.c
277         io-util.h
278         khash.c
279         khash.h
280         label.c
281         label.h
282         list.h
283         locale-util.c
284         locale-util.h
285         log.c
286         log.h
287         login-util.c
288         login-util.h
289         macro.h
290         memfd-util.c
291         memfd-util.h
292         mempool.c
293         mempool.h
294         missing_syscall.h
295         mkdir.c
296         mkdir.h
297         mkdir-label.c
298         mount-util.c
299         mount-util.h
300         parse-printf-format.c
301         parse-printf-format.h
302         parse-util.c
303         parse-util.h
304         path-util.c
305         path-util.h
306         prioq.c
307         prioq.h
308         proc-cmdline.c
309         proc-cmdline.h
310         procfs-util.c
311         procfs-util.h
312         process-util.c
313         process-util.h
314         random-util.c
315         random-util.h
316         refcnt.h
317         rm-rf.c
318         rm-rf.h
319         selinux-util.c
320         selinux-util.h
321         set.h
322         sigbus.c
323         sigbus.h
324         signal-util.c
325         signal-util.h
326         siphash24.c
327         siphash24.h
328         smack-util.c
329         smack-util.h
330         socket-util.c
331         socket-util.h
332         sparse-endian.h
333         special.h
334         stat-util.c
335         stat-util.h
336         stdio-util.h
337         string-table.c
338         string-table.h
339         string-util.c
340         string-util.h
341         strv.c
342         strv.h
343         syslog-util.c
344         syslog-util.h
345         terminal-util.c
346         terminal-util.h
347         time-util.c
348         time-util.h
349         umask-util.h
350         unaligned.h
351         unit-def.c
352         unit-def.h
353         unit-name.c
354         unit-name.h
355         user-util.c
356         user-util.h
357         utf8.c
358         utf8.h
359         util.c
360         util.h
361         verbs.c
362         verbs.h
363         virt.c
364         virt.h
365         xattr-util.c
366         xattr-util.h
367 '''.split())
368 #endif // 0
369
370 missing_h = files('missing.h')
371
372 generate_gperfs = find_program('generate-gperfs.py')
373
374 #if 0 /// elogind has only the cap and errno list.
375 # generate_af_list = find_program('generate-af-list.sh')
376 # af_list_txt = custom_target(
377 #         'af-list.txt',
378 #         output : 'af-list.txt',
379 #         command : [generate_af_list, cpp],
380 #         capture : true)
381
382 # generate_arphrd_list = find_program('generate-arphrd-list.sh')
383 # arphrd_list_txt = custom_target(
384 #         'arphrd-list.txt',
385 #         output : 'arphrd-list.txt',
386 #         command : [generate_arphrd_list, cpp],
387 #         capture : true)
388 #endif // 0
389
390 generate_cap_list = find_program('generate-cap-list.sh')
391 cap_list_txt = custom_target(
392         'cap-list.txt',
393         output : 'cap-list.txt',
394 #if 0 /// elogind needs musl_missing.h, so generate_cap_list must know the source root
395 #         command : [generate_cap_list, cpp, config_h, missing_h],
396 #else
397         command : [generate_cap_list, cpp, meson.source_root(), config_h, missing_h],
398 #endif // 0
399         capture : true)
400
401 generate_errno_list = find_program('generate-errno-list.sh')
402 errno_list_txt = custom_target(
403         'errno-list.txt',
404         output : 'errno-list.txt',
405         command : [generate_errno_list, cpp],
406         capture : true)
407
408 generate_socket_protocol_list = find_program('generate-socket-protocol-list.sh')
409 socket_protocol_list_txt = custom_target(
410         'socket-protocol-list.txt',
411         output : 'socket-protocol-list.txt',
412         command : [generate_socket_protocol_list, cpp],
413         capture : true)
414
415 generated_gperf_headers = []
416 #if 0 /// elogind has only the cap and errno list.
417 # foreach item : [['af',     af_list_txt,     'af',         ''],
418 #                 ['arphrd', arphrd_list_txt, 'arphrd',     'ARPHRD_'],
419 #                 ['cap',    cap_list_txt,    'capability', ''],
420 #                 ['errno',  errno_list_txt,  'errno',      ''],
421 #                 ['socket-protocol', socket_protocol_list_txt, 'socket_protocol',     'IPPROTO_']]
422 #else
423 foreach item : [['cap',    cap_list_txt,    'capability', ''],
424                 ['errno',  errno_list_txt,  'errno',      '']]
425 #endif // 0
426
427         fname = '@0@-from-name.gperf'.format(item[0])
428         gperf_file = custom_target(
429                 fname,
430                 input : item[1],
431                 output : fname,
432                 command : [generate_gperfs, item[2], item[3], '@INPUT@'],
433                 capture : true)
434
435         fname = '@0@-from-name.h'.format(item[0])
436         target1 = custom_target(
437                 fname,
438                 input : gperf_file,
439                 output : fname,
440                 command : [gperf,
441                            '-L', 'ANSI-C', '-t', '--ignore-case',
442                            '-N', 'lookup_@0@'.format(item[2]),
443                            '-H', 'hash_@0@_name'.format(item[2]),
444                            '-p', '-C',
445                            '@INPUT@'],
446                 capture : true)
447
448         fname = '@0@-to-name.h'.format(item[0])
449         awkscript = '@0@-to-name.awk'.format(item[0])
450         target2 = custom_target(
451                 fname,
452                 input : [awkscript, item[1]],
453                 output : fname,
454                 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
455                 capture : true)
456
457         generated_gperf_headers += [target1, target2]
458 endforeach
459
460 basic_sources += [missing_h] + generated_gperf_headers
461 #if 0 /// elogind does not need gcrypt
462 # basic_gcrypt_sources = files(
463 #         'gcrypt-util.c',
464 #         'gcrypt-util.h')
465 #endif // 0
466
467 libbasic = static_library(
468         'basic',
469         basic_sources,
470         include_directories : includes,
471         dependencies : [threads,
472                         libcap,
473 #if 0 /// Neither blkid nor libmount in elogind
474 #                         libblkid,
475 #                         libmount,
476 #endif // 0
477                         libselinux],
478         c_args : ['-fvisibility=default'],
479         install : false)
480
481 #if 0 /// elogind does not need gcrypt
482 # # A convenience library that is separate from libbasic to avoid
483 # # unnecessary linking to libgcrypt.
484 # libbasic_gcrypt = static_library(
485 #         'basic-gcrypt',
486 #         basic_gcrypt_sources,
487 #         include_directories : includes,
488 #         dependencies : [libgcrypt],
489 #         c_args : ['-fvisibility=default'])
490 #endif // 0