SUMMARY="A port of blastem to the libretro architecture"
DESCRIPTION="A port of the BlastEm Sega Genesis/Mega Drive emulator to \
libretro. This emulator is focused on being both extremely accurate and \
extremely fast. While it is not as mature as Genesis Plus GX, its extreme \
accuracy makes it capable of running many demos and test ROMs that choke \
other emulators, including the notoriously complex Titan Overdrive I and II \
demos."
HOMEPAGE="https://www.retrodev.com/blastem/"
COPYRIGHT="2014-2021 Michael Pavone, the libretro team"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="0786858437ed71996f43b7af0fbe627eb88152fc"
SOURCE_URI="https://github.com/libretro/blastem/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="e813d205dd3fd85f6ac4d6c2b96ad46c289e289eb4f725f61bf02165d0478ca0"
SOURCE_FILENAME="blastem-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="blastem-$srcGitRev"
ADDITIONAL_FILES="blastem_libretro.info.in"

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

PROVIDES="
	blastem_libretro$secondaryArchSuffix = $portVersion
	addon:blastem_libretro$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	retroarch$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

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

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

INSTALL()
{
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro blastem_libretro.so blastem_libretro.info
}
