SUMMARY="Libraries for text templating with Qt"
DESCRIPTION="Grantlee is a set of Free Software libraries written using the \
Qt framework. Currently two libraries are shipped with Grantlee: Grantlee \
Templates and Grantlee TextDocument.

The goal of Grantlee Templates is to make it easier for application \
developers to separate the structure of documents from the data they \
contain, opening the door for theming and advanced generation of other \
text such as code."
HOMEPAGE="https://github.com/steveire/grantlee/"
COPYRIGHT="2010-2017 Stephen Kelly"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/steveire/grantlee/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="139acee5746b957bdf1327ec0d97c604d4c0b9be42aec5d584297cb5ed6a990a"
SOURCE_FILENAME="grantlee-$portVersion.tar.gz"
PATCHES="grantlee-$portVersion.patchset"

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

PROVIDES="
	grantlee$secondaryArchSuffix = $portVersion
	lib:libgrantlee_templates$secondaryArchSuffix = $portVersion compat >= 5
	lib:libgrantlee_textdocument$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	"

PROVIDES_devel="
	grantlee${secondaryArchSuffix}_devel = $portVersion
	devel:libgrantlee_templates$secondaryArchSuffix = $portVersion compat >= 5
	devel:libgrantlee_textdocument$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES_devel="
	grantlee$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules >= 5.39
	devel:libQt5Core$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:doxygen
	cmd:dot
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. \
		-DLIB_SUFFIX="/${secondaryArchSuffix/_/}" \
		-DINCLUDE_INSTALL_DIR=$includeDir \
		$cmakeDirArgs

	make $jobArgs
	make docs
}

INSTALL()
{
	cd build
	make install
	mkdir -p $docDir
	install -Dm644 apidox/* $docDir/

	# Remove unneeded include, no idea, where does it comes from. Aliens?
	sed -i 's/;.*\"/"/' "$libDir"/cmake/Grantlee5/GrantleeTargets.cmake

	prepareInstalledDevelLibs \
		libGrantlee_TextDocument \
		libGrantlee_Templates

	packageEntries devel \
		$libDir/cmake \
		$developDir \
		$documentationDir
}

TEST()
{
	cd build
	make test
}
