SUMMARY="NetSurf generalised utility library"
DESCRIPTION="Various things useful to the NetSurf browser, and possibly to \
other applications."
HOMEPAGE="http://git.netsurf-browser.org/libnsutils.git/"
COPYRIGHT="2014 Vincent Sanders"
LICENSE="MIT"
ARCHITECTURES="x86_gcc2 x86_64"
REVISION="1"

SOURCE_URI="http://download.netsurf-browser.org/libs/releases/libnsutils-$portVersion-src.tar.gz"
CHECKSUM_SHA256="9ad6b921bceed2c0d44ca6ff36fa76841cc6533f8ed7ccb0a941fd9a78731afd"
PATCHES="libnsutils-$portVersion.patchset"

PROVIDES="
	libnsutils = $portVersion
	lib:libnsutils = 0.0.1 compat >= 0
"

PROVIDES_devel="
	libnsutils_devel = $portVersion
	devel:libnsutils = 0.0.1 compat >= 0
"

REQUIRES="
	haiku >= $haikuVersion
"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"

BUILD_PREREQUIRES="
	netsurf_buildsystem >= 1.1
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	# Build the static lib
	make PREFIX=$prefix NSSHARED=/system/data/netsurf-buildsystem
	# Build the shared lib
	make PREFIX=$prefix NSSHARED=/system/data/netsurf-buildsystem \
		COMPONENT_TYPE=lib-shared
}

INSTALL()
{
	make install PREFIX=$prefix NSSHARED=/system/data/netsurf-buildsystem \
		INCLUDEDIR=$relativeIncludeDir LIBDIR=$relativeLibDir
	make install PREFIX=$prefix NSSHARED=/system/data/netsurf-buildsystem \
		INCLUDEDIR=$relativeIncludeDir LIBDIR=$relativeLibDir COMPONENT_TYPE=lib-shared

	mkdir -p $prefix/develop/lib

	prepareInstalledDevelLib libnsutils
	fixPkgconfig

	packageEntries devel $developDir
}
