Christoph Reiter bd08ada171 Use pypi PURLs instead of plain pypi names
This allows us to include a version and we already use PURL
for other things, so might as well remove the pypi special case.

Normalize the names, since that is required for PURLs.
2025-02-17 09:02:11 +01:00

80 lines
3.1 KiB
Bash

# Maintainer: Ray Donnelly <mingw.android@gmail.com>
_realname=cvxopt
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.3.2
pkgrel=3
pkgdesc="Convex optimization based on the Python programming language (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
'purl: pkg:pypi/cvxopt'
"cpe: cpe:/a:cvxopt_project:cvxopt"
)
url='https://cvxopt.org/'
license=('spdx:GPL-3.0-or-later')
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
"${MINGW_PACKAGE_PREFIX}-python-installer"
"${MINGW_PACKAGE_PREFIX}-python-setuptools"
"${MINGW_PACKAGE_PREFIX}-python-setuptools-scm"
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-dsdp"
"${MINGW_PACKAGE_PREFIX}-fftw"
"${MINGW_PACKAGE_PREFIX}-glpk"
"${MINGW_PACKAGE_PREFIX}-gsl")
depends=("${MINGW_PACKAGE_PREFIX}-python"
"${MINGW_PACKAGE_PREFIX}-openblas"
"${MINGW_PACKAGE_PREFIX}-suitesparse")
optdepends=("${MINGW_PACKAGE_PREFIX}-fftw: for FFTW interface"
"${MINGW_PACKAGE_PREFIX}-glpk: solver for linear cone and PWL programming problems"
"${MINGW_PACKAGE_PREFIX}-gsl: for custom random number generators")
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname/-/_}-${pkgver}.tar.gz")
sha256sums=('3461fa42c1b2240ba4da1d985ca73503914157fc4c77417327ed6d7d85acdbe6')
prepare() {
cd "${srcdir}"
rm -rf python-build-${MSYSTEM} | true
cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}"
# Set version for setuptools_scm
export SETUPTOOLS_SCM_PRETEND_VERSION=${pkgver}
}
build() {
cd "${srcdir}/python-build-${MSYSTEM}"
CVXOPT_BLAS_LIB='openblas' \
CVXOPT_LAPACK_LIB='openblas' \
CVXOPT_BUILD_GSL=1 \
CVXOPT_BUILD_FFTW=1 \
CVXOPT_BUILD_DSDP=1 \
CVXOPT_BUILD_GLPK=1 \
CVXOPT_GSL_LIB_DIR=${MINGW_PREFIX}/lib \
CVXOPT_GSL_INC_DIR=${MINGW_PREFIX}/include \
CVXOPT_FFTW_LIB_DIR=${MINGW_PREFIX}/lib \
CVXOPT_FFTW_INC_DIR=${MINGW_PREFIX}/include \
CVXOPT_GLPK_LIB_DIR=${MINGW_PREFIX}/lib \
CVXOPT_GLPK_INC_DIR=${MINGW_PREFIX}/include \
CVXOPT_DSDP_LIB_DIR=${MINGW_PREFIX}/lib \
CVXOPT_DSDP_INC_DIR=${MINGW_PREFIX}/include/dsdp \
CVXOPT_SUITESPARSE_LIB_DIR=${MINGW_PREFIX}/lib \
CVXOPT_SUITESPARSE_INC_DIR=${MINGW_PREFIX}/include/suitesparse \
${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}
check() {
cd "${srcdir}/python-build-${MSYSTEM}"
${MINGW_PREFIX}/bin/python -m pytest
}
package() {
cd "${srcdir}/python-build-${MSYSTEM}"
MSYS2_ARG_CONV_EXCL="--prefix=" \
${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
--destdir="${pkgdir}" dist/*.whl
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/COPYING"
}