aboutsummaryrefslogtreecommitdiff
path: root/srcpkgs/python3-scipy/template
blob: 569c1ce07341548ec85c0c765da3623d9718d0da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Template file for 'python3-scipy'
pkgname=python3-scipy
version=1.6.3
revision=1
wrksrc="scipy-${version}"
build_style=python3-module
build_helper="numpy"
make_check_args="--force"
hostmakedepends="gcc-fortran python3-setuptools python3-Cython python3-pybind11"
makedepends="python3-devel python3-pybind11
 $(vopt_if openblas openblas-devel lapack-devel)"
depends="python3-numpy"
checkdepends="python3-pytest"
short_desc="Scientific library for Python3"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
license="BSD-3-Clause"
homepage="https://scipy.org/scipylib/"
distfiles="https://github.com/scipy/scipy/releases/download/v${version}/scipy-${version}.tar.xz"
checksum=3851fdcb1e6877241c3377aa971c85af0d44f90c57f4dd4e54e1b2bbd742635e

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

LDFLAGS+=" -shared"

# Tell numpy to build in parallel
export NPY_NUM_BUILD_JOBS="${XBPS_MAKEJOBS}"

pre_build() {
	# 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
}

do_check() {
	python3 ./runtests.py --verbose
}

post_install() {
	rm ${DESTDIR}/${py3_sitelib}/scipy/*.txt
	vlicense LICENSE.txt
}