math/py-numpy16: bring BLAS usage into line with math/py-numpy This old version for PY27 now behaves just like the modern one regarding usage of BLAS and actually CBLAS.diff -r1.5 -r1.6 pkgsrc/math/py-numpy16/Makefile
(thor)
@@ -1,37 +1,38 @@ | @@ -1,37 +1,38 @@ | |||
1 | # $NetBSD: Makefile,v 1.5 2020/10/12 21:52:03 bacon Exp $ | 1 | # $NetBSD: Makefile,v 1.6 2021/04/20 20:58:39 thor Exp $ | |
2 | 2 | |||
3 | DISTNAME= numpy-1.16.6 | 3 | DISTNAME= numpy-1.16.6 | |
4 | PKGNAME= ${PYPKGPREFIX}-${DISTNAME} | 4 | PKGNAME= ${PYPKGPREFIX}-${DISTNAME} | |
5 | PKGREVISION= 1 | 5 | PKGREVISION= 2 | |
6 | CATEGORIES= math python | 6 | CATEGORIES= math python | |
7 | MASTER_SITES= ${MASTER_SITE_PYPI:=n/numpy/} | 7 | MASTER_SITES= ${MASTER_SITE_PYPI:=n/numpy/} | |
8 | EXTRACT_SUFX= .zip | 8 | EXTRACT_SUFX= .zip | |
9 | 9 | |||
10 | MAINTAINER= pkgsrc-users@NetBSD.org | 10 | MAINTAINER= pkgsrc-users@NetBSD.org | |
11 | HOMEPAGE= http://www.numpy.org/ | 11 | HOMEPAGE= http://www.numpy.org/ | |
12 | COMMENT= Array processing for numbers, strings, records, and objects | 12 | COMMENT= Array processing for numbers, strings, records, and objects | |
13 | LICENSE= modified-bsd | 13 | LICENSE= modified-bsd | |
14 | 14 | |||
15 | # While this builds with 3, the package only exists to accomodate | 15 | # While this builds with 3, the package only exists to accomodate | |
16 | # things that require python2.7. | 16 | # things that require python2.7. | |
17 | PYTHON_VERSIONS_ACCEPTED= 27 | 17 | PYTHON_VERSIONS_ACCEPTED= 27 | |
18 | 18 | |||
19 | TEST_DEPENDS+= ${PYPKGPREFIX}-nose-[0-9]*:../../devel/py-nose | 19 | TEST_DEPENDS+= ${PYPKGPREFIX}-nose-[0-9]*:../../devel/py-nose | |
20 | 20 | |||
21 | PYTHON_VERSIONED_DEPENDENCIES= test:test | 21 | PYTHON_VERSIONED_DEPENDENCIES= test:test | |
22 | 22 | |||
23 | USE_LANGUAGES= c fortran | 23 | USE_LANGUAGES= c fortran | |
24 | MAKE_ENV+= ATLAS=None | 24 | ||
25 | .include "../../math/py-numpy/Makefile.make_env" | |||
25 | 26 | |||
26 | REPLACE_PYTHON+= *.py */*.py */*/*.py */*/*/*.py */*/*/*/*.py | 27 | REPLACE_PYTHON+= *.py */*.py */*/*.py */*/*/*.py */*/*/*/*.py | |
27 | 28 | |||
28 | # XXX Avoid picking up other compilers when installed | 29 | # XXX Avoid picking up other compilers when installed | |
29 | .include "../../mk/compiler.mk" | 30 | .include "../../mk/compiler.mk" | |
30 | 31 | |||
31 | .if defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "g95" | 32 | .if defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "g95" | |
32 | PYSETUPBUILDARGS+= --fcompiler=g95 | 33 | PYSETUPBUILDARGS+= --fcompiler=g95 | |
33 | .elif defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "gfortran" | 34 | .elif defined(PKGSRC_FORTRAN) && ${PKGSRC_FORTRAN} == "gfortran" | |
34 | PYSETUPBUILDARGS+= --fcompiler=gnu95 | 35 | PYSETUPBUILDARGS+= --fcompiler=gnu95 | |
35 | .elif !empty(PKGSRC_COMPILER:Mgcc) | 36 | .elif !empty(PKGSRC_COMPILER:Mgcc) | |
36 | PYSETUPBUILDARGS+= --fcompiler=gnu | 37 | PYSETUPBUILDARGS+= --fcompiler=gnu | |
37 | .endif | 38 | .endif | |
@@ -49,19 +50,15 @@ MAKE_ENV.DragonFly+= LDVER=ld.bfd | @@ -49,19 +50,15 @@ MAKE_ENV.DragonFly+= LDVER=ld.bfd | |||
49 | 50 | |||
50 | post-install: | 51 | post-install: | |
51 | cd ${DESTDIR}${PREFIX}/bin && ${RM} f2py || ${TRUE} | 52 | cd ${DESTDIR}${PREFIX}/bin && ${RM} f2py || ${TRUE} | |
52 | 53 | |||
53 | do-test: | 54 | do-test: | |
54 | cd ${WRKDIR} && \ | 55 | cd ${WRKDIR} && \ | |
55 | ${RUN} PYTHONPATH=${DESTDIR}${PREFIX}/${PYSITELIB} ${PYTHONBIN} -c "import numpy; numpy.test()" | 56 | ${RUN} PYTHONPATH=${DESTDIR}${PREFIX}/${PYSITELIB} ${PYTHONBIN} -c "import numpy; numpy.test()" | |
56 | 57 | |||
57 | BUILDLINK_API_DEPENDS.py-cython+= ${PYPKGPREFIX}-cython>=0.29.2 | 58 | BUILDLINK_API_DEPENDS.py-cython+= ${PYPKGPREFIX}-cython>=0.29.2 | |
58 | .include "../../devel/py-cython/buildlink3.mk" | 59 | .include "../../devel/py-cython/buildlink3.mk" | |
59 | .include "../../lang/python/application.mk" | 60 | .include "../../lang/python/application.mk" | |
60 | .include "../../lang/python/egg.mk" | 61 | .include "../../lang/python/egg.mk" | |
61 | .include "../../lang/python/versioned_dependencies.mk" | 62 | .include "../../lang/python/versioned_dependencies.mk" | |
62 | # Consider allowing mk/blas.buildlink3.mk to handle Accelerate.framework | 63 | .include "../../math/cblas/buildlink3.mk" | |
63 | .if ${OPSYS} != "Darwin" | |||
64 | # blas and lapack are not needed; numpy will use Accelerate.framework | |||
65 | .include "../../mk/blas.buildlink3.mk" | |||
66 | .endif | |||
67 | .include "../../mk/bsd.pkg.mk" | 64 | .include "../../mk/bsd.pkg.mk" |
@@ -1,11 +1,11 @@ | @@ -1,11 +1,11 @@ | |||
1 | $NetBSD: distinfo,v 1.2 2020/10/13 08:27:02 leot Exp $ | 1 | $NetBSD: distinfo,v 1.3 2021/04/20 20:58:39 thor Exp $ | |
2 | 2 | |||
3 | SHA1 (numpy-1.16.6.zip) = 99bc8b723639066168cca0c9a3b68c36c73bddc2 | 3 | SHA1 (numpy-1.16.6.zip) = 99bc8b723639066168cca0c9a3b68c36c73bddc2 | |
4 | RMD160 (numpy-1.16.6.zip) = af2c5ec5956986b061a5cf067de5685098b6846f | 4 | RMD160 (numpy-1.16.6.zip) = af2c5ec5956986b061a5cf067de5685098b6846f | |
5 | SHA512 (numpy-1.16.6.zip) = c219841cc804c194a38b8e046b83265b8b7a35be8f33d68561ef17b085465dd11bd1e84fe1baea809af0efb09a9b13283f13728d125fcdd2221c30ec23fd0a50 | 5 | SHA512 (numpy-1.16.6.zip) = c219841cc804c194a38b8e046b83265b8b7a35be8f33d68561ef17b085465dd11bd1e84fe1baea809af0efb09a9b13283f13728d125fcdd2221c30ec23fd0a50 | |
6 | Size (numpy-1.16.6.zip) = 5143340 bytes | 6 | Size (numpy-1.16.6.zip) = 5143340 bytes | |
7 | SHA1 (patch-numpy_distutils_fcompiler_____init____.py) = 49d070da5b48bd9818b37ac3254341fa68503c53 | 7 | SHA1 (patch-numpy_distutils_fcompiler_____init____.py) = 49d070da5b48bd9818b37ac3254341fa68503c53 | |
8 | SHA1 (patch-numpy_distutils_fcompiler_g95.py) = be73b64a3e551df998b6a904d6db762bf28a98ed | 8 | SHA1 (patch-numpy_distutils_fcompiler_g95.py) = be73b64a3e551df998b6a904d6db762bf28a98ed | |
9 | SHA1 (patch-numpy_distutils_fcompiler_gnu.py) = 893b0556f869543074cb74d5d4385d2f155004ec | 9 | SHA1 (patch-numpy_distutils_fcompiler_gnu.py) = 893b0556f869543074cb74d5d4385d2f155004ec | |
10 | SHA1 (patch-numpy_distutils_system__info.py) = f6414ce220c7f8ba7e139f5619080a78f6de8066 | 10 | SHA1 (patch-numpy_distutils_system__info.py) = 80659989fd4a8189a27e7f20802dda2151a4c4e1 | |
11 | SHA1 (patch-numpy_linalg_lapack__litemodule.c) = b421455fdbb666c8075d8bffbeb59533434d23e6 | 11 | SHA1 (patch-numpy_linalg_lapack__litemodule.c) = b421455fdbb666c8075d8bffbeb59533434d23e6 |
@@ -1,30 +1,78 @@ | @@ -1,30 +1,78 @@ | |||
1 | $NetBSD: patch-numpy_distutils_system__info.py,v 1.2 2020/10/12 21:52:03 bacon Exp $ | 1 | $NetBSD: patch-numpy_distutils_system__info.py,v 1.3 2021/04/20 20:58:39 thor Exp $ | |
2 | 2 | |||
3 | Disable openblas detection. In pkgsrc, use mk/blas.buildlink.mk. | 3 | --- numpy/distutils/system_info.py.orig 2021-04-20 20:11:02.731971594 +0000 | |
4 | ||||
5 | --- numpy/distutils/system_info.py.orig 2018-04-02 21:18:11.535155000 +0000 | |||
6 | +++ numpy/distutils/system_info.py | 4 | +++ numpy/distutils/system_info.py | |
7 | @@ -1531,12 +1531,12 @@ class lapack_opt_info(system_info): | 5 | @@ -82,6 +82,19 @@ The order of finding the locations of re | |
6 | 3. ALL section in site.cfg | |||
7 | Only the first complete match is returned. | |||
8 | ||||
9 | +Note that blas_opt_info and lapack_opt_info honor the NPY_BLAS_ORDER | |||
10 | +and NPY_LAPACK_ORDER environment variables to determine the order in which | |||
11 | +specific BLAS and LAPACK libraries are searched for. | |||
12 | + | |||
13 | +This search (or autodetection) can be bypassed by defining the environment | |||
14 | +variables NPY_BLAS_LIBS and NPY_LAPACK_LIBS, which should then contain the | |||
15 | +exact linker flags to use (language will be set to F77). Building against | |||
16 | +Netlib BLAS/LAPACK or stub files, in order to be able to switch BLAS and LAPACK | |||
17 | +implementations at runtime. If using this to build NumPy itself, it is | |||
18 | +recommended to also define NPY_CBLAS_LIBS (assuming your BLAS library has a | |||
19 | +CBLAS interface) to enable CBLAS usage for matrix multiplication (unoptimized | |||
20 | +otherwise). | |||
21 | + | |||
22 | Example: | |||
23 | ---------- | |||
24 | [ALL] | |||
25 | @@ -1542,8 +1555,24 @@ class lapack_opt_info(system_info): | |||
26 | ||||
27 | notfounderror = LapackNotFoundError | |||
28 | ||||
29 | + def _calc_info_from_envvar(self): | |||
30 | + info = {} | |||
31 | + info['language'] = 'f77' | |||
32 | + info['libraries'] = [] | |||
33 | + info['include_dirs'] = [] | |||
34 | + info['define_macros'] = [] | |||
35 | + info['extra_link_args'] = os.environ['NPY_LAPACK_LIBS'].split() | |||
36 | + self.set_info(**info) | |||
37 | + return True | |||
38 | + | |||
39 | def calc_info(self): | |||
40 | ||||
41 | + if 'NPY_LAPACK_LIBS' in os.environ: | |||
42 | + # Bypass autodetection, set language to F77 and use env var linker | |||
43 | + # flags directly | |||
44 | + self._calc_info_from_envvar() | |||
45 | + return | |||
46 | + | |||
47 | lapack_mkl_info = get_info('lapack_mkl') | |||
48 | if lapack_mkl_info: | |||
8 | self.set_info(**lapack_mkl_info) | 49 | self.set_info(**lapack_mkl_info) | |
9 | return | 50 | @@ -1621,8 +1650,28 @@ class blas_opt_info(system_info): | |
51 | ||||
52 | notfounderror = BlasNotFoundError | |||
53 | ||||
54 | + def _calc_info_from_envvar(self): | |||
55 | + info = {} | |||
56 | + info['language'] = 'f77' | |||
57 | + info['libraries'] = [] | |||
58 | + info['include_dirs'] = [] | |||
59 | + info['define_macros'] = [] | |||
60 | + info['extra_link_args'] = os.environ['NPY_BLAS_LIBS'].split() | |||
61 | + if 'NPY_CBLAS_LIBS' in os.environ: | |||
62 | + info['define_macros'].append(('HAVE_CBLAS', None)) | |||
63 | + info['extra_link_args'].extend( | |||
64 | + os.environ['NPY_CBLAS_LIBS'].split()) | |||
65 | + self.set_info(**info) | |||
66 | + return True | |||
67 | + | |||
68 | def calc_info(self): | |||
10 | 69 | |||
11 | - openblas_info = get_info('openblas_lapack') | 70 | + if 'NPY_BLAS_LIBS' in os.environ: | |
12 | + openblas_info = None | 71 | + # Bypass autodetection, set language to F77 and use env var linker | |
13 | if openblas_info: | 72 | + # flags directly | |
14 | self.set_info(**openblas_info) | 73 | + self._calc_info_from_envvar() | |
15 | return | 74 | + return | |
16 | 75 | + | ||
17 | - openblas_info = get_info('openblas_clapack') | 76 | blas_mkl_info = get_info('blas_mkl') | |
18 | + openblas_info = None | 77 | if blas_mkl_info: | |
19 | if openblas_info: | 78 | self.set_info(**blas_mkl_info) | |
20 | self.set_info(**openblas_info) | |||
21 | return | |||
22 | @@ -1642,7 +1642,7 @@ class blas_opt_info(system_info): | |||
23 | self.set_info(**blis_info) | |||
24 | return | |||
25 | ||||
26 | - openblas_info = get_info('openblas') | |||
27 | + openblas_info = None | |||
28 | if openblas_info: | |||
29 | self.set_info(**openblas_info) | |||
30 | return |