SUMMARY="A game interpreter to play RPG Maker games, using the libretro API"
DESCRIPTION="EasyRPG Player is a game interpreter to play RPG Maker 2000, 2003 \
and EasyRPG games. It uses the LCF parser library (liblcf) to read RPG Maker \
game data."
HOMEPAGE="https://easyrpg.org/"
COPYRIGHT="2007-2020 the EasyRPG team, the libretro team"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="45d197ee91c13bea6899a16c932cf8eee7ca270c"
SOURCE_URI="https://github.com/libretro/easyrpg-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="bee259d291937a00f3665e0036f1f362d9a07c2e9054cda42c3d66420a960876"
SOURCE_FILENAME="libretro-easyrpg-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="easyrpg-libretro-$srcGitRev"
ADDITIONAL_FILES="easyrpg_libretro.info.in"

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

PROVIDES="
	easyrpg_libretro$secondaryArchSuffix = $portVersion
	addon:easyrpg_libretro$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	retroarch$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

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

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