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