SUMMARY="Open Motorsport Simulator"
DESCRIPTION="Speed Dreams is a 3d cross-platform, open source motorsport simulation and racing game.

Speed Dreams is a fork of the open racing car simulator Torcs, aiming to implement exciting new \
features, cars, tracks and AI opponents to make a more enjoyable game for the player, as well as \
constantly improving visual and physics realism."
HOMEPAGE="http://www.speed-dreams.org/"
COPYRIGHT="2009 Jean-Philippe Meuret"
LICENSE="GNU GPL v2"
REVISION="3"
SOURCE_URI="http://sourceforge.net/projects/speed-dreams/files/2.0.0/speed-dreams-src-base-2.0.0-r4687.tar.xz"
CHECKSUM_SHA256="86d219caf26a9523345b2cc5fdb3d5daa1f7e272d409dc237ce5e2f0b37ae606"
SOURCE_DIR=""
SOURCE_URI_2="http://sourceforge.net/projects/speed-dreams/files/2.0.0/speed-dreams-src-partial-build-patch-2.0.0-r4687.tar.xz"
CHECKSUM_SHA256_2="1f01189b9af4bce3ed9de3e7fc16ca7bfa65f17b4c2ed3d3881537e880a0351c"
PATCHES="speed_dreams-$portVersion.patchset"

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

PROVIDES="
	speed_dreams$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libenet$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libenet$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libplibnet$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libSDL$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	# Apply the "partial build" patch
	cp -r ../sources-2/* .
	mkdir -p build && cd build
	cmake .. -Wno-dev -DCMAKE_INSTALL_PREFIX=$appsDir/SpeedDreams \
		-DSD_LOCALDIR=~/config/settings/speed-dreams
	make $jobArgs
}

INSTALL()
{
	cd build
	make install
}
