]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/meson.build
sleep-util: split battery-capacity into sleep/
[thirdparty/systemd.git] / src / shared / meson.build
CommitLineData
db9ecf05 1# SPDX-License-Identifier: LGPL-2.1-or-later
3a726fcd 2
f1b98127 3shared_sources = files(
f76ce81b 4 'acl-util.c',
f1b98127 5 'acpi-fpdt.c',
f1b98127 6 'apparmor-util.c',
f1b98127 7 'ask-password-api.c',
7e14a308 8 'async.c',
f1b98127 9 'barrier.c',
f1b98127 10 'base-filesystem.c',
af4e8e86 11 'battery-util.c',
f1b98127 12 'binfmt-util.c',
f1b98127 13 'bitmap.c',
f1b98127 14 'blockdev-util.c',
f1b98127 15 'bond-util.c',
9e43296f 16 'boot-entry.c',
f1b98127 17 'boot-timestamps.c',
f1b98127 18 'bootspec.c',
f1b98127 19 'bpf-dlopen.c',
f1b98127 20 'bpf-program.c',
f1b98127 21 'bridge-util.c',
f1b98127 22 'btrfs-util.c',
f1b98127 23 'bus-get-properties.c',
f1b98127 24 'bus-locator.c',
f1b98127 25 'bus-log-control-api.c',
f1b98127 26 'bus-map-properties.c',
f1b98127 27 'bus-message-util.c',
f1b98127 28 'bus-object.c',
f1b98127 29 'bus-polkit.c',
f1b98127 30 'bus-print-properties.c',
f1b98127 31 'bus-unit-procs.c',
f1b98127 32 'bus-unit-util.c',
f1b98127 33 'bus-util.c',
f1b98127 34 'bus-wait-for-jobs.c',
f1b98127 35 'bus-wait-for-units.c',
f1b98127 36 'calendarspec.c',
f1b98127 37 'cgroup-setup.c',
f1b98127 38 'cgroup-show.c',
f1b98127 39 'chown-recursive.c',
f1b98127 40 'clean-ipc.c',
f1b98127 41 'clock-util.c',
9b2c1614 42 'common-signal.c',
a8835c11 43 'compare-operator.c',
f1b98127 44 'condition.c',
f1b98127 45 'conf-parser.c',
f1b98127 46 'copy.c',
f1b98127 47 'coredump-util.c',
f1b98127 48 'cpu-set-util.c',
f1b98127 49 'creds-util.c',
f1b98127 50 'cryptsetup-util.c',
50e23ac6 51 'daemon-util.c',
f1b98127 52 'data-fd-util.c',
f1b98127 53 'dev-setup.c',
f1b98127 54 'device-nodes.c',
f1b98127 55 'discover-image.c',
f1b98127 56 'dissect-image.c',
f1b98127 57 'dlfcn-util.c',
f1b98127 58 'dm-util.c',
f1b98127 59 'dns-domain.c',
f1b98127 60 'dropin.c',
a01c4bc9 61 'edit-util.c',
7be4b236 62 'efi-api.c',
f1b98127 63 'efi-loader.c',
f1b98127 64 'elf-util.c',
f1b98127
ZJS
65 'enable-mempool.c',
66 'env-file-label.c',
f1b98127 67 'ethtool-util.c',
f1b98127 68 'exec-util.c',
f1b98127 69 'exit-status.c',
d51f8eb3 70 'extension-util.c',
f1b98127 71 'fdset.c',
f1b98127 72 'fileio-label.c',
e94830c0 73 'find-esp.c',
f1b98127 74 'firewall-util-nft.c',
f1b98127 75 'firewall-util.c',
f1b98127 76 'format-table.c',
f1b98127 77 'fstab-util.c',
f1b98127 78 'generator.c',
f1b98127 79 'geneve-util.c',
f1b98127 80 'gpt.c',
f1b98127 81 'group-record.c',
f1b98127 82 'hostname-setup.c',
f1b98127 83 'hwdb-util.c',
f1b98127 84 'id128-print.c',
f1b98127 85 'idn-util.c',
f1b98127 86 'ima-util.c',
d452335a 87 'image-policy.c',
f1b98127 88 'import-util.c',
f1b98127 89 'in-addr-prefix-util.c',
f1b98127 90 'install-file.c',
f1b98127 91 'install-printf.c',
f1b98127 92 'install.c',
f1b98127 93 'ip-protocol-list.c',
f1b98127 94 'ipvlan-util.c',
f1b98127 95 'journal-importer.c',
f1b98127 96 'journal-util.c',
f1b98127 97 'json.c',
f1b98127 98 'kbd-util.c',
5689e161 99 'kernel-image.c',
f1b98127
ZJS
100 'keyring-util.c',
101 'killall.c',
0690160e 102 'label-util.c',
f1b98127 103 'libcrypt-util.c',
f1b98127 104 'libfido2-util.c',
08221c57 105 'libmount-util.c',
f1b98127 106 'local-addresses.c',
3d36b5d7 107 'locale-setup.c',
f1b98127 108 'logs-show.c',
f1b98127 109 'loop-util.c',
f1b98127 110 'loopback-setup.c',
b3a062cb 111 'lsm-util.c',
f1b98127 112 'machine-id-setup.c',
f1b98127 113 'machine-pool.c',
f1b98127 114 'macvlan-util.c',
f1b98127 115 'mkdir-label.c',
f1b98127 116 'mkfs-util.c',
f1b98127 117 'mount-setup.c',
f1b98127 118 'mount-util.c',
f1b98127 119 'net-condition.c',
f1b98127 120 'netif-naming-scheme.c',
f1b98127 121 'netif-sriov.c',
f1b98127 122 'netif-util.c',
f1b98127 123 'nsflags.c',
f1b98127 124 'numa-util.c',
cd48e23f 125 'open-file.c',
f1b98127 126 'openssl-util.c',
f1b98127 127 'output-mode.c',
f1b98127 128 'pager.c',
f1b98127 129 'parse-argument.c',
c3eaba2d 130 'parse-helpers.c',
1d8aae43 131 'password-quality-util-passwdqc.c',
d34b1823 132 'password-quality-util-pwquality.c',
e30c1d01 133 'pcre2-util.c',
0786b039 134 'pe-binary.c',
f1b98127 135 'pkcs11-util.c',
f1b98127 136 'pretty-print.c',
f1b98127 137 'ptyfwd.c',
f1b98127 138 'qrcode-util.c',
f1b98127 139 'quota-util.c',
f1b98127 140 'reboot-util.c',
af72f975 141 'recovery-key.c',
f1b98127 142 'resize-fs.c',
f1b98127 143 'resolve-util.c',
f1b98127 144 'rm-rf.c',
f1b98127 145 'securebits-util.c',
f1b98127 146 'selinux-util.c',
f1b98127 147 'serialize.c',
f1b98127 148 'service-util.c',
4014172a 149 'sleep-util.c',
f1b98127 150 'smack-util.c',
f1b98127
ZJS
151 'socket-label.c',
152 'socket-netlink.c',
f1b98127 153 'spawn-ask-password-agent.c',
f1b98127 154 'spawn-polkit-agent.c',
f1b98127 155 'specifier.c',
f1b98127 156 'switch-root.c',
f1b98127 157 'tmpfile-util-label.c',
f1b98127 158 'tomoyo-util.c',
f1b98127 159 'tpm2-util.c',
f1b98127 160 'udev-util.c',
f1b98127 161 'user-record-nss.c',
f1b98127 162 'user-record-show.c',
f1b98127 163 'user-record.c',
f1b98127 164 'userdb-dropin.c',
f1b98127 165 'userdb.c',
f1b98127 166 'varlink.c',
f1b98127 167 'verb-log-control.c',
f1b98127 168 'verbs.c',
f1b98127 169 'vlan-util.c',
f1b98127 170 'volatile-util.c',
53c0397b 171 'wall.c',
f1b98127 172 'watchdog.c',
f1b98127 173 'web-util.c',
f1b98127 174 'wifi-util.c',
f1b98127 175 'xml.c',
2f492a73 176)
5c23128d 177
b9fa9b71 178if get_option('tests') != 'false'
f1b98127 179 shared_sources += files(
f1b98127 180 'tests.c',
2f492a73 181 )
b9fa9b71
MO
182endif
183
95aac012
ZJS
184generate_syscall_list = find_program('generate-syscall-list.py')
185fname = 'syscall-list.h'
186syscall_list_h = custom_target(
187 fname,
984b5296 188 input : syscall_list_txt,
95aac012
ZJS
189 output : fname,
190 command : [generate_syscall_list,
191 '@INPUT@'],
192 capture : true)
193
349cc4a5 194if conf.get('HAVE_ACL') == 1
f1b98127 195 shared_sources += files(
2f492a73
ZJS
196 'devnode-acl.c',
197 )
5c23128d
ZJS
198endif
199
3211da4b 200if conf.get('ENABLE_UTMP') == 1
975464e0 201 shared_sources += files('utmp-wtmp.c')
5c23128d
ZJS
202endif
203
349cc4a5 204if conf.get('HAVE_SECCOMP') == 1
975464e0 205 shared_sources += files('seccomp-util.c')
95aac012 206 shared_sources += syscall_list_h
5c23128d
ZJS
207endif
208
349cc4a5 209if conf.get('HAVE_LIBIPTC') == 1
31220972 210 shared_sources += files('firewall-util-iptables.c')
c3045943
MB
211endif
212
43b3f0fb 213if conf.get('HAVE_LIBBPF') == 1
f1b98127
ZJS
214 shared_sources += files(
215 'bpf-link.c',
2f492a73 216 )
43b3f0fb
JK
217endif
218
ba323bbe
YW
219if conf.get('HAVE_KMOD') == 1
220 shared_sources += files('module-util.c')
221endif
222
cef9f2a6 223if conf.get('HAVE_PAM') == 1
c5abccfa
YW
224 shared_sources += files(
225 'pam-util.c',
2f492a73 226 )
cef9f2a6
LP
227endif
228
7e0079f9
ZJS
229if conf.get('ENABLE_NSCD') == 1
230 shared_sources += files('nscd-flush.c')
231endif
232
38fc5e03 233if conf.get('HAVE_LIBFIDO2') == 1 and conf.get('HAVE_LIBCRYPTSETUP') == 1
0a8e026e
PC
234 shared_sources += files('cryptsetup-fido2.c')
235endif
236
da96ad5a
YW
237generate_ip_protocol_list = find_program('generate-ip-protocol-list.sh')
238ip_protocol_list_txt = custom_target(
239 'ip-protocol-list.txt',
240 output : 'ip-protocol-list.txt',
241 command : [generate_ip_protocol_list, cpp],
7b5e750d
YW
242 capture : true)
243
da96ad5a 244fname = 'ip-protocol-from-name.gperf'
7b5e750d
YW
245gperf_file = custom_target(
246 fname,
da96ad5a 247 input : ip_protocol_list_txt,
7b5e750d 248 output : fname,
da96ad5a 249 command : [generate_gperfs, 'ip_protocol', 'IPPROTO_', '@INPUT@'],
7b5e750d
YW
250 capture : true)
251
da96ad5a 252fname = 'ip-protocol-from-name.h'
7b5e750d
YW
253target1 = custom_target(
254 fname,
255 input : gperf_file,
256 output : fname,
257 command : [gperf,
258 '-L', 'ANSI-C', '-t', '--ignore-case',
da96ad5a
YW
259 '-N', 'lookup_ip_protocol',
260 '-H', 'hash_ip_protocol_name',
7b5e750d
YW
261 '-p', '-C',
262 '@INPUT@'],
263 capture : true)
264
da96ad5a
YW
265fname = 'ip-protocol-to-name.h'
266awkscript = 'ip-protocol-to-name.awk'
7b5e750d
YW
267target2 = custom_target(
268 fname,
da96ad5a 269 input : [awkscript, ip_protocol_list_txt],
7b5e750d
YW
270 output : fname,
271 command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
272 capture : true)
273
dca23091
YW
274shared_generated_gperf_headers = [target1, target2]
275shared_sources += shared_generated_gperf_headers
7b5e750d 276
6049ddcc
ZJS
277fname = 'ethtool-link-mode.h'
278ethtool_link_mode_h = custom_target(
279 fname,
280 input : ['ethtool-link-mode.py', 'linux/ethtool.h'],
281 output : fname,
1e473c2e 282 command : [python, '@INPUT0@', '--header', cpp, '@INPUT1@'],
6049ddcc
ZJS
283 capture : true)
284shared_sources += ethtool_link_mode_h
285
c18dde32
ZJS
286fname = 'ethtool-link-mode.xml'
287ethtool_link_mode_xml = custom_target(
288 fname,
289 input : ['ethtool-link-mode.py', 'linux/ethtool.h'],
290 output : fname,
1e473c2e 291 command : [python, '@INPUT0@', '--xml', cpp, '@INPUT1@'],
c18dde32
ZJS
292 capture : true)
293man_page_depends += ethtool_link_mode_xml
294
a2b0cd3f 295libshared_name = 'systemd-shared-@0@'.format(shared_lib_tag)
5c23128d 296
4b57a272 297libshared_deps = [threads,
4b57a272 298 libacl,
462255c6
LP
299 libblkid,
300 libcap,
42f3b2f9 301 libcrypt,
c5fd89ad 302 libdl,
4b57a272
ZJS
303 libgcrypt,
304 libiptc,
3cb9b42a 305 libkmod,
462255c6 306 liblz4,
77c772f2 307 libmount,
839fddbe 308 libopenssl,
da035a3a 309 libp11kit_cflags,
cef9f2a6 310 libpam,
462255c6 311 librt,
4b57a272
ZJS
312 libseccomp,
313 libselinux,
a2ea44b7 314 libxenctrl,
ede5a78f 315 libxz,
40c7d3c7 316 libzstd]
4b57a272 317
90461ef5 318libshared_sym_path = meson.current_source_dir() / 'libshared.sym'
c18dde32 319libshared_build_dir = meson.current_build_dir()
4f5993c3 320
2d4ceca8 321libshared_static = static_library(
37efbbd8
ZJS
322 libshared_name,
323 shared_sources,
2d4ceca8 324 include_directories : includes,
92148283
JJ
325 dependencies : [libshared_deps,
326 userspace],
03f7ddf0
ZJS
327 c_args : ['-fvisibility=default'],
328 build_by_default : false)
2d4ceca8
ZJS
329
330libshared = shared_library(
331 libshared_name,
37efbbd8 332 include_directories : includes,
4287c855 333 c_args : ['-fvisibility=default'],
4f5993c3 334 link_args : ['-shared',
2d4ceca8 335 '-Wl,--version-script=' + libshared_sym_path],
90461ef5 336 link_depends : libshared_sym_path,
2d4ceca8 337 link_whole : [libshared_static,
34e221a5 338 libbasic,
a8e559d4 339 libbasic_gcrypt,
99b9f8fd 340 libsystemd_static],
92148283
JJ
341 dependencies : [libshared_deps,
342 userspace],
37efbbd8 343 install : true,
b0d3095f 344 install_dir : pkglibdir)
f8cf3d19
LP
345
346shared_fdisk_sources = files(
f8cf3d19
LP
347 'fdisk-util.c',
348)
349
9ee80846
JJ
350libshared_fdisk = static_library(
351 'shared-fdisk',
352 shared_fdisk_sources,
353 include_directories : includes,
354 dependencies : [libfdisk,
355 userspace],
356 c_args : ['-fvisibility=default'],
357 build_by_default : false)