326.1. cataclysm-dda-0.I.1
Cataclysm: Dark Days Ahead — turn-based survival in a procedurally generated post-apocalyptic world, in its tiles build
| Version | 0.I.1, release 2 |
| Shelf | games-rpg — RPGs, roguelikes and interactive fiction |
| Phase | 44_apps (Applications), 188 of 422 in build order |
| Licence | CC-BY-SA-3.0 AND OFL-1.1 AND Apache-2.0 |
| Homepage | https://cataclysmdda.org |
| Build time | 15.5 SBU |
| Installed size | 175.5 MiB in 7936 files |
| Recipe | ports/core/games-rpg/cataclysm-dda/kpkgbuild |
About
Cataclysm: Dark Days Ahead is a turn-based survival roguelike set in a procedurally generated world after a catastrophe: the player scavenges, crafts, builds and fights through an open map that is simulated as they move. This port is its tiles build, cataclysm-tiles, which draws through SDL2 with graphical tilesets and plays sound, rather than the curses build for a terminal. It also installs zzip, upstream’s tool for compressing and expanding save files.
Sources
cataclysm-dda-0.I.1.tar.gz(230.8 MiB)
sha25627e35a0a5181f88f0929bef180ca0465d00e606e569911cb02d97b59b8b5768a
upstream: https://github.com/CleverRaven/Cataclysm-DDA/archive/refs/tags/0.I-1.tar.gz
archive copy: sources-2/games-rpg--cataclysm-dda-0.I.1.tar.gz
Dependencies
Depends on: pkgconf, sdl2-compat, sdl2-image, sdl2-mixer, sdl2-ttf, freetype2, zlib, librsvg.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
flatbuffers.patch— In the copy of FlatBuffers insrc/third-party, definesFLATBUFFERS_LOCALE_INDEPENDENTto0inutil.h, so number parsing uses plainstrtod,strtollandstrtoullinstead of the_lvariants with an explicit C locale. musl declaresstrtod_landstrtof_lbut notstrtoll_lorstrtoull_l. It also comments out the include ofcata_error_locale_dependent.h, a header the Cataclysm project adds to its copy, which stops the build with#erroron any platform but Cygwin when the locale-independent functions are off, and comments out thecount_assignment in the copy-assignment operator of FlatBuffers’span. With the patch, that parsing follows the C library’s current locale.make.patch— In theinstallrules ofMakefileandlang/Makefile, replacesinstall --mode=withinstall -mandcp -R --no-preserve=ownershipwithcp -R. The tree’scpandinstallare GNU coreutils’, which accept both forms, andcp -Rwithout-pkeeps no ownership in the first place, so the patched rules install the same files with the same modes.pathmax.patch— DefinesPATH_MAXas4096in the bundled zstd’scommon/zstd_internal.h. No file in this release’ssrcortoolsnamesPATH_MAX, so the definition has no effect on this version’s build.zzip-ldflags.patch— Adds$(LDFLAGS)to the link line ofzzip, which otherwise takes only the compile flags. Without itzziplinks without the tree’s-z,now, and the package lint warns that it lacksBIND_NOW(see What the package lint refuses).
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 cataclysm-dda'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/games-rpg/cataclysm-dda.
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-rpg/cataclysm-dda
echo '27e35a0a5181f88f0929bef180ca0465d00e606e569911cb02d97b59b8b5768a cataclysm-dda-0.I.1.tar.gz' | 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/cataclysm-dda
SRC=$SRC_ROOT/cataclysm-dda-0.I.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf cataclysm-dda-0.I.1.tar.gz -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 _tag and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/flatbuffers.patch"
patch -p1 -i "$PORT_SRC/pathmax.patch"
patch -p1 -i "$PORT_SRC/make.patch"
patch -p1 -i "$PORT_SRC/zzip-ldflags.patch"
mk() {
make \
PREFIX=/usr \
WARNINGS='-Wall -Wextra' \
RELEASE=1 TILES=1 SOUND=1 \
LOCALIZE=0 LANGUAGES= \
USE_XDG_DIR=1 DYNAMIC_LINKING=1 \
BACKTRACE=0 PCH=0 \
TESTS=0 RUNTESTS=0 \
ASTYLE=0 LINTJSON=0 \
"$@"
}
mk
mk DESTDIR=$PKG install
rm -rf "$PKG/usr/share/icons/hicolor/scalable"
install -d "$PKG/usr/share/icons/hicolor/256x256/apps"
rsvg-convert -w 256 -h 256 data/xdg/org.cataclysmdda.CataclysmDDA.svg \
-o "$PKG/usr/share/icons/hicolor/256x256/apps/org.cataclysmdda.CataclysmDDA.png"
rm -f "$PKG/usr/share/applications/org.cataclysmdda.CataclysmDDA.desktop"
cat > "$PKG/usr/share/applications/org.cataclysmdda.CataclysmDDA.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Cataclysm: Dark Days Ahead
GenericName=Survival Game
Comment=Turn-based survival in a post-apocalyptic world
Exec=cataclysm-tiles
Icon=org.cataclysmdda.CataclysmDDA
Terminal=false
StartupWMClass=cataclysm-tiles
Categories=Game;RolePlaying;
Keywords=zombie;survival;roguelike;tiles;dda;cdda;cataclysm;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.cataclysmdda.CataclysmDDA.desktop"
The switches, and why each is set:
WARNINGS— set to-Wall -Wextra, replacing upstream’s warning list, which starts with-Werror. With upstream’s list, any warning a newer compiler adds would stop the build.RELEASE=1— an optimised build. The Makefile’s default is a debug build.TILES=1— withSOUND=1: the SDL2 tiles build, with music and sound effects through sdl2-mixer. Sound needs the tiles build.LOCALIZE=0— withLANGUAGES=: build without gettext and compile no translations, so the game is English only, like the rest of the system.USE_XDG_DIR=1— keep saves and settings in the XDG base directories under the user’s home (~/.local/share/cataclysm-dda,~/.config/cataclysm-dda) rather than beside the program.DYNAMIC_LINKING=1— link the system libraries dynamically. On Linux the Makefile links them dynamically whatever this says; the variable changes the link only in a Windows build.BACKTRACE=0— no crash backtrace. Upstream’s default is on, and its Linux backtrace code usesexecinfo.h, which musl does not have.PCH=0— compile without precompiled headers, which upstream’s Makefile turns on by default.TESTS=0— withRUNTESTS=0: do not build the test program, and do not run it.ASTYLE=0— withLINTJSON=0: skip the source-style check and the JSON format check that aRELEASE=1build runs first. Neither changes what is built: the style check runsastyle, which is not a port, and the JSON check compiles upstream’s JSON formatter and runs it over every data file.
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/cataclysm-dda, 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 cataclysm-dda-0.I.1-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/cataclysm-dda, and runs the triggers its paths call for.
Contents
Installed programs: cataclysm-tiles, zzip.
Installed directories: /usr/share/cataclysm-dda, /usr/share/licenses/cataclysm-dda.
Notes
The mk function in build.sh passes the same variables to both make runs, the build and make install: the Makefile decides what to install from them, and an install run without TILES=1 and SOUND=1 would leave out the tilesets and the sound data.
Upstream installs a scalable SVG icon and a desktop entry. The desktop’s icon lookup reads PNGs only (see Desktop entries belong to the port), so build.sh removes the SVG, renders a 256-pixel PNG from it with rsvg-convert from librsvg, and replaces the entry with one that adds StartupWMClass=cataclysm-tiles, the window’s Wayland app id, which is SDL’s default, the executable’s name.