SUMMARY="C++ unit testing framework"
DESCRIPTION="
CppUnit is a C++ unit testing framework. It started its life as a port of \
JUnit to C++ by Michael Feathers.
"
HOMEPAGE="http://cppunit.sourceforge.net/"
SOURCE_URI="http://downloads.sourceforge.net/cppunit/cppunit-1.12.1.tar.gz"
CHECKSUM_SHA256="ac28a04c8e6c9217d910b0ae7122832d28d9917fa668bcc9e0b8b09acb4ea44a"
LICENSE="GNU LGPL v2.1"
COPYRIGHT="2000 Jerome Lacoste
	2000 Michael Feathers
	2000-2002 E. Sommerlade
	2001-2013 Baptiste Lepilleur
	2001 Bastiaan Bakker
	2001-2002, 2007-2008  Steve Robbins
	2012-2013 Harvey Brydon"
REVISION="2"
ARCHITECTURES="x86 x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	cppunit$secondaryArchSuffix = $portVersion compat >= 1.12
	cmd:cppunit_config$secondaryArchSuffix = $portVersion compat >= 1.12
	cmd:DllPlugInTester$secondaryArchSuffix = $portVersion compat >= 1.12
	lib:libcppunit$secondaryArchSuffix = $portVersion compat >= 1.12
	lib:libcppunit_1.12$secondaryArchSuffix = $portVersion compat >= 1.12
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	cppunit${secondaryArchSuffix}_devel = $portVersion
	devel:libcppunit$secondaryArchSuffix = $portVersion compat >= 1.12
	"
REQUIRES_devel="
	cppunit$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:libtoolize
	cmd:autoreconf
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:sed
	"

PATCH()
{
	# change obsolete macro
	sed -i -e 's#AM_CONFIG_HEADER(\(.*\))#AC_CONFIG_HEADERS([\1])#g' \
		configure.in
}

BUILD()
{
	libtoolize --force --copy --install
	autoreconf -i

	# there seems to be a problem with dirname
	sed -i -e 's#\/\* automatically generated \*\/#$ac_prefix_conf_INP#g' \
		configure

	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLib libcppunit
	fixPkgconfig

	packageEntries devel $developDir
}
