SUMMARY="An implementation of SVG Tiny written in C"
DESCRIPTION="The overall idea of the library is to take some SVG as input, \
and return a list of paths and texts which can be rendered easily. The \
library does not do the actual rendering."
HOMEPAGE="https://www.netsurf-browser.org/projects/libsvgtiny/"
COPYRIGHT="2003-2018 The NetSurf Developers"
LICENSE="MIT"
REVISION="3"
SOURCE_URI="https://download.netsurf-browser.org/libs/releases/libsvgtiny-$portVersion-src.tar.gz"
CHECKSUM_SHA256="2c0dcf952f1cd882c3e95401ef9459f16dbb53c5d3e4512339b2f9eb769d7781"

ARCHITECTURES="all ?x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	libsvgtiny$secondaryArchSuffix = $portVersion
	lib:libsvgtiny$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libdom$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libhubbub$secondaryArchSuffix
	lib:libparserutils$secondaryArchSuffix
	lib:libwapcaplet$secondaryArchSuffix
	"

PROVIDES_devel="
	libsvgtiny${secondaryArchSuffix}_devel = $portVersion
	devel:libsvgtiny$secondaryArchSuffix = $libVersion compat = $libVersionCompat
	"
REQUIRES_devel="
	libsvgtiny$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libdom$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	devel:libhubbub$secondaryArchSuffix
	devel:libparserutils$secondaryArchSuffix
	devel:libwapcaplet$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	netsurf_buildsystem
	cmd:gcc$secondaryArchSuffix
	cmd:gperf
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	for linkage in lib-static lib-shared; do
		make PREFIX="$prefix" NSSHARED=/system/data/netsurf-buildsystem \
			COMPONENT_TYPE=$linkage
	done
}

INSTALL()
{
	for linkage in lib-static lib-shared; do
		make PREFIX="$prefix" NSSHARED=/system/data/netsurf-buildsystem \
			INCLUDEDIR=$relativeIncludeDir LIBDIR=$relativeLibDir \
			COMPONENT_TYPE=$linkage \
			install
	done

	prepareInstalledDevelLib libsvgtiny
	fixPkgconfig

	# devel package
	packageEntries devel \
		"$developDir"
}

TEST()
{
	make PREFIX="$prefix" NSSHARED=/system/data/netsurf-buildsystem test
}
