54bbc42556b96ba26c58bd1aebd8004f7d7509fb
[feed/packages.git] / lang / python / numpy / Makefile
1 #
2 # Copyright (C) 2019 Jakub Piotr Cłapa <jpc@loee.pl>
3 # Copyright (C) 2020 Alexandru Ardelean <ardeleanalex@gmail.com>
4 #
5
6 include $(TOPDIR)/rules.mk
7
8 PKG_NAME:=numpy
9 PKG_VERSION:=1.25.1
10 PKG_RELEASE:=1
11
12 PYPI_NAME:=$(PKG_NAME)
13 PKG_HASH:=9a3a9f3a61480cc086117b426a8bd86869c213fc4072e606f01c4e4b66eb92bf
14
15 PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
16
17 PKG_LICENSE:=BSD-3-Clause
18 PKG_LICENSE_FILES:=LICENSE.txt
19 PKG_CPE_ID:=cpe:/a:numpy:numpy
20
21 PKG_CONFIG_DEPENDS:= \
22 CONFIG_NUMPY_OPENBLAS_SUPPORT
23
24 PKG_BUILD_DEPENDS:=python-cython/host
25
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= )
29
30 include ../pypi.mk
31 include $(INCLUDE_DIR)/package.mk
32 include ../python3-package.mk
33
34 define Package/python3-numpy
35 SUBMENU:=Python
36 SECTION:=lang
37 CATEGORY:=Languages
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
42 endef
43
44 # We need to duplicate the omitted arhitectures same as openblas
45 define Package/python3-numpy/config
46 menu "Configuration"
47 depends on !powerpc
48 depends on !arc
49
50 config NUMPY_OPENBLAS_SUPPORT
51 bool "Enable OpenBLAS support"
52 default n
53
54 endmenu
55 endef
56
57 ifeq ($(ARCH),x86_64)
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
61 endif
62
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
67
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
73 endif
74 endef
75
76 define Build/Prepare
77 $(call Build/Prepare/Default)
78 $(call Build/Prepare/numpy-sitecfg)
79 endef
80
81 define Package/python3-numpy/description
82 NumPy is the fundamental package for array computing with Python.
83
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.
87 endef
88
89 $(eval $(call Py3Package,python3-numpy))
90 $(eval $(call BuildPackage,python3-numpy))
91 $(eval $(call BuildPackage,python3-numpy-src))