SUMMARY="Application that provide Interpretation of the holy Quran"
DESCRIPTION="Provide interpretation of the holy quran
* Tafsir fi karimir rohmaan
* Tafsir As Sa'di
* Tafsir at tabari
* Tafsir al kortoby
* Minister of religion indonesia
* etc."
HOMEPAGE="https://github.com/zakariakov/mtafsir"
COPYRIGHT="2015-2018 Abou Zakariya"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/zakariakov/mtafsir/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="1e0dfbee7a6ef8cda68a070aeaba2075e5d9be6e1c6428d55925f1bb19d47a6a"
SOURCE_FILENAME="mtafsir-$portVersion.tar.gz"
ADDITIONAL_FILES="mtafsir.rdef.in"

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

PROVIDES="
	mtafsir$secondaryArchSuffix = $portVersion
	app:Mtafsir = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	ayat_tafasir_data
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Sql$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Sql$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/Mtafsir/{bin,share} $dataDir/ayat
	cp -rf ./usr/bin/mtafsir $appsDir/Mtafsir/bin/Mtafsir
	cp -rf ./usr/share/* $appsDir/Mtafsir/share
	rm -rf $appsDir/Mtafsir/share/mtafsir/tafasir/{tafasirInfo,baghawy.db,katheer.db,qortoby.db,sa3dy.db,tabary.db,tafheem.db}
	cp -rf $appsDir/Mtafsir/share/mtafsir/tafasir $dataDir/ayat/
	rm -rf $appsDir/Mtafsir/share/{icons,mtafsir/tafasir}
	ln -s  $dataDir/ayat/tafasir $appsDir/Mtafsir/share/mtafsir/tafasir
	local APP_SIGNATURE="application/x-vnd.mtafsir"
	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:-0}|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/mtafsir.rdef.in > mtafsir.rdef
	addResourcesToBinaries mtafsir.rdef $appsDir/Mtafsir/bin/Mtafsir
	addAppDeskbarSymlink $appsDir/Mtafsir/bin/Mtafsir
}
