135.28. gsm-1.0.24
GSM 06.10 lossy speech codec — libgsm and the toast, untoast and tcat tools
| Version | 1.0.24, release 1 |
| Shelf | audio-codecs — Audio codecs, containers and tagging, including the Bluetooth audio codecs |
| Phase | 41_system (System), 134 of 1047 in build order |
| Licence | TU-Berlin-2.0 |
| Homepage | https://www.quut.com/gsm/ |
| Build time | 0.1 SBU |
| Installed size | 157.6 KiB in 16 files |
| Recipe | ports/core/audio-codecs/gsm/kpkgbuild |
About
libgsm is the TU Berlin implementation of the GSM 06.10 full-rate speech codec, with toast, the command that compresses a sound file with it (untoast and tcat are the same program under other names). In KDOS, sox reads and writes GSM audio through it, finding the header at <gsm/gsm.h>, and gnuradio links it for its vocoder blocks.
Sources
gsm-1.0.24.tar.gz(65.0 KiB)
sha256a3c40c6471928383f4abfcb2e8f24012a1f562be2f17b8d672145d5986681a92
upstream: https://www.quut.com/gsm/gsm-1.0.24.tar.gz
archive copy: sources-1/audio-codecs--gsm-1.0.24.tar.gz
Dependencies
Depends on: nothing a recipe names.
Required by (2): gnuradio, sox.
Patches
build.sh applies these; kpkg applies nothing by itself.
gsm-64bit.patch— Declareslongwordandulongwordininc/private.hasintandunsigned intinstead oflong, so on a 64-bit target they are the 32-bit integers the header’s comments name, not 64-bit ones.
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 gsm'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/audio-codecs/gsm.
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/audio-codecs/gsm
echo 'a3c40c6471928383f4abfcb2e8f24012a1f562be2f17b8d672145d5986681a92 gsm-1.0.24.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/gsm
SRC=$SRC_ROOT/gsm-1.0.24
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gsm-1.0.24.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/gsm-64bit.patch"
_ccflags="-c $CFLAGS -fPIC -DNeedFunctionPrototypes=1 -Wall -Wno-comment"
make CC=gcc CCFLAGS="$_ccflags" all
gcc -shared $LDFLAGS -Wl,-soname,libgsm.so.1 -o lib/libgsm.so.$version \
-Wl,--whole-archive lib/libgsm.a -Wl,--no-whole-archive
install -Dm755 bin/toast "$PKG/usr/bin/toast"
ln -s toast "$PKG/usr/bin/untoast"
ln -s toast "$PKG/usr/bin/tcat"
install -Dm755 lib/libgsm.so.$version "$PKG/usr/lib/libgsm.so.$version"
ln -s libgsm.so.$version "$PKG/usr/lib/libgsm.so.1"
ln -s libgsm.so.$version "$PKG/usr/lib/libgsm.so"
install -Dm644 inc/gsm.h "$PKG/usr/include/gsm/gsm.h"
ln -s gsm/gsm.h "$PKG/usr/include/gsm.h"
install -Dm644 -t "$PKG/usr/share/man/man1" man/toast.1
install -Dm644 -t "$PKG/usr/share/man/man3" man/gsm.3 man/gsm_explode.3 \
man/gsm_option.3 man/gsm_print.3
ln -s toast.1 "$PKG/usr/share/man/man1/untoast.1"
ln -s toast.1 "$PKG/usr/share/man/man1/tcat.1"
test -x "$PKG/usr/bin/toast"
The switches, and why each is set:
CC=gcc— Replaces upstream’sCC = gcc -ansi -pedantic, whose-ansiwould contradict the-std=gnu11in the tree’sCFLAGS.CCFLAGS="$_ccflags"— Upstream’s makefile builds its ownCFLAGSout of several variables, and that assignment beats the environment’s, so the tree’s flags go in throughCCFLAGS, which upstream sets to-c -O2 -DNeedFunctionPrototypes=1 -Wall -Wno-comment. The value here keeps-c, the prototypes and the warnings, takes the optimisation and hardening from the tree’s release flags, and names-fPICagain, though the tree’s flags carry it already: the objects inlibgsm.amust be position-independent to be linked into the shared library below.
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/gsm, 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 gsm-1.0.24-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/gsm, and runs the triggers its paths call for.
Contents
Installed programs: tcat, toast, untoast.
Installed libraries: libgsm.so.
Installed directories: /usr/include/gsm, /usr/share/licenses/gsm.
Short descriptions
toast |
GSM 06.10 lossy sound compression |
Notes
- Upstream builds only a static library.
build.shmakes the shared one itself, linking the whole oflib/libgsm.aintolibgsm.so.<version>with the sonamelibgsm.so.1, and installs everything by hand: upstream’sinstalltarget writes intoINSTALL_ROOTwith paths of its own and installs no shared library. - The header is in two places.
gsm.hgoes to/usr/include/gsm/gsm.h, wheresox’sconfigurelooks first, with a link at/usr/include/gsm.hfor code that includes it bare. - The makefile’s own
-DSASR(>>is an arithmetic shift) and-DWAV49(theGSM_OPT_WAV49framing for GSM in WAVE files) are kept, because they are separate variables the build leaves alone.