SUMMARY="ScummVM, a Scumm interpreter core for the Libretro API"
DESCRIPTION="ScummVM is a program which allows you to run certain classic \
graphical point-and-click adventure games, provided you already have their \
data files. This is the libretro port of ScummVM."
HOMEPAGE="https://www.scummvm.org/"
COPYRIGHT="2001-2020 the ScummVM team, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="63e57573a9ffe71a1083ff46d9cd210203b87afb"
SOURCE_URI="https://github.com/libretro/scummvm/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="b5be836e068caf16418d3fde87c6ba436b31d87e1d9627855ba463bb0841a5d5"
SOURCE_FILENAME="libretro-scummvm-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="scummvm-$srcGitRev"
ADDITIONAL_FILES="scummvm_libretro.info.in"

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

PROVIDES="
	scummvm_libretro$secondaryArchSuffix = $portVersion
	addon:scummvm_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/scummvm_libretro.info.in \
		> scummvm_libretro.info
	cd backends/platform/libretro/build && make $jobArgs
}

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" AUTHORS CONTRIBUTING.md COPYING \
		COPYING.BSD COPYING.FREEFONT COPYING.LGPL COPYRIGHT \
		LIBRETRO_CMDLINE.md NEWS.md README.md TODO
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		scummvm_libretro.info \
		backends/platform/libretro/build/scummvm_libretro.so
}
