SUMMARY="Enhanced clone of the classic first-person shooter Doom"
DESCRIPTION="PrBoom+ is a Doom source port developed from the original PrBoom \
project by Andrey Budko"
HOMEPAGE="http://prboom-plus.sourceforge.net/"
COPYRIGHT="2016 Andrey Budko et al."
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/coelckers/prboom-plus/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="fed5553509c5e7211a02d159c212c61030dbc7e8bb1ed0adfecfad573074191b"
SOURCE_DIR="prboom-plus-$portVersion"
PATCHES="prboom_plus-$portVersion.patch"

ARCHITECTURES="all !x86_gcc2 ?x86"

commandBinDir="$binDir/toto"
if [ "$targetArchitecture" = "x86_gcc2" ]; then
	SECONDARY_ARCHITECTURES="x86"
	commandBinDir="$prefix/bin"
fi

PROVIDES="
	prboom_plus$secondaryArchSuffix = $portVersion
	cmd:prboom_plus = $portVersion
	cmd:prboom_plus_game_server = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libmad$secondaryArchSuffix
	lib:libpcreposix$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libSDL2_image_2.0$secondaryArchSuffix
	lib:libSDL2_mixer_2.0$secondaryArchSuffix
	lib:libSDL2_net_2.0$secondaryArchSuffix
	lib:libvorbisfile$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libmad$secondaryArchSuffix
	devel:libpcreposix$secondaryArchSuffix
	devel:libSDL2$secondaryArchSuffix
	devel:libSDL2_image$secondaryArchSuffix
	devel:libSDL2_mixer$secondaryArchSuffix
	devel:libSDL2_net$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	mkdir -p build && cd build
	cmake ../prboom2 $cmakeDirArgs \
		-DCMAKE_INSTALL_BIN=$commandBinDir \
		-DDOOMWADDIR="$dataDir/prboom-plus"
	make $jobArgs
}

INSTALL()
{
	cd build
	make install
}
