diff --git a/recipes-browser/wpewebkit/wpewebkit/0001-JSC-Fix-build-failure-on-musl-Add-fallback-for-round.patch b/recipes-browser/wpewebkit/wpewebkit/0001-JSC-Fix-build-failure-on-musl-Add-fallback-for-round.patch new file mode 100644 index 00000000..b0044d0d --- /dev/null +++ b/recipes-browser/wpewebkit/wpewebkit/0001-JSC-Fix-build-failure-on-musl-Add-fallback-for-round.patch @@ -0,0 +1,59 @@ +From 3c54d2278eba24fe75ff2c04b74807e118ed7562 Mon Sep 17 00:00:00 2001 +From: Pablo Saavedra +Date: Thu, 10 Oct 2024 15:11:47 +0200 +Subject: [PATCH] [JSC] Fix build failure on musl: Add fallback for roundeven + and roundevenf https://bugs.webkit.org/show_bug.cgi?id=281216 + +Reviewed by NOBODY (OOPS!). + +While building WPEWebKit on musl-based systems, errors occur due to +the absence of roundevenf and roundeven functions. These are not +available in musl and other non-glibc platforms. + +This patch provides fallback implementations for both functions. + +* Source/JavaScriptCore/runtime/MathCommon.cpp: +(JSC::Math::roundevenf): +(JSC::Math::roundeven): +--- + Source/JavaScriptCore/runtime/MathCommon.cpp | 22 ++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +Upstream-Status: Submitted [https://bugs.webkit.org/show_bug.cgi?id=281216] + +diff --git a/Source/JavaScriptCore/runtime/MathCommon.cpp b/Source/JavaScriptCore/runtime/MathCommon.cpp +index 0cd276b20126..625f9146c1ea 100644 +--- a/Source/JavaScriptCore/runtime/MathCommon.cpp ++++ b/Source/JavaScriptCore/runtime/MathCommon.cpp +@@ -635,6 +635,28 @@ JSC_DEFINE_NOEXCEPT_JIT_OPERATION(f64_nearest, double, (double operand)) + return std::nearbyint(operand); + } + ++#if OS(LINUX) && !defined(__GLIBC__) ++static inline float roundevenf(float operand) ++{ ++ float rounded = roundf(operand); ++ if (fabsf(operand - rounded) == 0.5f) { ++ if (fmod(rounded, 2.0f) != 0.0f) ++ return rounded - copysignf(1.0f, operand); ++ } ++ return rounded; ++} ++ ++static inline double roundeven(double operand) ++{ ++ double rounded = round(operand); ++ if (fabs(operand - rounded) == 0.5) { ++ if (fmod(rounded, 2.0) != 0.0) ++ return rounded - copysign(1.0, operand); ++ } ++ return rounded; ++} ++#endif ++ + JSC_DEFINE_NOEXCEPT_JIT_OPERATION(f32_roundeven, float, (float operand)) { return roundevenf(operand); } + JSC_DEFINE_NOEXCEPT_JIT_OPERATION(f64_roundeven, double, (double operand)) { return roundeven(operand); } + JSC_DEFINE_NOEXCEPT_JIT_OPERATION(f32_trunc, float, (float operand)) { return std::trunc(operand); } +-- +2.43.0 + diff --git a/recipes-browser/wpewebkit/wpewebkit_2.46.1.bb b/recipes-browser/wpewebkit/wpewebkit_2.46.1.bb index 180e1949..58116522 100644 --- a/recipes-browser/wpewebkit/wpewebkit_2.46.1.bb +++ b/recipes-browser/wpewebkit/wpewebkit_2.46.1.bb @@ -3,7 +3,9 @@ require conf/include/devupstream.inc FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -SRC_URI = "https://wpewebkit.org/releases/${BPN}-${PV}.tar.xz;name=tarball" +SRC_URI = "https://wpewebkit.org/releases/${BPN}-${PV}.tar.xz;name=tarball \ + file://0001-JSC-Fix-build-failure-on-musl-Add-fallback-for-round.patch \ + " SRC_URI[tarball.sha256sum] = "1e0aaf870f36001c42b1ce5a2027b4101bed878746e437cc6d6fed0693afe9ad"