SUMMARY="A Commodore Amiga emulator for the libretro API"
DESCRIPTION="A port of the PUAE Amiga emulator, which is itself a continuation \
of the E-UAE emulator, to libretro. The core has a built-in AROS fallback \
Kickstart that is compatible enough for some A500 games, but a proper \
KS ROM is preferred. This core is well-integrated with libretro and is the \
first option users should try when seeking to play Amiga games via libretro."
HOMEPAGE="https://github.com/libretro/libretro-uae"
COPYRIGHT="2014-2021, GnoStiC, Richard Drummond, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="3ec4903f23197ace99a451b77ff819eeb248da07"
SOURCE_URI="https://github.com/libretro/libretro-uae/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="ce989c40f340955d9f997334d50b884b38b9dc536fd1774edabfce022221a90b"
SOURCE_FILENAME="libretro-uae-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="libretro-uae-$srcGitRev"
ADDITIONAL_FILES="puae_libretro.info.in"

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

PROVIDES="
	puae_libretro$secondaryArchSuffix = $portVersion
	addon:uae_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/puae_libretro.info.in \
		> puae_libretro.info
	make $jobArgs GIT_VERSION=${srcGitRev:0:7}
}

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