323.7. ddnet-20.1
DDraceNetwork — the cooperative Teeworlds racing game, its client, server and map tools
| Version | 20.1, release 1 |
| Shelf | games-action — Action, arcade, racing, platform and sandbox games |
| Phase | 44_apps (Applications), 142 of 422 in build order |
| Licence | Zlib AND CC-BY-SA-3.0 AND OFL-1.1 AND Bitstream-Vera |
| Homepage | https://ddnet.org |
| Build time | 12.0 SBU |
| Installed size | 113.5 MiB in 926 files |
| Recipe | ports/core/games-action/ddnet/kpkgbuild |
About
DDNet (DDraceNetwork) is a cooperative online racing game built on Teeworlds: teams of players work through maps together using the hook, hammer and weapons. This port builds the client DDNet, the server DDNet-Server and upstream’s map and demo tools, which install under /usr/lib/ddnet. Part of the engine is written in Rust, so CMake drives a cargo build from a vendored crate bundle alongside the C++.
Sources
ddnet-20.1.tar.xz(36.2 MiB)
sha256eed1b81a3a856f000db60ec47980ccbdcbbba53f34e32f3f5610f2d1963ec9bb
upstream: https://ddnet.org/downloads/DDNet-20.1.tar.xz
archive copy: sources-2/games-action--ddnet-20.1.tar.xzddnet-vendor-20.1.tar.xz(3.5 MiB)
sha2560baa3847d666ab9ec205dbf1e430da8fcdf81e263ac3ea73e2b5250d1c76e380
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-2/games-action--ddnet-vendor-20.1.tar.xz
Dependencies
Depends on: cmake, ninja, pkgconf, python3, rust, sdl2-compat, glew, libglvnd, mesa, vulkan-loader, vulkan-headers, glslang, spirv-tools, freetype2, libpng, zlib, openssl, curl, sqlite, libogg, opus, opusfile, wavpack, ffmpeg, miniupnpc, libnotify, libwebsockets.
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 ddnet'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/games-action/ddnet.
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/ddnet
echo 'eed1b81a3a856f000db60ec47980ccbdcbbba53f34e32f3f5610f2d1963ec9bb ddnet-20.1.tar.xz' | sha256sum -c -
echo '0baa3847d666ab9ec205dbf1e430da8fcdf81e263ac3ea73e2b5250d1c76e380 ddnet-vendor-20.1.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/ddnet
SRC=$SRC_ROOT/ddnet-20.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ddnet-20.1.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:
tar xf "$PORT_SRC/$name-vendor-$version.tar.xz"
export CARGO_HOME="$SRC_ROOT/.cargo"
export CARGO_NET_OFFLINE=true
export RUSTFLAGS="-C target-feature=-crt-static"
mkdir build && cd build
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DPREFER_BUNDLED_LIBS=OFF \
-DDOWNLOAD_GTEST=OFF \
-DAUTOUPDATE=OFF \
-DINFORM_UPDATE=OFF \
-DSTEAM=OFF \
-DDISCORD=OFF \
-DDISCORD_DYNAMIC=OFF \
-DMYSQL=OFF \
-DWEBSOCKETS=ON \
-DANTIBOT=OFF \
-DUPNP=ON \
-DVIDEORECORDER=ON \
-DVULKAN=ON \
-DCLIENT=ON \
-DSERVER=ON \
-DTOOLS=ON \
-DIPO=OFF \
-DDEV=OFF \
-DPRECOMPILE_HEADERS=ON \
-DSECURITY_COMPILER_FLAGS=ON
ninja
DESTDIR=$PKG ninja install
cd ..
rm -f "$PKG/usr/share/applications/ddnet.desktop"
cat > "$PKG/usr/share/applications/ddnet.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=DDNet
GenericName=Platform Game
Comment=Cooperative racing on Teeworlds maps
Exec=DDNet %u
Icon=ddnet
Terminal=false
StartupWMClass=DDNet
MimeType=x-scheme-handler/ddnet;
Categories=Game;ArcadeGame;
Keywords=game;multiplayer;teeworlds;race;ddrace;
DESKTOP
chmod 644 "$PKG/usr/share/applications/ddnet.desktop"
The switches, and why each is set:
-DPREFER_BUNDLED_LIBS=OFF— search the system’s libraries before the prebuilt copies upstream keeps inddnet-libs, a directory the release tarball carries empty. With it on, every find module searchesddnet-libsfirst. Upstream’s default on Linux, named.-DDOWNLOAD_GTEST=OFF— do not download GoogleTest at configure time for the unit tests. A build with no network cannot, and upstream’s default on Linux is off too.-DAUTOUPDATE=OFF— with-DINFORM_UPDATE=OFF: no self-updater and no notice of a new version. Upstream’s default forINFORM_UPDATEis on, which shows a newer version in the start menu with a button that opens the download page onddnet.org.-DSTEAM=OFF— with-DDISCORD=OFFand-DDISCORD_DYNAMIC=OFF: no Steam release build and no Discord rich presence, which links Discord’s prebuiltdiscord_game_sdklibrary. All three are upstream’s defaults, named.-DMYSQL=OFF— the server keeps its ranks in SQLite only, without the MySQL backend. Upstream’s default, named.-DWEBSOCKETS=ON— let the server and client speakws://addresses as well as UDP, through libwebsockets. Upstream’s default is off; with it on, a missing libwebsockets is a configure error.-DANTIBOT=OFF— no support in the server for loading a dynamic anti-cheat library, which upstream does not provide. Upstream’s default, named.-DUPNP=ON— let a server the player hosts open its port on the router through UPnP, with miniupnpc. Upstream’s default is off; with it on, a missing miniupnpc is a configure error.-DVIDEORECORDER=ON— record demos to video through ffmpeg. Upstream’s default, named.-DVULKAN=ON— build the Vulkan renderer beside the OpenGL one. Its shaders are compiled at build time withglslangValidatorfrom glslang and optimised withspirv-optfrom spirv-tools; a missingglslangValidatororspirv-optstops the configure. Upstream’s default on Linux, named.-DCLIENT=ON— with-DSERVER=ONand-DTOOLS=ON: build the client, the server and the tools. All three are upstream’s defaults, named.-DIPO=OFF— no interprocedural (link-time) optimisation. Upstream’s default, named.-DDEV=OFF— a packaging build: upstream generates what packaging needs, strips absolute paths from debug information, and leaves out the extra assertions of a development build. Upstream’s default, named.-DPRECOMPILE_HEADERS=ON— precompile the commonly used headers, which only shortens the build. Upstream’s default, named.-DSECURITY_COMPILER_FLAGS=ON— let upstream add its hardening flags, such as-fstack-protector-strongand-D_FORTIFY_SOURCE=2, when the compiler supports them. Upstream’s default, 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/ddnet, 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 ddnet-20.1-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/ddnet, and runs the triggers its paths call for.
Contents
Installed programs: DDNet, DDNet-Server.
Installed directories: /usr/lib/ddnet, /usr/share/ddnet, /usr/share/licenses/ddnet.
Notes
The crates are vendored (vendoring = rust): ddnet-vendor-<version>.tar.xz holds vendor/, Cargo.lock and a .cargo/config.toml that replaces crates.io with the vendor directory. It is made by ports/fetch and held to its sha256 = line like any other source (see Vendoring). CMake runs cargo build --locked with the build directory as its working directory, and cargo finds its configuration by walking up from there, so build.sh unpacks the bundle at the top of the source tree, one level above build (Where the bundle goes). The CARGO_HOME, CARGO_NET_OFFLINE and RUSTFLAGS lines are the rust build shape’s; without -crt-static the Rust half would link statically against musl.
build.sh removes upstream’s ddnet.desktop and writes its own, which adds StartupWMClass=DDNet: the window’s Wayland app id is SDL’s default, the executable’s name, DDNet. Both entries claim the ddnet: URL scheme, a link to a server address that the client connects to.