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
srb2-2.2.15.tar.gz(57.6 MiB)
sha256c2689074539bf23d81e8add5f2beeac1b69d5586d69d93d44f6f6b195076bbaf
upstream: https://github.com/STJr/SRB2/archive/refs/tags/SRB2_release_2.2.15.tar.gz
archive copy: sources-2/games-action--srb2-2.2.15.tar.gzsrb2-assets-2.2.15.zip(170.7 MiB)
sha2563eda3080ab87940fca5e4dcd22b8e041dc1d9e65bfe9177bff68383e9bd58a10
upstream: https://github.com/STJr/SRB2/releases/download/SRB2_release_2.2.15/SRB2-v2215-Full.zip
archive copy: sources-2/games-action--srb2-assets-2.2.15.zip
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:
-DSRB2_SDL2_EXE_NAME=srb2— name the programsrb2. Left empty, upstream builds the name from the git branch or commit (lsdlsrb2and a suffix on Linux), and a release tarball has no repository to ask.-DSRB2_CONFIG_SYSTEM_LIBRARIES=ON— use the system’s libraries. In this release the variable is not declared as an option and is read in one place: with it on, the Game Music Emu headers come from the installed libgme; off, the build adds${libgme_SOURCE_DIR}, the directory of a bundled libgme source, which this release’sthirdparty/CMakeLists.txtnever sets up.-DSRB2_CONFIG_STATIC_STDLIB=OFF— do not link the C and C++ standard libraries statically. Upstream defaults it toON, which needs every dependency static too; in this release the switch only takes effect in a MinGW build, so on Linux it is named for clarity.-DSRB2_CONFIG_EXECINFO=OFF— compile withNOEXECINFO, without the crash handler’s stack-trace dump. That code usesbacktrace()fromexecinfo.h, which musl does not have.-DSRB2_CONFIG_HWRENDER=ON— with-DSRB2_CONFIG_STATIC_OPENGL=OFF: build the OpenGL renderer beside the software one, looking up OpenGL’s functions at run time rather than linking the program against the OpenGL library. Both are upstream’s defaults, named.-DSRB2_CONFIG_USE_GME=ON— play the video-game chiptune formats through Game Music Emu, beside the Ogg music SDL_mixer plays. Upstream’s default isOFF.-DCMAKE_REQUIRE_FIND_PACKAGE_libopenmpt=ON— with the same switch forlibgmeandminiupnpc: make each of those three lookups required. Upstream looks for each oneQUIETand builds without it when it is missing, losing tracker-module playback through libopenmpt, the GME formats, or the automatic router port mapping of a hosted game through miniupnpc, with nothing at configure time to say so.-DCMAKE_DISABLE_FIND_PACKAGE_SDL2_mixer_ext=ON— never look for SDL Mixer X, the extended fork of SDL_mixer that upstream prefers when it finds it. The tree has no port of it, and the build uses sdl2-mixer.-DSRB2_CONFIG_ERRORMODE=OFF— with-DSRB2_CONFIG_DEV_BUILD=OFF: warnings are not errors, and the program is not a development build. Both are upstream’s defaults, named.
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.