Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

88.26. tinyxml-2.6.2

Small C++ XML parser (TinyXML 1)

Version 2.6.2, release 2
Shelf formats — Data-format and serialisation libraries (XML, JSON, YAML, TOML, INI, RDF, protobuf, thrift), plus data query and convert tools
Phase 41_system (System), 556 of 1047 in build order
Licence Zlib
Homepage https://sourceforge.net/projects/tinyxml/
Build time 0.1 SBU
Installed size 232.4 KiB in 7 files
Recipe ports/core/formats/tinyxml/kpkgbuild

About

TinyXML is a small C++ XML parser that reads a document into a tree of objects and writes one back out. This is TinyXML 1, the original library, not its successor tinyxml2, which has a different API. KDOS carries it for the two programs that link it, kodi and opencpn.

Upstream ships no way to build the library: its Makefile builds only the xmltest program, with the four library sources compiled into it. build.sh therefore compiles the four sources itself, links them into libtinyxml.so.0, installs the two headers and writes a tinyxml.pc for pkg-config; the release has neither a library target nor a .pc file.

Sources

Dependencies

Depends on: nothing a recipe names.

Required by (2): kodi, opencpn.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install tinyxml'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/formats/tinyxml.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/formats/tinyxml
echo '15bdfdcec58a7da30adc87ac2b078e4417dbe5392f3afb719f9ba6d062645593  tinyxml-2.6.2.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/tinyxml
SRC=$SRC_ROOT/tinyxml-2.6.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf tinyxml-2.6.2.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers _ver and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

for p in define-stl entity CVE-2021-42260 CVE-2023-34194; do
	patch -p1 -i "$PORT_SRC/$p.patch"
done

for f in tinyxml tinystr tinyxmlerror tinyxmlparser; do
	$CXX $CXXFLAGS -fPIC -DTIXML_USE_STL -c "$f.cpp" -o "$f.o"
done
$CXX $CXXFLAGS $LDFLAGS -shared -Wl,-soname,libtinyxml.so.0 \
	-o libtinyxml.so.0.$version \
	tinyxml.o tinystr.o tinyxmlerror.o tinyxmlparser.o

install -Dm755 libtinyxml.so.0.$version "$PKG/usr/lib/libtinyxml.so.0.$version"
ln -s libtinyxml.so.0.$version "$PKG/usr/lib/libtinyxml.so.0"
ln -s libtinyxml.so.0.$version "$PKG/usr/lib/libtinyxml.so"
install -Dm644 tinyxml.h "$PKG/usr/include/tinyxml.h"
install -Dm644 tinystr.h "$PKG/usr/include/tinystr.h"
install -d "$PKG/usr/share/licenses/$name"
head -n 23 tinyxml.h > "$PKG/usr/share/licenses/$name/LICENSE"

install -d "$PKG/usr/lib/pkgconfig"
cat > "$PKG/usr/lib/pkgconfig/tinyxml.pc" <<EOF
prefix=/usr
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib
includedir=\${prefix}/include

Name: TinyXML
Description: Small C++ XML parser
Version: $version
Libs: -L\${libdir} -ltinyxml
Cflags: -I\${includedir}
EOF

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/tinyxml, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf tinyxml-2.6.2-2.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/tinyxml, and runs the triggers its paths call for.

Contents

Installed libraries: libtinyxml.so.

Installed directories: /usr/share/licenses/tinyxml.

Short descriptions

tinyxml.pc Small C++ XML parser