8000 numpy: bump to version 2.2.1 · commodo/packages@dc679aa · GitHub
[go: up one dir, main page]

Skip to content

Commit dc679aa

Browse files
committed
numpy: bump to version 2.2.1
Dropped: 003-without-vendored-meson.patch 004-workaround-for-multiple-top-level-packages-discovered.patch This time, we really need to use meson to build numpy. And to make things more complicated, the 'vendored' meson package (that comes with numpy) must be used. This is because they have some special logic in there that's specific to numpy. With this change, we also need to keep a special/internal 'openwrt-cross.txt.in' file, because cross-compiling numpy also requires that a 'longdouble_format' property be added. More details about this: numpy/numpy#23972 https://github.com/numpy/numpy/blob/maintenance/2.2.x/doc/source/building/cross_compilation.rst Removing quirk fix for x86_64 with detecting 'avx512f'. This should work with the new meson stuff. Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
1 parent ca9c3d1 commit dc679aa

File tree

5 files changed

+81
-54
lines changed

5 files changed

+81
-54
lines changed

lang/python/numpy/Makefile

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
include $(TOPDIR)/rules.mk
77

88
PKG_NAME:=numpy
9-
PKG_VERSION:=2.1.3
9+
PKG_VERSION:=2.2.1
1010
PKG_RELEASE:=1
1111

1212
PYPI_NAME:=$(PKG_NAME)
13-
PKG_HASH:=aa08e04e08aaf974d4458def539dece0d28146d866a39da5639596f4921fd761
13+
PKG_HASH:=45681fd7128c8ad1c379f0ca0776a8b0c6583d2f69889ddac01559dfe4390918
1414

1515
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
1616

@@ -27,9 +27,43 @@ PKG_BUILD_DEPENDS:=python-cython/host pyproject-metadata/host
2727
PYTHON3_PKG_BUILD_VARS:= \
2828
$(if $(CONFIG_NUMPY_OPENBLAS_SUPPORT),,NPY_BLAS_ORDER= NPY_LAPACK_ORDER= )
2929

30+
MESON_USE_STAGING_PYTHON:=1
31+
3032
include ../pypi.mk
3133
include $(INCLUDE_DIR)/package.mk
3234
include ../python3-package.mk
35+
include $(INCLUDE_DIR)/meson.mk
36+
37+
MESON_ARGS+= \
38+
-Ddisable-optimization=true \
39+
-Dcpu-baseline=min
40+
41+
# Override 'Meson', to use numpy's vendored meson
42+
define Meson
43+
$(call Python3/Run,,$(PKG_BUILD_DIR)/vendored-meson/meson/meson.py $(1),$(2))
44+
endef
45+
46+
define Meson/CreateCrossFile
47+
$(STAGING_DIR_HOST)/bin/sed \
48+
-e "s|@CC@|$(foreach BIN,$(TARGET_CC),'$(BIN)',)|" \
49+
-e "s|@CXX@|$(foreach BIN,$(TARGET_CXX),'$(BIN)',)|" \
50+
-e "s|@LD@|$(foreach FLAG,$(TARGET_LINKER),'$(FLAG)',)|" \
51+
-e "s|@AR@|$(TARGET_AR)|" \
52+
-e "s|@STRIP@|$(TARGET_CROSS)strip|" \
53+
-e "s|@NM@|$(TARGET_NM)|" \
54+
-e "s|@PKGCONFIG@|$(PKG_CONFIG)|" \
55+
-e "s|@CMAKE@|$(STAGING_DIR_HOST)/bin/cmake|" \
56+
-e "s|@PYTHON@|$(PYTHON_BIN)|" \
57+
-e "s|@CFLAGS@|$(foreach FLAG,$(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
58+
-e "s|@CXXFLAGS@|$(foreach FLAG,$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS),'$(FLAG)',)|" \
59+
-e "s|@LDFLAGS@|$(foreach FLAG,$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS),'$(FLAG)',)|" \
60+
-e "s|@ARCH@|$(MESON_ARCH)|" \
61+
-e "s|@CPU@|$(MESON_CPU)|" \
62+
-e "s|@ENDIAN@|$(if $(CONFIG_BIG_ENDIAN),big,little)|" \
63+
< files/openwrt-cross.txt.in \
64+
> $(1)
65+
echo "longdouble_format = '$(if $(CONFIG_BIG_ENDIAN),IEEE_DOUBLE_BE,IEEE_DOUBLE_LE)'" >> $(1)
66+
endef
3367

3468
define Package/python3-numpy
3569
SUBMENU:=Python
@@ -54,12 +88,6 @@ config NUMPY_OPENBLAS_SUPPORT
5488
endmenu
5589
endef
5690

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-
6391
define Build/Prepare/numpy-sitecfg
6492
echo "[DEFAULT]" > $(PKG_BUILD_DIR)/site.cfg
6593
echo "library_dirs = $(STAGING_DIR)/usr/lib" >> $(PKG_BUILD_DIR)/site.cfg
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[binaries]
2+
c = [@CC@]
3+
c_ld = [@LD@]
4+
cpp = [@CXX@]
5+
cpp_ld = [@LD@]
6+
ar = '@AR@'
7+
strip = '@STRIP@'
8+
nm = '@NM@'
9+
pkg-config = '@PKGCONFIG@'
10+
cmake = '@CMAKE@'
11+
python = '@PYTHON@'
12+
13+
[built-in options]
14+
c_args = [@CFLAGS@]
15+
c_link_args = [@LDFLAGS@]
16+
cpp_args = [@CXXFLAGS@]
17+
cpp_link_args = [@LDFLAGS@]
18+
prefix = '/usr'
19+
20+
[host_machine]
21+
system = 'linux'
22+
cpu_family = '@ARCH@'
23+
cpu = '@CPU@'
24+
endian = '@ENDIAN@'
25+
26+
[properties]
27+
needs_exe_wrapper = true

lang/python/numpy/patches/003-without-vendored-meson.patch

Lines changed: 0 additions & 34 deletions
This file was deleted.

lang/python/numpy/patches/004-workaround-for-multiple-top-level-packages-discovered.patch

Lines changed: 0 additions & 12 deletions
This file was deleted.

lang/python/numpy/test.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
EXP_VER="$2"
4+
5+
python3 - << EOF
6+
import sys
7+
import numpy as np
8+
9+
if (np.__version__ != "$EXP_VER"):
10+
print("Got incorrect version: " + np.__version__)
11+
sys.exit(1)
12+
13+
arr = np.array([1, 2, 3, 4, 5])
14+
15+
print(arr)
16+
17+
EOF
18+

0 commit comments

Comments
 (0)
0