SUMMARY="Graphite text processing engine"
DESCRIPTION="Graphite2 is a library providing rendering capabilities for \
complex non-Roman writing systems."
HOMEPAGE="http://graphite.sil.org/"
COPYRIGHT="2010-2018 SIL International"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/silnrsi/graphite/releases/download/$portVersion/graphite2-$portVersion.tgz"
CHECKSUM_SHA256="f99d1c13aa5fa296898a181dff9b82fb25f6cc0933dbaa7a475d8109bd54209d"
PATCHES="graphite2-$portVersion.patchset"

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

libVersion="3.2.1"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	graphite2$secondaryArchSuffix = $portVersion
	lib:libgraphite2$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	graphite2${secondaryArchSuffix}_devel = $portVersion
	cmd:gr2fonttest$secondaryArchSuffix
	devel:libgraphite2$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	graphite2$secondaryArchSuffix == $portVersion base
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage graphite2$secondaryArchSuffix \
	"$libDir"/libgraphite2.so.$libVersion

BUILD()
{
	cmake \
		-DCMAKE_INSTALL_PREFIX:PATH=$prefix \
		-DLIB_SUFFIX=$secondaryArchSubDir \
		.
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libgraphite2
	fixPkgconfig

	# devel package
	packageEntries devel \
		$binDir \
		$dataDir \
		$developDir
}

TEST()
{
	make test
}
