# Maintainer: Rafal Brzegowy <rafal.brzegowy@yahoo.com>

_realname=lis
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=2.0.30
pkgrel=2
pkgdesc='Library of Iterative Solvers for linear systems (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
depends=("${MINGW_PACKAGE_PREFIX}-libtool"
         "${MINGW_PACKAGE_PREFIX}-msmpi")
makedepends=("${MINGW_PACKAGE_PREFIX}-msmpi")
options=('!docs')
license=('BSD')
url='https://www.ssisc.org/lis/'
source=(https://www.ssisc.org/lis/dl/${_realname}-${pkgver}.zip)
sha256sums=('fefe1ba48aa5867cde3c07ea4009fb333baa863b535a1f29bbdf99de42f49f67')

prepare() {
  cd ${_realname}-${pkgver}
  autoreconf -fiv
}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}" && cd "${srcdir}/build-${MINGW_CHOST}"

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-mpi \
    --enable-omp \
    --enable-shared \
    --enable-fma \
    --enable-sse2 \
    --enable-longlong \
    --enable-longdouble \
    --enable-quad \
    --enable-f90 \
    --enable-fortran \
    --disable-test \
    --with-gnu-ld

  make
}

check() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make check || true
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make install DESTDIR="${pkgdir}"
  install -Dm644 ${srcdir}/${_realname}-${pkgver}/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}

# vim: ts=2 sw=2 et:
