# Contributor: Carlo Landmeter
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=glew
pkgver=2.2.0
pkgrel=5
pkgdesc="A cross-platform C/C++ extension loading library"
url="https://glew.sourceforge.net/"
arch="all"
license="GPL-2.0-or-later"
options="!check"  # No test suite.
depends_dev="libxmu-dev libxi-dev mesa-dev glu-dev"
makedepends="$depends_dev"
subpackages="$pkgname-dev $pkgname-tools"
source="https://downloads.sourceforge.net/glew/glew-$pkgver.tgz
	glew.patch
	makefile.patch
	"
replaces="mesa-dev"

prepare() {
	default_prepare
	update_config_guess
}

build() {
	make \
		STRIP= \
		LDFLAGS.EXTRA="$LDFLAGS" \
		CFLAGS.EXTRA="$CFLAGS -fPIC"
}

package() {
	make GLEW_DEST="$pkgdir/usr" install
	install -Dm755 bin/glewinfo bin/visualinfo -t "$pkgdir"/usr/bin
}

tools() {
	pkgdesc="$pkgdesc (tools)"

	amove usr/bin
}

sha512sums="
57453646635609d54f62fb32a080b82b601fd471fcfd26e109f479b3fef6dfbc24b83f4ba62916d07d62cd06d1409ad7aa19bc1cd7cf3639c103c815b8be31d1  glew-2.2.0.tgz
ceee2d21ce0f4f6cd4b8d9e524440a30c31cd2aa4fa206f2a8081c49d10db5779979bfb15087218d6f290faed9a4ed01e3d26c6a88768fe3ed66f8b171ae2b34  glew.patch
ee51ed18be51d722d0f159b376af29e0da66dca491726d1d2ed5fbfc08a4f173fbb3926cbb915be97fceb872be4dbe5f32e94defab3f70f27b30ed3b0afda343  makefile.patch
"
