. "$BST_LIB" # tinyxml2 is a small DOM-style XML parser -- and the FIRST C++ library this # image ships. That is what this suite is really pinning down. Every compiled # library before it was C, and the two that had an optional C++ half (libb64, # libinih) had that half switched off, because the external tcmode points CXX at # the C driver where the C++ standard headers do not resolve. tinyxml2 has no C # half to fall back on, so it is built through the wasmc++-glibc driver instead. # # The distro is static-only, so the payload is one header plus a pkg-config file # (-dev) and the static archive libtinyxml2.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 guard, version macros, class surface # and error enum; the .pc file describing the library the image actually ships; # and the archive carrying its compiled member plus, in its symbol index, the # ITANIUM-MANGLED method names and -- the part no C compile could ever produce -- # the vtables and typeinfo of the polymorphic XMLNode hierarchy. Those last are # the evidence that the C++ driver really produced C++ here. inc=/usr/include/tinyxml2.h pc=/usr/lib/pkgconfig/tinyxml2.pc lib=/usr/lib/libtinyxml2.a check libtinyxml2/header-present test -f "$inc" check libtinyxml2/header-nonempty test -s "$inc" check_out libtinyxml2/header-guard "#define TINYXML2_INCLUDED" cat "$inc" check_out libtinyxml2/header-namespace "namespace tinyxml2" cat "$inc" # Version. Unlike libyaml, tinyxml2 states its version in the header as three # macros, so the port's version is assertable at compile time and on the .pc. check_out libtinyxml2/ver-major "#define TINYXML2_MAJOR_VERSION 10" cat "$inc" check_out libtinyxml2/ver-minor "#define TINYXML2_MINOR_VERSION 0" cat "$inc" check_out libtinyxml2/ver-patch "#define TINYXML2_PATCH_VERSION 0" cat "$inc" # The class surface. tinyxml2's API is its class hierarchy, not a set of free # functions: the document, the five node kinds, the attribute, the two handles, # the visitor and its printer implementation, and the string/utility helpers. for c in XMLDocument XMLNode XMLElement XMLText XMLComment XMLDeclaration \ XMLUnknown XMLAttribute XMLPrinter XMLVisitor XMLUtil XMLHandle \ XMLConstHandle StrPair; do check_out "libtinyxml2/class-$c" "class TINYXML2_LIB $c" cat "$inc" done # The error enum a caller must name to check any parse result. check_out libtinyxml2/enum-XMLError "enum XMLError" cat "$inc" for e in "XML_SUCCESS = 0" XML_NO_ATTRIBUTE XML_WRONG_ATTRIBUTE_TYPE \ XML_ERROR_FILE_NOT_FOUND XML_ERROR_PARSING_ELEMENT \ XML_ERROR_EMPTY_DOCUMENT XML_ERROR_COUNT; do check_out "libtinyxml2/err-${e% =*}" "$e" cat "$inc" done # Document lifecycle: the three ways in (buffer, file by name, open FILE*), the # two ways out, and the reset. These are what a consumer actually calls. for m in "XMLError Parse(" "XMLError LoadFile(" "XMLError SaveFile(" \ "Clear(" "Print(" "RootElement("; do check_out "libtinyxml2/api-doc-$(printf '%s' "${m#XMLError }" | tr -d ' (')" "$m" cat "$inc" done # Node factories -- every node kind is allocated by the document, never by the # caller, because the document owns the memory pool. for m in NewElement NewText NewComment NewDeclaration NewUnknown DeleteNode; do check_out "libtinyxml2/api-new-$m" "$m(" cat "$inc" done # Tree navigation and mutation. for m in FirstChild FirstChildElement LastChild NextSibling PreviousSibling \ Parent InsertEndChild InsertFirstChild InsertAfterChild DeleteChild \ NoChildren DeepClone ShallowClone; do check_out "libtinyxml2/api-tree-$m" "$m(" cat "$inc" done # Element/attribute accessors, including the typed readers that are the reason # to use tinyxml2 over string slicing. for m in SetAttribute Attribute IntAttribute DoubleAttribute BoolAttribute \ QueryIntAttribute DeleteAttribute GetText SetText Value SetValue \ Name SetName; do check_out "libtinyxml2/api-attr-$m" "$m(" cat "$inc" done # Safe downcasts and the string helper's accessor. for m in ToElement ToText ToDocument CStr; do check_out "libtinyxml2/api-cast-$m" "$m(" cat "$inc" done # The visitor protocol and the printer that implements it -- the serialisation # half of the library, and the only public subclass tinyxml2 ships. for m in Accept VisitEnter VisitExit OpenElement CloseElement PushAttribute \ PushText PushComment PushDeclaration PushHeader; do check_out "libtinyxml2/api-visit-$m" "$m(" cat "$inc" done # Static conversion helpers used by the typed accessors above. for m in ToStr ToInt ToBool ToDouble; do check_out "libtinyxml2/api-util-$m" "$m(" cat "$inc" done # Error reporting. for m in ErrorID ErrorStr ErrorName; do check_out "libtinyxml2/api-err-$m" "$m(" cat "$inc" done # pkg-config metadata: shipped so a future recipe can DEPEND on tinyxml2, and the # one place the port's version and link line are stated on target. check libtinyxml2/pc-present test -f "$pc" check_out libtinyxml2/pc-name "Name: tinyxml2" cat "$pc" check_out libtinyxml2/pc-version "Version: 10.0.0" cat "$pc" check_out libtinyxml2/pc-desc "C++ XML parser" cat "$pc" check_out libtinyxml2/pc-libs "-ltinyxml2" cat "$pc" check_out libtinyxml2/pc-cflags "-I\${includedir}" cat "$pc" check_out libtinyxml2/pc-libdir "libdir=\${prefix}/lib" cat "$pc" check libtinyxml2/lib-present test -f "$lib" check libtinyxml2/lib-nonempty test -s "$lib" check_out libtinyxml2/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-libtinyxml2.$$ tr -c '\40-\176\n' ' ' < "$lib" > "$flat" 2>/dev/null # The single upstream translation unit. The .cpp.o suffix is itself the finding: # a C compile of this recipe would have produced no object at all. check libtinyxml2/member-tinyxml2 grep -q 'tinyxml2.cpp.o' "$flat" # Mangled method symbols, sampled across the document, node, element, printer and # utility classes. Itanium mangling encodes the namespace, class, method and full # parameter types, so each of these is evidence that a real C++ compile produced # that exact overload -- far stronger than a C-style bare name would be. for s in _ZN8tinyxml211XMLDocument5ParseEPKcm \ _ZN8tinyxml211XMLDocument8LoadFileEPKc \ _ZN8tinyxml211XMLDocument8SaveFileEPKcb \ _ZN8tinyxml211XMLDocument5ClearEv \ _ZN8tinyxml211XMLDocument10NewElementEPKc \ _ZN8tinyxml211XMLDocument7NewTextEPKc \ _ZN8tinyxml211XMLDocument10NewCommentEPKc \ _ZN8tinyxml211XMLDocument14NewDeclarationEPKc \ _ZN8tinyxml211XMLDocument10NewUnknownEPKc \ _ZN8tinyxml211XMLDocument10DeleteNodeEPNS_7XMLNodeE \ _ZNK8tinyxml211XMLDocument5PrintEPNS_10XMLPrinterE \ _ZNK8tinyxml211XMLDocument10PrintErrorEv \ _ZNK8tinyxml27XMLNode17FirstChildElementEPKc \ _ZN8tinyxml27XMLNode14InsertEndChildEPS0_ \ _ZN8tinyxml27XMLNode16InsertFirstChildEPS0_ \ _ZN8tinyxml27XMLNode11DeleteChildEPS0_ \ _ZNK8tinyxml27XMLNode9DeepCloneEPNS_11XMLDocumentE \ _ZN8tinyxml210XMLElement12SetAttributeEPKcS2_ \ _ZN8tinyxml210XMLElement15DeleteAttributeEPKc \ _ZNK8tinyxml210XMLElement7GetTextEv \ _ZN8tinyxml210XMLElement7SetTextEPKc \ _ZN8tinyxml210XMLPrinter11OpenElementEPKcb \ _ZN8tinyxml210XMLPrinter12CloseElementEb \ _ZN8tinyxml210XMLPrinter13PushAttributeEPKcS2_ \ _ZN8tinyxml27XMLUtil6ToBoolEPKcPb \ _ZN8tinyxml27XMLUtil7ToInt64EPKcPx; do check "libtinyxml2/sym-$s" grep -q "$s" "$flat" done # Vtables and typeinfo for the polymorphic XMLNode hierarchy and the visitor. # These records exist only because a C++ front end emitted them -- there is no # way for the C driver, which is what every other library in this image is built # with, to produce a _ZTV/_ZTI/_ZTS record. So this block, more than any other, # is what says the C++ arm of the toolchain is genuinely working on target. for s in _ZTVN8tinyxml211XMLDocumentE _ZTVN8tinyxml27XMLNodeE \ _ZTVN8tinyxml210XMLElementE _ZTVN8tinyxml27XMLTextE \ _ZTVN8tinyxml210XMLPrinterE; do check "libtinyxml2/vtable-${s#_ZTVN8tinyxml2}" grep -q "$s" "$flat" done for s in _ZTIN8tinyxml211XMLDocumentE _ZTIN8tinyxml210XMLElementE \ _ZTIN8tinyxml27XMLTextE _ZTIN8tinyxml210XMLPrinterE; do check "libtinyxml2/typeinfo-${s#_ZTIN8tinyxml2}" grep -q "$s" "$flat" done for s in _ZTSN8tinyxml211XMLDocumentE _ZTSN8tinyxml210XMLElementE \ _ZTSN8tinyxml27XMLNodeE; do check "libtinyxml2/typename-${s#_ZTSN8tinyxml2}" grep -q "$s" "$flat" done # No shared object and no libtool archive. tinyxml2's meson build asks for BOTH # a shared and a static library by default, and meson never reads the distro's # blanket --disable-shared (that is an autoconf flag), so a stray # libtinyxml2.so here would mean the port's explicit static-only override was # lost rather than merely that a default drifted. check libtinyxml2/no-shared sh -c 'set -- /usr/lib/libtinyxml2.so*; [ ! -e "$1" ]' check libtinyxml2/no-libtool sh -c 'set -- /usr/lib/libtinyxml2.la; [ ! -e "$1" ]' rm -f "$flat"