SUMMARY="A lightweight multi-platform web browser"
DESCRIPTION="NetSurf provides a small, fast, comprehensive multiplatform Web browsing \
solution supporting HTML 5 and CSS standards.

NetSurf is an open source web browser which uses its own layout engine. \
Its design goal is to be lightweight and portable. NetSurf provides \
features including tabbed browsing, bookmarks and page thumbnailing."
HOMEPAGE="https://www.netsurf-browser.org/"
COPYRIGHT="2003-2020 The NetSurf Browser project"
LICENSE="GNU GPL v2"
REVISION="4"
# Do NOT use the netsurf-all package. It contains a bunch of subprojects which
# we build as separate packages so they can easily be used by other projects.
SOURCE_URI="https://download.netsurf-browser.org/netsurf/releases/source/netsurf-$portVersion-src.tar.gz"
CHECKSUM_SHA256="36484429e193614685c2ff246f55bd0a6dddf31a018bee45e0d1f7c28851995e"
PATCHES="netsurf-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
fi

PROVIDES="
	netsurf$secondaryArchSuffix = $portVersion
	app:NetSurf = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcss$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libdom$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libhubbub$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libnsbmp$secondaryArchSuffix
	lib:libnsgif$secondaryArchSuffix
	lib:libnslog$secondaryArchSuffix
	lib:libnspsl$secondaryArchSuffix
	lib:libnsutils$secondaryArchSuffix
	lib:libparserutils$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libsvgtiny$secondaryArchSuffix
	lib:libutf8proc$secondaryArchSuffix
	lib:libwapcaplet$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcheck$secondaryArchSuffix
	devel:libcss$secondaryArchSuffix >= 0.9.1
	devel:libcurl$secondaryArchSuffix
	devel:libdom$secondaryArchSuffix >= 0.4.1
	devel:libexpat$secondaryArchSuffix
	devel:libhubbub$secondaryArchSuffix >= 0.3.7
	devel:libiconv$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libnsbmp$secondaryArchSuffix >= 0.1.6
	devel:libnsgif$secondaryArchSuffix >= 0.2.1
	devel:libnslog$secondaryArchSuffix >= 0.1.3
	devel:libnspsl$secondaryArchSuffix >= 0.1.6
	devel:libnsutils$secondaryArchSuffix >= 0.1.0
	devel:libparserutils$secondaryArchSuffix >= 0.2.4
	devel:libpng16$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libsvgtiny$secondaryArchSuffix >= 0.1.7
	devel:libutf8proc$secondaryArchSuffix
	devel:libwapcaplet$secondaryArchSuffix >= 0.4.3
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	html_parser
	cmd:bison
	cmd:flex
	cmd:gcc$secondaryArchSuffix
	cmd:git
	cmd:gperf
	cmd:make
	cmd:nsgenbind >= 0.8
	cmd:pkg_config$secondaryArchSuffix
	cmd:xxd
	"

BUILD()
{
	make TARGET=beos PREFIX=$prefix/ DESTDIR=$appsDir NETSURF_BEOS_BIN="/" \
		BUILD=release $jobArgs
}

INSTALL()
{
	make TARGET=beos PREFIX=$prefix/ DESTDIR=$appsDir NETSURF_BEOS_BIN="/" \
		BUILD=release install

	# Resources not needed since 3.6
	rm -rf $appsDir/boot

	addAppDeskbarSymlink $appsDir/NetSurf
}
