1# SPDX-License-Identifier: LGPL-2.1-or-later 2 3basic_sources = files( 4 'MurmurHash2.c', 5 'MurmurHash2.h', 6 'af-list.c', 7 'af-list.h', 8 'alloc-util.c', 9 'alloc-util.h', 10 'architecture.c', 11 'architecture.h', 12 'arphrd-util.c', 13 'arphrd-util.h', 14 'async.c', 15 'async.h', 16 'audit-util.c', 17 'audit-util.h', 18 'build.c', 19 'build.h', 20 'bus-label.c', 21 'bus-label.h', 22 'cap-list.c', 23 'cap-list.h', 24 'capability-util.c', 25 'capability-util.h', 26 'cgroup-util.c', 27 'cgroup-util.h', 28 'chase-symlinks.c', 29 'chase-symlinks.h', 30 'chattr-util.c', 31 'chattr-util.h', 32 'conf-files.c', 33 'conf-files.h', 34 'def.h', 35 'devnum-util.c', 36 'devnum-util.h', 37 'dirent-util.c', 38 'dirent-util.h', 39 'dns-def.h', 40 'efivars.c', 41 'efivars.h', 42 'env-file.c', 43 'env-file.h', 44 'env-util.c', 45 'env-util.h', 46 'errno-list.c', 47 'errno-list.h', 48 'errno-util.h', 49 'escape.c', 50 'escape.h', 51 'ether-addr-util.c', 52 'ether-addr-util.h', 53 'extract-word.c', 54 'extract-word.h', 55 'fd-util.c', 56 'fd-util.h', 57 'fileio.c', 58 'fileio.h', 59 'filesystems.c', 60 'filesystems.h', 61 'format-util.c', 62 'format-util.h', 63 'fs-util.c', 64 'fs-util.h', 65 'glob-util.c', 66 'glob-util.h', 67 'glyph-util.c', 68 'glyph-util.h', 69 'gunicode.c', 70 'gunicode.h', 71 'hash-funcs.c', 72 'hash-funcs.h', 73 'hashmap.c', 74 'hashmap.h', 75 'hexdecoct.c', 76 'hexdecoct.h', 77 'hmac.c', 78 'hmac.h', 79 'hostname-util.c', 80 'hostname-util.h', 81 'in-addr-util.c', 82 'in-addr-util.h', 83 'inotify-util.c', 84 'inotify-util.h', 85 'io-util.c', 86 'io-util.h', 87 'ioprio-util.c', 88 'ioprio-util.h', 89 'limits-util.c', 90 'limits-util.h', 91 'linux/btrfs.h', 92 'linux/btrfs_tree.h', 93 'linux/can/netlink.h', 94 'linux/can/vxcan.h', 95 'linux/cfm_bridge.h', 96 'linux/fib_rules.h', 97 'linux/fou.h', 98 'linux/genetlink.h', 99 'linux/hdlc/ioctl.h', 100 'linux/if.h', 101 'linux/if_addr.h', 102 'linux/if_bonding.h', 103 'linux/if_bridge.h', 104 'linux/if_ether.h', 105 'linux/if_link.h', 106 'linux/if_macsec.h', 107 'linux/if_tun.h', 108 'linux/if_tunnel.h', 109 'linux/in.h', 110 'linux/in6.h', 111 'linux/ipv6_route.h', 112 'linux/l2tp.h', 113 'linux/libc-compat.h', 114 'linux/mrp_bridge.h', 115 'linux/netdevice.h', 116 'linux/netfilter/nf_tables.h', 117 'linux/netfilter/nfnetlink.h', 118 'linux/netlink.h', 119 'linux/nexthop.h', 120 'linux/nl80211.h', 121 'linux/pkt_sched.h', 122 'linux/rtnetlink.h', 123 'linux/wireguard.h', 124 'list.h', 125 'locale-util.c', 126 'locale-util.h', 127 'log.c', 128 'log.h', 129 'login-util.c', 130 'login-util.h', 131 'macro.h', 132 'memfd-util.c', 133 'memfd-util.h', 134 'memory-util.c', 135 'memory-util.h', 136 'mempool.c', 137 'mempool.h', 138 'missing_audit.h', 139 'missing_capability.h', 140 'missing_drm.h', 141 'missing_fcntl.h', 142 'missing_fs.h', 143 'missing_input.h', 144 'missing_ioprio.h', 145 'missing_keyctl.h', 146 'missing_magic.h', 147 'missing_mman.h', 148 'missing_mount.h', 149 'missing_network.h', 150 'missing_prctl.h', 151 'missing_random.h', 152 'missing_resource.h', 153 'missing_sched.h', 154 'missing_securebits.h', 155 'missing_socket.h', 156 'missing_stat.h', 157 'missing_stdlib.h', 158 'missing_syscall.h', 159 'missing_timerfd.h', 160 'missing_type.h', 161 'mkdir.c', 162 'mkdir.h', 163 'mountpoint-util.c', 164 'mountpoint-util.h', 165 'namespace-util.c', 166 'namespace-util.h', 167 'nss-util.h', 168 'nulstr-util.c', 169 'nulstr-util.h', 170 'ordered-set.c', 171 'ordered-set.h', 172 'os-util.c', 173 'os-util.h', 174 'parse-util.c', 175 'parse-util.h', 176 'path-lookup.c', 177 'path-lookup.h', 178 'path-util.c', 179 'path-util.h', 180 'percent-util.c', 181 'percent-util.h', 182 'prioq.c', 183 'prioq.h', 184 'proc-cmdline.c', 185 'proc-cmdline.h', 186 'process-util.c', 187 'process-util.h', 188 'procfs-util.c', 189 'procfs-util.h', 190 'pthread-util.h', 191 'random-util.c', 192 'random-util.h', 193 'ratelimit.c', 194 'ratelimit.h', 195 'raw-clone.h', 196 'raw-reboot.h', 197 'recovery-key.c', 198 'recovery-key.h', 199 'recurse-dir.c', 200 'recurse-dir.h', 201 'replace-var.c', 202 'replace-var.h', 203 'rlimit-util.c', 204 'rlimit-util.h', 205 'set.h', 206 'sigbus.c', 207 'sigbus.h', 208 'signal-util.c', 209 'signal-util.h', 210 'siphash24.c', 211 'siphash24.h', 212 'socket-util.c', 213 'socket-util.h', 214 'sort-util.c', 215 'sort-util.h', 216 'sparse-endian.h', 217 'special.h', 218 'stat-util.c', 219 'stat-util.h', 220 'static-destruct.h', 221 'stdio-util.h', 222 'strbuf.c', 223 'strbuf.h', 224 'string-table.c', 225 'string-table.h', 226 'string-util.c', 227 'string-util.h', 228 'strv.c', 229 'strv.h', 230 'strxcpyx.c', 231 'strxcpyx.h', 232 'sync-util.c', 233 'sync-util.h', 234 'sysctl-util.c', 235 'sysctl-util.h', 236 'syslog-util.c', 237 'syslog-util.h', 238 'terminal-util.c', 239 'terminal-util.h', 240 'time-util.c', 241 'time-util.h', 242 'tmpfile-util.c', 243 'tmpfile-util.h', 244 'umask-util.h', 245 'unaligned.h', 246 'unit-def.c', 247 'unit-def.h', 248 'unit-file.c', 249 'unit-file.h', 250 'unit-name.c', 251 'unit-name.h', 252 'user-util.c', 253 'user-util.h', 254 'utf8.c', 255 'utf8.h', 256 'util.c', 257 'util.h', 258 'virt.c', 259 'virt.h', 260 'xattr-util.c', 261 'xattr-util.h') 262 263missing_audit_h = files('missing_audit.h') 264missing_capability_h = files('missing_capability.h') 265missing_socket_h = files('missing_socket.h') 266 267missing_syscall_def_h = files('missing_syscall_def.h') 268basic_sources += missing_syscall_def_h 269 270generate_af_list = find_program('generate-af-list.sh') 271af_list_txt = custom_target( 272 'af-list.txt', 273 output : 'af-list.txt', 274 command : [generate_af_list, cpp, config_h, missing_socket_h], 275 capture : true) 276 277generate_arphrd_list = find_program('generate-arphrd-list.sh') 278arphrd_list_txt = custom_target( 279 'arphrd-list.txt', 280 output : 'arphrd-list.txt', 281 command : [generate_arphrd_list, cpp, config_h], 282 capture : true) 283 284generate_cap_list = find_program('generate-cap-list.sh') 285cap_list_txt = custom_target( 286 'cap-list.txt', 287 output : 'cap-list.txt', 288 command : [generate_cap_list, cpp, config_h, missing_capability_h], 289 capture : true) 290 291generate_errno_list = find_program('generate-errno-list.sh') 292errno_list_txt = custom_target( 293 'errno-list.txt', 294 output : 'errno-list.txt', 295 command : [generate_errno_list, cpp], 296 capture : true) 297 298generated_gperf_headers = [] 299foreach item : [['af', af_list_txt, 'af', ''], 300 ['arphrd', arphrd_list_txt, 'arphrd', 'ARPHRD_'], 301 ['cap', cap_list_txt, 'capability', ''], 302 ['errno', errno_list_txt, 'errno', '']] 303 304 fname = '@0@-from-name.gperf'.format(item[0]) 305 gperf_file = custom_target( 306 fname, 307 input : item[1], 308 output : fname, 309 command : [generate_gperfs, item[2], item[3], '@INPUT@'], 310 capture : true) 311 312 fname = '@0@-from-name.h'.format(item[0]) 313 target1 = custom_target( 314 fname, 315 input : gperf_file, 316 output : fname, 317 command : [gperf, 318 '-L', 'ANSI-C', '-t', '--ignore-case', 319 '-N', 'lookup_@0@'.format(item[2]), 320 '-H', 'hash_@0@_name'.format(item[2]), 321 '-p', '-C', 322 '@INPUT@'], 323 capture : true) 324 325 fname = '@0@-to-name.h'.format(item[0]) 326 awkscript = '@0@-to-name.awk'.format(item[0]) 327 target2 = custom_target( 328 fname, 329 input : [awkscript, item[1]], 330 output : fname, 331 command : [awk, '-f', '@INPUT0@', '@INPUT1@'], 332 capture : true) 333 334 generated_gperf_headers += [target1, target2] 335endforeach 336 337basic_sources += generated_gperf_headers 338 339############################################################ 340 341arch_list = [ 342 'alpha', 343 'arc', 344 'arm', 345 'arm64', 346 'i386', 347 'ia64', 348 'loongarch64', 349 'm68k', 350 'mips64', 351 'mips64n32', 352 'mipso32', 353 'powerpc', 354 'powerpc64', 355 'riscv32', 356 'riscv64', 357 's390', 358 's390x', 359 'sparc', 360 'x86_64' 361] 362 363run_target( 364 'update-syscall-tables', 365 command : [update_syscall_tables_sh, meson.current_source_dir()] + arch_list) 366 367syscall_list_txt = files('syscall-list.txt') 368 369syscall_lists = [] 370foreach arch: arch_list 371 syscall_lists += files('syscalls-@0@.txt'.format(arch)) 372endforeach 373 374missing_syscalls_py = find_program('missing_syscalls.py') 375 376run_target( 377 'update-syscall-header', 378 command : [missing_syscalls_py, 379 missing_syscall_def_h, 380 syscall_lists]) 381 382############################################################ 383 384filesystem_includes = ['linux/magic.h', 385 'linux/gfs2_ondisk.h'] 386 387check_filesystems = find_program('check-filesystems.sh') 388r = run_command([check_filesystems, cpp, 'filesystems-gperf.gperf'] + filesystem_includes, check: false) 389if r.returncode() != 0 390 error('found unknown filesystem(s) defined in kernel headers:\n\n' + r.stdout()) 391 r.stdout() 392endif 393 394filesystems_gperf_h = custom_target( 395 'filesystems-gperf.h', 396 input : 'filesystems-gperf.gperf', 397 output : 'filesystems-gperf.h', 398 command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@']) 399 400generate_filesystem_list = find_program('generate-filesystem-list.py') 401fname = 'filesystem-list.h' 402filesystem_list_h = custom_target( 403 fname, 404 input : 'filesystems-gperf.gperf', 405 output : fname, 406 command : [generate_filesystem_list, 407 '@INPUT@'], 408 capture : true) 409 410generate_filesystem_switch_case_h = find_program('generate-filesystem-switch-case.py') 411fname = 'filesystem-switch-case.h' 412filesystem_switch_case_h = custom_target( 413 fname, 414 input : 'filesystems-gperf.gperf', 415 output : 'filesystem-switch-case.h', 416 command : [generate_filesystem_switch_case_h, 417 '@INPUT@'], 418 capture : true) 419 420basic_sources += [filesystem_list_h, filesystem_switch_case_h, filesystems_gperf_h] 421 422libbasic = static_library( 423 'basic', 424 basic_sources, 425 fundamental_sources, 426 include_directories : basic_includes, 427 dependencies : [versiondep, 428 threads, 429 libcap, 430 libm], 431 c_args : ['-fvisibility=default'], 432 build_by_default : false) 433 434############################################################ 435 436basic_gcrypt_sources = files( 437 'gcrypt-util.c', 438 'gcrypt-util.h') 439 440# A convenience library that is separate from libbasic to avoid 441# unnecessary linking to libgcrypt. 442libbasic_gcrypt = static_library( 443 'basic-gcrypt', 444 basic_gcrypt_sources, 445 include_directories : basic_includes, 446 dependencies : [libgcrypt], 447 c_args : ['-fvisibility=default'], 448 build_by_default : false) 449 450############################################################ 451 452basic_compress_sources = files( 453 'compress.c', 454 'compress.h') 455 456# A convenience library that is separate from libbasic to avoid unnecessary 457# linking to the compression libraries. 458libbasic_compress = static_library( 459 'basic-compress', 460 basic_compress_sources, 461 include_directories : basic_includes, 462 dependencies : [libxz, 463 libzstd, 464 liblz4], 465 c_args : ['-fvisibility=default'], 466 build_by_default : false) 467