SUMMARY="A ZX Spectrum emulator core for libretro"
DESCRIPTION="Fuse (the Free Unix Spectrum Emulator) was originally, and \
somewhat unsurprisingly, a ZX Spectrum emulator for Unix. However, it has now \
also been ported to libretro."
HOMEPAGE="http://fuse-emulator.sourceforge.net/"
COPYRIGHT="1999-2020, the Fuse team, the libretro team"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="23f7db522e1b9ad22a142e828d7c3631eb653142"
SOURCE_URI="https://github.com/libretro/fuse-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="bff4fed04eaf320025382f99c3ec45baae10300affe824584589682a06807c60"
SOURCE_FILENAME="fuse-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="fuse-libretro-$srcGitRev"
ADDITIONAL_FILES="fuse_libretro.info.in"

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

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

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