SUMMARY="A port of gpSP, a Game Boy Advance emulator to the libretro API"
DESCRIPTION="gpSP was initially a Nintendo Game Boy Advance emulator for the \
Sony PlayStation Portable console, but is now available on various platforms \
thanks to its Libretro core."
HOMEPAGE="http://gpsp-dev.blogspot.com/"
COPYRIGHT="2007-2018 Exophase, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="be3fdfd0b4e0529d7e00c4e16eb26d92fe0559a6"
SOURCE_URI="https://github.com/libretro/gpsp/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="e6586d042b1b2646e05eb1a7d525dfa957c3d590319de49fd84ce2a9aea4313b"
SOURCE_FILENAME="gpsp-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="gpsp-$srcGitRev"
ADDITIONAL_FILES="gpsp_libretro.info.in"

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

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

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