2 # Copyright (C) 2019 Jakub Piotr Cłapa <jpc@loee.pl>
3 # Copyright (C) 2020 Alexandru Ardelean <ardeleanalex@gmail.com>
6 include $(TOPDIR
)/rules.mk
12 PYPI_NAME
:=$(PKG_NAME
)
13 PKG_HASH
:=f65738447676ab5777f11e6bbbdb8ce11b785e105f690bc45966574816b6d3ea
15 PKG_MAINTAINER
:=Alexandru Ardelean
<ardeleanalex@gmail.com
>
17 PKG_LICENSE
:=BSD-3-Clause
18 PKG_LICENSE_FILES
:=LICENSE.txt
19 PKG_CPE_ID
:=cpe
:/a
:numpy
:numpy
21 PKG_CONFIG_DEPENDS
:= \
22 CONFIG_NUMPY_OPENBLAS_SUPPORT
24 PKG_BUILD_DEPENDS
:=python-cython
/host pyproject-metadata
/host
26 # Ensure numpy does not find openblas if openblas support is not enabled
27 PYTHON3_PKG_BUILD_VARS
:= \
28 $(if
$(CONFIG_NUMPY_OPENBLAS_SUPPORT
),,NPY_BLAS_ORDER
= NPY_LAPACK_ORDER
= )
31 include $(INCLUDE_DIR
)/package.mk
32 include ..
/python3-package.mk
34 define Package
/python3-numpy
38 TITLE
:=The fundamental package for scientific computing with Python
39 URL
:=https
://www.numpy.org
/
40 DEPENDS
:=@
!SOFT_FLOAT
+INSTALL_GFORTRAN
:libgfortran
+python3
+libstdcpp \
41 +NUMPY_OPENBLAS_SUPPORT
:openblas
44 # We need to duplicate the omitted arhitectures same as openblas
45 define Package
/python3-numpy
/config
50 config NUMPY_OPENBLAS_SUPPORT
51 bool
"Enable OpenBLAS support"
58 # FIXME: temporary fix for x86_64 with GCC 13 + musl;
59 # numpy does not detect this compiler extension, so we just enable it
60 TARGET_CFLAGS
+= -mavx512f
63 define Build
/Prepare
/numpy-sitecfg
64 echo
"[DEFAULT]" > $(PKG_BUILD_DIR
)/site.cfg
65 echo
"library_dirs = $(STAGING_DIR)/usr/lib" >> $(PKG_BUILD_DIR
)/site.cfg
66 echo
"include_dirs = $(STAGING_DIR)/usr/include" >> $(PKG_BUILD_DIR
)/site.cfg
68 ifdef CONFIG_NUMPY_OPENBLAS_SUPPORT
69 echo
>> $(PKG_BUILD_DIR
)/site.cfg
70 echo
"[openblas]" >> $(PKG_BUILD_DIR
)/site.cfg
71 echo
"libraries = openblas" >> $(PKG_BUILD_DIR
)/site.cfg
72 echo
"runtime_library_dirs = /usr/lib" >> $(PKG_BUILD_DIR
)/site.cfg
77 $(call Build
/Prepare
/Default
)
78 $(call Build
/Prepare
/numpy-sitecfg
)
81 define Package
/python3-numpy
/description
82 NumPy is the fundamental package for array computing with Python.
84 By default
, this package is built without some modules.
85 For some modules to be available
, the INSTALL_GFORTRAN symbol needs
86 to be enabled in the OpenWrt core
/toolchain.
89 $(eval
$(call Py3Package
,python3-numpy
))
90 $(eval
$(call BuildPackage
,python3-numpy
))
91 $(eval
$(call BuildPackage
,python3-numpy-src
))