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
rttr-0.9.6.tar.gz(1.1 MiB)
sha256058554f8644450185fd881a6598f9dee7ef85785cbc2bb5a5526a43225aa313f
upstream: https://github.com/rttrorg/rttr/archive/refs/tags/v0.9.6.tar.gz
archive copy: sources-1/devlibs--rttr-0.9.6.tar.gz
Dependencies
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
permission.patch— DropsPERMISSIONS OWNER_READfrom theinstall(FILES …)rule for the public headers inCMake/utility.cmake, so the headers are installed with CMake’s default mode, readable by everyone, instead of readable by their owner alone.
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:
-DBUILD_RTTR_DYNAMIC=ON,-DBUILD_STATIC=OFF— Build the shared library,librttr_core.so, and not the staticlibrttr_core.abeside it.-DBUILD_WITH_STATIC_RUNTIME_LIBS=OFF— When on, upstream builds a further variant of the library,rttr_core_s, linked against the C++ runtime statically. Off, the library uses the sharedlibstdc++like every other C++ library on the system.-DBUILD_UNIT_TESTS=OFF,-DBUILD_BENCHMARKS=OFF,-DBUILD_EXAMPLES=OFF— Upstream builds the unit tests and the examples by default. Nothing here runs or installs them.-DBUILD_DOCUMENTATION=OFF— On by default, it adds thedocdirectory, which generates the API reference with doxygen.-DBUILD_INSTALLER=ON— Everyinstall()rule for the library sits behind this switch: the libraries, the headers, the exportedrttr-config.cmakeand the licence and README. Without it,ninja installinstalls nothing.-DBUILD_PACKAGE=OFF— On by default, it includesCMake/installer.cmake, which sets up CPack to make.tar.gzand.tar.bz2archives of the build. kpkg makes the package, so CPack has nothing to do.
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.