SUMMARY="Official ICQ desktop client"
DESCRIPTION="ICQ desktop client for Haiku."
HOMEPAGE="https://www.icq.com"
COPYRIGHT="2016 ICQ LLC (Mail.Ru Group)"
LICENSE="Apache v2"
REVISION="7"
srcGitRev="fad5b8b0412aae4b23554ba7f63e0dcee92d16a7"
SOURCE_URI="https://github.com/mailru/icqdesktop.deprecated/archive/$srcGitRev.zip"
CHECKSUM_SHA256="973d55393442171b280a75339a06dfb86fc2c0d5226eefb2bff027666b163954"
SOURCE_DIR="icqdesktop.deprecated-$srcGitRev"
PATCHES="icq-$portVersion.patchset"
ADDITIONAL_FILES="icq.rdef"

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

PROVIDES="
	icq$secondaryArchSuffix = $portVersion
	app:ICQ$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libavcodec$secondaryArchSuffix
	lib:libavfilter$secondaryArchSuffix
	lib:libavformat$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libffi$secondaryArchSuffix
	lib:libgcrypt$secondaryArchSuffix
	lib:libGl$secondaryArchSuffix
	lib:libgnutls$secondaryArchSuffix
	lib:libgpg_error$secondaryArchSuffix
	lib:libidn$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libpcre$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Multimedia$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:librtmp.1$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libswresample$secondaryArchSuffix
	lib:libtasn1$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libavcodec$secondaryArchSuffix
	devel:libboost_system$secondaryArchSuffix
	devel:libcrypto$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	devel:libffi$secondaryArchSuffix
	devel:libgcrypt$secondaryArchSuffix
	devel:libGl$secondaryArchSuffix
	devel:libgnutls$secondaryArchSuffix
	devel:libgpg_error$secondaryArchSuffix
	devel:libidn$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libpcre$secondaryArchSuffix
	devel:libqt5$secondaryArchSuffix
	devel:librtmp$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libtasn1$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:python
	"

BUILD()
{
	cd corelib/corelib
	qmake
	make $jobArgs

	cd ../../gui
	python qt_prebuild_linux.py
	qmake
	# g++ runs out of memory on qrc_resource.cpp (it is huge!)
	# as a workaround cut a significant part out of it
	make $jobArgs LDFLAGS=-lboost_filesystem
}

INSTALL()
{
	mkdir -p $appsDir/ICQ/lib
	cp gui/icq $appsDir/ICQ/ICQ
	cp corelib/corelib/libcorelib.so* $appsDir/ICQ/lib
	ln -s $addOnsDir/Qt5/platforms $appsDir/ICQ/plugins

	addResourcesToBinaries $portDir/additional-files/icq.rdef \
		$appsDir/ICQ/ICQ
	addAppDeskbarSymlink $appsDir/ICQ/ICQ
}
