SUMMARY="A string internment library"
DESCRIPTION="LibWapcaplet is a string internment library.
It provides reference counted string interment and rapid string comparison \
functionality."
HOMEPAGE="https://www.netsurf-browser.org/projects/libwapcaplet/"
COPYRIGHT="2009-2020 The NetSurf Browser project"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://download.netsurf-browser.org/libs/releases/libwapcaplet-$portVersion-src.tar.gz"
CHECKSUM_SHA256="9b2aa1dd6d6645f8e992b3697fdbd87f0c0e1da5721fa54ed29b484d13160c5c"

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

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

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

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	netsurf_buildsystem >= 1.9
	devel:libcheck$secondaryArchSuffix
	lib:libcheck$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$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 \
			COMPONENT_TYPE=$linkage \
			INCLUDEDIR=$relativeIncludeDir LIBDIR=$relativeLibDir \
			install
	done

	prepareInstalledDevelLib libwapcaplet
	fixPkgconfig

	packageEntries devel \
		"$developDir"
}

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