Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

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

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:

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.