On 2024/10/11 10:37, Stuart Henderson wrote:
> On 2024/10/08 14:28, Brad Smith wrote:
> > On 10/8/2024 9:34 AM, Stuart Henderson wrote:
> > > > Log message:
> > > > Update to webkitgtk{40,41,60}-2.46.1.
> > > i386 doesn't like this:
> > >
> > > In file included from
> > > /pobj/webkitgtk41-2.46.1-webkitgtk41/build-i386-webkitgtk41/JavaScriptCore/DerivedSources/unified-sources/UnifiedSource-f2e18ffc-29.cpp:2:
> > > /pobj/webkitgtk41-2.46.1-webkitgtk41/webkitgtk-2.46.1/Source/JavaScriptCore/runtime/MathCommon.cpp:638:83:
> > > error: use of undeclared identifier 'roundevenf'
> > > JSC_DEFINE_NOEXCEPT_JIT_OPERATION(f32_roundeven, float, (float operand))
> > > { return roundevenf(operand); }
> > >
> > > It comes from this upstream commit,
> > > https://github.com/WebKit/WebKit/commit/0967dc49cdafeedc9a488676a9cabaaf09403a9e
> > > "FP rounding is not available on ARMv7, which is the only arch likely to
> > > use OMG on 32-bits. Use C Calls instead."
> > >
> > > There are some suggestions that roundevenf might be a compiler builtin
> > > - I'll try it with llvm 17 to see if that changes anything and report
> > > back.
> >
> >
> > The roundeven family of functions were only added in C23, although have
> > existed in glibc
> > for quite awhile.
> >
> > https://sourceware.org/git/?p=glibc.git;a=commit;h=41c67149b94676347b0068a902058f130e3e88e6
> >
>
> https://github.com/WebKit/WebKit/pull/34972
>
I'll try this in my next build.
Index: Makefile
===================================================================
RCS file: /cvs/ports/www/webkitgtk4/Makefile,v
diff -u -p -r1.220 Makefile
--- Makefile 6 Oct 2024 15:14:44 -0000 1.220
+++ Makefile 11 Oct 2024 09:59:06 -0000
@@ -17,6 +17,8 @@ DISTNAME = webkitgtk-${V}
PKGNAME = webkitgtk${API:S/.//}-${V}
FULLPKGNAME = ${PKGNAME}
+REVISION = 0
+
EXTRACT_SUFX = .tar.xz
SUBST_VARS = API
DPB_PROPERTIES = parallel
Index: patches/patch-Source_JavaScriptCore_runtime_MathCommon_cpp
===================================================================
RCS file: patches/patch-Source_JavaScriptCore_runtime_MathCommon_cpp
diff -N patches/patch-Source_JavaScriptCore_runtime_MathCommon_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Source_JavaScriptCore_runtime_MathCommon_cpp 11 Oct 2024
09:59:06 -0000
@@ -0,0 +1,38 @@
+From 3c54d2278eba24fe75ff2c04b74807e118ed7562 Mon Sep 17 00:00:00 2001
+From: Pablo Saavedra <[email protected]>
+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
+
+Index: Source/JavaScriptCore/runtime/MathCommon.cpp
+--- Source/JavaScriptCore/runtime/MathCommon.cpp.orig
++++ Source/JavaScriptCore/runtime/MathCommon.cpp
+@@ -635,6 +635,28 @@ JSC_DEFINE_NOEXCEPT_JIT_OPERATION(f64_nearest, double,
+ 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); }