# $Id$
# Maintainer (ArchLinux): Alexander Rødseth <rodseth@gmail.com>
# Contributor (ArchLinux): William Rea <sillywilly@gmail.com>
# Contributor (ArchLinux): Stefan Husmann <stefan-husmann@t-online.de>
# Maintainer (MSYS2): Ray Donnelly <mingw.android@gmail.com>

_realname=arpack
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.8.0
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
pkgdesc="Fortran77 subroutines designed to solve large scale eigenvalue problems (mingw-w64)"
url='https://forge.scilab.org/index.php/p/arpack-ng/'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libgfortran"
         "${MINGW_PACKAGE_PREFIX}-openblas")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc-fortran")
provides=("${MINGW_PACKAGE_PREFIX}-arpack-ng")
source=(${_realname}-${pkgver}.tar.gz::https://github.com/opencollab/arpack-ng/archive/${pkgver}.tar.gz)
sha256sums=('ADA5AEB3878874383307239C9235B716A8A170C6D096A6625BFD529844DF003D')

prepare() {
 cd "${srcdir}/${_realname}-ng-${pkgver}"
 ./bootstrap
}

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

  ../${_realname}-ng-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-static \
    --enable-shared \
    --with-blas=openblas

  make
}

#check() {
#  cd "${srcdir}"/build-${CARCH}
#  make check
#}

package() {
  cd "${srcdir}"/build-${CARCH}

  make DESTDIR="${pkgdir}"/ install
  install -Dm644 ${srcdir}/${_realname}-ng-${pkgver}/COPYING \
    ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}
