]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/meson.build
core/scope: drop effectively unused unit_watch_pidref() calls (#38186)
[thirdparty/systemd.git] / src / basic / meson.build
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.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 'devnum-util.c',
27 'dirent-util.c',
28 'dlfcn-util.c',
29 'efivars.c',
30 'env-file.c',
31 'env-util.c',
32 'errno-list.c',
33 'escape.c',
34 'ether-addr-util.c',
35 'extract-word.c',
36 'fd-util.c',
37 'fileio.c',
38 'filesystems.c',
39 'format-ifname.c',
40 'format-util.c',
41 'fs-util.c',
42 'gcrypt-util.c',
43 'glob-util.c',
44 'glyph-util.c',
45 'gunicode.c',
46 'hash-funcs.c',
47 'hashmap.c',
48 'hexdecoct.c',
49 'hmac.c',
50 'hostname-util.c',
51 'in-addr-util.c',
52 'initrd-util.c',
53 'inotify-util.c',
54 'io-util.c',
55 'iovec-util.c',
56 'iovec-wrapper.c',
57 'keyring-util.c',
58 'label.c',
59 'limits-util.c',
60 'locale-util.c',
61 'lock-util.c',
62 'log.c',
63 'log-context.c',
64 'login-util.c',
65 'memfd-util.c',
66 'memory-util.c',
67 'mempool.c',
68 'memstream-util.c',
69 'mkdir.c',
70 'mountpoint-util.c',
71 'namespace-util.c',
72 'nulstr-util.c',
73 'ordered-set.c',
74 'os-util.c',
75 'parse-util.c',
76 'path-util.c',
77 'percent-util.c',
78 'pidfd-util.c',
79 'pidref.c',
80 'prioq.c',
81 'proc-cmdline.c',
82 'process-util.c',
83 'procfs-util.c',
84 'psi-util.c',
85 'random-util.c',
86 'ratelimit.c',
87 'raw-clone.c',
88 'recurse-dir.c',
89 'replace-var.c',
90 'rlimit-util.c',
91 'runtime-scope.c',
92 'sha256.c',
93 'sigbus.c',
94 'signal-util.c',
95 'siphash24.c',
96 'socket-util.c',
97 'sort-util.c',
98 'stat-util.c',
99 'static-destruct.c',
100 'strbuf.c',
101 'string-table.c',
102 'string-util.c',
103 'strv.c',
104 'strxcpyx.c',
105 'sync-util.c',
106 'sysctl-util.c',
107 'syslog-util.c',
108 'terminal-util.c',
109 'time-util.c',
110 'tmpfile-util.c',
111 'uid-classification.c',
112 'uid-range.c',
113 'unit-def.c',
114 'unit-name.c',
115 'user-util.c',
116 'utf8.c',
117 'virt.c',
118 'xattr-util.c',
119 )
120
121 sources += basic_sources
122
123 generated_gperf_headers = []
124 foreach item : [
125 # name, source, prefix, headers
126 ['af', af_sources, '', ['<sys/socket.h>'], ],
127 ['arphrd', arphrd_sources, 'ARPHRD_', ['<linux/if_arp.h>'], ],
128 ['capability', capability_sources, '', ['<linux/capability.h>'], ],
129 ['errno', [], '', ['<errno.h>'], ],
130 ]
131
132 fname = '@0@-list.txt'.format(item[0])
133 generate_list = files('generate-@0@-list.sh'.format(item[0]))
134 list_txt = custom_target(
135 input : [generate_list, item[1]],
136 output : fname,
137 command : [env, 'bash', generate_list, cpp, system_include_args],
138 capture : true)
139
140 fname = '@0@-from-name.gperf'.format(item[0])
141 gperf_file = custom_target(
142 input : list_txt,
143 output : fname,
144 command : [generate_gperfs, item[0], item[2], '@INPUT@'] + item[3],
145 capture : true)
146
147 fname = '@0@-from-name.inc'.format(item[0])
148 target1 = custom_target(
149 input : gperf_file,
150 output : fname,
151 command : [gperf,
152 '-L', 'ANSI-C', '-t', '--ignore-case',
153 '-N', 'lookup_@0@'.format(item[0]),
154 '-H', 'hash_@0@_name'.format(item[0]),
155 '-p', '-C',
156 '@INPUT@'],
157 capture : true)
158
159 fname = '@0@-to-name.inc'.format(item[0])
160 awkscript = '@0@-to-name.awk'.format(item[0])
161 target2 = custom_target(
162 input : [awkscript, list_txt],
163 output : fname,
164 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
165 capture : true)
166
167 generated_gperf_headers += [target1, target2]
168 endforeach
169
170 generated_sources += generated_gperf_headers
171 basic_sources += generated_gperf_headers
172
173 ############################################################
174
175 check_filesystems = find_program('check-filesystems.sh')
176 r = run_command(
177 [
178 'env', '--chdir', meson.project_build_root(),
179 check_filesystems, cpp, files('filesystems-gperf.gperf'),
180 system_include_args,
181 ],
182 check: false,
183 )
184 if r.returncode() != 0
185 warning('Unknown filesystems defined in kernel headers:\n\n' + r.stdout())
186 endif
187
188 filesystems_gperf_h = custom_target(
189 input : 'filesystems-gperf.gperf',
190 output : 'filesystems-gperf.h',
191 command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
192
193 generate_filesystem_list = find_program('generate-filesystem-list.py')
194 fname = 'filesystem-list.inc'
195 filesystem_list_inc = custom_target(
196 input : 'filesystems-gperf.gperf',
197 output : fname,
198 command : [generate_filesystem_list,
199 '@INPUT@'],
200 capture : true)
201
202 generate_filesystem_switch_case_inc = find_program('generate-filesystem-switch-case.py')
203 fname = 'filesystem-switch-case.inc'
204 filesystem_switch_case_inc = custom_target(
205 input : 'filesystems-gperf.gperf',
206 output : fname,
207 command : [generate_filesystem_switch_case_inc,
208 '@INPUT@'],
209 capture : true)
210
211 generated_sources += [filesystem_list_inc, filesystem_switch_case_inc, filesystems_gperf_h]
212 basic_sources += [filesystem_list_inc, filesystem_switch_case_inc, filesystems_gperf_h]
213
214 libbasic_static = static_library(
215 'basic',
216 basic_sources,
217 fundamental_sources,
218 include_directories : basic_includes,
219 implicit_include_directories : false,
220 dependencies : [libcap,
221 libdl,
222 libgcrypt_cflags,
223 liblz4_cflags,
224 libm,
225 librt,
226 libxz_cflags,
227 libzstd_cflags,
228 threads,
229 userspace],
230 c_args : ['-fvisibility=default'],
231 build_by_default : false)