. "$BST_LIB" # iniparser is a C .INI-file parser that loads a whole file into a dictionary and # hands back typed getters -- the load-it-all counterpart to inih, which streams # a file through a callback (see 71-libinih). The distro is static-only and the # Doxygen manual is not built, so the payload is two headers plus a pkg-config # file (-dev) and the static archive libiniparser.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 -- each header carrying its include guard and its # declared API, the .pc file describing the library the image actually ships, and # the archive carrying both compiled members plus the exported symbols of both # layers in its index. That symbol index is what distinguishes a wasm32 compile # that produced the parser from an empty stub. inc=/usr/include/iniparser/iniparser.h dic=/usr/include/iniparser/dictionary.h pc=/usr/lib/pkgconfig/iniparser.pc lib=/usr/lib/libiniparser.a check iniparser/header-present test -f "$inc" check iniparser/header-nonempty test -s "$inc" check_out iniparser/header-guard "define _INIPARSER_H_" cat "$inc" check iniparser/dict-header-present test -f "$dic" check iniparser/dict-header-nonempty test -s "$dic" check_out iniparser/dict-header-guard "define _DICTIONARY_H_" cat "$dic" # The parser API: load/free the dictionary, and the four typed getters plus the # setter a caller reaches for. Declarations are matched with their return type so # a prose mention in the doc comments cannot satisfy the case. check_out iniparser/api-load "dictionary * iniparser_load(" cat "$inc" check_out iniparser/api-freedict "void iniparser_freedict(" cat "$inc" check_out iniparser/api-getstring "const char * iniparser_getstring(" cat "$inc" check_out iniparser/api-getint "int iniparser_getint(" cat "$inc" check_out iniparser/api-getlongint "long int iniparser_getlongint(" cat "$inc" check_out iniparser/api-getdouble "double iniparser_getdouble(" cat "$inc" check_out iniparser/api-getboolean "int iniparser_getboolean(" cat "$inc" check_out iniparser/api-set "int iniparser_set(" cat "$inc" check_out iniparser/api-unset "void iniparser_unset(" cat "$inc" # Section introspection -- the part of the API that has no inih counterpart, # since inih never builds a queryable model of the file. check_out iniparser/api-getnsec "int iniparser_getnsec(" cat "$inc" check_out iniparser/api-getsecname "const char * iniparser_getsecname(" cat "$inc" check_out iniparser/api-getseckeys "iniparser_getseckeys(" cat "$inc" # The dictionary layer iniparser is built on, shipped as a public header of its # own: the struct a caller walks, and the store it is manipulated through. check_out iniparser/dict-struct "} dictionary ;" cat "$dic" check_out iniparser/dict-new "dictionary * dictionary_new(" cat "$dic" check_out iniparser/dict-del "void dictionary_del(" cat "$dic" check_out iniparser/dict-get "const char * dictionary_get(" cat "$dic" check_out iniparser/dict-set "int dictionary_set(" cat "$dic" # pkg-config metadata: shipped so a future recipe can DEPEND on iniparser, and # the one place the port's version and link line are stated on target. check iniparser/pc-present test -f "$pc" check_out iniparser/pc-name "Name: libiniparser" cat "$pc" check_out iniparser/pc-version "Version: 4.1" cat "$pc" check_out iniparser/pc-libs "-liniparser" cat "$pc" check_out iniparser/pc-cflags "-I\${includedir}" cat "$pc" # The .pc ships with @baselib@ substituted, so libdir resolves rather than # handing a consumer a literal placeholder. check_out iniparser/pc-libdir "libdir=\${exec_prefix}/lib" cat "$pc" check iniparser/lib-present test -f "$lib" check iniparser/lib-nonempty test -s "$lib" check_out iniparser/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-iniparser.$$ tr -c '\40-\176\n' ' ' < "$lib" > "$flat" 2>/dev/null # Both translation units: a build that lost the dictionary member would still # link for a caller that only reads strings, and would fail much later. check iniparser/lib-member-iniparser grep -q "iniparser.c.o" "$flat" check iniparser/lib-member-dictionary grep -q "dictionary.c.o" "$flat" for s in iniparser_load iniparser_freedict iniparser_getstring iniparser_getint \ iniparser_getlongint iniparser_getdouble iniparser_getboolean \ iniparser_getnsec iniparser_getsecname iniparser_set iniparser_unset; do check "iniparser/sym-$s" grep -q "$s" "$flat" done for s in dictionary_new dictionary_del dictionary_get dictionary_set dictionary_hash; do check "iniparser/sym-$s" grep -q "$s" "$flat" done # No shared object: static-only is distro policy, and the CMakeLists this package # configures from builds a shared target unless patched, so a stray # libiniparser.so here would mean that patch was lost. check iniparser/no-shared sh -c 'set -- /usr/lib/libiniparser.so*; [ ! -e "$1" ]' # The Doxygen manual is not built, so no HTML should have reached the image. check iniparser/no-htmldoc sh -c '[ ! -d /usr/share/doc/iniparser/html ]' rm -f "$flat"