SUMMARY="Highly portable C++ class library"
DESCRIPTION="GNU Common C++ is a class framework that was specifically \
designed for telephony applications. The original library was refactored \
into a different codebase which is better suited for embedded applications, \
GNU uCommon C++ (uCommon for short). The uCommon library, as currently \
packaged, also includes the original Common C++ class framework for legacy \
application support. All development of Common C++ now happens as part of \
uCommon, but we will continue to fix bugs in the original Common C++ \
codebase, which has long been considered stable."
HOMEPAGE="https://www.gnu.org/software/commoncpp/"
COPYRIGHT="2015-2017 Cherokees of Idaho
	David Sugar
	Eric Schendel
	Angelo Naselli
	Leandro Melo de Sales
	Adrien Béraud"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="http://git.savannah.gnu.org/cgit/commoncpp.git/snapshot/commoncpp-$portVersion.tar.gz"
CHECKSUM_SHA256="99fd0e2c69f24e4ca93d01a14bc3fc4e40d69576f235f80f7a8ab37c16951f3e"
SOURCE_DIR="commoncpp-$portVersion"
PATCHES="ucommon-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

libVersion="8.0.01"

PROVIDES="
	ucommon$secondaryArchSuffix = $portVersion
	cmd:args$secondaryArchSuffix
	cmd:car$secondaryArchSuffix
	cmd:commoncpp_config$secondaryArchSuffix
	cmd:keywait$secondaryArchSuffix
	cmd:mdsum$secondaryArchSuffix
	cmd:pdetach$secondaryArchSuffix
	cmd:scrub_files$secondaryArchSuffix
	cmd:sockaddr$secondaryArchSuffix
	cmd:ucommon_config$secondaryArchSuffix
	cmd:urlout$secondaryArchSuffix
	cmd:zerofill$secondaryArchSuffix
	lib:libcommoncpp$secondaryArchSuffix = $libVersion
	lib:libucommon$secondaryArchSuffix = $libVersion
	lib:libusecure$secondaryArchSuffix = $libVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	"

PROVIDES_devel="
	ucommon${secondaryArchSuffix}_devel = $portVersion
	devel:libcommoncpp$secondaryArchSuffix = $libVersion
	devel:libucommon$secondaryArchSuffix = $libVersion
	devel:libusecure$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	ucommon$secondaryArchSuffix == $portVersion base
	"

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

BUILD()
{
	mkdir -p build && cd build
	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libusecure libucommon libcommoncpp

	# devel package
	packageEntries devel \
		$developDir $dataDir
}
