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"
LICENSE="BSD (3-clause)"
REVISION="2"
SOURCE_URI="http://downloads.sourceforge.net/project/glew/glew/${portVersion}/glew-${portVersion}.tgz"
CHECKSUM_SHA256="aa25dc48ed84b0b64b8d41cdd42c8f40f149c37fa2ffa39cd97f42c78d128bc7"
SOURCE_DIR="glew-$portVersion"
PATCHES="glew-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	glew1$secondaryArchSuffix = $portVersion
	lib:libglew$secondaryArchSuffix = $portVersion compat >= 1
	lib:libglewmx$secondaryArchSuffix = $portVersion compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	"

PROVIDES_devel="
	glew1${secondaryArchSuffix}_devel = $portVersion
	devel:libglew$secondaryArchSuffix = $portVersion compat >= 1
	devel:libglewmx$secondaryArchSuffix = $portVersion compat >= 1
	"
REQUIRES_devel="
	glew1$secondaryArchSuffix == $portVersion base
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	"
CONFLICTS_devel="
	glew${secondaryArchSuffix}_devel
	"

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

BUILD()
{
	cp /system/data/libtool/config/config.guess config/ \
		|| cp /system/data/libtool/build-aux/config.guess config/
	make $jobArgs GLEW_DEST=$prefix BINDIR=$binDir LIBDIR=$libDir INCDIR=$includeDir/GL
}

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

	prepareInstalledDevelLib libGLEW
	prepareInstalledDevelLib libGLEWmx
	fixPkgconfig

	packageEntries devel $developDir
	rm -rf $binDir
}
