SUMMARY="C++ interface for Cairo"
DESCRIPTION="a C++ wrapper for the cairo graphics library. It offers all the \
power of cairo with an interface familiar to C++ developers, including use of \
the Standard Template Library where it makes sense."
HOMEPAGE="https://www.cairographics.org/cairomm/"
COPYRIGHT="2006-2016 cairomm authors"
LICENSE="GNU LGPL v2"
REVISION="2"
SOURCE_URI="https://www.cairographics.org/releases/cairomm-${portVersion}.tar.gz"
CHECKSUM_SHA256="97a78bd7de6baf8af3da1f9b39f1317f8da9f1145b7694e928fbd5521da08ef6"

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

libVersion="1.4.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
apiVersion="1.0"

PROVIDES="
	cairomm$secondaryArchSuffix = $portVersion
	lib:libcairomm_$apiVersion$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcairo$secondaryArchSuffix
	lib:libsigc_2.0$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	"

PROVIDES_devel="
	cairomm${secondaryArchSuffix}_devel = $portVersion
	devel:libcairomm_$apiVersion$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	cairomm$secondaryArchSuffix == $portVersion base
	devel:libcairo$secondaryArchSuffix
	devel:libsigc_2.0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcairo$secondaryArchSuffix
	devel:libsigc_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage cairomm$secondaryArchSuffix \
	"$libDir"/libcairomm-$apiVersion.so.$libVersion

BUILD()
{
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm -rf $libDir/*.la

	mv $libDir/cairomm-$apiVersion/include/*.h $includeDir/cairomm-$apiVersion

	prepareInstalledDevelLibs \
		libcairomm-$apiVersion

	fixPkgconfig

	sed -i -e 's|-I${libdir}/cairomm-$apiVersion/include||' \
		$developLibDir/pkgconfig/cairomm-$apiVersion.pc

	packageEntries devel \
		$developDir
}
