SUMMARY="A 2D racing game"
DESCRIPTION="The goal is to reach the finish line within the stages without \
running out of time, hitting other cars or running out of fuel (fuel is \
refilled by hitting a special type of car)."
HOMEPAGE="http://www2.braingames.getput.com/roadf/"
COPYRIGHT="2003-2009 Brain Games"
LICENSE="GNU GPL v2"
REVISION="4"
SOURCE_URI="http://braingames.jorito.net/roadfighter/downloads/roadfighter.src_1.0.1269.tgz"
CHECKSUM_SHA256="88d97bd2fdad4f0e7a722a55076a1b191f086c6bb508152b24a6bf0fcfec4d3b"
PATCHES="roadfighter-$portVersion.patchset"

ARCHITECTURES="all ?x86"

PROVIDES="
	roadfighter = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	lib:libSDL_sound_1.0$secondaryArchSuffix
	lib:libSDL_ttf_2.0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	devel:libSDL$secondaryArchSuffix
	devel:libSDL_image$secondaryArchSuffix
	devel:libSDL_mixer$secondaryArchSuffix
	devel:libSDL_sound$secondaryArchSuffix
	devel:libSDL_ttf$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	haiku_devel
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	make LDFLAGS=-lbe $jobArgs
}

INSTALL()
{
	installDir=$appsDir/"Road Fighter"
	mkdir -p "$installDir"
	make install PREFIX="$installDir" GAMEDIR="$installDir"
	rm -rf "$installDir"/share/{applications,pixmaps}

	cd "$installDir"
	echo -e "#!/bin/sh\n`cat roadfighter`" > roadfighter

	addAppDeskbarSymlink "$installDir/roadfighter" "Road Fighter"
}
