SUMMARY="A port of the fMSX emulator for the libretro API"
DESCRIPTION="This is a libretro port of fMSX, a MSX emulator by legendary \
author Marat Fayzullin. It runs and MSX/MSX2/MSX2+ software."
HOMEPAGE="https://fms.komkon.org/fMSX/"
COPYRIGHT="1993-2020 Marat Fayzullin, the libretro team"
LICENSE="fMSX"
REVISION="1"
srcGitRev="179ae738fd794ab2312671eece58defb902c02a1"
SOURCE_URI="https://github.com/libretro/fmsx-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="e0496ee48cfd8abc4549ac15ca8ed0c77e39ed67ea04107685f843de528aa170"
SOURCE_FILENAME="libretro-fmsx-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="fmsx-libretro-$srcGitRev"
ADDITIONAL_FILES="fmsx_libretro.info.in"

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

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

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