328.9. stella-7.0c
Atari 2600 VCS emulator with a built-in debugger
| Version | 7.0c, release 1 |
| Shelf | emulators — Standalone emulators of computers and consoles, and compatibility layers |
| Phase | 44_apps (Applications), 116 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://stella-emu.github.io/ |
| Build time | 3.6 SBU |
| Installed size | 7.8 MiB in 95 files |
| Recipe | ports/core/emulators/stella/kpkgbuild |
About
Stella emulates the Atari 2600 Video Computer System, with a built-in debugger for the 6507 and the cartridge’s bank switching. It is an SDL 2 program, drawn here by sdl2-compat on SDL 3, with its own launcher and menus and no toolkit. The player supplies the cartridge ROMs.
Sources
stella-7.0c.tar.gz(7.3 MiB)
sha256b9309198aa5746cd568e91caaea10bbeab4ca8155493d0243694b41bdb39d7ca
upstream: https://github.com/stella-emu/stella/archive/refs/tags/7.0c.tar.gz
archive copy: sources-2/emulators--stella-7.0c.tar.gz
Dependencies
Depends on: pkgconf, sdl2-compat, zlib, libpng, sqlite.
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 stella'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/emulators/stella.
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/emulators/stella
echo 'b9309198aa5746cd568e91caaea10bbeab4ca8155493d0243694b41bdb39d7ca stella-7.0c.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/stella
SRC=$SRC_ROOT/stella-7.0c
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf stella-7.0c.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:
install -d "$SRC_ROOT/sdl-shim"
cat > "$SRC_ROOT/sdl-shim/sdl2-config" <<'SHIM'
#!/bin/sh
case "$1" in
--cflags) exec pkg-config --cflags sdl2 ;;
--libs) exec pkg-config --libs sdl2 ;;
--version) exec pkg-config --modversion sdl2 ;;
*) exit 1 ;;
esac
SHIM
chmod 755 "$SRC_ROOT/sdl-shim/sdl2-config"
./configure --prefix=/usr \
--with-sdl-prefix="$SRC_ROOT/sdl-shim" \
--enable-release \
--enable-gui \
--enable-sound \
--enable-debugger \
--enable-joystick \
--enable-cheats \
--enable-png \
--enable-zip \
--enable-windowed \
--enable-shared
make
make DESTDIR=$PKG install
cat > "$PKG/usr/share/applications/stella.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Stella
GenericName=Atari 2600 Emulator
Comment=Emulate the Atari 2600 Video Computer System
TryExec=stella
Exec=stella %f
Icon=stella
Terminal=false
StartupWMClass=stella
Categories=Game;Emulator;
Keywords=atari;2600;vcs;emulator;retro;
DESKTOP
chmod 644 "$PKG/usr/share/applications/stella.desktop"
The switches, and why each is set:
--with-sdl-prefix="$SRC_ROOT/sdl-shim"— Where configure looks forsdl2-config. configure takes SDL’s flags only from that script and has no other route, andsdl2-configdoes not exist here, sobuild.shwrites a small one into$SRC_ROOT/sdl-shimthat answers--cflags,--libsand--versionfrom pkg-config, which reads sdl2-compat’sProvides: sdl2.--enable-release— Build with every optimisation, for a release. Off by default upstream.--enable-gui— This switch and--enable-sound,--enable-debugger,--enable-joystick,--enable-cheats,--enable-png,--enable-zip,--enable-windowedand--enable-sharedare upstream’s defaults: the built-in interface, sound, the debugger, joysticks, cheat codes, PNG snapshots, zipped ROMs, windowed modes and a dynamically linked binary.
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/stella, 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 stella-7.0c-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/stella, and runs the triggers its paths call for.
Contents
Installed programs: stella.
Installed directories: /usr/share/doc/stella, /usr/share/licenses/stella.
Notes
zlib, libpng and SQLite, the store for settings and ROM properties, come from the system, and all three are in depends. A missing one does not stop configure: it compiles the copy of SQLite in src/lib/sqlite instead, and without libpng it drops PNG snapshots, and without zlib both PNG snapshots and zipped ROMs, printing only disabled.
PlusROM cartridges reach a high-score server over HTTP from inside the game. On a machine with no network the cartridge runs and its upload fails; nothing else in Stella goes online.
Upstream’s menu entry is replaced for StartupWMClass: SDL’s Wayland app_id is the executable’s name, stella.