SUMMARY="An HTML5 compliant parsing library"
DESCRIPTION="
Hubbub is an HTML5 compliant parsing library, written in C. It was developed \
as part of the NetSurf project and is available for use by other software \
under the MIT licence.
The HTML5 specification defines a parsing algorithm, based on the behaviour \
of mainstream browsers, which provides instructions for how to parse all \
markup, both valid and invalid. As a result, Hubbub parses web content well.
If you are looking for an HTML5 parser in Python or Ruby, you may wish to \
look at html5lib."
HOMEPAGE="https://www.netsurf-browser.org/projects/hubbub/"
COPYRIGHT="2007-2020 J-M Bell"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://download.netsurf-browser.org/libs/releases/libhubbub-$portVersion-src.tar.gz"
SOURCE_DIR="libhubbub-$portVersion"
CHECKSUM_SHA256="9e7ae253e6c9069e757eb9ad4e4846f38b4db52c0ca0151446a9fa4a977735b6"

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

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

PROVIDES="
	hubbub$secondaryArchSuffix = $portVersion
	lib:libhubbub$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libparserutils$secondaryArchSuffix
	"

PROVIDES_devel="
	hubbub${secondaryArchSuffix}_devel = $portVersion
	devel:libhubbub$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	hubbub$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	devel:libiconv$secondaryArchSuffix
	devel:libjson_c$secondaryArchSuffix
	devel:libparserutils$secondaryArchSuffix >= 0.2.4
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	netsurf_buildsystem >= 1.9
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:perl
	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 libhubbub
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}

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