323.1. supertux-0.7.0
Classic 2D side-scrolling platformer with Tux, with a level editor
| Version | 0.7.0, release 2 |
| Shelf | games-action — Action, arcade, racing, platform and sandbox games |
| Phase | 44_apps (Applications), 136 of 422 in build order |
| Licence | GPL-3.0-or-later AND CC-BY-SA-4.0 AND CC-BY-SA-3.0 AND OFL-1.1 |
| Homepage | https://www.supertux.org/ |
| Build time | 10.1 SBU |
| Installed size | 313.6 MiB in 4908 files |
| Recipe | ports/core/games-action/supertux/kpkgbuild |
About
SuperTux is a side-scrolling platform game in the style of the classic console platformers, with Tux as the hero, a world map, and a level editor built into the game. It draws through SDL2 and OpenGL and plays its music and sound through OpenAL; the program is supertux2, and its levels, graphics and music install under /usr/share/games/supertux2.
Sources
supertux-0.7.0.tar.gz(279.1 MiB)
sha25632fc5b99b9994ed58e58341d6f21de925764b381256e108591136de53bc31da5
upstream: https://github.com/SuperTux/supertux/releases/download/v0.7.0/SuperTux-v0.7.0-Source.tar.gz
archive copy: sources-2/games-action--supertux-0.7.0.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, sdl2-compat, sdl2-image, sdl2-ttf, physfs, openal-soft, libogg, libvorbis, libpng, zlib, fmt, glm, freetype2, glew, mesa, libglvnd, librsvg.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
musl-execinfo.patch— Insrc/supertux/error_handler.cpp, includes<execinfo.h>only when__has_includefinds it, and compiles the Unix stack-trace code (backtrace()andbacktrace_symbols()) only then. musl has noexecinfo.h, and the tree carries nolibexecinfo, so unpatched the file does not compile; patched, the crash handler on KDOS reports the error without a call stack.
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 supertux'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/games-action/supertux.
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/supertux
echo '32fc5b99b9994ed58e58341d6f21de925764b381256e108591136de53bc31da5 supertux-0.7.0.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/supertux
SRC=$SRC_ROOT/supertux-0.7.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf supertux-0.7.0.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:
patch -p1 -i "$PORT_SRC/musl-execinfo.patch"
cmake -S . -B build -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DINSTALL_SUBDIR_BIN=bin \
-DIS_SUPERTUX_RELEASE=ON \
-DENABLE_OPENGL=ON \
-DUSE_GL_LIBRARY=glew \
-DENABLE_NETWORKING=OFF \
-DENABLE_DISCORD=OFF \
-DSTEAM_BUILD=OFF \
-DFLATPAK=OFF \
-DUSE_SYSTEM_SDL2_TTF=ON \
-DUSE_STATIC_SIMPLESQUIRREL=ON \
-DSUPERTUX_PCH=OFF \
-DSUPERTUX_LTO=OFF \
-DBUILD_TESTING=OFF \
-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON \
-DCMAKE_REQUIRE_FIND_PACKAGE_OpenGL=ON
cmake --build build
DESTDIR=$PKG cmake --install build
find "$PKG/usr/share/games/supertux2" -name '*.po' -delete
install -d "$PKG/usr/share/icons/hicolor/256x256/apps"
rsvg-convert -w 256 -h 256 supertux2.svg \
-o "$PKG/usr/share/icons/hicolor/256x256/apps/supertux2.png"
cat > "$PKG/usr/share/applications/supertux2.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=SuperTux
GenericName=Platform Game
Comment=Play a classic 2D platform game
Exec=supertux2
Icon=supertux2
Terminal=false
StartupWMClass=supertux2
Categories=Game;ArcadeGame;
Keywords=game;arcade;platform;tux;jump;
DESKTOP
chmod 644 "$PKG/usr/share/applications/supertux2.desktop"
The switches, and why each is set:
-DINSTALL_SUBDIR_BIN=bin— installsupertux2into/usr/bin. On Linux upstream’s default isgames, which would put it in/usr/games.-DIS_SUPERTUX_RELEASE=ON— build as an official release: the title screen shows the release logo rather than the development one, the window takes the release icon, and the installed icon issupertux2rather thansupertux-nightly. Upstream’s default isONtoo unless the source is a git checkout that is not on a tag; naming it keeps the result independent of how the source arrived. It also turns precompiled headers on by default, which-DSUPERTUX_PCH=OFFoverrides.-DENABLE_OPENGL=ON— with-DUSE_GL_LIBRARY=glew: draw through OpenGL, loading its functions with glew (the alternative is libepoxy). Without OpenGL the game falls back to its SDL renderer. Both are upstream’s defaults, named.-DCMAKE_REQUIRE_FIND_PACKAGE_OpenGL=ON— make thefind_package(OpenGL)call required. Upstream asks for OpenGL quietly and builds without the OpenGL renderer when it is not found, so a build root missing libglvnd would otherwise give a game with only the SDL renderer and no error.-DENABLE_NETWORKING=OFF— build without libcurl. Networking in SuperTux is the add-on downloader, which fetches add-ons and their index over HTTP; without it the add-on menu cannot download, and curl is not independs.-DENABLE_DISCORD=OFF— with-DSTEAM_BUILD=OFFand-DFLATPAK=OFF: no Discord rich-presence client, and none of the Steam or Flatpak variations (a Flatpak build, for one, forces SDL’s Wayland driver and drops the script menu’s “Open in editor” entry). The Discord client’s source is inexternal/discord-sdk, but its CMake file downloads RapidJSON withFetchContentat configure time, which an offline build cannot do. All three are off by default, named.-DUSE_SYSTEM_SDL2_TTF=ON— link the tree’s sdl2-ttf instead of compiling the copy of SDL_ttf inexternal/. Upstream’s bundled copy can shape text with libraqm; the system library does not, and upstream warns at configure time that right-to-left scripts such as Arabic are then not displayed properly.-DUSE_STATIC_SIMPLESQUIRREL=ON— link the SimpleSquirrel scripting library (SuperTux’s wrapper around the Squirrel language its levels are scripted in) statically intosupertux2. With itOFF, upstream’s default on Linux, the build installs a separatelibsimplesquirrelshared library that only this program uses.-DSUPERTUX_PCH=OFF— compile without precompiled headers, whichIS_SUPERTUX_RELEASEwould otherwise switch on. Precompiled headers only shorten the compile.-DSUPERTUX_LTO=OFF— no link-time optimisation, upstream’s default, named.-DCMAKE_DISABLE_FIND_PACKAGE_Git=ON— keep CMake from looking forgit. Upstream reads the version from git only when the source has a.gitdirectory, which an unpacked release does not; the version then comes from the release’s ownversion.cmakerather than fromgit describe.
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/supertux, 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 supertux-0.7.0-2.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/supertux, and runs the triggers its paths call for.
Contents
Installed programs: supertux2.
Installed directories: /usr/share/doc/supertux2, /usr/share/games/supertux2, /usr/share/licenses/supertux.
Notes
build.sh deletes every .po file under /usr/share/games/supertux2. SuperTux reads its translations as .po files at run time, through its bundled tinygettext, and kpkg’s language prune removes compiled catalogues (.mo, .gmo, .qm) but not .po files, so without the deletion the game would ship every translation while the rest of the system is English only.
Upstream installs supertux2.svg as its hicolor icon (see Desktop entries belong to the port). build.sh also renders a 256-pixel PNG from it with rsvg-convert from librsvg, and writes its own supertux2.desktop over upstream’s, untranslated, with search keywords.