SUMMARY="A port of NeoCD, a Neo Geo CD/CDZ emulator for libretro"
DESCRIPTION="NeoCD-Libretro is a complete rewrite of NeoCD from scratch in \
modern C++11. It is designed with accuracy and portability in mind rather \
than being all about speed like the older versions. The goal is also to \
document all that is known about the platform in the source code so other \
emulator authors can make their own implementations."
HOMEPAGE="https://github.com/libretro/neocd_libretro"
COPYRIGHT="2005-2021, Fabrice Martinez, the libretro team"
LICENSE="GNU LGPL v3"
REVISION="1"
srcGitRev="83d10f3be10fff2f28aa56fc674c687528cb7f5c"
SOURCE_URI="https://github.com/libretro/neocd_libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="0951342e93f856f9fc2d8baa385273e43794e6fee1b40680d69814039b054b03"
SOURCE_FILENAME="neocd-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="neocd_libretro-$srcGitRev"
ADDITIONAL_FILES="neocd_libretro.info.in"

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

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

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