SUMMARY="A port of bsnes to the libretro architecture"
DESCRIPTION="bsnes is a SNES, NES, and Game Boy (DMG), Color, and Advance \
emulator. It has a focus on accuracy, but also on speed and can also emulate \
the Super Game Boy."
HOMEPAGE="http://wiki.libretro.com/index.php?title=Bsnes"
SOURCE_URI="https://github.com/libretro/bsnes-libretro/archive/4a98250c9bf814d3b48ae8e7836a72115823c05a.tar.gz"
CHECKSUM_SHA256="ae3742fdffce9581ff92ce56bd407dd53afe60efa6efa044bde79f3d89629c39"
SOURCE_DIR="bsnes-libretro-4a98250c9bf814d3b48ae8e7836a72115823c05a"
REVISION="1"
LICENSE="GNU GPL v3"
COPYRIGHT="2014-2015 byuu, the libretro team"

ARCHITECTURES="?x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	bsnes_libretro$secondaryArchSuffix = $portVersion
	lib:bsnes_libretro$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	"

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

BUILD()
{
	make $jobArgs ui=target-libretro
}

INSTALL()
{
	mkdir -p $libDir
	cp -a out/bsnes_libretro.so $libDir
}
