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

137.17. libmusicbrainz5-5.1.0

MusicBrainz client library — disc IDs to artist, album and track metadata

Version 5.1.0, release 1
Shelf music-libs — Music-format libraries: tracker modules, chip emulation, MIDI, OSC, synthesis and soundfonts
Phase 41_system (System), 779 of 1047 in build order
Licence LGPL-2.1-or-later
Homepage https://musicbrainz.org/doc/libmusicbrainz
Build time 1.8 SBU
Installed size 1.2 MiB in 73 files
Recipe ports/core/music-libs/libmusicbrainz5/kpkgbuild

About

libmusicbrainz5 is the client library for the MusicBrainz web service: given a disc ID or a search, it returns the artist, release and track metadata the MusicBrainz database holds. It talks HTTP through neon and parses the replies with libxml2. libkcddb, KDE’s CD database library, uses it, and through libkcddb k3b, audex and the audiocd:/ KIO worker of audiocd-kio look up an audio CD’s track names.

Sources

Dependencies

Depends on: cmake, ninja, neon, libxml2.

Required by (1): libkcddb.

Patches

build.sh applies these; kpkg applies nothing by itself.

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

What kpkg does

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

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-libs/libmusicbrainz5
echo '6749259e89bbb273f3f5ad7acdffb7c47a2cf8fcaeab4c4695484cef5f4c6b46  libmusicbrainz5-5.1.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/libmusicbrainz5
SRC=$SRC_ROOT/libmusicbrainz5-5.1.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libmusicbrainz5-5.1.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/custom-command-inc-depends.patch"
patch -p1 -i "$PORT_SRC/libxml2-const-error.patch"
cmake -S . -B build -G Ninja \
	-D CMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-D CMAKE_BUILD_TYPE=Release \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D BUILD_SHARED_LIBS=ON
cmake --build build
DESTDIR=$PKG cmake --install build
test -e "$PKG/usr/lib/libmusicbrainz5.so.1"
test -f "$PKG/usr/lib/pkgconfig/libmusicbrainz5.pc"
test -f "$PKG/usr/include/musicbrainz5/mb5_c.h"

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

Contents

Installed libraries: libmusicbrainz5.so.

Installed directories: /usr/include/musicbrainz5, /usr/share/licenses/libmusicbrainz5.

Short descriptions

libmusicbrainz5.pc The Musicbrainz Client Library.

Notes

src/xmlParser.cc is compiled twice: into the library and into make-c-interface, the helper program the build runs to generate the C interface from cinterface.xml. Both patches are needed before the library itself is reached. build.sh checks that libmusicbrainz5.so.1, libmusicbrainz5.pc and the generated mb5_c.h were installed.