SUMMARY="Haiku platform plugins for Qt5"
DESCRIPTION="Qt modules for integration with Haiku:
* qthaikustyle is a plugin which utilizes BControlLook to \
provide a native look and feel for Qt applications.
* qhaikuplatform is a Qt Platform Abstraction library which \
provides support for clipboard, system fonts, window look, \
icons, cursors, OpenGL support, drag-n-drop, etc.
* qhvifplugin is image plugin for HVIF icons
* qhaikuaudio is qtmultimedia audio input/output plugin"
HOMEPAGE="https://github.com/threedeyes/qthaikuplugins/"
COPYRIGHT="2017-2021 Gerasim Troeglazov"
LICENSE="GNU LGPL v2.1
	GNU LGPL v3"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="112a6d72fb468617f43194fde453dfc9e35cd0fe1de55857484d88042a65be01"
SOURCE_DIR="qthaikuplugins-$portVersion"

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

PROVIDES="
	qthaikuplugins$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku_svg_icon_theme
	haiku$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libswresample$secondaryArchSuffix
	cmd:qsystray
	"
REPLACES="
	qthaikustyle$secondaryArchSuffix
	"
SUPPLEMENTS="
	qt5$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libavutil$secondaryArchSuffix
	devel:libswresample$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	cd $sourceDir/platforms/qhaikuplatform
	qmake .
	make $jobArgs

	cd $sourceDir/audio/qhaikuaudio
	qmake .
	make $jobArgs

	cd $sourceDir/imageformats/qhvifplugin
	qmake .
	make $jobArgs

	cd $sourceDir/styles/qthaikustyle
	qmake .
	make $jobArgs

	cd $sourceDir/tools/qsettings
	qmake .
	make $jobArgs
}

INSTALL()
{
	mkdir -p $addOnsDir/Qt5/imageformats $preferencesDir $prefix/bin

	cp -fr $sourceDir/platforms/qhaikuplatform/plugins/platforms $addOnsDir/Qt5
	cp -fr $sourceDir/styles/qthaikustyle/plugins/styles $addOnsDir/Qt5
	cp -fr $sourceDir/audio/qhaikuaudio/plugins/audio $addOnsDir/Qt5
	cp -f $sourceDir/imageformats/qhvifplugin/libqhvif.so $addOnsDir/Qt5/imageformats
	cp -f $sourceDir/tools/qsettings/QtConfigurator "$preferencesDir/Qt Configurator"

	addPreferencesDeskbarSymlink "$preferencesDir/Qt Configurator"
}
