SUMMARY="The OpenGL Extension Wrangler Library"
DESCRIPTION="The OpenGL Extension Wrangler Library (GLEW) is a cross-platform \
open-source C/C++ extension loading library. GLEW provides efficient run-time \
mechanisms for determining which OpenGL extensions are supported on the target \
platform."
HOMEPAGE="http://glew.sourceforge.net/"
COPYRIGHT="2007 The Kronos Group Inc.
	2002-2007 Milan Ikits
	2002-2007 Marcelo E. Magallon
	2002 Lev Povalahev
	1999-2007 Brian Paul"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="http://downloads.sourceforge.net/project/glew/glew/${portVersion}/glew-${portVersion}.tgz"
CHECKSUM_SHA256="04de91e7e6763039bc11940095cd9c7f880baba82196a7765f727ac05a993c95"
SOURCE_DIR="glew-$portVersion"
PATCHES="glew-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	glew21$secondaryArchSuffix = $portVersion
	lib:libglew$secondaryArchSuffix = $portVersion compat >= 2.1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	"

BUILD_REQUIRES="
	devel:libgl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:g++$secondaryArchSuffix
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	make $jobArgs GLEW_DEST=$prefix BINDIR=$binDir LIBDIR=$libDir \
		INCDIR=$includeDir/GL PKGDIR=$developLibDir/pkgconfig
}

INSTALL()
{
	make install.all GLEW_DEST=$prefix BINDIR=$binDir LIBDIR=$libDir \
		INCDIR=$includeDir/GL PKGDIR=$developLibDir/pkgconfig

	rm $libDir/libGLEW.a

	prepareInstalledDevelLib libGLEW
	fixPkgconfig

	rm -rf $binDir $developDir
}
