SUMMARY="A library for building efficient parsers" 
DESCRIPTION="LibParserUtils is a library for building efficient parsers."
HOMEPAGE="http://www.netsurf-browser.org/projects/libparserutils/"
SOURCE_URI="http://download.netsurf-browser.org/libs/releases/libparserutils-$portVersion-src.tar.gz"
CHECKSUM_SHA256="55c50abbffaaebe17acba43008ee2c4085401ce618e505fafa7c75baaa813da7"
REVISION="1"
LICENSE="MIT"
COPYRIGHT="2007-2014 J-M Bell"

ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	libparserutils$secondaryArchSuffix = $portVersion
	lib:libparserutils$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv${secondaryArchSuffix}
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv${secondaryArchSuffix}

	lib:libiconv${secondaryArchSuffix}
	"

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

PATCHES="libparserutils-0.2.0.patchset"

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
	make install PREFIX=$prefix NSSHARED=/system/data/netsurf-buildsystem \
		INCLUDEDIR=$relativeIncludeDir COMPONENT_TYPE=lib-shared

	mkdir -p $prefix/develop/lib

	prepareInstalledDevelLib libparserutils
	fixPkgconfig

	packageEntries devel $developDir
}

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

PROVIDES_devel="
	libparserutils${secondaryArchSuffix}_devel = $portVersion
	devel:libparserutils$secondaryArchSuffix = $portVersion
"
