SUMMARY="A port of Final Burn Neo to the libretro architecture"
DESCRIPTION="Final Burn Neo is a multi-systems Arcade Emulator most popular \
for emulating Neo-Geo, Capcom, Konami, and Cave games. It is developed by the \
Final Burn team and originated from FinalBurn by Dave."
HOMEPAGE="https://github.com/libretro/FBNeo"
COPYRIGHT="2000-2019 the Final Burn team, the libretro team"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="8e9f73ab28fc6176f0bde53eac0f0b561b065e16"
SOURCE_URI="https://github.com/libretro/FBNeo/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="03999ace4fafd68fdb540c966909b3fd97e34950b1951f97387bcca9852a7e73"
SOURCE_FILENAME="fbneo-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="FBNeo-$srcGitRev"
ADDITIONAL_FILES="fbneo_libretro.info.in"

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

PROVIDES="
	fbneo_libretro$secondaryArchSuffix = $portVersion
	addon:fbneo_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/fbneo_libretro.info.in \
		> fbneo_libretro.info
	cd src/burner/libretro
	make -f Makefile $jobArgs GIT_VERSION=${srcGitRev:0:7}
}

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