SUMMARY="An Indonesian Dictionary KBBI based on QT"
DESCRIPTION="Indonesian dictinary version of Kamus besar bahasa Indonesia"
COPYRIGHT="2017-2020 Anto Samalona
	2017-2020 Ade Malsasa Akbar
	2017-2020 Azis Pratama
	2017-2020 Billy
	2017-2020 Christian Kurniawan
	2017-2020 HanHan
	2017-2020 La Ode Muh. Fadlun Akbar
	2017-2020 Ramdziana Feri Yustianto
	2017-2020 Rania el-Amina
	2017-2020 Sucipto
"
HOMEPAGE="https://github.com/bgli/kbbi-qt"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/bgli/kbbi-qt/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="e858907628fb37789187b98dede196993bc7aaec88dbae9bb05683d576ef4aff"
SOURCE_FILENAME="kbbi-qt-$portVersion.tar.gz"
SOURCE_DIR="kbbi-qt-$portVersion"
PATCHES="kbbi_qt-$portVersion.patchset"
ADDITIONAL_FILES="kbbi_qt.rdef.in"

ARCHITECTURES="all !x86_gcc2"
if [ "$targetArchitecture" = x86_gcc2 ]; then
	SECONDARY_ARCHITECTURES="x86"
fi

PROVIDES="
	kbbi_qt$secondaryArchSuffix = $portVersion
	app:KBBI_Qt = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Svg$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:unzip
	"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/KBBI-Qt/data
	install -T ./KBBI-Qt $appsDir/KBBI-Qt/KBBI-Qt
	cp -rf src/data $appsDir/KBBI-Qt/
	local APP_SIGNATURE="application/x-vnd.kbbi"
	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/kbbi_qt.rdef.in > kbbi-qt.rdef

	addResourcesToBinaries kbbi-qt.rdef $appsDir/KBBI-Qt/KBBI-Qt
	addAppDeskbarSymlink $appsDir/KBBI-Qt/KBBI-Qt
}
