From 60319fd0ec87b982842e454e8f2606bab7853064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E4=B8=8A=E9=93=9C=2010332738?= Date: Thu, 5 Jun 2025 09:58:40 +0800 Subject: [PATCH 1/2] add support for riscv64 --- fix_code_error.patch | 12 ++++++++++ riscv-use-unknown-cpu.patch | 45 +++++++++++++++++++++++++++++++++++++ webkitgtk.spec | 16 ++++++++++++- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 fix_code_error.patch create mode 100644 riscv-use-unknown-cpu.patch diff --git a/fix_code_error.patch b/fix_code_error.patch new file mode 100644 index 0000000..87d1841 --- /dev/null +++ b/fix_code_error.patch @@ -0,0 +1,12 @@ +diff -ruN webkitgtk-2.48.1/Source/WebCore/platform/audio/DenormalDisabler.cpp webkitgtk-2.48.1_bak/Source/WebCore/platform/audio/DenormalDisabler.cpp +--- webkitgtk-2.48.1/Source/WebCore/platform/audio/DenormalDisabler.cpp 2025-04-02 01:41:30.802833600 -0400 ++++ webkitgtk-2.48.1_bak/Source/WebCore/platform/audio/DenormalDisabler.cpp 2025-06-04 14:15:04.714509655 -0400 +@@ -91,7 +91,7 @@ + } + } + #else +-DenormalDisabler::DenormalDisabler() = default ++DenormalDisabler::DenormalDisabler() = default; + DenormalDisabler::~DenormalDisabler() = default; + #endif + diff --git a/riscv-use-unknown-cpu.patch b/riscv-use-unknown-cpu.patch new file mode 100644 index 0000000..aecaba3 --- /dev/null +++ b/riscv-use-unknown-cpu.patch @@ -0,0 +1,45 @@ +From dd8bfa25806753be6cdabd1407b5aa1ed9ad9eb1 Mon Sep 17 00:00:00 2001 +From: David Abdurachmanov +Date: Tue, 10 Dec 2024 09:47:12 +0000 +Subject: [PATCH] riscv: use unknown cpu + +The patch is borrowed from Debian. Disabling JIT and WebAssembly on +riscv64 no longer works. We are hitting compilation errors quite often +these days. + +Signed-off-by: David Abdurachmanov + +diff --git a/Source/WTF/wtf/PlatformCPU.h b/Source/WTF/wtf/PlatformCPU.h +index ca328a20..c88b16a2 100644 +--- a/Source/WTF/wtf/PlatformCPU.h ++++ b/Source/WTF/wtf/PlatformCPU.h +@@ -285,14 +285,6 @@ + + #endif /* ARM */ + +-/* CPU(RISCV64) - RISC-V 64-bit */ +-#if defined(__riscv) \ +- && defined(__riscv_xlen) \ +- && (__riscv_xlen == 64) +-#define WTF_CPU_RISCV64 1 +-#define WTF_CPU_KNOWN 1 +-#endif +- + #if !CPU(KNOWN) + #define WTF_CPU_UNKNOWN 1 + #endif +diff --git a/Source/cmake/WebKitCommon.cmake b/Source/cmake/WebKitCommon.cmake +index 38ac0c47..9d7873e2 100644 +--- a/Source/cmake/WebKitCommon.cmake ++++ b/Source/cmake/WebKitCommon.cmake +@@ -125,8 +125,6 @@ if (NOT HAS_RUN_WEBKIT_COMMON) + set(WTF_CPU_PPC64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") + set(WTF_CPU_PPC64LE 1) +- elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv64") +- set(WTF_CPU_RISCV64 1) + elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "^loongarch64") + set(WTF_CPU_LOONGARCH64 1) + else () +-- +2.47.1 diff --git a/webkitgtk.spec b/webkitgtk.spec index 78fab23..825abc4 100644 --- a/webkitgtk.spec +++ b/webkitgtk.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 ## NOTE: Lots of files in various subdirectories have the same name (such as ## "LICENSE") so this short macro allows us to distinguish them by using their @@ -7,7 +7,9 @@ mkdir -p _license_files ; \ cp -p %1 _license_files/$(echo '%1' | sed -e 's!/!.!g') +%ifarch riscv64 %global _lto_cflags %{nil} +%endif %bcond_without docs @@ -23,6 +25,9 @@ URL: https://www.webkitgtk.org/ Source0: https://webkitgtk.org/releases/webkitgtk-%{version}.tar.xz Source1: https://webkitgtk.org/releases/webkitgtk-%{version}.tar.xz.asc +Patch01: riscv-use-unknown-cpu.patch +Patch02: fix_code_error.patch + ExcludeArch: loongarch64 BuildRequires: bison @@ -230,6 +235,7 @@ files for developing applications that use JavaScript engine from webkit2gtk-4.1 # https://bugzilla.redhat.com/show_bug.cgi?id=1456261 %global _dwz_max_die_limit_x86_64 250000000 %global _dwz_max_die_limit_aarch64 250000000 +%global _dwz_max_die_limit_riscv64 250000000 # Require 32 GB of RAM per vCPU for debuginfo processing. 16 GB is not enough. %global _find_debuginfo_opts %limit_build -m 32768 @@ -238,6 +244,11 @@ files for developing applications that use JavaScript engine from webkit2gtk-4.1 # Cf. https://bugzilla.redhat.com/show_bug.cgi?id=2130009 # Cf. https://bugs.webkit.org/show_bug.cgi?id=245697 # Disable BTI until this is fixed upstream. + +%ifarch %{ix86} riscv64 +%global optflags %(echo %{optflags} | sed 's/-g /-g1 /') +%endif + %ifarch aarch64 %global optflags %(echo %{optflags} | sed 's/-mbranch-protection=standard /-mbranch-protection=pac-ret /') %endif @@ -429,6 +440,9 @@ export NINJA_STATUS="[2/2][%f/%t %es] " %endif %changelog +* Thu Jun 05 2025 Shangtong Guo - 2.48.1-2 +- add support for riscv64 + * Mon May 12 2025 wenxin - 2.48.1-1 - update to 2.48.1 -- Gitee From 58e1fbbba8df99a8cb614aefa1126278cb5cbbe2 Mon Sep 17 00:00:00 2001 From: Guost123 Date: Thu, 5 Jun 2025 10:27:17 +0800 Subject: [PATCH 2/2] add support for riscv64 --- webkitgtk.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webkitgtk.spec b/webkitgtk.spec index 825abc4..d9f2563 100644 --- a/webkitgtk.spec +++ b/webkitgtk.spec @@ -7,7 +7,7 @@ mkdir -p _license_files ; \ cp -p %1 _license_files/$(echo '%1' | sed -e 's!/!.!g') -%ifarch riscv64 +%ifnarch riscv64 %global _lto_cflags %{nil} %endif -- Gitee