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

pkgbase=capstone
pkgname=('capstone' 'python-capstone' 'python2-capstone')
pkgver=3.0.4
pkgrel=1
pkgdesc='A lightweight multi-platform, multi-architecture disassembly framework'
url='http://www.capstone-engine.org/index.html'
arch=('i686' 'x86_64')
license=('BSD')
makedepends=('glibc' 'python' 'python2')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/aquynh/${pkgbase}/archive/${pkgver}.tar.gz)
sha512sums=('a5c29e7c559b5391d6a4ec9a7f766699ea6d321aa2f1fc57fdcec893107fa3ef2f5f6323629971c1129f1ca087df4f3ad03d0a8234d2eae368c8ccfec04dbf4d')

build() {
  cd ${pkgbase}-${pkgver}
  make
}

package_capstone() {
  depends=('glibc')
  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 LICENSE.TXT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

package_python-capstone() {
  depends=('capstone' 'python')
  cd ${pkgbase}-${pkgver}/bindings/python
  python setup.py install -O1 --root="${pkgdir}" --prefix=/usr
  install -Dm 644 ../../LICENSE.TXT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

package_python2-capstone() {
  depends=('capstone' 'python2')
  cd ${pkgbase}-${pkgver}/bindings/python
  python2 setup.py install -O1 --root="${pkgdir}" --prefix=/usr
  install -Dm 644 ../../LICENSE.TXT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim: ts=2 sw=2 et:
