SUMMARY="A port of Caprice32, an Amstrad CPC emulator, to the libretro API"
DESCRIPTION="Caprice32 is a software emulator of the Amstrad CPC 8bit home \
computer series. The emulator imitates the CPC464, CPC664 and CPC6128 models."
HOMEPAGE="https://sourceforge.net/projects/caprice32/"
COPYRIGHT="1997-2020 Ulrich Doewich, dantoine, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="06ba0e50b260b4f55c405a0924f33c0baaf1c987"
SOURCE_URI="https://github.com/libretro/libretro-cap32/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="7f4f2e3f2ed580286a0d8129a82976fa88aef07f2f26e4e15a95e0271494ecae"
SOURCE_FILENAME="cap32-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="libretro-cap32-$srcGitRev"
ADDITIONAL_FILES="cap32_libretro.info.in"

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

PROVIDES="
	cap32_libretro$secondaryArchSuffix = $portVersion
	addon:cap32_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/cap32_libretro.info.in \
		> cap32_libretro.info
	make $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 \
		cap32_libretro.info \
		cap32_libretro.so
}
