SUMMARY="Library to use arbitrary fonts in OpenGL applications"
DESCRIPTION="FTGL is a free cross-platform Open Source C++ library that uses \
Freetype2 to simplify rendering fonts in OpenGL applications."
HOMEPAGE="https://sourceforge.net/projects/ftgl"
COPYRIGHT="2001-2004 Unicode, Inc.
	2001-2009 Henry Maddocks"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://sourceforge.net/projects/canvasdraw/files/5.11.1/Docs%20and%20Sources/ftgl-${portVersion}_Sources.tar.gz"
CHECKSUM_SHA256="690a7f80375846765f5cbbc10d0d859bfb62281441ff5878f818ced447fca763"
SOURCE_DIR="ftgl"
PATCHES="ftgl-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	ftgl$secondaryArchSuffix = $portVersion compat >= 2
	lib:libftgl$secondaryArchSuffix = 2.1.3 compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	lib:libglu$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	ftgl${secondaryArchSuffix}_devel = $portVersion compat >= 1
	devel:libftgl$secondaryArchSuffix = 2.1.3 compat >= 2
	"
REQUIRES_devel="
	ftgl$secondaryArchSuffix == $portVersion base
	devel:libfreetype$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfreetype$secondaryArchSuffix
	devel:libgl$secondaryArchSuffix
	devel:libglu$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	touch src/ftgl.dep
	make $jobArgs
}

INSTALL()
{
	mkdir -p $libDir
	mkdir -p $includeDir
	cp lib/Haiku11/*.so $libDir
	cp -r include/FTGL $includeDir


	prepareInstalledDevelLibs libftgl
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
