SUMMARY="A program for downloading of internet sites"
DESCRIPTION="HTTraQt - graphical user interface (GUI) for HTTrack library, \
developed in C++ and based on multiplatform Qt library.

Program is intended for loading of Internet pages and/or their contents, \
equipped with flexible system of settings. In essence, the program is the \
clone from WinHTTrack, with some completions and simplifications of the \
interface of management and settings.

HTTraQt it was written by me in free from work time and other hobbies."
HOMEPAGE="http://httraqt.sourceforge.net/"
COPYRIGHT="Eduard Kalinowski"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://sourceforge.net/projects/httraqt/files/httraqt-$portVersion.tar.gz"
CHECKSUM_SHA256="ab88a618e7f0e56407f0d24275992196206200a333131c3b51745dc8b0c55d5e"
SOURCE_DIR="httraqt"
PATCHES="httraqt-$portVersion.patchset"
ADDITIONAL_FILES="httraqt.rdef.in"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	httraqt$secondaryArchSuffix = $portVersion
	app:HTTraQt = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libhttrack$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libhttrack$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:cmake
	"

BUILD()
{
	mkdir -p build
	cd build
	cmake -DHTTRAQT_ENABLE_DISTRIBUTION=OFF ..
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/HTTraQt
	cp build/httraqt $appsDir/HTTraQt/HTTraQt
	cp -R lang $appsDir/HTTraQt

	local APP_SIGNATURE="application/x-vnd.httraqt"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	local LONG_INFO="$SUMMARY"
	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/httraqt.rdef.in > $sourceDir/httraqt.rdef

	addResourcesToBinaries  $sourceDir/httraqt.rdef \
		$appsDir/HTTraQt/HTTraQt

	addAppDeskbarSymlink $appsDir/HTTraQt/HTTraQt
}
