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

323.6. srb2-2.2.15

Sonic Robo Blast 2 — a 3D Sonic fan game on a heavily modified Doom Legacy engine, with its game data

Version 2.2.15, release 1
Shelf games-action — Action, arcade, racing, platform and sandbox games
Phase 44_apps (Applications), 141 of 422 in build order
Licence GPL-2.0-only
Homepage https://www.srb2.org
Build time 2.0 SBU
Installed size 185.2 MiB in 386 files
Recipe ports/core/games-action/srb2/kpkgbuild

About

Sonic Robo Blast 2 is a 3D Sonic the Hedgehog fan game, built on a heavily modified Doom Legacy engine, with single-player zones, multiplayer over the network and a large add-on community. The engine is free software; the game data is not part of the source tree, so the port takes it from upstream’s full Windows release archive, a second source, and installs the data files from it without its Windows program and libraries.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, unzip, sdl2-compat, sdl2-mixer, libglvnd, mesa, libpng, zlib, curl, libgme, miniupnpc, libopenmpt.

Required by: no port names it.

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/44_apps/phase.env && kpkg install srb2'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/games-action/srb2.

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/games-action/srb2
echo 'c2689074539bf23d81e8add5f2beeac1b69d5586d69d93d44f6f6b195076bbaf  srb2-2.2.15.tar.gz' | sha256sum -c -
echo '3eda3080ab87940fca5e4dcd22b8e041dc1d9e65bfe9177bff68383e9bd58a10  srb2-assets-2.2.15.zip' | 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/srb2
SRC=$SRC_ROOT/srb2-2.2.15
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf srb2-2.2.15.tar.gz -C "$SRC" --strip-components=1
cp srb2-assets-2.2.15.zip "$SRC"

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 build && cd build
cmake .. -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DSRB2_SDL2_EXE_NAME=srb2 \
	-DSRB2_CONFIG_SYSTEM_LIBRARIES=ON \
	-DSRB2_CONFIG_STATIC_STDLIB=OFF \
	-DSRB2_CONFIG_EXECINFO=OFF \
	-DSRB2_CONFIG_HWRENDER=ON \
	-DSRB2_CONFIG_STATIC_OPENGL=OFF \
	-DSRB2_CONFIG_USE_GME=ON \
	-DSRB2_CONFIG_ERRORMODE=OFF \
	-DSRB2_CONFIG_DEV_BUILD=OFF \
	-DCMAKE_REQUIRE_FIND_PACKAGE_libopenmpt=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_libgme=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_miniupnpc=ON \
	-DCMAKE_DISABLE_FIND_PACKAGE_SDL2_mixer_ext=ON
ninja
cd ..

install -Dm755 build/bin/srb2 "$PKG/usr/bin/srb2"

unzip -q srb2-assets-$version.zip \
	srb2.pk3 zones.pk3 characters.pk3 music.pk3 models.dat 'models/*' \
	LICENSE.txt LICENSE-3RD-PARTY.txt -d assets-full
install -d "$PKG/usr/share/games/SRB2"
cp -R assets-full/srb2.pk3 assets-full/zones.pk3 assets-full/characters.pk3 \
	assets-full/music.pk3 assets-full/models.dat assets-full/models \
	"$PKG/usr/share/games/SRB2/"
install -Dm644 assets-full/LICENSE.txt "$PKG/usr/share/licenses/srb2/LICENSE.txt"
install -Dm644 assets-full/LICENSE-3RD-PARTY.txt \
	"$PKG/usr/share/licenses/srb2/LICENSE-3RD-PARTY.txt"

install -Dm644 srb2.png "$PKG/usr/share/icons/hicolor/256x256/apps/srb2.png"

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/srb2.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Sonic Robo Blast 2
GenericName=3D Platform Game
Comment=A 3D Sonic the Hedgehog fan game
Exec=srb2
Icon=srb2
Terminal=false
StartupWMClass=srb2
Categories=Game;ActionGame;
Keywords=sonic;platformer;3d;srb2;
DESKTOP
chmod 644 "$PKG/usr/share/applications/srb2.desktop"

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

Contents

Installed programs: srb2.

Installed directories: /usr/share/games/SRB2, /usr/share/licenses/srb2.

Notes

curl is a required dependency of this release: the game reaches the master server through it and downloads the add-ons a network game uses.

The game data is srb2-assets-<version>.zip, upstream’s full release archive. build.sh extracts only the four .pk3 archives (srb2, zones, characters, music), models.dat, the models directory and the two licence files, and leaves out srb2win.exe and the Windows libraries. The data goes into /usr/share/games/SRB2, which is on the program’s own data search path, so no setting is needed to find it. unzip is in depends for this step.

The build runs from a build directory inside the source: upstream’s configure refuses a build in the source directory itself. Only the program is installed from it, by hand; the icon is the srb2.png in the source, and the window’s Wayland app id is SDL’s default, the executable’s name, srb2, which is what StartupWMClass names.