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="d6b4650ff897ee1ead27cf77a5933ea197cbeef6705638dd181adc2e816b23c2"

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

PROVIDES="
	box2d$secondaryArchSuffix = $portVersion
	lib:libBox2D$secondaryArchSuffix = 2.4.0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	box2d${secondaryArchSuffix}_devel = $portVersion
	devel:libBox2D$secondaryArchSuffix = 2.4.0
	"
REQUIRES_devel="
	box2d$secondaryArchSuffix == $portVersion base
	"

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

BUILD()
{
	cmake -Bbuild -GNinja . \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DBOX2D_BUILD_TESTBED=OFF \
		-DBUILD_SHARED_LIBS=ON \
		-DBOX2D_BUILD_DOCS=ON \
		$cmakeDirArgs

	ninja -C build $jobArgs
}

INSTALL()
{
	ninja -C build install

	prepareInstalledDevelLib libbox2d

	packageEntries devel \
		$developDir \
		$documentationDir \
		$libDir/cmake
}
