151.3. presenterm-0.16.1
Slides from a markdown file, drawn in the terminal
| Version | 0.16.1, release 2 |
| Shelf | office — Office suites, word processors, spreadsheets, presentations, accounting and finance, and office-format import libraries |
| Phase | 41_system (System), 821 of 1047 in build order |
| Licence | BSD-2-Clause |
| Homepage | https://github.com/mfontanini/presenterm |
| Build time | 5.6 SBU |
| Installed size | 7.2 MiB in 3 files |
| Recipe | ports/core/office/presenterm/kpkgbuild |
About
presenterm presents a Markdown file as slides in the terminal, with syntax-highlighted code and pictures. It is built from its Rust vendor bundle and highlights code with the syntax and theme sets the bat port compiles. The package adds a desktop entry, “Slides”, which opens a file in a terminal. It is NoDisplay=true: presenterm given no file exits at once, so Start does not list it.
Why it is in KDOS
The comment above it in script/phases/41_system/packages.d/office.txt:
SLIDES FROM A MARKDOWN FILE, drawn in the terminal — the pictures go through the sixel and kitty protocols Konsole speaks.
Sources
presenterm-0.16.1.tar.gz(2.3 MiB)
sha256221258deae7204c65a55d3666aaea5fa157312b4196a59abc60ba4d363787c10
upstream: https://github.com/mfontanini/presenterm/archive/refs/tags/v0.16.1.tar.gz
archive copy: sources-3/office--presenterm-0.16.1.tar.gzpresenterm-vendor-0.16.1.tar.xz(21.4 MiB)
sha2561dc0b318549b9cabe23d4d96ce93fb33ca1c781744fd2660cbe8765776840a59
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-3/office--presenterm-vendor-0.16.1.tar.xz
Dependencies
Depends on: rust, bat, oniguruma.
Required by: no port names it.
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 presenterm'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/office/presenterm.
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/office/presenterm
echo '221258deae7204c65a55d3666aaea5fa157312b4196a59abc60ba4d363787c10 presenterm-0.16.1.tar.gz' | sha256sum -c -
echo '1dc0b318549b9cabe23d4d96ce93fb33ca1c781744fd2660cbe8765776840a59 presenterm-vendor-0.16.1.tar.xz' | 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/presenterm
SRC=$SRC_ROOT/presenterm-0.16.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf presenterm-0.16.1.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:
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
install -m644 /usr/share/bat/assets/syntaxes.bin /usr/share/bat/assets/themes.bin \
/usr/share/bat/assets/acknowledgements.txt bat/
export RUSTFLAGS="-C target-feature=-crt-static"
cargo build --release --frozen --offline
readelf -d target/release/presenterm | grep -q 'NEEDED.*\[libonig\.so\.5\]'
install -Dm755 target/release/presenterm $PKG/usr/bin/presenterm
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/presenterm.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Slides
GenericName=Presentation
Comment=Present a markdown file as slides
Exec=presenterm %f
Icon=x-office-presentation
Terminal=true
NoDisplay=true
Categories=Office;Presentation;
Keywords=slides;presentation;markdown;talk;presenterm;
EOF
chmod 644 "$PKG/usr/share/applications/presenterm.desktop"
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/presenterm, 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 presenterm-0.16.1-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/presenterm, and runs the triggers its paths call for.
Contents
Installed programs: presenterm.
Installed directories: /usr/share/licenses/presenterm.
Notes
presenterm embeds bat’s serialized syntax and theme sets, bat/syntaxes.bin and bat/themes.bin, with include_bytes!, and upstream ships them prebuilt from a bat checkout. build.sh copies the sets the bat port built from source, and its acknowledgements, from /usr/share/bat/assets over those files before cargo runs, so bat is in depends. The sets are bincode dumps of syntect’s types and carry no version tag: sets written by a bat that links another syntect major version abort presenterm at the first code block, so a bump of either port has to keep both Cargo.lock files on the same syntect. See A bundle no tool writes. presenterm’s own stock themes still come from the dump inside the vendored syntect crate; see Known gaps.
The readelf check after the build stops it unless the binary needs libonig.so.5: syntect’s regex-onig feature links oniguruma, and the check catches a build that compiled the crate’s bundled copy instead.