#!/usr/bin/bash
# JOBoRun		: Jwm OpenBox Obarun RUNit
# Maintainer	: Joe Bo Run <joborun@disroot.org>
# PkgSource		: url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website		: https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------

pkgname=swig
pkgver=4.0.2
pkgrel=05
pkgdesc="Generate scripting interfaces to C/C++ code"
arch=('x86_64')
url="http://www.swig.org/"
depends=('pcre' 'gcc-libs')
checkdepends=('ruby' 'python' 'java-environment' 'tcl' 'php' 'lua' 'r' 'go' 'boost')
source=(https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz
        jdk17.patch
        python310.patch)

prepare() {
  cd ${pkgname}-${pkgver}
  patch -Np1 -i ../jdk17.patch

  # https://github.com/swig/swig/issues/2044
  patch -Np1 -i ../python310.patch
}

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

check() {
  cd ${pkgname}-${pkgver}
  make check PY3=y
}

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
}

#---- license gpg-key sha256sums ----

license=('custom')

sha256sums=(d53be9730d8d58a16bf0cbd1f8ac0c0c3e1090573168bfa151b01eb47fa906fc # swig-4.0.2.tar.gz
	ee648f4e6b7bc1f482cb9199eb96ff85a5473d4703566f5c3f49d723ec1c3d27 # jdk17.patch
	c83d88476041e88d10ae60c2cd8c82dfff2abcd0cf472455c39778e2fac1c78b) # python310.patch
