SUMMARY="A port of Yabause, a Sega Saturn emulator to the libretro API"
DESCRIPTION="Yabause is a Sega Saturn emulator licensed under the GPL2+. \
In order to use it you will need at least one Sega Saturn BIOS that cannot \
be provided with this emulator for copyright reasons."
HOMEPAGE="https://yabause.org/"
COPYRIGHT="2003-2019 Guillaume Duhamel, Theo Berkau, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="c940fe68461cb2bc6dd98cc162b46813ba12b081"
SOURCE_URI="https://github.com/libretro/yabause/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="f86dbce7c1936d6ea884ba6e7f2e4247e7899caf371e17cd1b6223a047dbc4af"
SOURCE_FILENAME="libretro-yabause-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="yabause-$srcGitRev"
ADDITIONAL_FILES="yabause_libretro.info.in"

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

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

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

BUILD()
{
	sed -e "s/@DISPLAY_VERSION@/v${portVersion/_/-}/" \
		$portDir/additional-files/yabause_libretro.info.in \
		> yabause_libretro.info
	cd yabause/src/libretro && 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 \
		yabause_libretro.info \
		yabause/src/libretro/yabause_libretro.so
}
