SUMMARY="A port of Virtual Jaguar, an Atari Jaguar emulator to the libretro API"
DESCRIPTION="Virtual Jaguar is an Atari Jaguar emulator originally written by \
David Raingeard, based off CoJag sources by Aaron Giles of MAME fame. The \
Atari Jaguar was a the first 64-bit console on the market but never was able \
to compete commercially with the Sony PlayStation and the Sega Saturn. This is \
the libretro port of Virtual Jaguar."
HOMEPAGE="https://icculus.org/virtualjaguar/"
COPYRIGHT="2003-2018 Cal2, the Virtual Jaguar SDL team, the libretro team"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="d1b1b28a6ad2518b746e3f7537ec6d66db96ec57"
SOURCE_URI="https://github.com/libretro/virtualjaguar-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="d36e265e3e1409cb54de3b72b055a35c465b9f8c4f2064e77ed2d784671eb89a"
SOURCE_FILENAME="libretro-virtualjaguar-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="virtualjaguar-libretro-$srcGitRev"
ADDITIONAL_FILES="virtualjaguar_libretro.info.in"

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

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

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 \
		virtualjaguar_libretro.info \
		virtualjaguar_libretro.so
}
