SUMMARY="Skeletal based character animation library"
DESCRIPTION="Cal3D is a skeletal based 3D character animation library written \
in C++ in a platform-/graphic API-independent way. Originally designed to \
be used in a 3D client for Worldforge, it evolved into a stand-alone product \
which can be used in many different kinds of projects. It supports \
combining animations, actions and morph targets (facial expressions) through \
a \"mixer\"."
HOMEPAGE="https://mp3butcher.github.io/Cal3D/"
COPYRIGHT="2001-2006 Mekensleep
	Laurent Desmecht
	Loic Dachary
	Bruno Heidelberger"
LICENSE="GNU LGPL v2.1"
REVISION="2"
SOURCE_URI="https://github.com/mp3butcher/Cal3D/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="fce2f57128bbefbcd4cee2d45337165e94614bc839c84e9c22b9bd988f10a440"
SOURCE_FILENAME="cal3d-$portVersion.tar.gz"
SOURCE_DIR="Cal3D-$portVersion/cal3d"
PATCHES="cal3d-$portVersion.patchset"

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

libVersion="12.0.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	cal3d$secondaryArchSuffix = $portVersion
	cmd:cal3d_converter$secondaryArchSuffix
	lib:libcal3d$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
#	lib:libunittest++$secondaryArchSuffix
	"

PROVIDES_devel="
	cal3d${secondaryArchSuffix}_devel = $portVersion
	devel:libcal3d$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	cal3d$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
#	devel:libunittest++$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage cal3d$secondaryArchSuffix \
	"$binDir"/cal3d_converter \
	"$libDir"/libcal3d.so.$libVersion

PATCH()
{
	sed -i 's/AM_USE_UNITTESTCPP/#\ AM_USE_UNITTESTCPP/' configure.in
}

BUILD()
{
	autoreconf -vfi
	#sed -i 's/unittest++/\ UnitTest++/' configure
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm "$libDir"/*.la

	prepareInstalledDevelLib libcal3d
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}
