SUMMARY="A port of OpenLara, a Tomb Raider engine, to the libretro architecture"
DESCRIPTION="OpenLara is an open source implementation of the Tomb Raider \
game engine, allowing you to play the original Tomb Raider on any platform \
OpenLara is ported on. Original game files are required to play."
HOMEPAGE="http://xproger.info/projects/OpenLara/"
COPYRIGHT="2016-2020 XProger, the libretro team"
LICENSE="BSD (2-clause)"
REVISION="1"
srcGitRev="0b887fd8097c99d940ab7c253e92496dd2334af8"
SOURCE_URI="https://github.com/libretro/OpenLara/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="a926ec1a2d07e494d8a326e5c65a57549a52a1869d32fe73d4b583ac57d8d628"
SOURCE_FILENAME="libretro-openlara-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="OpenLara-$srcGitRev"
ADDITIONAL_FILES="openlara_libretro.info.in"

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

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

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

BUILD()
{
	sed -e "s/@DISPLAY_VERSION@/v${portVersion/_/-}/" \
		$portDir/additional-files/openlara_libretro.info.in \
		> openlara_libretro.info
	make -C src/platform/libretro $jobArgs clean && \
	make -C src/platform/libretro $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 \
		openlara_libretro.info \
		src/platform/libretro/openlara_libretro.so
}
