SUMMARY="A port of PCSX ReArmed, a PlayStation emulator to the libretro API"
DESCRIPTION="PCSX ReArmed is a cross-platform Sony PlayStation emulator \
which can accurately play many games. This is the libretro core."
HOMEPAGE="http://notaz.gp2x.de/pcsx_rearmed.php"
COPYRIGHT="2012-2018, notaz, Exophase, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="589bd99ba31de8216624dbf0cbbc016f0663ce3d"
SOURCE_URI="https://github.com/libretro/pcsx_rearmed/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="1a190ebc5df71abcf3d59516e6e75e4db38acfa952f031c04e34c8b56545856f"
SOURCE_FILENAME="pcsx-rearmed-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="pcsx_rearmed-$srcGitRev"
ADDITIONAL_FILES="pcsx_rearmed_libretro.info.in"

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

PROVIDES="
	pcsx_rearmed_libretro$secondaryArchSuffix = $portVersion
	addon:pcsx_rearmed_libretro$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	retroarch$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:git
	cmd:make
	"

BUILD()
{
	sed -e "s/@DISPLAY_VERSION@/v${portVersion/_/-}/" \
		$portDir/additional-files/pcsx_rearmed_libretro.info.in \
		> pcsx_rearmed_libretro.info
	make $jobArgs -f Makefile.libretro
}

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