SUMMARY="Multi-platform 2D graphics library (with Xlib surfaces)"
DESCRIPTION="Cairo is a 2D graphics library with support for multiple output \
devices. Currently supported output targets include the X Window \
System (via both Xlib and XCB), quartz, win32, and image buffers, \
as well as PDF, PostScript, and SVG file output. Experimental backends \
include OpenGL, BeOS, OS/2, and DirectFB."
HOMEPAGE="http://cairographics.org/"
COPYRIGHT="2000, 2002, 2004-2007 Keith Packard
	2002-2003 University of Southern California
	2004-2010 Red Hat, Inc.
	2005-2010 Mozilla Corporation
	2006-2009 Adrian Johnson
	2007-2009 Chris Wilson
	2006-2013 Intel Corporation
	2011 Andrea Canciani
	2011 Samsung Electronics
	2010-2011 Linaro Limited
	2009-2010 Eric Anholt
	2002-2010 many others"
LICENSE="GNU LGPL v2.1
	MPL v1.1"
REVISION="4"
SOURCE_URI="http://cairographics.org/releases/cairo-$portVersion.tar.xz"
CHECKSUM_SHA256="5e7b29b3f113ef870d1e3ecf8adf21f923396401604bda16d44be45e66052331"
PATCHES="cairo-$portVersion.patchset"
SOURCE_DIR="cairo-$portVersion"

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

# This recipe MUST be kept in sync with cairo!

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

PROVIDES="
	xcairo$secondaryArchSuffix = $portVersion
	lib:libcairo$secondaryArchSuffix = $libVersionCompat
	lib:libcairo_gobject$secondaryArchSuffix = $libVersionCompat
	lib:libcairo_script_interpreter$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libpixman_1$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libz$secondaryArchSuffix

	lib:libX11$secondaryArchSuffix
	lib:libXext$secondaryArchSuffix
	"
CONFLICTS="
	cairo$secondaryArchSuffix
	"

PROVIDES_devel="
	xcairo${secondaryArchSuffix}_devel = $portVersion
	devel:libcairo$secondaryArchSuffix = $libVersionCompat
	devel:libcairo_gobject$secondaryArchSuffix = $libVersionCompat
	devel:libcairo_script_interpreter$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	xcairo$secondaryArchSuffix == $portVersion base
	devel:libglib_2.0$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libpixman_1$secondaryArchSuffix

	devel:libX11$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libpixman_1$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libz$secondaryArchSuffix

	devel:libX11$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage xcairo$secondaryArchSuffix \
	"$libDir"/libcairo.so.$libVersion \
	"$libDir"/libcairo-gobject.so.$libVersion \
	"$libDir"/libcairo-script-interpreter.so.$libVersion

BUILD()
{
	autoreconf -fi
	export CFLAGS="-D__BSD_VISIBLE -g -O2"

	runConfigure ./configure \
		--disable-static --enable-shared \
		--enable-xlib
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libcairo*.la

	prepareInstalledDevelLibs \
		libcairo \
		libcairo-gobject \
		libcairo-script-interpreter
	fixPkgconfig

	packageEntries devel \
		$developDir
}
