. "$BST_LIB" # inih is a C .INI-file parser. The distro is static-only and the C++ INIReader # half is not built (the external tcmode's CXX is the C driver), so the payload # is one header plus a pkg-config file (-dev) and the static archive libinih.a # (-staticdev). There is no on-target C compiler to link against it, so the # on-target assertion is that the shipped payload is real -- the header carrying # its include guard, its declared API and its tunable defaults, the .pc file # describing the library the image actually ships, and the archive carrying its # compiled member plus every exported ini_parse* symbol in its index. That # symbol index is what distinguishes a wasm32 compile that produced the parser # from an empty stub. inc=/usr/include/ini.h pc=/usr/lib/pkgconfig/inih.pc lib=/usr/lib/libinih.a check libinih/header-present test -f "$inc" check libinih/header-nonempty test -s "$inc" check_out libinih/header-guard "define INI_H" cat "$inc" # The declared C API: all four entry points, and the two callback typedefs a # caller must implement against. check_out libinih/api-parse "int ini_parse(" cat "$inc" check_out libinih/api-parse-file "int ini_parse_file(" cat "$inc" check_out libinih/api-parse-stream "int ini_parse_stream(" cat "$inc" check_out libinih/api-parse-string "int ini_parse_string(" cat "$inc" check_out libinih/handler-typedef "ini_handler" cat "$inc" check_out libinih/reader-typedef "ini_reader" cat "$inc" # The compile-time tunables, at their upstream defaults: this port passes none # of inih's feature options, so a caller gets multi-line entries, BOM tolerance, # inline comments and the 200-byte stack line buffer. check_out libinih/tunable-multiline "define INI_ALLOW_MULTILINE 1" cat "$inc" check_out libinih/tunable-bom "define INI_ALLOW_BOM 1" cat "$inc" check_out libinih/tunable-inline "define INI_ALLOW_INLINE_COMMENTS 1" cat "$inc" check_out libinih/tunable-stack "define INI_USE_STACK 1" cat "$inc" check_out libinih/tunable-maxline "define INI_MAX_LINE 200" cat "$inc" # pkg-config metadata: shipped so a future recipe can DEPEND on inih, and the # one place the port's version and link line are stated on target. check libinih/pc-present test -f "$pc" check_out libinih/pc-name "Name: inih" cat "$pc" check_out libinih/pc-version "Version: 58" cat "$pc" check_out libinih/pc-libs "-linih" cat "$pc" check_out libinih/pc-cflags "-I\${includedir}" cat "$pc" check libinih/lib-present test -f "$lib" check libinih/lib-nonempty test -s "$lib" check_out libinih/lib-archive "!" head -c 8 "$lib" # Flatten the archive to printable text once: GNU grep suppresses matches inside # binary data, and busybox tr does not handle [:print:] under -c, so the octal # range is the formulation both greps and both trs agree on. flat=${TMPDIR:-/tmp}/bst-libinih.$$ tr -c '\40-\176\n' ' ' < "$lib" > "$flat" 2>/dev/null check libinih/lib-member grep -q "ini.c.o" "$flat" for s in ini_parse ini_parse_file ini_parse_stream ini_parse_string; do check "libinih/sym-$s" grep -q "$s" "$flat" done # No shared object: static-only is distro policy, and inih's meson defaults to a # shared library, so a stray libinih.so here would mean the override was lost. check libinih/no-shared sh -c 'set -- /usr/lib/libinih.so*; [ ! -e "$1" ]' rm -f "$flat"