# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=swig
pkgver=4.0.2
pkgrel=1
pkgdesc="Generate scripting interfaces to C/C++ code"
arch=('i686' 'x86_64')
url="http://www.swig.org/"
license=('custom')
groups=('base-devel')
depends=('zlib' 'libpcre')
makedepends=('zlib-devel' 'pcre-devel')
source=(https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz
        swig-4.0.0-msysize.patch)
sha256sums=('d53be9730d8d58a16bf0cbd1f8ac0c0c3e1090573168bfa151b01eb47fa906fc'
            'e5499ba5ec6e10f3de3a49a26ea22ca16f81cde3b7ec543d959f0f2096b03543')

prepare() {
  cd ${pkgname}-${pkgver}

  patch -p1 -i ${srcdir}/swig-4.0.0-msysize.patch

  ./autogen.sh
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure -build=${CHOST} --prefix=/usr
  make
}

package() {
  cd ${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
}
