# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Maintainer: Ray Donnelly <ray.donnelly@gmail.com>

_realname=gyp
pkgname=${_realname}
pkgver=r2173.a03d7413
pkgrel=3
pkgdesc="GYP can Generate Your Projects"
url="https://gyp.gsrc.io/"
arch=('i686' 'x86_64')
provides=("gyp-git")
conflicts=("gyp-git")
replaces=("gyp-git")
makedepends=(
  'git'
  'gcc'
  "python-setuptools"
  "python-build"
  "python-installer"
  "python-six"
)
depends=('python')
license=('custom')
_commit="a03d7413becefc8d55c8aa3df58b55b9bd0e9052"
source=("git+https://chromium.googlesource.com/external/gyp#commit=${_commit}"
        '0001-msys-ize.patch')
sha256sums=('SKIP'
            'fc53fc2f49ce1895c13aa330c814db29288a445e87a47d7bc81f6a6ab400df5f')

pkgver() {
  cd "${srcdir}"/${_realname}
  printf "r%s.%s" $(("$(git rev-list --count ${_commit})" + 1)) "$(git rev-parse --short "${_commit}")"
}

prepare() {
  cd "${srcdir}"/${_realname}

  patch -Np1 -i "${srcdir}/0001-msys-ize.patch"
}

build() {
  cd "${srcdir}"/${_realname}
  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}"/${_realname}
  python -m installer --destdir="${pkgdir}" dist/*.whl
}
