SUMMARY="A Qt 5 port for putty, the free telnet/ssh client"
DESCRIPTION="PuTTY is a free implementation of SSH and Telnet for Windows \
and Unix platforms, along with an xterm terminal emulator.\

LEGAL WARNING: Use of PuTTY, PSCP, PSFTP and Plink is illegal in countries \
where encryption is outlawed. We believe it is legal to use PuTTY, PSCP, \
PSFTP and Plink in England and Wales and in many other countries, but we \
are not lawyers, and so if in doubt you should seek legal advice before \
downloading it. You may find useful information at cryptolaw.org, which \
collects information on cryptography laws in many countries, but we can't \
vouch for its correctness."
HOMEPAGE="https://github.com/dsmorozov/qputty-qt5/"
COPYRIGHT="2015-2018 Dmitry Morozov, 1999-2018 PuTTY Team"
LICENSE="MIT
	GNU LGPL v3"
REVISION="1"
SOURCE_URI="https://github.com/dsmorozov/qputty-qt5/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="e79e356eb7d04f8ec133ce1094cfb54c7c4b540d6cc05e5f224111909c261973"
SOURCE_FILENAME="qputty-qt5-$portVersion.tar.gz"
SOURCE_DIR="qputty-qt5-$portVersion"
puttyVersion="0.70"
SOURCE_URI_2="http://the.earth.li/~sgtatham/putty/latest/putty-$puttyVersion.tar.gz"
CHECKSUM_SHA256_2="bb8aa49d6e96c5a8e18a057f3150a1695ed99a24eef699e783651d1f24e7b0be"
SOURCE_DIR_2="putty-$puttyVersion"
PATCHES="qputty-$portVersion.patchset"
PATCHES_2="putty-$puttyVersion.patchset"
ADDITIONAL_FILES="qputty.rdef.in"

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

PROVIDES="
	qputty$secondaryArchSuffix = $portVersion
	app:QPuTTY$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Svg$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	rm -rf $sourceDir/putty
	ln -s $sourceDir2 $sourceDir/putty
	qmake KERBEROS=no GSSGLUE=no VERSION=$portVersion
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir
	cp -f qPutty $appsDir/QPuTTY

	local APP_SIGNATURE="application/x-vnd.qputty"
	local MAJOR=$portVersion
	local LONG_INFO="$SUMMARY"
	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/qputty.rdef.in > qputty.rdef

	addResourcesToBinaries qputty.rdef $appsDir/QPuTTY
	addAppDeskbarSymlink $appsDir/QPuTTY
}
