# Maintainer: Dirk Stolle

_realname=passagemath-graphs
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=10.6.47
pkgrel=1
pkgdesc="passagemath: Graphs, posets, hypergraphs, designs, abstract complexes, combinatorial polyhedra, abelian sandpiles, quivers (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/passagemath/passagemath'
msys2_references=(
  'purl: pkg:pypi/passagemath-graphs'
)
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-categories"
         "${MINGW_PACKAGE_PREFIX}-python-passagemath-environment")
makedepends=("${MINGW_PACKAGE_PREFIX}-boost"
             "${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cython"
             "${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-pkgconfig"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-passagemath-setup"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
optdepends=(
  "${MINGW_PACKAGE_PREFIX}-python-passagemath-bliss: graph (iso/auto)morphisms with bliss"
  "${MINGW_PACKAGE_PREFIX}-python-passagemath-cliquer: find cliques in graphs with cliquer"
  "${MINGW_PACKAGE_PREFIX}-python-passagemath-cmr: combinatorial matrix recognition"
  "${MINGW_PACKAGE_PREFIX}-python-passagemath-homfly: Homfly polynomials of knots/links with libhomfly"
  "${MINGW_PACKAGE_PREFIX}-python-passagemath-nauty: find automorphism groups of graphs, generate non-isomorphic graphs with nauty"
  "${MINGW_PACKAGE_PREFIX}-python-passagemath-planarity: graph planarity with the planarity suite"
  "${MINGW_PACKAGE_PREFIX}-python-passagemath-rankwidth: rankwidth and rank decompositions of graphs with rw"
  "${MINGW_PACKAGE_PREFIX}-python-passagemath-tdlib: tree decompositions with tdlib"
)
options=('!strip')
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname/-/_}-${pkgver}.tar.gz")
sha256sums=('1b1d6635bb64913fab8708bffbed46b3607f63d29c5b88deb261b3cac042c655')

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

  # Avoid warnings that may cause compilation to fail.
  CFLAGS+=" -Wno-incompatible-pointer-types"

  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
}
