SUMMARY="A port of FCEUMM, a Famicom/NES emulator to the libretro architecture"
DESCRIPTION="FCEUMM is a fork of FCEU Ultra which supports a lot of new \
mappers including some obscure mappers such as one for unlicensed NES ROMs."
HOMEPAGE="http://cah4e3.shedevr.org.ru/fceultra.php"
COPYRIGHT="2011-2018 the FCEU team, cah4e3, the libretro team"
LICENSE="GNU LGPL v2"
REVISION="1"
srcGitRev="02b5bbf26981b5ae0da81a9f312cb51ed64112b8"
SOURCE_URI="https://github.com/libretro/libretro-fceumm/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="1c293933d9c949660138cc9df434fabd932bcecf557dd2588f53c338cc0e94d8"
SOURCE_FILENAME="libretro-fceumm-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="libretro-fceumm-$srcGitRev"
ADDITIONAL_FILES="fceumm_libretro.info.in"

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

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

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" Authors Copying changelog.txt README.md \
		whatsnew.txt zzz_todo.txt
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		fceumm_libretro.info \
		fceumm_libretro.so
}
