SUMMARY="An implementation of the W3C DOM"
DESCRIPTION="An implementation of the W3C DOM for NetSurf, written in C."
HOMEPAGE="https://www.netsurf-browser.org/projects/libdom/"
COPYRIGHT="2007-2020 J-M Bell"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://download.netsurf-browser.org/libs/releases/libdom-$portVersion-src.tar.gz"
CHECKSUM_SHA256="98ee072471e55e208c9878e515c410ad462ca36f87b4afcbecad023f3a2cef4a"

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

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

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

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libexpat$secondaryArchSuffix
	devel:libhubbub$secondaryArchSuffix >= 0.3.7
	devel:libparserutils$secondaryArchSuffix >= 0.2.4
	devel:libwapcaplet$secondaryArchSuffix >= 0.4.3
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:perl
	cmd:pkg_config$secondaryArchSuffix
	netsurf_buildsystem >= 1.9
	xml_parser
	"

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 libdom
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}

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