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

209.2. sdl2-compat-2.32.72

The SDL2 library, headers and build files, answering every SDL2 call through SDL3

Version 2.32.72, release 1
Shelf game-libs — Game engines and game-development libraries, SDL in all versions, and shared game libraries
Phase 42_graphics (Graphics Stack), 47 of 189 in build order
Licence Zlib
Homepage https://libsdl.org
Build time 0.3 SBU
Installed size 3.3 MiB in 111 files
Recipe ports/core/game-libs/sdl2-compat/kpkgbuild

About

sdl2-compat is the SDL 2 library, libSDL2-2.0.so.0, with SDL 2’s headers, SDL2Config.cmake for find_package(SDL2) and sdl2-compat.pc, whose Provides: sdl2 is how pkgconf answers a lookup for sdl2. It is built as a thin layer that answers every SDL 2 call through sdl3. It loads libSDL3.so.0 at run time, so an SDL 2 program gets SDL 3’s drivers: the Wayland video driver, PipeWire audio and the controller support. It is the SDL 2 every SDL 2 port in KDOS links, and the base of the SDL 2 satellites (sdl2-image, sdl2-ttf, sdl2-mixer) and of sdl12-compat, which serves SDL 1.2 programs through it.

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, sdl3.

Required by (66): baresip, brogue-ce, cataclysm-dda, celestia, chocolate-doom, crawl-tiles, crispy-doom, darktable, ddnet, devilutionx, dosbox-staging, dosbox-x, dsda-doom, endless-sky, fheroes2, flare-engine, freeciv, ft2-clone, furnace, fuse-emulator, grafx2, hatari, ioquake3, ironwail, krita, lagrange, love, mednafen, mgba, milkytracker, mlt, movit, mupen64plus, neverball, openmsx, openrct2, openttd, pioneer, plasma-desktop, powder-toy, ppsspp, pt2-clone, python3-kivy, qemu, retroarch, sauerbraten, scummvm, sdl12-compat, sdl2-gfx, sdl2-image, sdl2-mixer, sdl2-net, sdl2-pango, sdl2-ttf, srb2, stella, supertux, supertuxkart, tuxpaint, vice, wesnoth, whisper.cpp, widelands, wine, wxwidgets, xonotic.

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 sdl2-compat'

What kpkg does

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

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/sdl2-compat
echo 'a14d2f78dad8e83ef1039b6534ace4d14f11f5b11d023af989affd70ac1bb35e  sdl2-compat-2.32.72.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/sdl2-compat
SRC=$SRC_ROOT/sdl2-compat-2.32.72
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf sdl2-compat-2.32.72.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:

mkdir -p build && cd build
cmake .. -G Ninja \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DSDL2COMPAT_TESTS=OFF \
	-DSDL2COMPAT_STATIC=OFF \
	-DSDL2COMPAT_X11=OFF
ninja
DESTDIR=$PKG ninja install

rm -f "$PKG/usr/bin/sdl2-config"

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/sdl2-compat, 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 sdl2-compat-2.32.72-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/sdl2-compat, and runs the triggers its paths call for.

Contents

Installed libraries: libSDL2-2.0.so, libSDL2.so, libSDL2_test.a, libSDL2main.a.

Installed directories: /usr/lib/cmake/SDL2, /usr/share/licenses/sdl2-compat.

Short descriptions

sdl2-compat.pc An SDL2 compatibility layer that uses SDL3 behind the scenes.

Notes

build.sh deletes /usr/bin/sdl2-config. With no sdl2-config, a consumer that pkg-config cannot answer fails at configure instead of taking the prefix the script hardcodes. A port whose build runs sdl2-config itself gives it a shim script that runs pkg-config sdl2 (grafx2 and stella do), or passes the flags from pkgconf as make variables (neverball).