SUMMARY="A port of Gambatte, a Nintendo Game Boy emulator to the libretro API"
DESCRIPTION="Gambatte is an accuracy-focused, open-source, cross-platform \
Game Boy Color emulator written in C++. It is based on hundreds of corner case \
hardware tests, as well as previous documentation and reverse engineering \
efforts."
HOMEPAGE="https://github.com/sinamas/gambatte"
COPYRIGHT="2007-2018 Sindre Aamås, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="eb6f26a57ff6c35154950da20f83ddf1d44d4ca6"
SOURCE_URI="https://github.com/libretro/gambatte-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="0a0882e6fa282400bed64c320b0bd7d475d55e3a6e5a2b86acd1ee7ae0bc7f49"
SOURCE_FILENAME="gambatte-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="gambatte-libretro-$srcGitRev"
ADDITIONAL_FILES="gambatte_libretro.info.in"

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

PROVIDES="
	gambatte_libretro$secondaryArchSuffix = $portVersion
	addon:gambatte_libretro$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	retroarch$secondaryArchSuffix
	"

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

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

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" COPYING README.md
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		gambatte_libretro.info \
		gambatte_libretro.so
}
