. "$BST_LIB" # libb64 is a C base64 encode/decode library. The distro is static-only, so the # port ships no shared object: the payload is the five b64 headers (-dev) and # the static archive libb64.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 -- every header present and carrying its own version guard and API # declarations, and the archive carrying both compiled members plus every # exported base64_* symbol in its index. That symbol index is what distinguishes # a wasm32 compile that actually produced the library from an empty stub. inc=/usr/include/b64 lib=/usr/lib/libb64.a for h in ccommon cdecode cencode decode encode; do check "libb64/$h-present" test -f "$inc/$h.h" done # Version guards: ccommon carries the 2.0 library version, and each C header its # own encoder/decoder version. check_out libb64/ccommon-version "define BASE64_VER_MAJOR" cat "$inc/ccommon.h" check_out libb64/cencode-version "define BASE64_CENC_VER_MAJOR" cat "$inc/cencode.h" check_out libb64/cdecode-version "define BASE64_CDEC_VER_MAJOR" cat "$inc/cdecode.h" # The declared C API and its state structs, so a truncated header is caught. check_out libb64/cencode-api "base64_encode_block" cat "$inc/cencode.h" check_out libb64/cencode-state "base64_encodestate" cat "$inc/cencode.h" check_out libb64/cdecode-api "base64_decode_block" cat "$inc/cdecode.h" check_out libb64/cdecode-state "base64_decodestate" cat "$inc/cdecode.h" # The two C++ wrapper headers ship alongside the C ones (unusable on this image # -- no C++ standard library -- but part of the package's payload). check_out libb64/cxx-namespace "namespace base64" cat "$inc/encode.h" check_out libb64/encode-cxx "struct encoder" cat "$inc/encode.h" check_out libb64/decode-cxx "struct decoder" cat "$inc/decode.h" check libb64/lib-present test -f "$lib" check libb64/lib-nonempty test -s "$lib" check_out libb64/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-libb64.$$ tr -c '\40-\176\n' ' ' < "$lib" > "$flat" 2>/dev/null check libb64/lib-cencode grep -q cencode.o "$flat" check libb64/lib-cdecode grep -q cdecode.o "$flat" for s in init_encodestate encode_block encode_blockend encode_value \ encode_length init_decodestate decode_block decode_value \ decode_maxlength; do check "libb64/sym-$s" grep -q "base64_$s" "$flat" done rm -f "$flat"