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

325.2. wesnoth-1.18.8

Turn-based fantasy strategy with campaigns, skirmishes and a map editor

Version 1.18.8, release 1
Shelf games-strategy — Strategy, simulation and space-trading games, and their data
Phase 44_apps (Applications), 202 of 422 in build order
Licence GPL-2.0-or-later
Homepage https://www.wesnoth.org/
Build time 41.0 SBU
Installed size 450.8 MiB in 20801 files
Recipe ports/core/games-strategy/wesnoth/kpkgbuild

About

The Battle for Wesnoth is a turn-based fantasy strategy game on a hex map, with single-player campaigns, skirmishes against the computer, multiplayer, and a built-in map editor. This port builds the game, wesnoth, and the multiplayer server, wesnothd.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, boost, icu, openssl, curl, libvorbis, fontconfig, sdl2-compat, sdl2-image, sdl2-mixer, cairo, pango, readline, dbus.

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 wesnoth'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/games-strategy/wesnoth.

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-strategy/wesnoth
echo 'fce3bd71d4ed32c9d11c0f707d19743cec6adf5c34761fab94ab72754aaedd89  wesnoth-1.18.8.tar.bz2' | 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/wesnoth
SRC=$SRC_ROOT/wesnoth-1.18.8
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf wesnoth-1.18.8.tar.bz2 -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 recipe’s helpers _series and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

cmake -S . -B build -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DENABLE_GAME=ON \
	-DENABLE_SERVER=ON \
	-DENABLE_CAMPAIGN_SERVER=OFF \
	-DENABLE_MYSQL=OFF \
	-DENABLE_TESTS=OFF \
	-DENABLE_NLS=OFF \
	-DENABLE_SYSTEM_LUA=OFF \
	-DENABLE_DISPLAY_REVISION=OFF \
	-DENABLE_DESKTOP_ENTRY=ON \
	-DENABLE_APPDATA_FILE=ON \
	-DENABLE_NOTIFICATIONS=ON \
	-DENABLE_STRICT_COMPILATION=OFF \
	-DENABLE_LTO=OFF \
	-DFIFO_DIR=/run/wesnothd
cmake --build build
DESTDIR=$PKG cmake --install build
rm -rf "$PKG/run"

cat > "$PKG/usr/share/applications/org.wesnoth.Wesnoth.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Battle for Wesnoth
GenericName=Strategy Game
Comment=Fantasy turn-based strategy: campaigns, skirmishes and a map editor
Exec=wesnoth
Icon=wesnoth-icon
Terminal=false
StartupWMClass=wesnoth
Categories=Game;StrategyGame;
Keywords=strategy;turn-based;fantasy;campaign;hex;wesnoth;
Actions=Editor;

[Desktop Action Editor]
Name=Map Editor
Exec=wesnoth -e
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.wesnoth.Wesnoth.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/wesnoth, 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 wesnoth-1.18.8-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/wesnoth, and runs the triggers its paths call for.

Contents

Installed programs: wesnoth, wesnothd.

Installed directories: /usr/share/icons/HighContrast, /usr/share/licenses/wesnoth, /usr/share/wesnoth.

Short descriptions

wesnoth Battle for Wesnoth, a turn-based fantasy strategy game
wesnothd Battle for Wesnoth multiplayer network daemon

Notes

The install creates FIFO_DIR in the package, and build.sh removes it again with rm -rf "$PKG/run": /run is a tmpfs at run time, so a staged file there is lost, and the package lint refuses it (see What the package lint refuses). wesnothd logs that it could not make the FIFO and runs without it.

Upstream’s desktop entry runs the game through sh -c to hide its console output. build.sh writes its own over it, which runs wesnoth directly, so the launcher sees the window it started, sets StartupWMClass=wesnoth, the window’s Wayland app id, and has a Map Editor action that runs wesnoth -e.