SUMMARY="A Mattel Intellivision emulator using the libretro API"
DESCRIPTION="FreeIntv is a libretro emulation core for the Mattel \
Intellivision designed to be compatible with joypads from the SNES era forward \
even if they originally required a number pad."
HOMEPAGE="http://neocomputer.org/projects/freeintv/"
COPYRIGHT="2018-2020 David Richardson, the libretro team"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="0058a09492c5c17a4fa59ebb3601ce66844b3b25"
SOURCE_URI="https://github.com/libretro/FreeIntv/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="7cc050bd8673cfd5be8ac5dc3320f7b1e662d348f85480bf3ee33343d8e2791d"
SOURCE_FILENAME="libretro-freeintv-$portVersion-$srcGitRev.tar.gz"
SOURCE_DIR="FreeIntv-$srcGitRev"
ADDITIONAL_FILES="freeintv_libretro.info.in"

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

PROVIDES="
	freeintv_libretro$secondaryArchSuffix = $portVersion
	addon:freeintv_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/freeintv_libretro.info.in \
		> freeintv_libretro.info
	make $jobArgs
}

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