SUMMARY="NetSurf Parametric Logging Library"
DESCRIPTION="A category-based logging library which supports complex  \
logging filters, multiple log levels, and provides context through to client \
applications."
HOMEPAGE="http://git.netsurf-browser.org/libnslog.git/"
COPYRIGHT="2014-2020 Vincent Sanders"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://download.netsurf-browser.org/libs/releases/libnslog-$portVersion-src.tar.gz"
CHECKSUM_SHA256="fc98dca9d7efa67096470a5d96c023146e25bfdec08c0db74661c7b4db0453d0"

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

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

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

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	netsurf_buildsystem >= 1.9
	cmd:bison
	cmd:flex
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

TEST_REQUIRES="
	cmd:pkg_config$secondaryArchSuffix
	devel:libcheck$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 \
			COMPONENT_TYPE=$linkage \
			INCLUDEDIR=$relativeIncludeDir LIBDIR=$relativeLibDir \
			install
	done

	prepareInstalledDevelLib libnslog
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}

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