SUMMARY="A DOS-Emulator that uses SDL library"
DESCRIPTION="DOSBox is a DOS-emulator that uses the SDL-library which makes \
DOSBox very easy to port to different platforms. DOSBox has already been \
ported to many different platforms, such as Windows, BeOS, Linux, MacOS X...
DOSBox 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...
You can re-live the good old days with the help of DOSBox, it can run plenty \
of the old classics that don't run on your new computer!
DOSBox is totally free of charge and OpenSource."
HOMEPAGE="https://www.dosbox.com/"
COPYRIGHT="2002-2019 The DOSBox Team"
LICENSE="GNU GPL v2"
REVISION="1"
upstreamVersion="0.74-3"
SOURCE_URI="http://sourceforge.net/projects/dosbox/files/dosbox/$upstreamVersion/dosbox-$upstreamVersion.tar.gz"
SOURCE_DIR="dosbox-$upstreamVersion"
CHECKSUM_SHA256="c0d13dd7ed2ed363b68de615475781e891cd582e8162b5c3669137502222260a"
PATCHES="dosbox-$portVersion.patchset"
ADDITIONAL_FILES="dosbox.rdef"

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

PROVIDES="
	dosbox$secondaryArchSuffix = $portVersion
	apps:dosbox = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libglu$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libsdl_1.2$secondaryArchSuffix
	lib:libsdl_net_1.2$secondaryArchSuffix
	lib:libsdl_sound_1.0$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libglu$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libsdl_1.2$secondaryArchSuffix
	devel:libsdl_net_1.2$secondaryArchSuffix
	devel:libsdl_sound_1.0$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	autoreconf -vfi
	# Dynamic core x86 and fpu-x86 available on on x86 cpu
	LDFLAGS=-lnetwork runConfigure ./configure \
		--enable-core-inline \
		--enable-dynamic-core \
		--enable-dynamic-x86 \
		--enable-dynrec \
		--enable-fpu \
		--enable-fpu-x86 \
		--enable-unaligned_memory \
		--enable-opengl
	make $jobArgs
}

INSTALL()
{
	make install

	mkdir $appsDir
	mv $binDir/dosbox $appsDir/DOSBox
	rm -rf $binDir
	strip $appsDir/DOSBox

	addResourcesToBinaries $portDir/additional-files/dosbox.rdef $appsDir/DOSBox
	addAppDeskbarSymlink $appsDir/DOSBox
}
