SUMMARY="A standalone port of Mednafen Lynx to libretro"
DESCRIPTION="This is a standalone port of Mednafen Lynx to libretro, an Atari \
Lynx emulator. It is a fork of Handy."
HOMEPAGE="https://mednafen.github.io/documentation/lynx.html"
COPYRIGHT="2005-2018 Forgotten, the Mednafen team, the libretro team"
LICENSE="GNU GPL v2
	Zlib"
REVISION="1"
srcGitRev="cd470e4233b37489bb62ad397790880d8a15b58c"
SOURCE_URI="https://github.com/libretro/beetle-lynx-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="585ba053bc21111e392504b9669770acde586bbf2d6f09a2baac0de9bf03385a"
SOURCE_FILENAME="libretro-mednafen-lynx-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="beetle-lynx-libretro-$srcGitRev"
ADDITIONAL_FILES="mednafen_lynx_libretro.info.in"

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

PROVIDES="
	mednafen_lynx_libretro$secondaryArchSuffix = $portVersion
	addon:mednafen_lynx_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/mednafen_lynx_libretro.info.in \
		> mednafen_lynx_libretro.info
	make $jobArgs
}

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" COPYING
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		mednafen_lynx_libretro.info \
		mednafen_lynx_libretro.so
}
