SUMMARY="MSX/Coleco/SG-1000 emulator core for the libretro API"
DESCRIPTION="This is a libretro port of BlueMSX, originally an emulator of \
MSX/MSX2 computers. BlueMSX is now able to also emulate the Colecovision and \
the Sega SG-1000 systems."
HOMEPAGE="http://bluemsx.msxblue.com/"
COPYRIGHT="2003-2020 Daniel Vik, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="cfc1df4d026387883f21994bcce603c4a6be8730"
SOURCE_URI="https://github.com/libretro/blueMSX-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="fe5dee98a5732009fb7ce48f7111af3f212594f0876a14fe9dfa96fbfc6f6111"
SOURCE_FILENAME="libretro-bluemsx-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="blueMSX-libretro-$srcGitRev"
ADDITIONAL_FILES="bluemsx_libretro.info.in"

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

PROVIDES="
	bluemsx_libretro$secondaryArchSuffix = $portVersion
	addon:bluemsx_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/bluemsx_libretro.info.in \
		> bluemsx_libretro.info
	make -f Makefile.libretro $jobArgs
}

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