SUMMARY="A port of Handy, an Atari Lynx emulator for the libretro API"
DESCRIPTION="Handy is an emulator of the Atari Lynx handheld. It requires the \
Lynx BIOS to boot and start games."
HOMEPAGE="http://handy.sourceforge.net/"
COPYRIGHT="1997-2018 Keith Wilkins, the libretro team"
LICENSE="Zlib"
REVISION="1"
srcGitRev="ebcbb8be5d174306ffb091b7657637b910fc35d2"
SOURCE_URI="https://github.com/libretro/libretro-handy/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="97077c4b7b9b25893ea028322326ba2b36094fed805454f28ce0a6a1bb291d96"
SOURCE_FILENAME="handy-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="libretro-handy-$srcGitRev"
ADDITIONAL_FILES="handy_libretro.info.in"

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

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

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