# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=glad
pkgver=2.0.5
pkgrel=1
pkgdesc='Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs'
url='https://github.com/Dav1dde/glad'
arch=('any')
license=('MIT')
depends=('python' 'python-jinja' 'python-lxml' 'python-setuptools')
makedepends=('python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest' 'xorgproto' 'libx11' 'glfw-x11' 'xorg-server-xvfb' 'mingw-w64-gcc' 'wine' 'rust' 'libxinerama')
source=(${url}/archive/refs/tags/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('ca42985fc2a8e5eaa7508066792d6a2233bec66ade9aff55accf2efb3849c82b74116852fe63fdf7a1d65d90efe7d324f6ba8489ce4d9980b12c855579fde0b6')
b2sums=('4289f729347100bcc74deee8e9b5c8949e127b78a41cd6fca163b666d43e3b96b6dd8c1a852151e05c73ea86532da15e928671ac6c753da4ed2e786452825eab')

build() {
  cd ${pkgname}-${pkgver}
  python -m build --wheel --no-isolation
}

check() {
  cd ${pkgname}-${pkgver}
  rm test/c/run/wgl -r # Remove Windows tests
  PRINT_MESSAGE=1 \
  EXIT_ON_FAILURE=1 \
  xvfb-run ./utility/test.sh
}

package() {
  cd ${pkgname}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 README.md -t "$pkgdir"/usr/share/doc/"$pkgname"
  install -Dm 644 LICENSE -t "$pkgdir"/usr/share/licenses/"$pkgname"
}

# vim: ts=2 sw=2 et:
