SUMMARY="An Atari 8-bit computer and 5200 console emulator core for libretro"
DESCRIPTION="This is a free and portable Atari 8-bit computer and 5200 console \
emulator, originally written by David Firth and now developed by the Atari800 \
Development Team."
HOMEPAGE="https://atari800.github.io/"
COPYRIGHT="2001-2018, the Atari800 Dev team, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="478a8ec99a7f8436a39d5ac193c5fe313233ee7b"
SOURCE_URI="https://github.com/libretro/libretro-atari800/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="10a13295036cdc27d28852e348227c874f5c0f14bc41b9c4f2fc3e4473a66c6c"
SOURCE_FILENAME="libretro-atari800-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="libretro-atari800-$srcGitRev"
ADDITIONAL_FILES="atari800_libretro.info.in"

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

PROVIDES="
	atari800_libretro$secondaryArchSuffix = $portVersion
	addon:atari800_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/atari800_libretro.info.in \
		> atari800_libretro.info
	make $jobArgs GIT_VERSION=${srcGitRev:0:7}
}

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" atari800/DOC/BUGS atari800/DOC/CREDITS \
		atari800/DOC/ChangeLog atari800/DOC/FAQ atari800/DOC/NEWS \
		atari800/DOC/README atari800/DOC/TODO atari800/DOC/USAGE \
		atari800/DOC/*.txt
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		atari800_libretro.info \
		atari800_libretro.so
}
