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

251.1. libcanberra-0.30

XDG sound theme event sounds over ALSA, PulseAudio and GStreamer, with the GTK 3 module

Version 0.30, release 1
Shelf xdg — freedesktop desktop integration: portals, MIME, desktop entries, AppStream, tray and indicators, notifications, event sounds, script dialogs
Phase 43_toolkits (Toolkits), 37 of 344 in build order
Licence LGPL-2.1-or-later
Homepage https://0pointer.de/lennart/projects/libcanberra/
Build time 0.2 SBU
Installed size 357.7 KiB in 22 files
Recipe ports/core/xdg/libcanberra/kpkgbuild

About

libcanberra plays event sounds by name from the XDG sound theme specification: an application asks for message-new-instant or bell-window-system, and libcanberra finds the file in the installed theme, here sound-theme-freedesktop, and plays it. The port installs the library, libcanberra-gtk3 and the GTK 3 module that plays feedback sounds for widgets, and canberra-gtk-play. Ports that use it include KDE’s KNotifications framework, KWin, the Plasma workspace and its volume applet, Dino, Brasero and GNOME Disks.

Sources

Dependencies

Depends on: pkgconf, libtool, alsa-lib, libpulse, gstreamer, libvorbis, libogg, gtk3, libX11, eudev, tdb, sound-theme-freedesktop.

Required by (11): aisleriot, brasero, dino, gnome-disk-utility, kmix, knotifications, kwin, plasma-desktop, plasma-pa, plasma-workspace, rawtherapee.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

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/43_toolkits/phase.env && kpkg install libcanberra'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/xdg/libcanberra.

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/xdg/libcanberra
echo 'c2b671e67e0c288a69fc33dc1b6f1b534d07882c2aceed37004bf48c601afa72  libcanberra-0.30.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/libcanberra
SRC=$SRC_ROOT/libcanberra-0.30
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libcanberra-0.30.tar.xz -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/dont-assume-all-GdkDisplays-are-GdkX11Displays.patch"

./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --disable-static \
	--enable-alsa --enable-pulse --enable-gstreamer --enable-null \
	--enable-udev --disable-oss --enable-tdb \
	--enable-gtk3 --disable-gtk \
	--with-systemdsystemunitdir=no --disable-lynx --disable-gtk-doc
make
make -j1 DESTDIR=$PKG install

rm -rf "$PKG/usr/share/gtk-doc"
rm -rf "$PKG/usr/share/gdm" "$PKG/usr/share/gnome" \
	"$PKG/usr/lib/gnome-settings-daemon-3.0" "$PKG/usr/bin/canberra-boot"
readelf -d "$PKG/usr/lib/libcanberra.so" | grep -q "NEEDED.*libtdb"

install -Dm644 "$SRC/LGPL" "$PKG/usr/share/licenses/$name/LGPL"

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

Contents

Installed programs: canberra-gtk-play.

Installed libraries: libcanberra-gtk3.so, libcanberra.so.

Installed directories: /usr/lib/libcanberra-0.30, /usr/share/doc/libcanberra, /usr/share/licenses/libcanberra.

Short descriptions

libcanberra.pc Event Sound API
libcanberra-gtk3.pc Gtk3 Event Sound API

Notes

dont-assume-all-GdkDisplays-are-GdkX11Displays.patch is upstream’s commit c0620e43, made after the 0.30 release and never released in a tarball. The GTK 3 module and libcanberra-gtk3 read window properties through Xlib; the patch returns early on a display that is not an X11 one, so a GTK 3 application on Wayland plays its sounds instead of crashing in Xlib.

make install runs with -j1: libtool relinks each backend module against the library as it installs it, and a parallel install can relink a module before the library is in place.

The gtk-doc HTML reference ships prebuilt in the tarball and installs whatever --disable-gtk-doc says, so build.sh removes it. It also removes the GNOME session autostart and shutdown files, the GDM autostart file and the gnome-settings-daemon-3.0 entry that asks that daemon to load the GTK module, which name programs KDOS does not have.