SUMMARY="A libretro core for Game & Watch simulators"
DESCRIPTION="gw-libretro is a libretro core that runs Game & Watch simulators. \
It runs simulators converted from source code. The converted games are \
available at libretro's buildbot site. Unpack the zip and read the README.txt \
for instructions."
HOMEPAGE="https://bot.libretro.com/assets/cores/Handheld%20Electronic%20Game/"
COPYRIGHT="2013-2018 the libretro team"
LICENSE="Zlib
	Public Domain"
REVISION="1"
srcGitRev="0f1ccca156388880bf4507ad44741f80945dfc6f"
SOURCE_URI="https://github.com/libretro/gw-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="bca59f2f7f1384e9a20db1d7dcfbe23ef288785d94dc3aabf7ab8a80d25e51cd"
SOURCE_FILENAME="gw-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="gw-libretro-$srcGitRev"
ADDITIONAL_FILES="gw_libretro.info.in"

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

PROVIDES="
	gw_libretro$secondaryArchSuffix = $portVersion
	addon:gw_libretro$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	retroarch$secondaryArchSuffix
	"

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

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

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