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

325.1. openttd-15.3

Transport Tycoon Deluxe engine — build rail, road, air and sea networks

Version 15.3, release 2
Shelf games-strategy — Strategy, simulation and space-trading games, and their data
Phase 44_apps (Applications), 201 of 422 in build order
Licence GPL-2.0-only
Homepage https://www.openttd.org/
Build time 27.8 SBU
Installed size 22.7 MiB in 92 files
Recipe ports/core/games-strategy/openttd/kpkgbuild

About

OpenTTD is an open-source engine for Transport Tycoon Deluxe: the player builds rail, road, air and sea networks and runs a transport company over a century of play, alone, against AI companies or with others over the network. The engine needs base sets of graphics, sounds and music to start; the free ones are the openttd-opengfx, openttd-opensfx and openttd-openmsx ports in depends, so the game runs without the original game’s files.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, sdl2-compat, mesa, libglvnd, freetype2, fontconfig, harfbuzz, icu, fluidsynth, opusfile, libpng, zlib, xz, lzo, curl, openttd-opengfx, openttd-opensfx, openttd-openmsx.

Required by: no port names it.

Patches

build.sh applies these; kpkg applies nothing by itself.

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

What kpkg does

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

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

patch -p1 -i "$PORT_SRC/fix-segfault.patch"
patch -p1 -i "$PORT_SRC/no-survey.patch"
patch -p1 -i "$PORT_SRC/musl-getrandom.patch"

cmake -S . -B build -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_BINDIR=bin \
	-DCMAKE_INSTALL_DATADIR=share/games \
	-DOPTION_INSTALL_FHS=ON \
	-DOPTION_DEDICATED=OFF \
	-DOPTION_USE_ASSERTS=OFF \
	-DCMAKE_DISABLE_FIND_PACKAGE_Allegro=ON \
	-DCMAKE_DISABLE_FIND_PACKAGE_unofficial-breakpad=ON \
	-DCMAKE_DISABLE_FIND_PACKAGE_Grfcodec=ON \
	-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_SDL2=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_Freetype=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_Fontconfig=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_Harfbuzz=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_ICU=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_Fluidsynth=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_OpusFile=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_PNG=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_ZLIB=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_LibLZMA=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_LZO=ON \
	-DCURL_NO_CURL_CMAKE=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_CURL=ON \
	-DCMAKE_REQUIRE_FIND_PACKAGE_OpenGL=ON \
	-DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS -Wl,-z,stack-size=1048576"
cmake --build build
DESTDIR=$PKG cmake --install build

find "$PKG/usr/share/games/openttd/lang" -name '*.lng' ! -name 'english*.lng' -delete

cat > "$PKG/usr/share/applications/openttd.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=OpenTTD
GenericName=Transport Simulation
Comment=Build rail, road, air and sea transport networks
Exec=openttd
Icon=openttd
Terminal=false
StartupWMClass=openttd
Categories=Game;Simulation;
Keywords=game;simulation;transport;tycoon;deluxe;economics;train;ship;bus;truck;aircraft;cargo;
DESKTOP
chmod 644 "$PKG/usr/share/applications/openttd.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/openttd, 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 openttd-15.3-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/openttd, and runs the triggers its paths call for.

Contents

Installed programs: openttd.

Installed directories: /usr/share/doc/openttd, /usr/share/games/openttd/ai, /usr/share/games/openttd/game, /usr/share/games/openttd/lang, /usr/share/games/openttd/scripts, /usr/share/licenses/openttd.

Short descriptions

openttd open source clone of the Microprose game "Transport Tycoon Deluxe"

Notes

build.sh deletes every language file under /usr/share/games/openttd/lang except the English ones. OpenTTD’s .lng files are its translations, which kpkg’s language prune does not recognise. The in-game list then offers English alone, and a configuration that names another language falls back to English.

Upstream’s desktop entry carries no window class, so build.sh writes its own over it with StartupWMClass=openttd, the window’s Wayland app id, which is the program’s name.