SUMMARY="Doom source port that accurately reproduces the experience of Doom"
DESCRIPTION="Chocolate Doom is a source port of the game Doom, by id Software. \
The purpose of Chocolate Doom is to be as compatible as possible with the \
original DOS version of Doom."
HOMEPAGE="https://www.chocolate-doom.org/"
COPYRIGHT="Id Software Inc. 1993-1996
	Simon Howard
	James Haley
	Samuel Villarreal"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://www.chocolate-doom.org/downloads/$portVersion/chocolate-doom-$portVersion.tar.gz"
CHECKSUM_SHA256="d435d6177423491d60be706da9f07d3ab4fabf3e077ec2a3fc216e394fcfc8c7"
SOURCE_DIR="chocolate-doom-$portVersion"

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

PROVIDES="
	chocolate_doom$secondaryArchSuffix = $portVersion
	cmd:chocolate_doom$secondaryArchSuffix = $portVersion
	cmd:chocolate_doom_setup$secondaryArchSuffix = $portVersion
	cmd:chocolate_heretic$secondaryArchSuffix = $portVersion
	cmd:chocolate_heretic_setup$secondaryArchSuffix = $portVersion
	cmd:chocolate_hexen$secondaryArchSuffix = $portVersion
	cmd:chocolate_hexen_setup$secondaryArchSuffix = $portVersion
	cmd:chocolate_server$secondaryArchSuffix = $portVersion
	cmd:chocolate_setup$secondaryArchSuffix = $portVersion
	cmd:chocolate_strife$secondaryArchSuffix = $portVersion
	cmd:chocolate_strife_setup$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libsamplerate$secondaryArchSuffix
	lib:libsdl2_2.0$secondaryArchSuffix
	lib:libsdl2_mixer_2.0$secondaryArchSuffix
	lib:libsdl2_net_2.0$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libpng16$secondaryArchSuffix
	devel:libsamplerate$secondaryArchSuffix
	devel:libsdl2_2.0$secondaryArchSuffix
	devel:libsdl2_mixer_2.0$secondaryArchSuffix
	devel:libsdl2_net_2.0$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	python_imaging
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:install
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:python
	cmd:sed
	"

BUILD()
{
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	cd src
	mkdir -p $binDir
	cp chocolate-doom \
		chocolate-doom-setup \
		chocolate-hexen \
		chocolate-hexen-setup \
		chocolate-heretic \
		chocolate-heretic-setup \
		chocolate-server \
		chocolate-setup \
		chocolate-strife-setup \
		chocolate-strife $binDir
}
