# Template file for 'python3-scipy'
pkgname=python3-scipy
version=1.15.2
revision=1
build_style=python3-pep517
build_helper="meson numpy"
# SciPy imposes strict and unnecessary restrictions on build dependencies
make_build_args="--skip-dependency-check
 $(vopt_if openblas "" "-Csetup-args=-Dblas=blas -Csetup-args=-Dlapack=lapack")
"
hostmakedepends="python3-meson-python python3-Cython python3-pybind11
 pythran python3-numpy gcc-fortran pkg-config"
makedepends="python3-devel python3-pybind11 python3-numpy pythran
 $(vopt_if openblas openblas-devel "lapack-devel cblas-devel")"
depends="python3-numpy"
checkdepends="python3-pytest python3-pytest-xdist python3-hypothesis python3-pooch
 python3-matplotlib python3-mpmath python3-psutil python3-sympy"
short_desc="Scientific library for Python3"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="BSD-3-Clause"
homepage="https://scipy.org/"
changelog="https://github.com/scipy/scipy/releases"
distfiles="${PYPI_SITE}/s/scipy/scipy-${version}.tar.gz"
checksum=cd58a314d92838f7e6f755c8a2167ead4f27e1fd5c1251fd54289569ef3495ec
# must be tested from site dir of installed version (see dev.py:739)
make_check_pre='eval env -C "${testdir}/${py3_sitelib}"'

build_options="openblas"

case "$XBPS_TARGET_MACHINE" in
	x86_64*|i686*|aarch64*|armv[67]*|ppc64*)
		# Prefer accelerated routines where available
		build_options_default="openblas"
		;;
	*) ;;
esac

if [ "$build_option_openblas" ]; then
	case "$XBPS_TARGET_MACHINE" in
		ppc64*) ;;
		ppc*) broken="numpy can't be built with openblas";;
	esac
fi

if [ "$XBPS_CHECK_PKGS" != full ]; then
	make_check_args="-m 'not slow'"
fi

post_install() {
	vlicense LICENSE.txt
}
