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-2018 Jean-Philippe Meuret"
LICENSE="GNU GPL v2"
REVISION="3"
SOURCE_URI="https://sourceforge.net/projects/speed-dreams/files/$portVersion/speed-dreams-src-base-$portVersion-r6553.tar.xz"
CHECKSUM_SHA256="32aa55c17f8dafc1c54fb0d0b7b993d2688d431899cfc5db9eeece148c6887d0"
SOURCE_DIR=""
PATCHES="speed_dreams-$portVersion.patchset"

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

PROVIDES="
	speed_dreams$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libenet$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libvorbisfile$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcurl$secondaryArchSuffix
	devel:libenet$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libplibnet$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libSDL2$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libvorbisfile$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	mkdir -p build && cd build

	cmake .. -Wno-dev -DCMAKE_INSTALL_PREFIX=$appsDir/SpeedDreams \
		-DSD_LOCALDIR=~/config/settings/speed-dreams \
		-DOPTION_OSGGRAPH:BOOL=false
	make $jobArgs
}

INSTALL()
{
	cd build
	make install
}
