void-packages/srcpkgs/python3-numpy/template
2021-03-29 09:38:02 -04:00

86 lines
2.4 KiB
Bash

# Template file for 'python3-numpy'
pkgname=python3-numpy
version=1.20.2
revision=1
wrksrc="numpy-${version}"
build_style=python3-module
hostmakedepends="python3-setuptools python3-Cython gcc-fortran"
makedepends="python3-devel
$(vopt_if openblas 'openblas-devel' 'lapack-devel cblas-devel')"
depends="python3-setuptools"
short_desc="Fast and sophisticated array facility to Python3"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="BSD-3-Clause"
homepage="https://www.numpy.org/"
distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
checksum=f2431c82e2d0ee1a7dba3abd26b9e80d8d3cfa620e8b37e7d95991ad6c785834
alternatives="numpy:f2py:/usr/bin/f2py3"
# Tests do not function propery in a build directory
make_check="no"
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="segfaults";;
esac
fi
post_patch() {
case "${XBPS_TARGET_MACHINE}" in
armv5tel-musl)
cp "${FILESDIR}/fenv-constants.h" numpy/core/src/npymath/
patch -Np0 -i "${FILESDIR}/fenv-constants.patch"
;;
esac
if [ "$XBPS_TARGET_LIBC" = musl ] ; then
vsed -i 's|"backtrace",||' numpy/core/setup_common.py
fi
if [ "$XBPS_WORDSIZE" != "$XBPS_TARGET_WORDSIZE" ]; then
# When host/target word sizes disagree, this $werror header
# triggers -Werror failures about redefining SIZEOF_OFF_T from
# the wrong host size to the correct target size
vsed -e 's/\$werror//' -i numpy/core/src/_simd/_simd.dispatch.c.src
fi
}
pre_build() {
# Build numpy in parallel
make_build_args+=" ${makejobs}"
# Find the right linear algebra subroutines on the target arch
: > site.cfg
for _blaslib in $(vopt_if openblas openblas "lapack blas"); do
cat >> site.cfg <<-EOF
[$_blaslib]
libraries = ${_blaslib}
include_dirs = ${XBPS_CROSS_BASE}/usr/include
library_dirs = ${XBPS_CROSS_BASE}/usr/lib
runtime_library_dirs = ${XBPS_CROSS_BASE}/usr/lib
EOF
done
}
post_install() {
# create compat symlinks for .h files
vmkdir ${py3_inc}
ln -sfr ${DESTDIR}/${py3_sitelib}/numpy/core/include/numpy \
${DESTDIR}/${py3_inc}
rm -f ${DESTDIR}/usr/bin/f2py
rm -f ${DESTDIR}/usr/lib/python*/site-packages/numpy/LICENSE.txt
vlicense LICENSE.txt LICENSE
}