# Template file for 'python-numpy'
pkgname=python-numpy
version=1.16.5
revision=1
build_style=python2-module
hostmakedepends="python-setuptools python-Cython gcc-fortran"
makedepends="python-devel lapack-devel cblas-devel"
short_desc="Fast and sophisticated array facility to Python2"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.numpy.org/"
distfiles="https://github.com/numpy/numpy/archive/v${version}.tar.gz"
checksum=3c82a9b8616e3096a79a2af9c288d8ed4013a10fc7baf3eaf54655309734dadd
alternatives="numpy:f2py:/usr/bin/f2py2"

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
}

pre_build() {
	make_build_args+=" ${makejobs}"
}

post_install() {
	# create compat symlinks for .h files
	vmkdir ${py2_inc}
	ln -sfr ${DESTDIR}/${py2_sitelib}/numpy/core/include/numpy \
		${DESTDIR}/${py2_inc}

	rm -f ${DESTDIR}/usr/bin/f2py

	rm -f ${DESTDIR}/usr/lib/python*/site-packages/numpy/LICENSE.txt
	vlicense LICENSE.txt LICENSE
}
