# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=gyp
pkgver=20240207.1615ec32
pkgrel=1
pkgdesc="Generate Your Projects meta-build system"
url="https://gyp.gsrc.io/"
arch=(any)
license=(BSD-3-Clause)
depends=(
  ninja
  python
)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-wheel
)
_commit=1615ec326858f8c2bd8f30b3a86ea71830409ce4  # changes/79/5276479/4
source=(
  "git+https://chromium.googlesource.com/external/gyp#commit=$_commit"
  0001-Fix-Python-compat-and-remove-six.patch
)
b2sums=('011245ee2d08baf1cd9731b184e4206640e42087c35c24388e2636fcb2dfd9b345dadca1bf57c0a2e228debb76ce1b8654a338dd7e8e3810fe5616446d91aab9'
        '5110f87d01089cc954923c9323b8edd4490615a6709523db7232e0a1a82e7ac5a65aa4740376f5cf771ebdc3cd123744634356263b116d337310e4de55070671')

pkgver() {
  cd gyp

  local commit_date="$(TZ=UTC git show -s --pretty=%cd --date=format-local:%Y%m%d HEAD)"
  local short_rev="$(git rev-parse --short HEAD)"

  echo $commit_date.$short_rev
}

prepare() {
  cd gyp
  git apply -3 ../0001-Fix-Python-compat-and-remove-six.patch
}

build() {
  cd gyp
  python -m build --wheel --no-isolation
}

package() {
  cd gyp
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 LICENSE
}

# vim:set sw=2 sts=-1 et:
