SUMMARY="A port of the EightyOne ZX-81 emulator to libretro"
DESCRIPTION="81-libretro is an work in progress port of the EightyOne \
(a.k.a. THE Sinclair Emulator) to libretro. It's being developed on Windows \
with MinGW (64 bits) and Debian 8, and tested on RetroArch 1.2 frontend."
HOMEPAGE="https://github.com/libretro/81-libretro/"
COPYRIGHT="2008-2018 Michael D Wynne, the libretro team"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="7e8153cd5b88cd5cb23fb0c03c04e7c7d8a73159"
SOURCE_URI="https://github.com/libretro/81-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="db2266bdc6e6b552bc007cfc47b50fcf931c112321b5639a05ab014ab43035a6"
SOURCE_FILENAME="81-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="81-libretro-$srcGitRev"
ADDITIONAL_FILES="81_libretro.info.in"

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

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

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