Add loongarch64 and sw_64 support

Signed-off-by: yangchenguang <yangchenguang@kylinsec.com.cn>
(cherry picked from commit 5a5108aa0f89890cd72f77e86ead7bbf0526f9c8)
This commit is contained in:
yangchenguang 2023-08-17 20:35:11 +08:00 committed by openeuler-sync-bot
parent f3a3b9116f
commit 1ebfc79508
3 changed files with 77 additions and 2 deletions

View File

@ -0,0 +1,46 @@
From ca19adc35b02cff09844228f2562b1d1522e2fe4 Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Mon, 25 Apr 2022 09:49:00 +0800
Subject: [PATCH] add loongarch architecture support
---
numpy/core/include/numpy/npy_cpu.h | 3 +++
numpy/core/include/numpy/npy_endian.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h
index bc1fad7..e975b01 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_WASM
*/
#ifndef _NPY_CPUARCH_H_
@@ -103,6 +104,8 @@
#define NPY_CPU_ARCEB
#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
#define NPY_CPU_RISCV64
+#elif defined(__loongarch__)
+ #define NPY_CPU_LOONGARCH
#elif defined(__EMSCRIPTEN__)
/* __EMSCRIPTEN__ is defined by emscripten: an LLVM-to-Web compiler */
#define NPY_CPU_WASM
diff --git a/numpy/core/include/numpy/npy_endian.h b/numpy/core/include/numpy/npy_endian.h
index aa367a0..82609ed 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_RISCV64) \
+ || defined(NPY_CPU_LOONGARCH) \
|| defined(NPY_CPU_WASM)
#define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
#elif defined(NPY_CPU_PPC) \
--
2.27.0

23
numpy-1.21.4-sw.patch Normal file
View File

@ -0,0 +1,23 @@
diff -Naur numpy-1.21.4.org/numpy/core/include/numpy/npy_cpu.h numpy-1.21.4.sw/numpy/core/include/numpy/npy_cpu.h
--- numpy-1.21.4.org/numpy/core/include/numpy/npy_cpu.h 2022-02-27 02:48:27.080000000 +0000
+++ numpy-1.21.4.sw/numpy/core/include/numpy/npy_cpu.h 2022-02-28 06:42:23.070000000 +0000
@@ -61,6 +61,8 @@
#define NPY_CPU_IA64
#elif defined(__hppa)
#define NPY_CPU_HPPA
+#elif defined(__sw_64__)
+ #define NPY_CPU_SW_64
#elif defined(__alpha__)
#define NPY_CPU_ALPHA
#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM64)
diff -Naur numpy-1.21.4.org/numpy/core/include/numpy/npy_endian.h numpy-1.21.4.sw/numpy/core/include/numpy/npy_endian.h
--- numpy-1.21.4.org/numpy/core/include/numpy/npy_endian.h 2022-02-27 02:48:27.080000000 +0000
+++ numpy-1.21.4.sw/numpy/core/include/numpy/npy_endian.h 2022-02-28 06:44:18.830000000 +0000
@@ -41,6 +41,7 @@
|| defined(NPY_CPU_AMD64) \
|| defined(NPY_CPU_IA64) \
|| defined(NPY_CPU_ALPHA) \
+ || defined(NPY_CPU_SW_64) \
|| defined(NPY_CPU_ARMEL) \
|| defined(NPY_CPU_ARMEL_AARCH32) \
|| defined(NPY_CPU_ARMEL_AARCH64) \

View File

@ -2,7 +2,7 @@
Name: numpy Name: numpy
Version: 1.21.4 Version: 1.21.4
Release: 4 Release: 5
Epoch: 1 Epoch: 1
Summary: A fast multidimensional array facility for Python Summary: A fast multidimensional array facility for Python
@ -18,6 +18,9 @@ Patch0: backport-CVE-2021-41496.patch
Patch1: backport-CVE-2021-41495.patch Patch1: backport-CVE-2021-41495.patch
Patch2: backport-CVE-2021-34141.patch Patch2: backport-CVE-2021-34141.patch
Patch1000: numpy-1.21.4-sw.patch
Patch1001: add-loongarch-architecture-support.patch
%description %description
NumPy is the fundamental package for scientific computing with Python. It contains among other things: NumPy is the fundamental package for scientific computing with Python. It contains among other things:
a powerful N-dimensional array object a powerful N-dimensional array object
@ -106,6 +109,9 @@ popd &> /dev/null
%changelog %changelog
* Thu Aug 17 2023 yangchenguang <yangchenguang@kylinsec.com.cn> - 1:1.21.4-5
- Add loongarch64 and sw_64 support
* Thu May 26 2022 renhongxun <renhongxun@h-partners.com> - 1.21.4-4 * Thu May 26 2022 renhongxun <renhongxun@h-partners.com> - 1.21.4-4
- fix CVE-2021-34141 - fix CVE-2021-34141
@ -118,7 +124,7 @@ popd &> /dev/null
* Fri Dec 24 2021 yuanxin <yuanxin24@huawei.com> - 1.21.4-1 * Fri Dec 24 2021 yuanxin <yuanxin24@huawei.com> - 1.21.4-1
- update version to 1.21.4 - update version to 1.21.4
* Thu Aug 24 2021 wulei<wulei80@huawei.com> - 1.18.5-1 * Tue Aug 24 2021 wulei<wulei80@huawei.com> - 1.18.5-1
- update to 1.18.5 - update to 1.18.5
* Mon Jan 18 2021 tianwei<tianwei12@huawei.com> - 1.16.5-6 * Mon Jan 18 2021 tianwei<tianwei12@huawei.com> - 1.16.5-6