-From eb6d6579150bf4684603ce377c51e90ad3bb8109 Mon Sep 17 00:00:00 2001
+From 0e2b652a0eff85798584116c905a2d6ad8f25d5f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 15 Nov 2020 15:32:39 -0800
Subject: [PATCH] numpy/core: Define RISCV-32 support
Helps compile on riscv32
-Upstream-Status: Submitted [https://github.com/numpy/numpy/pull/17780]
+Upstream-Status: Backport
+(https://github.com/numpy/numpy/pull/17780/commits/0e2b652a0eff85798584116c905a2d6ad8f25d5f)
+
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- numpy/core/include/numpy/npy_cpu.h | 3 +++
- numpy/core/include/numpy/npy_endian.h | 1 +
- 2 files changed, 4 insertions(+)
+ numpy/_core/include/numpy/npy_cpu.h | 9 +++++++--
+ numpy/_core/include/numpy/npy_endian.h | 1 +
+ 2 files changed, 8 insertions(+), 2 deletions(-)
-diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h
-index 78d229e..04be511 100644
---- a/numpy/core/include/numpy/npy_cpu.h
-+++ b/numpy/core/include/numpy/npy_cpu.h
-@@ -19,6 +19,7 @@
+diff --git a/numpy/_core/include/numpy/npy_cpu.h b/numpy/_core/include/numpy/npy_cpu.h
+index a19f8e6bbd..15f9f12931 100644
+--- a/numpy/_core/include/numpy/npy_cpu.h
++++ b/numpy/_core/include/numpy/npy_cpu.h
+@@ -18,6 +18,7 @@
+ * NPY_CPU_ARCEL
* NPY_CPU_ARCEB
* NPY_CPU_RISCV64
- * NPY_CPU_LOONGARCH
+ * NPY_CPU_RISCV32
+ * NPY_CPU_LOONGARCH
* NPY_CPU_WASM
*/
- #ifndef NUMPY_CORE_INCLUDE_NUMPY_NPY_CPU_H_
-@@ -104,6 +105,8 @@
+@@ -102,8 +103,12 @@
+ #define NPY_CPU_ARCEL
+ #elif defined(__arc__) && defined(__BIG_ENDIAN__)
#define NPY_CPU_ARCEB
- #elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
- #define NPY_CPU_RISCV64
-+#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 32
-+ #define NPY_CPU_RISCV32
+-#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
+- #define NPY_CPU_RISCV64
++#elif defined(__riscv)
++ #if __riscv_xlen == 64
++ #define NPY_CPU_RISCV64
++ #elif __riscv_xlen == 32
++ #define NPY_CPU_RISCV32
++ #endif
#elif defined(__loongarch__)
#define NPY_CPU_LOONGARCH
#elif defined(__EMSCRIPTEN__)
-diff --git a/numpy/core/include/numpy/npy_endian.h b/numpy/core/include/numpy/npy_endian.h
-index 5e58a7f..0926212 100644
---- a/numpy/core/include/numpy/npy_endian.h
-+++ b/numpy/core/include/numpy/npy_endian.h
+diff --git a/numpy/_core/include/numpy/npy_endian.h b/numpy/_core/include/numpy/npy_endian.h
+index 5e58a7f52c..09262120bf 100644
+--- a/numpy/_core/include/numpy/npy_endian.h
++++ b/numpy/_core/include/numpy/npy_endian.h
@@ -49,6 +49,7 @@
|| defined(NPY_CPU_PPC64LE) \
|| defined(NPY_CPU_ARCEL) \
|| defined(NPY_CPU_WASM)
#define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
--
-2.20.1
+2.39.5
DESCRIPTION = "NumPy is the fundamental package needed for scientific computing with Python."
SECTION = "devel/python"
LICENSE = "BSD-3-Clause & BSD-2-Clause & PSF-2.0 & Apache-2.0 & MIT"
-LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=a752eb20459cf74a9d84ee4825e8317c"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=1de863c37a83e71b1e97b64d036ea78b"
SRCNAME = "numpy"
file://fix_reproducibility.patch \
file://run-ptest \
"
-SRC_URI[sha256sum] = "2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010"
+SRC_URI[sha256sum] = "aa08e04e08aaf974d4458def539dece0d28146d866a39da5639596f4921fd761"
GITHUB_BASE_URI = "https://github.com/numpy/numpy/releases"
UPSTREAM_CHECK_REGEX = "releases/tag/v?(?P<pver>\d+(\.\d+)+)$"
-inherit ptest setuptools3 github-releases cython
+inherit ptest python_mesonpy github-releases cython
S = "${WORKDIR}/numpy-${PV}"
-CLEANBROKEN = "1"
+# Remove references to buildpaths from numpy's __config__.py
+do_install:append() {
+ sed -i \
+ -e 's|${S}=||g' \
+ -e 's|${B}=||g' \
+ -e 's|${RECIPE_SYSROOT_NATIVE}=||g' \
+ -e 's|${RECIPE_SYSROOT_NATIVE}||g' \
+ -e 's|${RECIPE_SYSROOT}=||g' \
+ -e 's|${RECIPE_SYSROOT}||g' ${D}${PYTHON_SITEPACKAGES_DIR}/numpy/__config__.py
-do_compile:prepend() {
- export NPY_DISABLE_SVML=1
+ nativepython3 -mcompileall -s ${D} ${D}${PYTHON_SITEPACKAGES_DIR}/numpy/__config__.py
}
-FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/numpy/core/lib/*.a ${PYTHON_SITEPACKAGES_DIR}/numpy/random/lib/*.a"
+FILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/numpy/_core/lib/*.a \
+ ${PYTHON_SITEPACKAGES_DIR}/numpy/random/lib/*.a \
+"
# install what is needed for numpy.test()
RDEPENDS:${PN} = "python3-unittest \
ldd \
"
-# Upstream has a pyproject.toml but as of 1.26.4 it's marked as experimental
-INSANE_SKIP = "pep517-backend"
-
BBCLASSEXTEND = "native nativesdk"