python3-scipy: use new meson helper

This commit is contained in:
Andrew J. Hesford 2023-09-20 10:45:43 -04:00 committed by Andrew J. Hesford
parent c6431f06c5
commit 8ecb9de064

View file

@ -2,9 +2,10 @@
pkgname=python3-scipy
version=1.11.2
revision=1
build_style=meson
build_helper="python3"
configure_args="$(vopt_if openblas "" "-Dblas=blas -Dlapack=lapack")"
build_style=python3-pep517
build_helper="meson"
make_build_args="--no-isolation --wheel
$(vopt_if openblas "" "-Csetup-args=-Dblas=blas -Csetup-args=-Dlapack=lapack")"
hostmakedepends="python3-build python3-installer python3-meson-python
python3-wheel python3-Cython python3-pybind11 pythran python3-numpy
gcc-fortran pkg-config"
@ -22,8 +23,12 @@ make_check="no" # Tests need an installed copy to run and meson makes this tough
build_options="openblas"
if [ "$CROSS_BUILD" ]; then
make_build_args+="
-Csetup-args=--cross-file=${XBPS_WRAPPERDIR}/meson/xbps_meson.cross
-Csetup-args=--cross-file=${XBPS_WRAPPERDIR}/meson/python.cross
"
_pybind11_dir="${py3_sitelib}/pybind11"
configure_args+=" --cross-file=python.cross"
export PKG_CONFIG_PATH="${XBPS_CROSS_BASE}/${_pybind11_dir}/share/pkgconfig"
# pybind11 uses a path relative to the pkgconfig file to set $prefix,
# which causes the wrapper to double-include $XBPS_CROSS_BASE; override
@ -46,8 +51,19 @@ if [ "$build_option_openblas" ]; then
esac
fi
pre_patch() {
if [ "${CROSS_BUILD}" ]; then
post_patch() {
if [ "$CROSS_BUILD" ]; then
local _xpy="${XBPS_CROSS_BASE}/${py3_sitelib}"
cat > "${XBPS_WRAPPERDIR}/meson/python.cross" <<-EOF
[properties]
numpy-include-dir = '${_xpy}/numpy/core/include'
pythran-include-dir = '${_xpy}/pythran'
EOF
fi
}
pre_build() {
if [ "$CROSS_BUILD" ]; then
# Meson can't tolerate $CC with arguments as set by the build helper
CC="${XBPS_CROSS_TRIPLET}-gcc"
# CXX needs to know where to find Python headers
@ -55,25 +71,6 @@ pre_patch() {
fi
}
post_patch() {
if [ "$CROSS_BUILD" ]; then
local _xpy="${XBPS_CROSS_BASE}/${py3_sitelib}"
cat > python.cross <<-EOF
[properties]
numpy-include-dir = '${_xpy}/numpy/core/include'
pythran-include-dir = '${_xpy}/pythran'
EOF
fi
}
do_build() {
# Use the build directory already configured by xbps-src for meson
python3 -m build --no-isolation --wheel \
-Cbuilddir="./build" -Ccompile-args="${makejobs}" .
}
do_install() {
python3 -m installer --destdir "${DESTDIR}" \
--no-compile-bytecode dist/*.whl
post_install() {
vlicense LICENSE.txt
}