SUMMARY="A Quran Study Software"
DESCRIPTION="Al-Anvar is a cross-platform Quran Study Software. It uses \
\"Tanzil.net\" and \"Zekr.org\" database as its database."
HOMEPAGE="http://al-anvar.sourceforge.net/"
COPYRIGHT="2012-2018 S. Hosein Hoseini"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://github.com/mazbrili/al-anvar/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="3c7e9c86828416584c54c7a47237078f278056b684ee6ea8d35fec442cb81dca"
SOURCE_FILENAME="al-anvar-$portVersion.tar.gz"
SOURCE_DIR="al-anvar-$portVersion"
ADDITIONAL_FILES="al-anvar.rdef.in"

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

PROVIDES="
	al_anvar$secondaryArchSuffix = $portVersion
	app:Al_Anvar = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libphonon4qt5$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5WebKit$secondaryArchSuffix
	lib:libQt5WebKitWidgets$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libphonon4qt5$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Svg$secondaryArchSuffix
	devel:libQt5WebKit$secondaryArchSuffix
	devel:libQt5WebKitWidgets$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	devel:libsqlite3$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:unzip
	"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	install -d "$appsDir"
	install -T ../bin/al-anvar "$appsDir"/Al-Anvar

	local APP_SIGNATURE="application/x-vnd.al-anvar"
	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/al-anvar.rdef.in > al-anvar.rdef

	addResourcesToBinaries al-anvar.rdef "$appsDir"/Al-Anvar
	addAppDeskbarSymlink "$appsDir"/Al-Anvar
}
