62 lines
2 KiB
Bash
62 lines
2 KiB
Bash
# Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
|
|
# See LICENSE.md for license information.
|
|
# SPDX-License-Identifier: MIT
|
|
#
|
|
# Hatari 2.4.1: the Atari ST emulator. The ST gates parse its trace and
|
|
# debugger output as Hatari 2.4 prints them. Debian and Ubuntu package
|
|
# 2.4.1; Fedora ships a different version, so on dnf systems 2.4.1 is built
|
|
# from source into toolchains/opt/hatari.
|
|
|
|
compDescription="emulator: Hatari 2.4.1 (Atari ST; distribution package, source build on dnf)"
|
|
compGroups="emulator:atarist"
|
|
compRequires="host"
|
|
compUrl="https://framagit.org/hatari/hatari.git"
|
|
compCommit="4371dcd647fc85d31c0629400adaeaa4212040d9"
|
|
if [ "$(distroFamily)" = "dnf" ]; then
|
|
hatariBin="$compDir/bin/hatari"
|
|
compHostDeps="build-tools make cmake git sdl2-dev zlib-dev png-dev readline-dev"
|
|
compPin="$compCommit"
|
|
else
|
|
hatariBin="$(command -v hatari || true)"
|
|
compHostDeps="hatari"
|
|
compPin="distro"
|
|
fi
|
|
|
|
|
|
compInstall() {
|
|
local src
|
|
if [ "$compPin" = "distro" ]; then
|
|
[ -n "$hatariBin" ] || die "hatari is not on PATH after installing host packages"
|
|
return 0
|
|
fi
|
|
src="$(freshBuildDir "$compId")"
|
|
gitFetchCommit "$compUrl" "$compCommit" "$src"
|
|
cmake -S "$src" -B "$src/build" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$compDir"
|
|
cmake --build "$src/build" -j"$JOEY_JOBS"
|
|
rm -rf "$compDir"
|
|
cmake --install "$src/build"
|
|
dropBuildDir "$compId"
|
|
}
|
|
|
|
|
|
compInstalled() {
|
|
[ -n "$hatariBin" ] && [ -x "$hatariBin" ]
|
|
}
|
|
|
|
|
|
compVerify() {
|
|
local version
|
|
# It prints a blank line first and exits 1, so match anywhere.
|
|
version="$("$hatariBin" --version 2>&1 || true)"
|
|
[[ "$version" == *"Hatari v"* ]] || return 1
|
|
# Another version still runs programs; only the gates may disagree.
|
|
if [[ "$version" != *"Hatari v2.4"* ]]; then
|
|
version="${version#$'\n'}"
|
|
warn "found '${version%%$'\n'*}'; the ST gates were written against Hatari 2.4.x"
|
|
fi
|
|
}
|
|
|
|
|
|
compEnv() {
|
|
envVar HATARI "$hatariBin"
|
|
}
|