# Maintainer: Dirk Stolle

_realname=passagemath-polyhedra
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=10.6.46
pkgrel=1
pkgdesc="passagemath: Convex polyhedra in arbitrary dimension, mixed integer linear optimization (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/passagemath/passagemath'
msys2_references=(
  'purl: pkg:pypi/passagemath-polyhedra'
)
license=('spdx:GPL-2.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-cysignals"
         "${MINGW_PACKAGE_PREFIX}-python-gmpy2"
         "${MINGW_PACKAGE_PREFIX}-python-memory-allocator"
         "${MINGW_PACKAGE_PREFIX}-python-passagemath-environment"
         "${MINGW_PACKAGE_PREFIX}-python-passagemath-glpk"
         "${MINGW_PACKAGE_PREFIX}-python-passagemath-modules"
         "${MINGW_PACKAGE_PREFIX}-python-passagemath-ppl"
         "${MINGW_PACKAGE_PREFIX}-cc-libs"
         "${MINGW_PACKAGE_PREFIX}-gmp"
)
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cython"
             "${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-python-pkgconfig"
             "${MINGW_PACKAGE_PREFIX}-python-passagemath-setup"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
# There are more potential optional dependencies, but they are not packaged yet.
optdepends=("${MINGW_PACKAGE_PREFIX}-python-cvxopt"
            # "${MINGW_PACKAGE_PREFIX}-python-cvxpy"
            # "${MINGW_PACKAGE_PREFIX}-python-fpylll"
            # "${MINGW_PACKAGE_PREFIX}-python-jupymake"
            "${MINGW_PACKAGE_PREFIX}-python-passagemath-cddlib"
            # "${MINGW_PACKAGE_PREFIX}-python-passagemath-database-polytopes-4d"
            "${MINGW_PACKAGE_PREFIX}-python-passagemath-flint"
            "${MINGW_PACKAGE_PREFIX}-python-passagemath-graphs"
            # "${MINGW_PACKAGE_PREFIX}-python-passagemath-groups"
            # "${MINGW_PACKAGE_PREFIX}-python-passagemath-latte-4ti2"
            # "${MINGW_PACKAGE_PREFIX}-python-passagemath-linbox"
            # "${MINGW_PACKAGE_PREFIX}-python-passagemath-palp"
            # "${MINGW_PACKAGE_PREFIX}-python-passagemath-pari"
            "${MINGW_PACKAGE_PREFIX}-python-passagemath-plot"
            # "${MINGW_PACKAGE_PREFIX}-python-passagemath-topcom"
            # "${MINGW_PACKAGE_PREFIX}-python-pynormaliz"
)
options=('!strip')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname/-/_}-${pkgver}.tar.gz")
sha256sums=('19a2d17234a4c666ed9f4b2a7cfcf77dd165ed8ad4fd08511d848d23996c6384')

build() {
  cp -r "${_realname/-/_}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"

  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "python-build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl
}
