SUMMARY="A port of NekoP2, a NEC PC98 emulator, to the libretro API"
DESCRIPTION="Neko Project II is a PC-9801E emulator. The PC-9801E belongs to \
the non IBM compatible NEC PC-98xx family. This is the libretro port of NekoP2."
HOMEPAGE="https://www.yui.ne.jp/np2/"
COPYRIGHT="2005-2020 the NekoP2 team, the libretro team"
LICENSE="MIT"
REVISION="1"
srcGitRev="cd389b3490d5048873c40edd949a1b0631e0606d"
SOURCE_URI="https://github.com/libretro/libretro-meowPC98/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="6689487085533e6db9f95151ad202a7a04f0b6ddfcc9db87b32cbb34ed4ef4c0"
SOURCE_FILENAME="nekop2-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="libretro-meowPC98-$srcGitRev"
ADDITIONAL_FILES="nekop2_libretro.info.in"

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

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

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" readme.txt update.txt
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		nekop2_libretro.info \
		libretro/nekop2_libretro.so
}
