SUMMARY="A port of Desmume, a Nintendo DS emulator for the libretro API"
DESCRIPTION="A port of the mature and longstanding DeSmuME emulator for \
Nintendo's DS console to libretro. The core has very good compatibility \
and many modern features, including increased internal resolution (very \
demanding)."
HOMEPAGE="http://desmume.org/"
COPYRIGHT="2006-2021 YopYop156, Zeromus, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="7ea0fc96804fcd9c8d33e8f76cf64b1be50cc5ea"
SOURCE_URI="https://github.com/libretro/desmume/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="5da45ba5fb269fa47a2c2674459fd5a074d0b94fcea5c7ce9bb63a678c010488"
SOURCE_FILENAME="desmume-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="desmume-$srcGitRev"
ADDITIONAL_FILES="desmume_libretro.info.in"

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

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

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

BUILD()
{
	sed -e "s/@DISPLAY_VERSION@/v${portVersion/_/-}/" \
		$portDir/additional-files/desmume_libretro.info.in \
		> desmume_libretro.info
	make -C desmume/src/frontend/libretro/ $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 \
		desmume_libretro.info \
		desmume/src/frontend/libretro/desmume_libretro.so
}
