SUMMARY="A library to render SVG files using cairo"
DESCRIPTION="libRSVG is a a high performance SVG rendering library associated \
with the Gnome Project."
HOMEPAGE="https://wiki.gnome.org/Projects/LibRsvg"
COPYRIGHT="2009-2010 Raph Levien"
LICENSE="GNU GPL v2
	GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://download.gnome.org/sources/librsvg/2.40/librsvg-$portVersion.tar.xz"
CHECKSUM_SHA256="f7628905f1cada84e87e2b14883ed57d8094dca3281d5bcb24ece4279e9a92ba"

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

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

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

PROVIDES="
	librsvg$secondaryArchSuffix = $portVersion
	cmd:rsvg_convert$commandSuffix = $portVersion
	lib:librsvg_2$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcroco_0.6$secondaryArchSuffix
	lib:libcairo$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libgdk_pixbuf_2.0$secondaryArchSuffix
	lib:libgio_2.0$secondaryArchSuffix
#	lib:libgirepository_1.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libpango_1.0$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libuuid$secondaryArchSuffix >= 1.3
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	librsvg${secondaryArchSuffix}_devel = $portVersion
	devel:librsvg_2$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	librsvg$secondaryArchSuffix == $portVersion base
	lib:libgio_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgdk_pixbuf_2.0$secondaryArchSuffix
	lib:libcairo$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcroco_0.6$secondaryArchSuffix
	devel:libcairo$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libgdk_pixbuf_2.0$secondaryArchSuffix
	devel:libgio_2.0$secondaryArchSuffix
#	devel:libgirepository_1.0$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libpango_1.0$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libuuid$secondaryArchSuffix >= 1.3
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:awk
	cmd:cargo$secondaryArchSuffix
	cmd:make
	cmd:gcc$secondaryArchSuffix
	cmd:gtkdocize
	cmd:libtoolize$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage librsvg$secondaryArchSuffix \
	$commandBinDir/rsvg-convert \
	$libDir/librsvg-2.so.$libVersion

BUILD()
{
	autoreconf -vfi
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir \
		--disable-gtk-theme \
		--disable-pixbuf-loader \
		--enable-introspection=no
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/*.la
	rm -rf $dataDir/pixmaps

	prepareInstalledDevelLib librsvg-2
	fixPkgconfig

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
