SUMMARY="Generate static code representation of the Public suffix list"
DESCRIPTION="Public suffix list
------------------

The public suffix list is a database of top level domain names. The database
allows an application to determine if if a domain name requires an additional
label to be valid.

Uses
----

The principal use in a web browser is to restrict supercookies being set,
although it can also serve secondary purposes in the UI such as domain
highlighting"
HOMEPAGE="https://source.netsurf-browser.org/libnspsl.git/"
COPYRIGHT="2016-2020 Vincent Sanders"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://download.netsurf-browser.org/libs/releases/libnspsl-$portVersion-src.tar.gz"
CHECKSUM_SHA256="d3c58205cb78d310bf81ca55347a2d098719cecac7046bc367983b138b45020b"

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

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

PROVIDES="
	libnspsl$secondaryArchSuffix = $portVersion
	lib:libnspsl$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

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

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	netsurf_buildsystem >= 1.9
	cmd:gcc$secondaryArchSuffix
	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 libnspsl
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}

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