SUMMARY="Multi-platform 2D graphics library"
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
"
SOURCE_URI="http://cairographics.org/releases/cairo-$portVersion.tar.xz"
CHECKSUM_SHA256="dc59f0b7ac945ce4e138a03c227a29260915a8b05a4226c1f6f1be586ba7f5b6"
REVISION="1"
ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PATCHES="cairo-$portVersion.patchset"

PROVIDES="
	cairo$secondaryArchSuffix = $portVersion compat >= 1
	lib:libcairo$secondaryArchSuffix = 2.11200.18 compat >= 2
	lib:libcairo_script_interpreter$secondaryArchSuffix = 2.11200.18 compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libpixman_1$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	# required by fontconfig
	lib:libbz2$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libpixman_1$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	# required by fontconfig
	devel:libbz2$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	autoreconf -fi
	export CFLAGS=-D__BSD_VISIBLE
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libcairo libcairo-script-interpreter
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}

# ----- devel package -------------------------------------------------------

PROVIDES_devel="
	cairo${secondaryArchSuffix}_devel = $portVersion compat >= 1
	devel:libcairo$secondaryArchSuffix = 2.11200.18 compat >= 2
	devel:libcairo_script_interpreter$secondaryArchSuffix = 2.11200.18 compat >= 2
	"
REQUIRES_devel="
	cairo$secondaryArchSuffix == $portVersion base
	"
