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

138.1. termusic-0.13.2

A terminal music player drawn in ratatui, with its own playback daemon

Version 0.13.2, release 1
Shelf music-players — Music players, library managers and taggers
Phase 41_system (System), 780 of 1047 in build order
Licence MIT AND GPL-3.0-or-later
Homepage https://github.com/tramhao/termusic
Build time 7.6 SBU
Installed size 39.2 MiB in 5 files
Recipe ports/core/music-players/termusic/kpkgbuild

About

termusic is a music player for the terminal, drawn with ratatui. It is two programs: the daemon, termusic-server, owns the audio device and the playback queue, and termusic, the interface, talks to it over gRPC. Shipping only the interface would give a player that starts and cannot play. It keeps its own library database and knows nothing about mpd, so the two stacks do not meet. The recipe writes a terminal desktop entry for it, named Termusic, the project’s name, so that Start and Discover tell it apart from the other music players by name.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/music-players.txt:

A whole player rather than a client — termusic drives a playback daemon of its own over gRPC and knows nothing about mpd, so the two stacks do not meet. ratatui rather than ncurses.

Sources

Dependencies

Depends on: rust, alsa-lib, pkgconf, protobuf, opus, clang, sqlite.

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

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/music-players/termusic.

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/music-players/termusic
echo '661e1c39135f6eeb01cb6df199b8dcdd902ac456e96bd204ea4fda7ec6ae41ef  termusic-0.13.2.tar.gz' | sha256sum -c -
echo '7d800a19f4b68cfa8265e6b686eba85d2958958fb47c01dbf402f8330e446f8d  termusic-vendor-0.13.2.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/termusic
SRC=$SRC_ROOT/termusic-0.13.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf termusic-0.13.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 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
export CARGO_HOME="$SRC_ROOT/.cargo"
export RUSTFLAGS="-C target-feature=-crt-static"
export CARGO_NET_OFFLINE=true
export LIBCLANG_PATH=/usr/lib

cargo build --release --frozen --offline \
	--features termusic-server/rusty-libopus,termusic-server/rusty-soundtouch,termusic-server/rusty-simd,termusic/cover-viuer-sixel
readelf -d target/release/termusic | grep -q 'NEEDED.*\[libsqlite3\.so\.0\]'
readelf -d target/release/termusic-server | grep -q 'NEEDED.*\[libsqlite3\.so\.0\]'

install -Dm755 target/release/termusic        $PKG/usr/bin/termusic
install -Dm755 target/release/termusic-server $PKG/usr/bin/termusic-server

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/termusic.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Termusic
GenericName=Music Player
Comment=Play a music library
Exec=termusic
Icon=folder-music
Terminal=true
Categories=AudioVideo;Player;
Keywords=music;audio;player;library;termusic;
EOF
chmod 644 "$PKG/usr/share/applications/termusic.desktop"

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/termusic, 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 termusic-0.13.2-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/termusic, and runs the triggers its paths call for.

Contents

Installed programs: termusic, termusic-server.

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

Notes

The crates come from the vendor bundle, termusic-vendor-<version>.tar.xz, pinned with its own sha256 = line and unpacked at the top of the tree; cargo builds --frozen --offline from it (see Vendoring).

The workspace asks for rusqlite’s bundled SQLite. The chroot exports LIBSQLITE3_SYS_USE_PKG_CONFIG=1, which makes libsqlite3-sys link the system library anyway (see rust), and build.sh checks with readelf that both binaries NEED libsqlite3.so.0, so a build that fell back to the bundled copy stops instead of shipping it.

Its network code uses rustls with the default AWS-LC provider, compiled in by aws-lc-sys; the copy is listed in /usr/share/kdos/bundled.txt for kdos cve, see Bundled copies.