324.4. yamagi-quake2-8.70
Quake II engine kept faithful to the original — OpenGL 1.4, 3.2, GLES3 and software renderers
| Version | 8.70, release 1 |
| Shelf | games-shooter — First-person shooters, Doom and Quake engines, and their data |
| Phase | 44_apps (Applications), 196 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://www.yamagi.org/quake2/ |
| Build time | 0.7 SBU |
| Installed size | 3.3 MiB in 24 files |
| Recipe | ports/core/games-shooter/yamagi-quake2/kpkgbuild |
About
Yamagi Quake II is a Quake II engine that keeps the original game’s look and play while running on current systems, with OpenGL 1.4, OpenGL 3.2, OpenGL ES 3 and software renderers. It installs the client quake2 and the dedicated server q2ded. The game data is not free and is not shipped: a player copies baseq2/pak0.pak and the rest of their own Quake II into /usr/share/games/quake2/baseq2, the directory the desktop entry’s comment names.
Sources
yamagi-quake2-8.70.tar.xz(2.1 MiB)
sha25637e4143e4d362d7b93ba7a8d2c36a945fbcae82aef386512032200233b1750c8
upstream: https://deponie.yamagi.org/quake2/quake2-8.70.tar.xz
archive copy: sources-2/games-shooter--yamagi-quake2-8.70.tar.xz
Dependencies
Depends on: sdl3, mesa, libglvnd, openal-soft, curl.
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 yamagi-quake2'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/games-shooter/yamagi-quake2.
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-shooter/yamagi-quake2
echo '37e4143e4d362d7b93ba7a8d2c36a945fbcae82aef386512032200233b1750c8 yamagi-quake2-8.70.tar.xz' | 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/yamagi-quake2
SRC=$SRC_ROOT/yamagi-quake2-8.70
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf yamagi-quake2-8.70.tar.xz -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:
export CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
make \
WITH_SDL3=yes \
WITH_OPENAL=yes \
WITH_CURL=yes \
WITH_EXECINFO=no \
WITH_RPATH=no \
WITH_XDG=yes \
WITH_SYSTEMWIDE=yes \
WITH_SYSTEMDIR=/usr/share/games/quake2
install -d "$PKG/usr/lib/yamagi-quake2/baseq2" "$PKG/usr/bin" \
"$PKG/usr/share/games/quake2/baseq2"
install -m755 release/quake2 release/q2ded "$PKG/usr/lib/yamagi-quake2/"
install -m755 release/ref_*.so "$PKG/usr/lib/yamagi-quake2/"
install -m755 release/baseq2/game.so "$PKG/usr/lib/yamagi-quake2/baseq2/"
install -m644 stuff/yq2.cfg "$PKG/usr/share/games/quake2/baseq2/yq2.cfg"
ln -s ../lib/yamagi-quake2/quake2 "$PKG/usr/bin/quake2"
ln -s ../lib/yamagi-quake2/q2ded "$PKG/usr/bin/q2ded"
install -Dm644 stuff/icon/Quake2.png \
"$PKG/usr/share/icons/hicolor/512x512/apps/yamagi-quake2.png"
install -Dm644 README.md CHANGELOG doc/*.md -t "$PKG/usr/share/doc/yamagi-quake2"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/yamagi-quake2.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Yamagi Quake II
GenericName=First Person Shooter
Comment=Play Quake II; needs the game data in /usr/share/games/quake2/baseq2
Exec=quake2
Icon=yamagi-quake2
Terminal=false
NoDisplay=true
StartupWMClass=quake2
Categories=Game;ActionGame;
Keywords=first;person;shooter;quake;quake2;
DESKTOP
chmod 644 "$PKG/usr/share/applications/yamagi-quake2.desktop"
The switches, and why each is set:
-D_LARGEFILE64_SOURCE— appended toCFLAGS. The engine’s copy of minizip, insrc/common/unzip, callsfopen64,ftello64andfseeko64on every platform but macOS and Haiku; musl declares those names only when_LARGEFILE64_SOURCEis defined.WITH_SDL3=yes— withWITH_OPENAL=yes: build on sdl3, and with the OpenAL sound backend, which the engine loads at run time (itsal_driversetting names the library) from openal-soft. Both are upstream’s defaults, named.WITH_CURL=yes— HTTP downloads of the files a server’s game needs, through cURL, which the engine also loads at run time; curl is independsfor it. Upstream’s default, named.WITH_EXECINFO=no— no crash backtrace. Upstream’s default isyes, and the code usesexecinfo.h, which musl does not have.WITH_RPATH=no— no$ORIGIN/librun path, which upstream sets by default so that libraries placed in alibdirectory beside the program, such as a patched SDL, are loaded first.WITH_XDG=yes— keep the user’s configuration and saves under the XDG base directories. Upstream’s default, named.WITH_SYSTEMWIDE=yes— withWITH_SYSTEMDIR=/usr/share/games/quake2: also search a system-wide directory for game data andgame.so, and compile that directory in. Upstream’s default is no system-wide directory at all;/usr/share/games/quake2is the directory the engine falls back to whenSYSTEMWIDEis on and noSYSTEMDIRis given, soWITH_SYSTEMDIRnames it.
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/yamagi-quake2, 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 yamagi-quake2-8.70-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/yamagi-quake2, and runs the triggers its paths call for.
Contents
Installed programs: q2ded, quake2.
Installed directories: /usr/lib/yamagi-quake2, /usr/share/doc/yamagi-quake2, /usr/share/games/quake2, /usr/share/licenses/yamagi-quake2.
Notes
The Makefile has no install target, so build.sh installs by hand. The engine loads its renderer libraries (ref_gl1.so, ref_gl3.so, ref_gles3.so, ref_soft.so) from the directory its executable is in and from nowhere else, and finds baseq2/game.so through the same search path as the game data, which includes that directory. So the whole release/ tree is kept together in /usr/lib/yamagi-quake2. The engine finds that directory by reading /proc/self/exe, which names the real file rather than the path it was started by, so /usr/bin can hold plain symbolic links to quake2 and q2ded. Upstream’s yq2.cfg goes into the system-wide baseq2.
The window’s Wayland app id is the executable’s name, quake2, which is what the entry’s StartupWMClass names. The entry is NoDisplay=true, so the game is not in the application menu: without the data the engine exits on Couldn't load pics/colormap.pcx and opens no window and no dialog, which from a menu would look like nothing happening. Once the data is in place, the player starts the game by running quake2.