SUMMARY="A lightweight QtWebKit browser."
DESCRIPTION="QupZilla is a free and open-source web browser, \
intended for general users. It allows seamless integration with \
users' desktop environments and has several distinguishing features \
positively received by reviewers:
 - A unified interface for bookmarks, history and RSS reading.
 - A themeable interface.
 - Integrated Adblock.
 - Speed dial."
HOMEPAGE="http://www.qupzilla.com"
COPYRIGHT="2010-2014 David Rosca"
LICENSE="GNU GPL v3"
REVISION="6"
SOURCE_URI="https://github.com/QupZilla/qupzilla/archive/eee3895f6954617f8eb1f15df18b33a9745491ba.zip"
CHECKSUM_SHA256="1ed2b9f1edd6908349d047e932114e7a0215c6dfe6290fe4a6f3bc1a4dd05e25"
SOURCE_DIR="qupzilla-eee3895f6954617f8eb1f15df18b33a9745491ba"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	qupzilla${secondaryArchSuffix} = $portVersion
	app:QupZilla${secondaryArchSuffix} = $portVersion
	"
# TODO: update requirements to be more specific about which Qt 
# libraries are required.	
REQUIRES="
	haiku${secondaryArchSuffix}
	libqt4${secondaryArchSuffix} >= 4.8.0
	lib:libexecinfo${secondaryArchSuffix}
	"

BUILD_PREREQUIRES="
	cmd:qmake${secondaryArchSuffix}
	cmd:make
	cmd:g++${secondaryArchSuffix}
	cmd:pkg_config$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	libqt4${secondaryArchSuffix}_devel >= 4.8.0
	devel:libssl${secondaryArchSuffix}
	devel:libcrypto${secondaryArchSuffix}
	devel:libexecinfo${secondaryArchSuffix}
	"

BUILD()
{
	qmake QUPZILLA_PREFIX=${appsDir}/QupZilla
	make $jobArgs
}

INSTALL()
{
	mkdir -p ${appsDir}/QupZilla/
	mkdir -p ${appsDir}/QupZilla/lib/
		
	cd bin/
	
	# Add Haiku resources.
	rc -o ../haiku/QupZilla.rsrc ../haiku/QupZilla.rdef
	xres -o qupzilla ../haiku/QupZilla.rsrc
	mimeset -f qupzilla
	
	cp qupzilla ${appsDir}/QupZilla/QupZilla
	cp -R locale ${appsDir}/QupZilla/
	cp -R plugins ${appsDir}/QupZilla/
	cp -R themes ${appsDir}/QupZilla/
	cp libQupZilla.* ${appsDir}/QupZilla/lib/

	addAppDeskbarSymlink ${appsDir}/QupZilla/QupZilla "QupZilla"
}
