319.2. cmus-2.12.0
Console music player with a library view
| Version | 2.12.0, release 1 |
| Shelf | music-players — Music players, library managers and taggers |
| Phase | 44_apps (Applications), 300 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://cmus.github.io/ |
| Build time | 0.5 SBU |
| Installed size | 920.7 KiB in 38 files |
| Recipe | ports/core/music-players/cmus/kpkgbuild |
About
cmus is a music player for the terminal, with a library view, playlists and a play queue, driven entirely from the keyboard. It decodes through one input plugin per format and plays through one output plugin, all chosen when it is configured.
Sources
cmus-2.12.0.tar.gz(340.5 KiB)
sha25644b96cd5f84b0d84c33097c48454232d5e6a19cd33b9b6503ba9c13b6686bfc7
upstream: https://github.com/cmus/cmus/archive/refs/tags/v2.12.0.tar.gz
archive copy: sources-3/music-players--cmus-2.12.0.tar.gz
Dependencies
Depends on: ncurses, alsa-lib, flac, libvorbis, opusfile, libmad, faad2, wavpack, libmikmod, basu, ffmpeg, libcdio, libcdio-paranoia.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
ffmpeg8.patch— inip/ffmpeg.c, callavcodec_close()only on a libavcodec older than 57.48.101 and otherwise rely onavcodec_free_context(), which closes the context itself.avcodec_close()is gone from libavcodec since FFmpeg 8, and cmus calls it unconditionally, so the ffmpeg input plugin would not build against the tree’s ffmpeg, version 9.mpris-basu.patch— Build the MPRIS module against basu whichever sd-bus libraries exist
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/44_apps/phase.env && kpkg install cmus'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/music-players/cmus.
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/cmus
echo '44b96cd5f84b0d84c33097c48454232d5e6a19cd33b9b6503ba9c13b6686bfc7 cmus-2.12.0.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/cmus
SRC=$SRC_ROOT/cmus-2.12.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf cmus-2.12.0.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/ffmpeg8.patch"
patch -p1 -i "$PORT_SRC/mpris-basu.patch"
./configure \
prefix=/usr \
mandir=/usr/share/man \
docdir=/usr/share/doc/cmus \
CONFIG_ALSA=y \
CONFIG_FLAC=y \
CONFIG_VORBIS=y \
CONFIG_OPUS=y \
CONFIG_MAD=y \
CONFIG_WAV=y \
CONFIG_CUE=y \
CONFIG_AAC=y \
CONFIG_WAVPACK=y \
CONFIG_MIKMOD=y \
CONFIG_MPRIS=y \
CONFIG_FFMPEG=y \
CONFIG_CDIO=y \
CONFIG_PULSE=n CONFIG_JACK=n CONFIG_AO=n CONFIG_ARTS=n CONFIG_ROAR=n \
CONFIG_SNDIO=n CONFIG_SUN=n CONFIG_OSS=n CONFIG_COREAUDIO=n \
CONFIG_AAUDIO=n CONFIG_WAVEOUT=n CONFIG_SAMPLERATE=n \
CONFIG_MP4=n CONFIG_MPC=n CONFIG_MODPLUG=n \
CONFIG_BASS=n CONFIG_VTX=n CONFIG_TREMOR=n \
CONFIG_CDDB=n CONFIG_DISCID=n
make
make DESTDIR=$PKG install
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/cmus.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Music (cmus)
GenericName=Music Player
Comment=Browse and play a music library
Exec=cmus
Icon=folder-music
Terminal=true
Categories=AudioVideo;Player;
Keywords=music;audio;player;library;playlist;cmus;
DESKTOP
chmod 644 "$PKG/usr/share/applications/cmus.desktop"
The switches, and why each is set:
cmus’s configure takes CONFIG_<NAME>=y or =n for every plugin. Most of them default to auto, built whenever the library happens to be found; with y, a library that is not found stops the configure. The recipe names every one, so a missing codec port stops the build instead of leaving that format out.
CONFIG_ALSA=y— the one output plugin. Sound on KDOS reaches PipeWire through ALSA’s default device, so the ALSA plugin is the whole route.CONFIG_FLAC=y— withCONFIG_,VORBIS CONFIG_,OPUS CONFIG_,MAD CONFIG_,WAV CONFIG_,CUE CONFIG_,AAC CONFIG_andWAVPACK CONFIG_: the dedicated input plugins, on flac, libvorbis, opusfile, libmad for MP3, faad2 for raw ADTS AAC, wavpack and libmikmod for tracker modules, plus WAV files and cue sheets.MIKMOD CONFIG_FFMPEG=y— the catch-all input through ffmpeg. It plays what no dedicated plugin does, such as.m4a(AAC or ALAC in an MP4 container),.wma,.apeand.shn. cmus ranks its dedicated plugins above it, so MP3 still goes through libmad. Seeffmpeg8.patch.CONFIG_MPRIS=y— publish the player on the session bus over MPRIS, for media keys and the panel, through basu. configure prefers libelogind to basu, and the tree has both;mpris-basu.patchmakes it take basu, the one sd-bus library on KDOS.CONFIG_CDIO=y— play audio CDs, read throughlibcdio_cddafrom libcdio-paranoia, on libcdio.CONFIG_PULSE=n— no PulseAudio output. cmus ranks it above ALSA, so building it would send every cmus stream to PipeWire’s PulseAudio service instead, a second route to the same server.CONFIG_JACK=n— withCONFIG_,AO CONFIG_,ARTS CONFIG_,ROAR CONFIG_,SNDIO CONFIG_,SUN CONFIG_,OSS CONFIG_,COREAUDIO CONFIG_andAAUDIO CONFIG_set toWAVEOUT n: the other output plugins, andCONFIG_SAMPLERATE=nleaves out the libsamplerate resampling that only the JACK output uses.CONFIG_MP4=n— no second.m4areader: it needs mp4v2, which is not a port, and ffmpeg reads the container.CONFIG_MPC=n— withCONFIG_,MODPLUG CONFIG_,BASS CONFIG_andVTX CONFIG_set toTREMOR n: the remaining input plugins, for Musepack, libmodplug’s modules, BASS, VTX chiptunes and the integer Vorbis decoder.CONFIG_CDDB=n— no CDDB lookup of a disc’s track names. It needs libcddb, which is not a port, so an audio CD lists as numbered tracks.CONFIG_DISCID=nleaves out the disc identification through libdiscid as well.
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/cmus, 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 cmus-2.12.0-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/cmus, and runs the triggers its paths call for.
Contents
Installed programs: cmus, cmus-remote.
Installed directories: /usr/lib/cmus, /usr/share/cmus, /usr/share/doc/cmus, /usr/share/licenses/cmus.
Short descriptions
cmus |
C* Music Player |
cmus-remote |
control cmus |
Notes
The desktop entry is KDOS’s own, with Terminal=true; upstream ships none.