328.8. hatari-2.6.1
Atari ST, STE, TT and Falcon emulator, with the Hatari UI configuration front end
| Version | 2.6.1, release 2 |
| Shelf | emulators — Standalone emulators of computers and consoles, and compatibility layers |
| Phase | 44_apps (Applications), 115 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://www.hatari-emu.org/ |
| Build time | 0.3 SBU |
| Installed size | 18.2 MiB in 128 files |
| Recipe | ports/core/emulators/hatari/kpkgbuild |
About
Hatari emulates the Atari ST, STE, TT and Falcon computers, with a built-in debugger and disassembler. It is an SDL 2 program, drawn here by sdl2-compat on SDL 3. The port also installs the Hatari UI, hatariui, a Python GTK 3 front end for configuring and controlling the emulator. Hatari carries no TOS: the player supplies a TOS or EmuTOS image, and when none loads Hatari opens its settings dialog to choose one.
Sources
hatari-2.6.1.tar.gz(2.3 MiB)
sha25675f09c8deddb511b8c1574b84c507743097db9abc6edbb078f942efa8677547e
upstream: https://github.com/hatari/hatari/archive/refs/tags/v2.6.1.tar.gz
archive copy: sources-2/emulators--hatari-2.6.1.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, sdl2-compat, zlib, libpng, readline, portmidi, capstone, eudev, python3, python3-gobject, gtk3.
Required by: no port names it.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
-DCMAKE_DISABLE_FIND_PACKAGE_X11=ON, line 17: libX11 (explained with the switches below)
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 hatari'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/emulators/hatari.
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/hatari
echo '75f09c8deddb511b8c1574b84c507743097db9abc6edbb078f942efa8677547e hatari-2.6.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/hatari
SRC=$SRC_ROOT/hatari-2.6.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf hatari-2.6.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:
mkdir build && cd build
cmake .. -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_DISABLE_FIND_PACKAGE_X11=ON \
-DCMAKE_DISABLE_FIND_PACKAGE_CapsImage=ON \
-DENABLE_MAN_PAGES=ON \
-DENABLE_WERROR=OFF
ninja
DESTDIR=$PKG ninja install
cd ..
install -Dm644 gpl.txt "$PKG/usr/share/licenses/$name/gpl.txt"
test -x "$PKG/usr/bin/hatariui"
cat > "$PKG/usr/share/applications/hatari.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Hatari
GenericName=Atari ST Emulator
Comment=Emulate the Atari ST, STE, TT and Falcon computers
TryExec=hatari
Exec=hatari %f
Icon=hatari
Terminal=false
StartupWMClass=hatari
MimeType=application/x-st-disk-image;application/vnd.msa-disk-image;application/vnd.fastcopy-disk-image;application/x-stx-disk-image;
Categories=Game;Emulator;
Keywords=emulator;atari;atari st;ste;falcon;tos;retro;
DESKTOP
cat > "$PKG/usr/share/applications/hatariui.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Hatari UI
GenericName=Atari ST Emulator Front End
Comment=Configure and control the Hatari Atari ST emulator
TryExec=hatariui
Exec=hatariui
Icon=hatari
Terminal=false
StartupWMClass=hatariui.py
Categories=Game;Emulator;
Keywords=emulator;atari;atari st;hatari;settings;
DESKTOP
chmod 644 "$PKG/usr/share/applications/hatari.desktop" \
"$PKG/usr/share/applications/hatariui.desktop"
The switches, and why each is set:
-DCMAKE_DISABLE_FIND_PACKAGE_X11=ON— Do not look for X11. Its one use iscontrol.creparenting the emulator’s SDL window into the Hatari UI’s window through Xlib, compiled only when SDL’sSDL_config.halso definesSDL_VIDEO_DRIVER_X11, which sdl2-compat’s does not. With X11 found, the binary would link libX11 for code that is never compiled; the Hatari UI runs the emulator in a window of its own either way.-DCMAKE_DISABLE_FIND_PACKAGE_CapsImage=ON— Do not look for the closed CAPS library, which reads IPF, RAW and CTR disk images. It is not a port.-DENABLE_MAN_PAGES=ON— Build and install the manual pages. Upstream turns this on only when it findsgzip, which compresses each page; naming it makes a missinggzipa build failure rather than a package without manual pages.-DENABLE_WERROR=OFF— Do not compile with-Werror. Unset, the option is already off.
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/hatari, 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 hatari-2.6.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/hatari, and runs the triggers its paths call for.
Contents
Installed programs: atari-convert-dir, atari-hd-image, gst2ascii, hatari, hatari-prg-args, hatari_profile, hatariui, hmsa, zip2st.
Installed directories: /usr/share/doc/hatari, /usr/share/hatari, /usr/share/licenses/hatari.
Short descriptions
atari-convert-dir |
helper for creating Atari compatible disk images |
atari-hd-image |
tool for creating a harddisk image for use with Hatari |
gst2ascii |
Filter and output Atari program symbol table as ASCII |
hatari |
Atari ST/STE/TT/Falcon emulator |
hatari-prg-args |
autorun Atari programs with arguments |
hatari_profile |
Post-processor for Hatari profiler data |
hatariui |
Python/Gtk UI for Hatari |
hmsa |
Atari MSA / ST disk image creator and converter |
zip2st |
convert directory or .zip archive to .st disk image |
Notes
Every optional library is in depends, because each is found or quietly left out: zlib for zipped disk images, libpng for screenshots and AVI frames, readline for the debugger’s history, portmidi for MIDI, capstone for the disassembler, and eudev for the media-change detection of the NatFeats SCSI driver, which watches the host’s block devices.
The Hatari UI is built only when configure’s probe imports GTK 3 from Python, which python3-gobject and gtk3 in depends provide. The probe fails silently, so build.sh checks that hatariui was installed: without it the menu entry build.sh writes for it would name a program that is not there.
Both menu entries are replaced for StartupWMClass. Hatari sets SDL 2’s SDL_VIDEO_X11_WMCLASS to hatari with setenv() in main(), after sdl2-compat has carried the environment’s SDL 2 variables over to SDL 3, so SDL 3 takes the executable’s name, also hatari, as the Wayland app_id. The Hatari UI is PyGObject with no application id, so GTK takes the program name, the script’s base name, hatariui.py.