SUMMARY="A port of Hatari, an Atari 16/32bit computer emulator"
DESCRIPTION="Hatari is an Atari ST/STE/TT/Falcon emulator. The Atari ST was a \
16/32 bit computer system which was first released by Atari in 1985. Using the \
Motorola 68000 CPU, it was a very popular computer having quite a lot of CPU \
power at that time. Unlike many other Atari ST emulators which try to give you \
a good environment for running GEM applications, Hatari tries to emulate the \
hardware of a ST as close as possible so that it is able to run most of the \
old ST games and demos."
HOMEPAGE="https://hatari.tuxfamily.org/"
COPYRIGHT="2001-2020 Nicolas Pomarède, the Hatari team, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="cea06eebf695b078fadc0e78bb0f2b2baaca799f"
SOURCE_URI="https://github.com/libretro/hatari/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="41a044a0a5625052a4a477dca47897aafccd23d835dc20b43e41b37a38e64628"
SOURCE_FILENAME="hatari-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="hatari-$srcGitRev"
ADDITIONAL_FILES="hatari_libretro.info.in"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	hatari_libretro$secondaryArchSuffix = $portVersion
	addon:hatari_libretro$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	retroarch$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	sed -e "s/@DISPLAY_VERSION@/v${portVersion/_/-}/" \
		$portDir/additional-files/hatari_libretro.info.in \
		> hatari_libretro.info
	make -f Makefile.libretro $jobArgs
}

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" gpl.txt readme.txt
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		hatari_libretro.info \
		hatari_libretro.so
}
