SUMMARY="A 2D Physics Engine for Games"
DESCRIPTION="Box2D is a feature rich 2D rigid body physics engine, written in C++. \
It has been used in many games, including Crayon Physics Deluxe, \
winner of the 2008 Independant Game Festival Grand Prize"
HOMEPAGE="http://www.box2d.org"
COPYRIGHT="2007-2015 Erin Catto"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/erincatto/Box2D/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="58ffc8475a8650aadc351345aef696937747b40501ab78d72c197c5ff5b3035c"
SOURCE_DIR="box2d-$portVersion"
PATCHES="box2d-$portVersion.patchset"

ARCHITECTURES="all !x86"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	box2d23$secondaryArchSuffix = $portVersion
	lib:libBox2D$secondaryArchSuffix = 2.3.0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	cd Box2D
	cmake . -DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DBOX2D_INSTALL_DOC=ON \
		-DBOX2D_BUILD_SHARED=ON \
		-DBOX2D_BUILD_STATIC=ON \
		-DBOX2D_BUILD_EXAMPLES=OFF \
		-DBOX2D_INCLUDE_DIR=$includeDir \
		-DLIB_INSTALL_DIR=$libDir \
		-DDOC_INSTALL_DIR=$docDir \
		-DINCLUDE_INSTALL_DIR=$includeDir
	make $jobArgs
}

INSTALL()
{
	cd Box2D
	make install

	prepareInstalledDevelLib libBox2D

	rm -rf 	$developDir $libDir/cmake $documentationDir $libDir/Box2D
}
