diff --git a/0001-fix-build-error-with-gcc14.patch b/0001-fix-build-error-with-gcc14.patch new file mode 100644 index 0000000000000000000000000000000000000000..40022e531ec133462f428b1b7fc9a05d2e3a77f6 --- /dev/null +++ b/0001-fix-build-error-with-gcc14.patch @@ -0,0 +1,94 @@ +From 13977aed79cee75e77ee736e596e38ad0949aee4 Mon Sep 17 00:00:00 2001 +From: Shangtong Guo +Date: Fri, 14 Nov 2025 03:05:53 -0500 +Subject: [PATCH] fix build error with gcc14 + +--- + .../parser/HTMLDocumentParserFastPath.cpp | 22 +++++++++++++++++++ + .../inline/text/TextUtil.cpp | 8 +++++++ + 2 files changed, 30 insertions(+) + +diff --git a/Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp b/Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp +index 880abf6b..fea817fc 100644 +--- a/Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp ++++ b/Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp +@@ -491,7 +491,12 @@ private: + // '\r' => 0000 1101 + constexpr simde_uint8x16_t lowNibbleMask { '\0', 0, 0, 0, 0, 0, '&', 0, 0, 0, 0, 0, '<', '\r', 0, 0 }; + constexpr simde_uint8x16_t v0f = SIMD::splat8(0x0f); ++#if defined(SIMDE_RISCV_V_NATIVE) ++ auto inputConverted = simde_vandq_u8(input, v0f); ++ return SIMD::equal(simde_vqtbl1q_u8(lowNibbleMask, inputConverted), input); ++#else + return SIMD::equal(simde_vqtbl1q_u8(lowNibbleMask, SIMD::bitAnd(input, v0f)), input); ++#endif + }; + + std::span cursor; +@@ -505,7 +510,13 @@ private: + WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN + auto vectorMatch = [&](auto input) ALWAYS_INLINE_LAMBDA { + constexpr simde_uint8x16_t zeros = SIMD::splat8(0); ++#if defined(SIMDE_RISCV_V_NATIVE) ++ auto firstVector = vectorEquals8Bit(input.val[0]); ++ auto secondVector = SIMD::equal(input.val[1], zeros); ++ return SIMD::findFirstNonZeroIndex(SIMD::bitAnd(firstVector, secondVector)); ++#else + return SIMD::findFirstNonZeroIndex(SIMD::bitAnd(vectorEquals8Bit(input.val[0]), SIMD::equal(input.val[1], zeros))); ++#endif + }; + WTF_ALLOW_UNSAFE_BUFFER_USAGE_END + auto* it = SIMD::findInterleaved(start, vectorMatch, scalarMatch); +@@ -653,7 +664,12 @@ WTF_ALLOW_UNSAFE_BUFFER_USAGE_END + // '\r' => 0000 1101 + constexpr auto lowNibbleMask = quoteChar == '\'' ? simde_uint8x16_t { '\0', 0, 0, 0, 0, 0, '&', '\'', 0, 0, 0, 0, 0, '\r', 0, 0 } : simde_uint8x16_t { '\0', 0, '"', 0, 0, 0, '&', 0, 0, 0, 0, 0, 0, '\r', 0, 0 }; + constexpr auto v0f = SIMD::splat8(0x0f); ++#if defined(SIMDE_RISCV_V_NATIVE) ++ auto inputConverted = simde_vandq_u8(input, v0f); ++ return SIMD::equal(simde_vqtbl1q_u8(lowNibbleMask, inputConverted), input); ++#else + return SIMD::equal(simde_vqtbl1q_u8(lowNibbleMask, SIMD::bitAnd(input, v0f)), input); ++#endif + }; + + if constexpr (sizeof(CharacterType) == 1) { +@@ -666,7 +682,13 @@ WTF_ALLOW_UNSAFE_BUFFER_USAGE_END + WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN + auto vectorMatch = [&](auto input) ALWAYS_INLINE_LAMBDA { + constexpr simde_uint8x16_t zeros = SIMD::splat8(0); ++#if defined(SIMDE_RISCV_V_NATIVE) ++ auto firstVector = vectorEquals8Bit(input.val[0]); ++ auto secondVector = SIMD::equal(input.val[1], zeros); ++ return SIMD::findFirstNonZeroIndex(SIMD::bitAnd(firstVector, secondVector)); ++#else + return SIMD::findFirstNonZeroIndex(SIMD::bitAnd(vectorEquals8Bit(input.val[0]), SIMD::equal(input.val[1], zeros))); ++#endif + }; + WTF_ALLOW_UNSAFE_BUFFER_USAGE_END + auto* it = SIMD::findInterleaved(span, vectorMatch, scalarMatch); +diff --git a/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp b/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp +index ff021918..71b118f8 100644 +--- a/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp ++++ b/Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp +@@ -545,10 +545,18 @@ bool TextUtil::containsStrongDirectionalityText(StringView text) + auto cond0 = SIMD::lessThan(input, c0590); + // General Punctuation such as curly quotes. + // ch >= 0x2010 && ch <= 0x2029 ++#if defined(SIMDE_RISCV_V_NATIVE) ++ auto cond1 = simde_vandq_u16(SIMD::greaterThanOrEqual(input, c2010), SIMD::lessThanOrEqual(input, c2029)); ++#else + auto cond1 = SIMD::bitAnd(SIMD::greaterThanOrEqual(input, c2010), SIMD::lessThanOrEqual(input, c2029)); ++#endif + // CJK etc., up to Surrogate Pairs. + // ch >= 0x206A && ch <= 0xD7FF ++#if defined(SIMDE_RISCV_V_NATIVE) ++ auto cond2 = simde_vandq_u16(SIMD::greaterThanOrEqual(input, c206A), SIMD::lessThanOrEqual(input, cD7FF)); ++#else + auto cond2 = SIMD::bitAnd(SIMD::greaterThanOrEqual(input, c206A), SIMD::lessThanOrEqual(input, cD7FF)); ++#endif + // Common in CJK. + // ch >= 0xFF00 && ch <= 0xFFFF + auto cond3 = SIMD::greaterThanOrEqual(input, cFF00); +-- +2.41.0 + diff --git a/fix_code_error.patch b/fix_code_error.patch new file mode 100644 index 0000000000000000000000000000000000000000..87d184146589396003d3a7f8cc9550bc0ddd3101 --- /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 0000000000000000000000000000000000000000..aecaba3b1762524835e2b40dc8863a5e7ad930a2 --- /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 78fab2354461b878aa0f98637df448cc4473ed94..54522b8e786dab2be05edc5e0369b60dd1771bd7 100644 --- a/webkitgtk.spec +++ b/webkitgtk.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 3 ## 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') +%ifnarch riscv64 %global _lto_cflags %{nil} +%endif %bcond_without docs @@ -23,6 +25,10 @@ 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 +Patch03: 0001-fix-build-error-with-gcc14.patch + ExcludeArch: loongarch64 BuildRequires: bison @@ -230,6 +236,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,10 +245,22 @@ 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 +%ifarch riscv64 +%define gcc_version %(gcc -dumpversion | cut -d. -f1) +%if "%{gcc_version}" == "14" +%global optflags %(echo '%{optflags}' | sed 's/-O2/-O1/g; s/-O3/-O1/g') -D__riscv_v_fixed_vlen=128 -mrvv-vector-bits=zvl +%endif +%endif + %define _vpath_builddir %{_vendor}-%{_target_os}-build/webkitgtk-6.0 %cmake \ -GNinja \ @@ -429,6 +448,12 @@ export NINJA_STATUS="[2/2][%f/%t %es] " %endif %changelog +* Fri Sep 14 2025 Shangtong Guo - 2.48.1-3 +- fix build error with gcc14 + +* 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