324.7. xonotic-0.8.6
Arena first-person shooter on the DarkPlaces engine: SDL client and dedicated server
| Version | 0.8.6, release 2 |
| Shelf | games-shooter — First-person shooters, Doom and Quake engines, and their data |
| Phase | 44_apps (Applications), 199 of 422 in build order |
| Licence | GPL-2.0-or-later AND BSD-3-Clause |
| Homepage | https://xonotic.org |
| Build time | 0.9 SBU |
| Installed size | 7.9 MiB in 28 files |
| Recipe | ports/core/games-shooter/xonotic/kpkgbuild |
About
Xonotic is a fast arena first-person shooter on the DarkPlaces engine, an extended Quake engine. This port builds the engine twice, as the SDL client xonotic and the dedicated server xonotic-dedicated, together with d0_blind_id, the player-identification and encryption library the engine uses for its player IDs. The game’s maps, models, sounds and textures are the separate xonotic-data port, installed in /usr/share/xonotic.
Sources
xonotic-0.8.6.zip(6.3 MiB)
sha2568b92ac781cff4ae89c121a23eacd7dec05a2aabedaccc23a19d1a0958b4012a8
upstream: https://dl.xonotic.org/xonotic-0.8.6-source.zip
archive copy: sources-2/games-shooter--xonotic-0.8.6.zip
Dependencies
Depends on: unzip, pkgconf, sdl2-compat, libjpeg-turbo, libpng, zlib, libogg, libvorbis, libtheora, curl, gmp, xonotic-data.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
gcc-15.patch— In DarkPlaces’qtypes.h, renames the members of theqbooleanenum fromfalseandtruetoqfalseandqtrue, with#define false qfalseand#define true qtrueafter it, and indpsoftrast.cremovestypedef qboolean bool;. In C23, GCC’s default language,bool,trueandfalseare keywords, and the original lines do not compile.
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 xonotic'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/games-shooter/xonotic.
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/xonotic
echo '8b92ac781cff4ae89c121a23eacd7dec05a2aabedaccc23a19d1a0958b4012a8 xonotic-0.8.6.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/xonotic
SRC=$SRC_ROOT/xonotic-0.8.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
cp xonotic-0.8.6.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:
unzip -q "$name-$version.zip"
cd Xonotic
patch -p1 -i "$PORT_SRC/gcc-15.patch"
cd source/d0_blind_id
./configure --prefix=/usr --libdir=/usr/lib --disable-static
make
make DESTDIR=$PKG install
cd ../..
dpflags=${CFLAGS/-O2/-O3}
dpflags=${dpflags/-std=gnu11/}
for t in sdl-release sv-release; do
make -C source/darkplaces \
CPUOPTIMIZATIONS="$dpflags $LDFLAGS" \
SDL_CONFIG='pkg-config sdl2' \
SDLCONFIG_UNIXLIBS_X11= \
DP_FS_BASEDIR=/usr/share/xonotic \
$t
done
install -Dm755 source/darkplaces/darkplaces-sdl "$PKG/usr/bin/xonotic"
install -Dm755 source/darkplaces/darkplaces-dedicated "$PKG/usr/bin/xonotic-dedicated"
install -Dm644 COPYING "$PKG/usr/share/licenses/$name/COPYING"
install -Dm644 GPL-2 "$PKG/usr/share/licenses/$name/GPL-2"
install -Dm644 source/darkplaces/COPYING "$PKG/usr/share/licenses/$name/darkplaces-COPYING"
install -Dm644 source/d0_blind_id/COPYING "$PKG/usr/share/licenses/$name/d0_blind_id-COPYING"
for s in 16 22 24 32 48 64 128 256 512; do
install -Dm644 misc/logos/icons_png/xonotic_$s.png \
"$PKG/usr/share/icons/hicolor/${s}x$s/apps/xonotic.png"
done
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/xonotic.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Xonotic
GenericName=First-Person Shooter
Comment=Fast arena shooter, for LAN and local play against bots
Exec=xonotic
Icon=xonotic
Terminal=false
StartupWMClass=xonotic
Categories=Game;ActionGame;
Keywords=fps;shooter;arena;deathmatch;xonotic;
DESKTOP
chmod 644 "$PKG/usr/share/applications/xonotic.desktop"
The switches, and why each is set:
CPUOPTIMIZATIONS— set to the tree’sCFLAGSandLDFLAGS, with-O2raised to-O3and-std=gnu11removed. The DarkPlaces makefile sets its ownCFLAGSandLDFLAGSand ignores the exported ones;CPUOPTIMIZATIONSis the one variable it appends to its release compile line, and it comes last there, so its-O2would override the makefile’s own-O3. The release link line repeats it ahead of the libraries, so the link flags travel in it too; on a compile-only line the compiler ignores the-Wl,options.-std=gnu11comes out because, withgcc-15.patchapplied,dpsoftrast.cusesboolas the C23 keyword, which GNU C11 does not have (see the release flags).SDL_CONFIG='pkg-config sdl2'— the command the makefile runs for SDL2’s flags. Its default issdl2-config, which sdl2-compat does not install.SDLCONFIG_UNIXLIBS_X11=— empty, so the SDL client does not linklibX11. Built on SDL2 it calls no Xlib function (its X11 code is for SDL 1.2, and the GLX client is a separate target), but the makefile adds-lX11to the SDL client’s link all the same.DP_FS_BASEDIR=/usr/share/xonotic— compile in the base directory where the engine looks for the game data, the directory xonotic-data installs.sdl-release— withsv-release: the two DarkPlaces targets built, the SDL client and the dedicated server, each with the makefile’s release optimisation level.
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/xonotic, 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 xonotic-0.8.6-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/xonotic, and runs the triggers its paths call for.
Contents
Installed programs: blind_id, xonotic, xonotic-dedicated.
Installed libraries: libd0_blind_id.so, libd0_rijndael.so.
Installed directories: /usr/include/d0_blind_id, /usr/share/licenses/xonotic.
Short descriptions
d0_blind_id.pc |
Library for user identification using RSA blind signatures |
d0_rijndael.pc |
Library for Rijndael encryption |
Notes
The source release is a .zip, which kpkg copies into the work directory as it is (see Sources, and what each one becomes), so build.sh unpacks it itself with unzip and builds from the Xonotic directory inside. d0_blind_id is built first, with its own configure, as a shared library: DarkPlaces opens it at run time with dlopen, as it does libpng, libogg, libvorbis, libtheora and libcurl, so those are in depends although no link line names them. Its big-number arithmetic is on gmp.
DarkPlaces picks the game it runs from its executable’s name, which is why the client is installed as xonotic; that name is also SDL’s default Wayland app id, which StartupWMClass names.