SUMMARY="A library for managing 3D-Studio Release 3 and 4 .3DS files"
DESCRIPTION="lib3ds is an overall software library for managing 3D-Studio \
Release 3 and 4 .3DS files. It is a free alternative to Autodesk's 3DS File \
Toolkit for managing 3DS files. It started out in 1996 to be released in \
1999 under the GNU General Public License (GPL) as Open-Source software.\
In 2000, the library was completely rewritten in ANSI-C to attain more \
hardware platform independence. To enable commercial application the license \
was changed to GNU Lesser General Public License (LGPL)."
HOMEPAGE="http://lib3ds.org"
COPYRIGHT="2000-2010 Jan Eric Kyprianidis"
LICENSE="GNU LGPL v2"
REVISION="2"
srcGitRev="d477b7dc451ec88a739cc28e6d9a7564123569d0"
SOURCE_URI="https://github.com/AdrianArroyoCalle/lib3ds/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="04e28c09b9b1905a401686f9c27ffc520104801fb1353ed89ac6ec7f50f1104e"
SOURCE_DIR="lib3ds-$srcGitRev"
PATCHES="lib3ds-$portVersion.patchset"

ARCHITECTURES="all ?x86"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	lib3ds$secondaryArchSuffix = $portVersion
	lib:lib3ds$secondaryArchSuffix = 2.0 compat >= 2.0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	lib3ds${secondaryArchSuffix}_devel = $portVersion
	devel:lib3ds$secondaryArchSuffix = 2.0 compat >= 2.0
	"
REQUIRES_devel="
	lib3ds$secondaryArchSuffix == $portVersion
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	cmake .
	make
}

INSTALL()
{
	mkdir -p $libDir $includeDir
	cp bin/lib3ds.so.2.0 $libDir/
	ln -sr $libDir/lib3ds.so.2.0 $libDir/lib3ds.so
	cp src/*.h $includeDir/

	prepareInstalledDevelLibs lib3ds
	packageEntries devel $developDir
}
