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

87.22. rttr-0.9.6

Run-time type reflection library for C++

Version 0.9.6, release 1
Shelf devlibs — General-purpose C and C++ utility libraries with no domain
Phase 41_system (System), 359 of 1047 in build order
Licence MIT
Homepage https://www.rttr.org/
Build time 4.0 SBU
Installed size 2.4 MiB in 137 files
Recipe ports/core/devlibs/rttr/kpkgbuild

About

RTTR is a run-time reflection library for C++: a program registers its classes, their properties, methods and constructors with RTTR_REGISTRATION, and can then look them up by name, read and write properties and invoke methods on objects it knows only as a rttr::variant. The port installs the shared librttr_core, its headers under /usr/include/rttr, and the CMake package files under /usr/share/rttr/cmake, so that a program can find it with find_package(rttr) as the imported target RTTR::Core. No port in the tree depends on it.

Sources

Dependencies

Depends on: cmake, ninja.

Required by: no port names it.

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 rttr'

What kpkg does

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

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/devlibs/rttr
echo '058554f8644450185fd881a6598f9dee7ef85785cbc2bb5a5526a43225aa313f  rttr-0.9.6.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/rttr
SRC=$SRC_ROOT/rttr-0.9.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf rttr-0.9.6.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/permission.patch"
mkdir build && cd build
cmake .. -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DBUILD_RTTR_DYNAMIC=ON \
	-DBUILD_STATIC=OFF \
	-DBUILD_WITH_STATIC_RUNTIME_LIBS=OFF \
	-DBUILD_UNIT_TESTS=OFF \
	-DBUILD_BENCHMARKS=OFF \
	-DBUILD_EXAMPLES=OFF \
	-DBUILD_DOCUMENTATION=OFF \
	-DBUILD_INSTALLER=ON \
	-DBUILD_PACKAGE=OFF
ninja
DESTDIR=$PKG ninja install
find "$PKG/usr/share/rttr" -maxdepth 1 -type f -exec chmod 644 {} +

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/rttr, 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 rttr-0.9.6-1.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/rttr, and runs the triggers its paths call for.

Contents

Installed libraries: librttr_core.so.

Installed directories: /usr/include/rttr, /usr/share/licenses/rttr, /usr/share/rttr.

Notes

The header patch does not cover the licence and README, which CMake/config.cmake installs into /usr/share/rttr with PERMISSIONS OWNER_READ as well. The find … -exec chmod 644 line at the end of build.sh gives the plain files there, and only there (-maxdepth 1), mode 644 instead.