SUMMARY="Genesis Plus GX Wide, a Sega 8/16bit emulator to the libretro API"
DESCRIPTION="Genesis Plus GX is a Sega Genesis, Mega-CD, Game Gear, SG-1000 \
and Master System (Mark-III) emulator. Its main focuses are accuracy and \
performance. It is based off the original Genesis Plus by Charles McDonald. \
This is a fork which adds true widescreen support to the original core."
HOMEPAGE="https://github.com/libretro/Genesis-Plus-GX-Wide"
COPYRIGHT="1998-2021 Charles McDonald, Eke-eke, heyjoeway, the libretro team"
LICENSE="GenesisPlusGX
	GNU LGPL v2.1
	LIBCHDR
	LibPNG
	Xiph
	Zlib"
REVISION="1"
srcGitRev="73c298b106610055be4bffd4f5eb996c6bf83aee"
SOURCE_URI="https://github.com/libretro/Genesis-Plus-GX-Wide/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="ca0ffa0e4352cd92f862d79b2c606440614831ffbfe34454091dce4388577d9a"
SOURCE_FILENAME="libretro-genesis-plus-gx-wide-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="Genesis-Plus-GX-Wide-$srcGitRev"
ADDITIONAL_FILES="genesis_plus_gx_wide_libretro.info.in"

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

PROVIDES="
	genesis_plus_gx_wide_libretro$secondaryArchSuffix = $portVersion
	addon:genesis_plus_gx_wide_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/genesis_plus_gx_wide_libretro.info.in \
		> genesis_plus_gx_wide_libretro.info
	make -f Makefile.libretro $jobArgs
}

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