SUMMARY="A port of Vecx, a GCE Vectrex emulator to the libretro API"
DESCRIPTION="Vecx is a GCE Vectrex emulator, a vector display-based home video \
game console that was developed by Western Technologies/Smith Engineering. It \
had an integrated vector monitor, was monochrome and used plastic screen \
overlays (also emulated by Vecx) to simulate color and various static graphics \
and decorations. This is the libretro port of Vecx."
HOMEPAGE="https://www.valavan.net/vectrex.html"
COPYRIGHT="2002-2018 Valavan Manohararajah, John Hawthorn, the libretro team"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="28d6efc8972313903d0802a736ff8c3bc115e78f"
SOURCE_URI="https://github.com/libretro/libretro-vecx/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="8584af54ce532c4bb37a20a023eda9fcfa90a5d2bea66d5d65abeeab183836eb"
SOURCE_FILENAME="libretro-vecx-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="libretro-vecx-$srcGitRev"
ADDITIONAL_FILES="vecx_libretro.info.in"

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

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

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

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

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