SUMMARY="Anti-Grain Geometry (AGG)"
DESCRIPTION="
Anti-Grain Geometry (AGG) is an Open Source, free of charge graphic library, \
written in industrially standard C++.
"
HOMEPAGE="http://en.wikipedia.org/wiki/Anti-Grain_Geometry"
SRC_URI="http://gnashdev.org/tools/ltib/agg-2.5.tar.gz"
CHECKSUM_SHA256="ab1edc54cc32ba51a62ff120d501eecd55fceeedf869b9354e7e13812289911f"
REVISION="2"
LICENSE="GNU GPL v2"
COPYRIGHT="2002-2006 Maxim Shemanarev"

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

PROVIDES="
	agg$secondaryArchSuffix = $portVersion
	lib:libagg$secondaryArchSuffix = 2.0.4 compat >= 2
	lib:libaggfontfreetype$secondaryArchSuffix = 2.0.4 compat >= 2
	lib:libagggpc$secondaryArchSuffix = 2.0.4 compat >= 2
	lib:libaggplatformHaiku$secondaryArchSuffix = 2.0.4 compat >= 2
"
REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libz$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	devel:libsdl_1.2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libbz2$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:sed
	cmd:pkg_config$secondaryArchSuffix
"
PATCHES="agg-2.5.patchset"

BUILD()
{
	if [ -d src/platform/BeOS ]; then
		mv src/platform/BeOS src/platform/Haiku
	fi
	aclocal
	autoheader
	autoconf
	libtoolize --force
	automake --foreign --add-missing --ignore-deps
	runConfigure ./configure \
		--enable-ctrl \
		--enable-gpc \
		--enable-platform \
		--enable-examples
	make $jobArgs
}

INSTALL()
{
	make install
	
	prepareInstalledDevelLibs libagg libagggpc libaggfontfreetype \
		libaggplatformHaiku libaggplatformsdl
	fixPkgconfig
	# fix include path in pkgconfig
	sed -i -e 's#^includedir=\(.*\)#includedir=\1/agg2#g' \
		$developLibDir/pkgconfig/libagg.pc

	packageEntries devel $developDir $dataRootDir/aclocal
	packageEntries sdl $libDir/libaggplatformsdl*
}

PROVIDES_devel="
	agg${secondaryArchSuffix}_devel = $portVersion
	devel:libagg$secondaryArchSuffix = 2.0.4 compat >= 2
	devel:libaggfontfreetype$secondaryArchSuffix = 2.0.4 compat >= 2
	devel:libagggpc$secondaryArchSuffix = 2.0.4 compat >= 2
	devel:libaggplatformHaiku$secondaryArchSuffix = 2.0.4 compat >= 2
	devel:libaggplatformsdl$secondaryArchSuffix = 2.0.4 compat >= 2
"
REQUIRES_devel="
	agg$secondaryArchSuffix == $portVersion base
"

PROVIDES_sdl="
	agg${secondaryArchSuffix}_sdl = $portVersion
	lib:libaggplatformsdl$secondaryArchSuffix = 2.0.4 compat >= 2
"
REQUIRES_sdl="
	agg$secondaryArchSuffix == $portVersion base
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libsdl_1.2$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
"
