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

_realname=starpu
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.3.8
pkgrel=1
pkgdesc='StarPU is a task programming library for hybrid architectures (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
depends=("${MINGW_PACKAGE_PREFIX}-fftw"
         "${MINGW_PACKAGE_PREFIX}-libssp"
         "${MINGW_PACKAGE_PREFIX}-libtool")
makedepends=("${MINGW_PACKAGE_PREFIX}-hwloc")
options=('!docs')
license=('LGPL')
url='https://starpu.gitlabpages.inria.fr'
source=(https://files.inria.fr/starpu/${_realname}-${pkgver}/${_realname}-${pkgver}.tar.gz)
sha256sums=('D35A27B219AF8E7973888EBBFF728EC0112AE9CDA88D6B79C4CC7A1399B4D052')

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 \
    LDFLAGS=-lssp \
    --prefix=${MINGW_PREFIX} \
    --disable-opencl \
    --with-gnu-ld \
    --disable-mpi \
    --disable-build-doc \
    --disable-build-examples \
    --enable-quick-check

  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.LGPL ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}

# vim: ts=2 sw=2 et:
