From 1182efa2f05c5804a55d35d45a9d72f97b64a9b2 Mon Sep 17 00:00:00 2001 From: wxiat Date: Thu, 29 Jun 2023 16:45:50 +0800 Subject: [PATCH] add sw Signed-off-by: wxiat --- Python-3.6.8-sw.patch | 45 +++++++++++++++++++++++++++++++++++++++++++ python3.spec | 7 ++++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 Python-3.6.8-sw.patch diff --git a/Python-3.6.8-sw.patch b/Python-3.6.8-sw.patch new file mode 100644 index 0000000..1925652 --- /dev/null +++ b/Python-3.6.8-sw.patch @@ -0,0 +1,45 @@ +diff -Naur Python-3.6.8.org/configure.ac Python-3.6.8.sw/configure.ac +--- Python-3.6.8.org/configure.ac 2023-05-17 15:31:40.509671581 +0800 ++++ Python-3.6.8.sw/configure.ac 2023-05-17 15:33:36.428751614 +0800 +@@ -784,6 +784,8 @@ + # else + aarch64_be-linux-gnu + # endif ++# elif defined(__sw_64__) ++ sw_64-linux-gnu + # elif defined(__alpha__) + alpha-linux-gnu + # elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP) +@@ -1808,7 +1810,7 @@ + # support. Without this, treatment of subnormals doesn't follow + # the standard. + case $host in +- alpha*) ++ alpha* | sw_64* ) + BASECFLAGS="$BASECFLAGS -mieee" + ;; + esac +diff -Naur Python-3.6.8.org/Lib/test/test_sysconfig.py Python-3.6.8.sw/Lib/test/test_sysconfig.py +--- Python-3.6.8.org/Lib/test/test_sysconfig.py 2023-05-17 15:31:40.495671088 +0800 ++++ Python-3.6.8.sw/Lib/test/test_sysconfig.py 2023-05-17 15:34:19.362262761 +0800 +@@ -407,7 +407,7 @@ + import platform, re + machine = platform.machine() + suffix = sysconfig.get_config_var('EXT_SUFFIX') +- if re.match('(aarch64|arm|loongarch64|mips|ppc|powerpc|s390|sparc)', machine): ++ if re.match('(aarch64|arm|sw_64|loongarch64|mips|ppc|powerpc|s390|sparc)', machine): + self.assertTrue('linux' in suffix, suffix) + if re.match('(i[3-6]86|x86_64)$', machine): + if ctypes.sizeof(ctypes.c_char_p()) == 4: +diff -Naur Python-3.6.8.org/Modules/_ctypes/callproc.c Python-3.6.8.sw/Modules/_ctypes/callproc.c +--- Python-3.6.8.org/Modules/_ctypes/callproc.c 2023-05-17 15:31:40.495671088 +0800 ++++ Python-3.6.8.sw/Modules/_ctypes/callproc.c 2023-05-17 15:37:29.182943941 +0800 +@@ -1050,7 +1050,7 @@ + #endif + + #if (defined(__x86_64__) && (defined(__MINGW64__) || defined(__CYGWIN__))) || \ +- defined(__aarch64__) || defined(__loongarch__) ++ defined(__aarch64__) || defined(__loongarch__) || defined(__sw_64__) + #define CTYPES_PASS_BY_REF_HACK + #define POW2(x) (((x & ~(x - 1)) == x) ? x : 0) + #define IS_PASS_BY_REF(x) (x > 8 || !POW2(x)) diff --git a/python3.spec b/python3.spec index e6fa602..7b0e49a 100644 --- a/python3.spec +++ b/python3.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 # ================== # Top-level metadata # ================== @@ -793,6 +793,7 @@ Patch1000: add-anolis-platform.patch Patch1001: 1001-python3-anolis-add-loongarch.patch Patch1002: 1002-fix-faulthandler_register-stack.patch Patch1003: 1003-ctypes-pass-by-value-for-structs-on-loongarch64.patch +Patch10000: Python-3.6.8-sw.patch # ========================================== # Descriptions, and metadata for subpackages @@ -1135,6 +1136,7 @@ git apply %{PATCH351} %patch1001 -p1 %patch1002 -p1 %patch1003 -p1 +%patch1004 -p1 # Remove files that should be generated by the build # (This is after patching, so that we can use patches directly from upstream) @@ -2066,6 +2068,9 @@ fi # ====================================================== %changelog +* Thu Jun 29 2023 wxiat - 3.6.8-51.0.2.1 +- add sw patch + * Thu Jun 15 2023 zhangbinchen - 3.6.8-51.0.1.1 - Add Anolis platform cherry-pick [9a96461] - Support Loongarch for python3 -- Gitee