# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>

pkgname=python-httptools
pkgver=0.6.4
pkgrel=2
pkgdesc='Fast HTTP parser'
arch=(x86_64 aarch64)
url=https://github.com/MagicStack/httptools
license=(MIT)
depends=(
  python
  llhttp
)
makedepends=(
  cython
  git
  python-setuptools
  python-wheel
)
_tag=e265ae033d3d7212f92a614963a349e315f82df3
source=(git+https://github.com/MagicStack/httptools#tag=${_tag}
        git+https://github.com/nodejs/http-parser.git)
b2sums=('d8a3c1df63fcab61795a076466daee0afbc370a861bcf000b4ffbffbd38d3f86c13db3cf4c93a58894f1a72021eb4f654c2cdb960f0b5e255643cdadf7371116'
        'SKIP')

prepare() {
  cd httptools
  sed 's/CYTHON_DEPENDENCY =.*/CYTHON_DEPENDENCY = "Cython"/' -i setup.py
  git rm vendor/llhttp
  git config --global protocol.file.allow always
  git submodule init
  git config submodule.vendor/http-parser.url "$srcdir"/http-parser
  git submodule update
}

pkgver() {
  cd httptools
  git describe --tags | sed 's/^v//'
}

build() {
  cd httptools
  python setup.py build build_ext --use-system-llhttp
}

package() {
  cd httptools
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
  install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim: ts=2 sw=2 et:
