SUMMARY="A port of DosBox to the libretro architecture"
DESCRIPTION="DOSBox is a DOS emulator that also emulates CPU:286/386 \
realmode/protected mode, Directory FileSystem/XMS/EMS, \
Tandy/Hercules/CGA/EGA/VGA/VESA graphics, a SoundBlaster/Gravis Ultra Sound \
card for excellent sound compatibility with older games, and more."
HOMEPAGE="https://www.dosbox.com/"
COPYRIGHT="2000-2020 Dosbox team, the libretro team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="aa71b67d54eaaf9e41cdd3cb5153d9cff0ad116e"
SOURCE_URI="https://github.com/libretro/dosbox-libretro/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="5ed77ba6cc864ede7d2bdd51f36dc4b8f0adf77f7058fc3c7f8413f689222854"
SOURCE_FILENAME="dosbox-libretro-${portVersion/_/-}-$srcGitRev.tar.gz"
SOURCE_DIR="dosbox-libretro-$srcGitRev"
ADDITIONAL_FILES="dosbox_libretro.info.in"

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

PROVIDES="
	dosbox_libretro$secondaryArchSuffix = $portVersion
	addon:dosbox_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/dosbox_libretro.info.in \
		> dosbox_libretro.info
	make -f Makefile.libretro GIT_VERSION=${srcGitRev:0:7} $jobArgs
}

INSTALL()
{
	install -m 0755 -d "$docDir"
	install -m 0644 -t "$docDir" AUTHORS COPYING NEWS PORTING README \
		README.DOSBOX THANKS
	install -m 0755 -d "$addOnsDir"/libretro
	install -m 0644 -t "$addOnsDir"/libretro \
		dosbox_libretro.info \
		dosbox_libretro.so
}
