commit:     c1b610a5a12b7954708038906c87c0a69768f254
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  3 21:42:04 2024 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Wed Jan  3 21:58:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1b610a5

net-libs/webkit-gtk: fix build failing assert on some machines

Closes: https://bugs.gentoo.org/920704
Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>

 .../webkit-gtk/files/2.42.4-wasm-assert-fix.patch  | 53 ++++++++++++++++++++++
 net-libs/webkit-gtk/webkit-gtk-2.42.4-r410.ebuild  |  4 +-
 net-libs/webkit-gtk/webkit-gtk-2.42.4-r600.ebuild  |  4 +-
 net-libs/webkit-gtk/webkit-gtk-2.42.4.ebuild       |  4 +-
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/net-libs/webkit-gtk/files/2.42.4-wasm-assert-fix.patch 
b/net-libs/webkit-gtk/files/2.42.4-wasm-assert-fix.patch
new file mode 100644
index 000000000000..da54b9b9a0e2
--- /dev/null
+++ b/net-libs/webkit-gtk/files/2.42.4-wasm-assert-fix.patch
@@ -0,0 +1,53 @@
+From 509b303bf5650710bee5e151decc1a723a54657f Mon Sep 17 00:00:00 2001
+From: Conrad Kostecki <[email protected]>
+Date: Tue, 2 Jan 2024 12:25:20 -0800
+Subject: [PATCH] Source/JavaScriptCore/wasm/generateWasm.py: return value in
+ int for memorybits
+
+https://bugs.webkit.org/show_bug.cgi?id=266942
+
+Reviewed by Justin Michaud.
+
+The assert function currently checks, if power number raised to the
+number fits memorybits. This seems not always work on every system,
+as it happens, that the float numbers are not correctly rounded.
+
+This patch adds an int, so its being rounded to a full number and works
+on my system, where otherwise the rounding would fail. The return method
+also returns the result as an int.
+
+Example:
+import math
+
+2 ** 3
+= 8
+
+2.0 ** 3.0
+= 7.999999999999999
+
+int(2.0) ** int(3.0)
+= 8
+
+2 ** int(3.0)
+= 8
+
+Signed-off-by: Conrad Kostecki <[email protected]>
+Canonical link: https://commits.webkit.org/272577@main
+---
+ Source/JavaScriptCore/wasm/generateWasm.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Source/JavaScriptCore/wasm/generateWasm.py 
b/Source/JavaScriptCore/wasm/generateWasm.py
+index 434223d346a0..7a99210b60a2 100755
+--- a/Source/JavaScriptCore/wasm/generateWasm.py
++++ b/Source/JavaScriptCore/wasm/generateWasm.py
+@@ -136,5 +136,5 @@ def memoryLog2Alignment(op):
+         if not match:
+             print(op["name"])
+         memoryBits = int(match.group(2) if match.group(2) else match.group(1))
+-    assert 2 ** math.log(memoryBits, 2) == memoryBits
++    assert 2 ** int(math.log(memoryBits, 2)) == memoryBits
+     return str(int(math.log(memoryBits / 8, 2)))
+-- 
+2.43.0
+

diff --git a/net-libs/webkit-gtk/webkit-gtk-2.42.4-r410.ebuild 
b/net-libs/webkit-gtk/webkit-gtk-2.42.4-r410.ebuild
index 21f9214fe9c3..c88fc397b1f9 100644
--- a/net-libs/webkit-gtk/webkit-gtk-2.42.4-r410.ebuild
+++ b/net-libs/webkit-gtk/webkit-gtk-2.42.4-r410.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -153,6 +153,8 @@ src_prepare() {
 
        # Fix USE=-jumbo-build compilation on arm64
        eapply "${FILESDIR}"/2.42.1-arm64-non-jumbo-fix.patch
+       # Fix assert failure on some machines, bug #920704
+       eapply "${FILESDIR}"/2.42.4-wasm-assert-fix.patch
 }
 
 src_configure() {

diff --git a/net-libs/webkit-gtk/webkit-gtk-2.42.4-r600.ebuild 
b/net-libs/webkit-gtk/webkit-gtk-2.42.4-r600.ebuild
index 642cfe89e038..599c268e4b4a 100644
--- a/net-libs/webkit-gtk/webkit-gtk-2.42.4-r600.ebuild
+++ b/net-libs/webkit-gtk/webkit-gtk-2.42.4-r600.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -154,6 +154,8 @@ src_prepare() {
 
        # Fix USE=-jumbo-build compilation on arm64
        eapply "${FILESDIR}"/2.42.1-arm64-non-jumbo-fix.patch
+       # Fix assert failure on some machines, bug #920704
+       eapply "${FILESDIR}"/2.42.4-wasm-assert-fix.patch
 }
 
 src_configure() {

diff --git a/net-libs/webkit-gtk/webkit-gtk-2.42.4.ebuild 
b/net-libs/webkit-gtk/webkit-gtk-2.42.4.ebuild
index ec5e2d42380d..b5ad3bd607ec 100644
--- a/net-libs/webkit-gtk/webkit-gtk-2.42.4.ebuild
+++ b/net-libs/webkit-gtk/webkit-gtk-2.42.4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -151,6 +151,8 @@ src_prepare() {
 
        # Fix USE=-jumbo-build compilation on arm64
        eapply "${FILESDIR}"/2.42.1-arm64-non-jumbo-fix.patch
+       # Fix assert failure on some machines, bug #920704
+       eapply "${FILESDIR}"/2.42.4-wasm-assert-fix.patch
 }
 
 src_configure() {

Reply via email to