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

325.5. freeciv-3.2.6

Turn-based empire-building strategy in the Civilization tradition, SDL2 client and server

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

About

Freeciv is a turn-based empire-building game in the tradition of Civilization: a civilisation grows from one settler to a space programme against computer or human rivals. The port builds the SDL2 client, freeciv-sdl2, the freeciv-server it starts for a local game, and two command-line rules tools. The client draws through SDL2 on sdl2-compat, so it needs no toolkit.

Sources

Dependencies

Depends on: meson, ninja, pkgconf, python3, gzip, sdl2-compat, sdl2-image, sdl2-ttf, sdl2-gfx, sdl2-mixer, icu, curl, sqlite, readline, zlib, bzip2, xz, zstd, desktop-file-utils.

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

What kpkg does

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

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/freeciv
echo 'b3ce15f54083b1fca146f62837a5f7d41d298537fa34940cca70eeb09c7a9c6e  freeciv-3.2.6.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/freeciv
SRC=$SRC_ROOT/freeciv-3.2.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf freeciv-3.2.6.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:

meson setup build --prefix=/usr --sysconfdir=/etc --libdir=lib \
	--buildtype=release \
	-Dclients=sdl2 \
	-Dfcmp='[]' \
	-Dserver=enabled \
	-Daudio=sdl2 \
	-Dtools=manual,ruleup \
	-Dnls=false \
	-Dsyslua=false \
	-Dsys-tolua-cmd=false \
	-Dreadline=true \
	-Dmwand=false \
	-Djson-protocol=false \
	-Dgitrev=false \
	-Dappimage=false \
	-Dsvgflags=true
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
for m in gtk3.22 gtk4 qt sdl3 modpack mp-cli mp-gtk3 mp-gtk4 mp-qt ruledit; do
	rm -f "$PKG/usr/share/man/man6/freeciv-$m.6"
done

cat > "$PKG/usr/share/applications/org.freeciv.sdl2.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Freeciv
GenericName=Strategy Game
Comment=Turn-based strategy inspired by the history of human civilization
Exec=freeciv-sdl2
Icon=freeciv-client
Terminal=false
StartupWMClass=freeciv-sdl2
Categories=Game;StrategyGame;
Keywords=strategy;simulation;civilization;tiles;history;multiplayer;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.freeciv.sdl2.desktop"
desktop-file-edit --set-key=NoDisplay --set-value=true "$PKG/usr/share/applications/org.freeciv.server.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/freeciv, 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 freeciv-3.2.6-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/freeciv, and runs the triggers its paths call for.

Contents

Installed programs: freeciv-manual, freeciv-ruleup, freeciv-sdl2, freeciv-server.

Installed libraries: libfreeciv.so.

Installed directories: /etc/freeciv, /usr/share/doc/freeciv, /usr/share/freeciv, /usr/share/licenses/freeciv.

Short descriptions

freeciv-manual Generate HTML or wiki manual for freeciv-server(6)
freeciv-ruleup Update Freeciv rulesets
freeciv-server The server for the Freeciv game

Notes

Freeciv installs a manual page for every client and front end whatever was built. The loop after the install removes the pages for the GTK 3.22, GTK 4, Qt and SDL3 clients, the modpack installer in all its forms, and the rules editor, so no page describes a program the package does not carry.

Upstream’s org.freeciv.sdl2.desktop is replaced by one written in build.sh, which adds StartupWMClass=freeciv-sdl2: SDL gives the window the program’s name as its Wayland app_id, and the line ties the window to its launcher. The server’s entry stays installed but is hidden with desktop-file-edit, so the menu lists the client alone (see Desktop entries belong to the port).