# Maintainer: Markus M. May <triplem@tu.archserver.org>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>

pkgname=swig
pkgver=2.0.2
pkgrel=1
pkgdesc="Generate scripting interfaces to C/C++ code"
arch=('i686' 'x86_64')
url="http://www.swig.org/"
license=('custom')
depends=('gcc-libs' 'zlib' 'pcre')
source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz
        swig-deprecated-pycobject.patch
        swig-pyslice.patch)
md5sums=('eaf619a4169886923e5f828349504a29'
         '30180b9c0291355a95907d04f7b91341'
         '406696effdbe98b35472ace95d6f4fc5')                

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  # Use PyCapsule API instead of deprecated PyCObject API in python bindings
  # See https://bugzilla.redhat.com/show_bug.cgi?id=623854
  patch -Np1 -i ../swig-deprecated-pycobject.patch

  # Fix PySlice* API/ABI issues with the Python 3.2
  # See https://bugzilla.redhat.com/show_bug.cgi?id=666429
  patch -Np1 -i ../swig-pyslice.patch

  ./configure --prefix=/usr
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  install -D -m644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
  install -D -m644 LICENSE-UNIVERSITIES "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE-UNIVERSITIES
}
