326.3. brogue-ce-1.15.1
Brogue Community Edition — a roguelike of 26 dungeon levels, drawn in SDL2 tiles or glyphs
| Version | 1.15.1, release 1 |
| Shelf | games-rpg — RPGs, roguelikes and interactive fiction |
| Phase | 44_apps (Applications), 190 of 422 in build order |
| Licence | AGPL-3.0-or-later |
| Homepage | https://github.com/tmewett/BrogueCE |
| Build time | 0.6 SBU |
| Installed size | 2.2 MiB in 10 files |
| Recipe | ports/core/games-rpg/brogue-ce/kpkgbuild |
About
Brogue CE, the community edition of Brogue, is a roguelike of 26 dungeon levels, played for the Amulet of Yendor, with a small set of rules and a lot of interaction between monsters, terrain and items. This port builds only its graphical front end, which draws with SDL2 either as tiles or as glyphs; the game is brogue.
Sources
brogue-ce-1.15.1.tar.gz(1.3 MiB)
sha2562abc186c5327342cb9ad7e45d41096ab10797d5ba76dcac843824ac2a0bfb3ac
upstream: https://github.com/tmewett/BrogueCE/archive/refs/tags/v1.15.1.tar.gz
archive copy: sources-2/games-rpg--brogue-ce-1.15.1.tar.gz
Dependencies
Depends on: sdl2-compat, sdl2-image, pkgconf.
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 brogue-ce'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/games-rpg/brogue-ce.
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/brogue-ce
echo '2abc186c5327342cb9ad7e45d41096ab10797d5ba76dcac843824ac2a0bfb3ac brogue-ce-1.15.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/brogue-ce
SRC=$SRC_ROOT/brogue-ce-1.15.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf brogue-ce-1.15.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
make \
SDL_CONFIG='pkg-config sdl2' \
DATADIR=/usr/share/brogue-ce \
TERMINAL=NO GRAPHICS=YES RELEASE=YES
install -Dm755 bin/brogue "$PKG/usr/libexec/brogue-ce/brogue"
install -Dm644 bin/keymap.txt "$PKG/usr/share/brogue-ce/keymap.txt"
install -d "$PKG/usr/share/brogue-ce/assets"
install -m644 bin/assets/* "$PKG/usr/share/brogue-ce/assets/"
install -Dm644 bin/assets/icon.png \
"$PKG/usr/share/icons/hicolor/256x256/apps/brogue-ce.png"
install -Dm644 LICENSE.txt "$PKG/usr/share/licenses/brogue-ce/LICENSE.txt"
install -d "$PKG/usr/bin"
cat > "$PKG/usr/bin/brogue" <<'KDOS_SH'
#!/bin/sh
dir="${XDG_DATA_HOME:-$HOME/.local/share}/brogue-ce"
mkdir -p "$dir"
cd "$dir" || exit 1
exec /usr/libexec/brogue-ce/brogue "$@"
KDOS_SH
chmod 755 "$PKG/usr/bin/brogue"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/brogue-ce.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Brogue CE
GenericName=Roguelike
Comment=Descend 26 levels of the Dungeons of Doom for the Amulet of Yendor
Exec=brogue
Icon=brogue-ce
Terminal=false
StartupWMClass=brogue
Categories=Game;RolePlaying;
Keywords=roguelike;dungeon;brogue;rpg;
DESKTOP
chmod 644 "$PKG/usr/share/applications/brogue-ce.desktop"
The switches, and why each is set:
SDL_CONFIG='pkg-config sdl2'— the command the Makefile runs for SDL2’s compile and link flags. Its default issdl2-config, which sdl2-compat does not install, sopkg-config sdl2answers instead with the same--cflagsand--libsarguments.DATADIR=/usr/share/brogue-ce— compiled in as the directory the game readsassets/from: the tile sheet, its table and the window icon. The default is., the directory the program is run from.TERMINAL=NO— withGRAPHICS=YES: the SDL2 front end only, without the ncurses one for a terminal. Both are upstream’s defaults, named.RELEASE=YES— a release build. Otherwise the Makefile runstools/git-extra-version, which, with no git repository to ask, appends-devto the version string the game shows.
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/brogue-ce, 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 brogue-ce-1.15.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/brogue-ce, and runs the triggers its paths call for.
Contents
Installed programs: brogue.
Installed directories: /usr/libexec/brogue-ce, /usr/share/brogue-ce, /usr/share/licenses/brogue-ce.
Notes
Brogue writes its saves, recordings and high scores into its working directory. Started from the menu that would be the home directory, or / for a launcher that sets none, so the program itself installs as /usr/libexec/brogue-ce/brogue, and the brogue in /usr/bin is a small script written by build.sh that creates ${XDG_DATA_HOME:-$HOME/.local/share}/brogue-ce, changes into it and starts the game there.
The key map is not under DATADIR: the game opens keymap.txt in its working directory, the save directory above. The copy installed as /usr/share/brogue-ce/keymap.txt, every line of it commented out, is the documented sample a player copies there to rebind keys.
The Makefile has no install target, so build.sh installs the program, the key map, the assets, the icon and the licence by hand. The executable keeps the name brogue, which is SDL’s default Wayland app id, so StartupWMClass=brogue matches the window although the command the entry runs is the script.