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

209.1. sdl3-3.4.16

Simple DirectMedia Layer 3 — windows, audio and input; SDL2 programs reach it through sdl2-compat

Version 3.4.16, release 1
Shelf game-libs — Game engines and game-development libraries, SDL in all versions, and shared game libraries
Phase 42_graphics (Graphics Stack), 46 of 189 in build order
Licence Zlib
Homepage https://libsdl.org
Build time 1.9 SBU
Installed size 11.5 MiB in 2288 files
Recipe ports/core/game-libs/sdl3/kpkgbuild

About

SDL 3 is the Simple DirectMedia Layer: one C library that opens a window, draws into it through OpenGL, OpenGL ES or Vulkan, plays and records sound, and reads keyboards, mice, game controllers and touch. In KDOS it is the SDL that carries the drivers. SDL 2 programs, among them baresip’s video display and whisper.cpp’s streaming transcription, link sdl2-compat, which answers every SDL 2 call through this library at run time.

The build keeps one video driver, Wayland, and the four audio APIs a KDOS session can answer: ALSA, PipeWire, PulseAudio and JACK, the last three all served by pipewire.

Why it is in KDOS

The comment above sdl3 and sdl2-compat in script/phases/42_graphics/packages.d/game-libs.txt:

SDL3 carries the drivers; sdl2-compat is the SDL2 library baresip's video display and whisper.cpp's streaming transcription link, answering through SDL3 at run time. Without them a call cannot show the other person and transcription is batch over a closed file. Built with no X11 and no KMSDRM — a graphical program here runs under a compositor.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, perl, wayland, wayland-protocols, libxkbcommon, libdecor, libdrm, mesa, alsa-lib, pipewire, dbus, eudev, libpulse, libusb, liburing.

Required by (13): amiberry, freerdp, koreader, lite-xl, luanti, multimon-ng, schismtracker, sdl2-compat, sdl3-image, sdl3-mixer, sdl3-ttf, warzone2100, yamagi-quake2.

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/42_graphics/phase.env && kpkg install sdl3'

What kpkg does

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

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/game-libs/sdl3
echo '7322236cd12090c3eb40b9728be4d49c76f66ad17d04369584d4ecad5cf77c68  sdl3-3.4.16.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/sdl3
SRC=$SRC_ROOT/sdl3-3.4.16
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf sdl3-3.4.16.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 recipe’s helpers devseries and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

mkdir -p build && cd build
cmake .. -G Ninja \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DSDL_SHARED=ON \
	-DSDL_STATIC=OFF \
	-DSDL_TEST_LIBRARY=OFF \
	-DSDL_TESTS=OFF \
	-DSDL_EXAMPLES=OFF \
	-DSDL_RPATH=OFF \
	-DSDL_X11=OFF \
	-DSDL_KMSDRM=OFF \
	-DSDL_WAYLAND=ON \
	-DSDL_WAYLAND_LIBDECOR=ON \
	-DSDL_ALSA=ON \
	-DSDL_PIPEWIRE=ON \
	-DSDL_PULSEAUDIO=ON \
	-DSDL_JACK=ON \
	-DSDL_SNDIO=OFF \
	-DSDL_OSS=OFF \
	-DSDL_DBUS=ON \
	-DSDL_IBUS=OFF \
	-DSDL_LIBUDEV=ON \
	-DSDL_HIDAPI_LIBUSB=ON \
	-DSDL_LIBURING=ON \
	-DSDL_OPENGL=ON \
	-DSDL_OPENGLES=ON \
	-DSDL_VULKAN=ON \
	-DSDL_INSTALL_DOCS=ON
ninja
DESTDIR=$PKG ninja install

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

Contents

Installed libraries: libSDL3.so.

Installed directories: /usr/include/SDL3, /usr/lib/cmake/SDL3, /usr/share/licenses/SDL3, /usr/share/licenses/sdl3.

Short descriptions

sdl3.pc Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.

Notes

SDL loads most of what it can use with dlopen at run time, by soname, rather than linking it: upstream’s SDL_DEPS_SHARED is left on, so ALSA, PipeWire, PulseAudio, JACK, Wayland, libdecor and libusb are each looked up when SDL initialises the driver that uses it. The libraries must be present when the port builds, for their headers and for the probes, and each is in depends for that; a library missing at run time removes only the driver or feature built on it.

SDL_Init(SDL_INIT_AUDIO) opens no window and needs no video device, so a program that uses SDL for sound alone, such as whisper.cpp’s streaming transcription, runs in a terminal with no compositor above it.

SDL 2 programs reach this library through sdl2-compat, and the two are built to match: SDL2COMPAT_X11 stays off for as long as this port is built with -DSDL_X11=OFF.