pkgsrc/math/py-numpy/Makefile
thor c55ff69d21 py-numpy: updated the BLAS patch for more likely upstream inclusion
This introduces a 'generic' variant for blas_opt_info() and
lapack_opt_info() that looks into BLAS_LIBS and LAPACK_LIBS. The
others stay alive, and you can choose via NPY_BLAS_ORDER and
NPY_LAPACK_ORDER.

Will post this upstream … hoping for the best.

Other projects seem just to abuse the [openblas] entry in
site.cfg, or whatever hacks to trick this into building with
a generic BLAS. One hurdle is that using openblas seems to
assume that CBLAS is present in there, which it is not in pkgsrc.

We could think about introducing some alternatives stuff that uses
stubs for all the related libs anyway, but that is not my application,
which builds things from source. For binary packages, it would be
interesting, though. See Debian and Genoot for prior art on that.
2021-04-07 11:57:30 +00:00

69 lines
2.4 KiB
Makefile

# $NetBSD: Makefile,v 1.77 2021/04/07 11:57:30 thor Exp $
DISTNAME= numpy-1.19.5
PKGREVISION= 3
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
CATEGORIES= math python
MASTER_SITES= ${MASTER_SITE_PYPI:=n/numpy/}
EXTRACT_SUFX= .zip
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.numpy.org/
COMMENT= Array processing for numbers, strings, records, and objects
LICENSE= modified-bsd
TEST_DEPENDS+= ${PYPKGPREFIX}-hypothesis-[0-9]*:../../devel/py-hypothesis
TEST_DEPENDS+= ${PYPKGPREFIX}-nose-[0-9]*:../../devel/py-nose
TEST_DEPENDS+= ${PYPKGPREFIX}-test-[0-9]*:../../devel/py-test
# error: 'for' loop initial declarations are only allowed in C99 mode
USE_LANGUAGES= c99 fortran
# Use our BLAS. The patch adds 'generic' as first entry anyway, but we
# enforce it to fail early and for the case that upstream accepts the
# patch, but with changed default order.
MAKE_ENV+= BLAS_LIBS=${BLAS_LIBS:Q} LAPACK_LIBS=${LAPACK_LIBS:Q}
MAKE_ENV+= NPY_BLAS_ORDER=generic NPY_LAPACK_ORDER=generic
REPLACE_PYTHON+= *.py */*.py */*/*.py */*/*/*.py */*/*/*/*.py
PYTHON_VERSIONS_INCOMPATIBLE= 27 # since 1.17
# XXX Avoid picking up other compilers when installed
.include "../../mk/compiler.mk"
.if defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "g95"
PYSETUPBUILDARGS+= --fcompiler=g95
.elif defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "gfortran"
PYSETUPBUILDARGS+= --fcompiler=gnu95
.elif !empty(PKGSRC_COMPILER:Mgcc)
PYSETUPBUILDARGS+= --fcompiler=gnu
.endif
# This package bypasses the wrappers and calls the compilers directly when
# linking, so ensure that we pass through requisite options.
LDFLAGS+= ${_COMPILER_ABI_FLAG.${ABI}}
.include "../../mk/bsd.prefs.mk"
# numpy fails using the gold linker with:
# fatal error: --sysroot=: must take a non-empty argument
# Work around it on DragonFly by specifying the classic gnu linker
MAKE_ENV.DragonFly+= LDVER=ld.bfd
post-install:
cd ${DESTDIR}${PREFIX}/bin && ${RM} f2py || ${TRUE}
do-test:
cd ${WRKDIR} && \
${RUN} PYTHONPATH=${DESTDIR}${PREFIX}/${PYSITELIB} ${PYTHONBIN} -c "import numpy; numpy.test()"
BUILDLINK_API_DEPENDS.py-cython+= ${PYPKGPREFIX}-cython>=0.29.21
.include "../../devel/py-cython/buildlink3.mk"
.include "../../lang/python/application.mk"
.include "../../lang/python/egg.mk"
# Consider allowing mk/blas.buildlink3.mk to handle Accelerate.framework
.if ${OPSYS} != "Darwin"
# blas and lapack are not needed; numpy will use Accelerate.framework
.include "../../mk/blas.buildlink3.mk"
.endif
.include "../../mk/bsd.pkg.mk"