From 5c1f6fe53db3f3916776b9e06909e8fc598e7a53 Mon Sep 17 00:00:00 2001
From: Diego Nicola Barbato <dnbarbato@posteo.de>
Date: Tue, 9 Nov 2021 18:24:57 +0100
Subject: [PATCH] gnu: webkitgtk: Really disable SSE2 on i686-linux.
This is a followup to d82fd7c2dd542693988f61fb15c020e3209ac7ec.
* gnu/packages/patches/webkitgtk-dont-detect-sse2.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/webkit.scm (webkitgtk)[source]: Use it.
[arguments]: Remove 'disable-sse2' phase. When building on i686-linux, insert
'setenv' forms in the 'prepare-build-environment' phase that set both 'CFLAGS'
and 'CXXFLAGS' to '-march=i686'.
---
gnu/local.mk | 1 +
.../patches/webkitgtk-dont-detect-sse2.patch | 28 +++++++++++++++++++
gnu/packages/webkit.scm | 17 +++++------
3 files changed, 36 insertions(+), 10 deletions(-)
create mode 100644 gnu/packages/patches/webkitgtk-dont-detect-sse2.patch
@@ -1899,6 +1899,7 @@ dist_patch_DATA = \
%D%/packages/patches/vtk-fix-freetypetools-build-failure.patch \
%D%/packages/patches/vtk-8-fix-freetypetools-build-failure.patch \
%D%/packages/patches/warsow-qfusion-fix-bool-return-type.patch \
+ %D%/packages/patches/webkitgtk-dont-detect-sse2.patch \
%D%/packages/patches/webkitgtk-share-store.patch \
%D%/packages/patches/webkitgtk-bind-all-fonts.patch \
%D%/packages/patches/websocketpp-fix-for-cmake-3.15.patch \
new file mode 100644
@@ -0,0 +1,28 @@
+Copied from Debian:
+
+https://sources.debian.org/data/main/w/webkit2gtk/2.34.1-1/debian/patches/dont-detect-sse2.patch
+
+From: Alberto Garcia <berto@igalia.com>
+Subject: Don't check for SSE2 support on i386
+Bug-Debian: https://bugs.debian.org/930935
+Forwarded: no
+Index: webkitgtk/Source/cmake/WebKitCompilerFlags.cmake
+===================================================================
+--- webkitgtk.orig/Source/cmake/WebKitCompilerFlags.cmake
++++ webkitgtk/Source/cmake/WebKitCompilerFlags.cmake
+@@ -148,15 +148,6 @@ if (COMPILER_IS_GCC_OR_CLANG)
+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wno-expansion-to-defined)
+ endif ()
+-
+- # Force SSE2 fp on x86 builds.
+- if (WTF_CPU_X86 AND NOT CMAKE_CROSSCOMPILING)
+- WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-msse2 -mfpmath=sse)
+- include(DetectSSE2)
+- if (NOT SSE2_SUPPORT_FOUND)
+- message(FATAL_ERROR "SSE2 support is required to compile WebKit")
+- endif ()
+- endif ()
+ endif ()
+
+ if (COMPILER_IS_GCC_OR_CLANG AND NOT MSVC)
@@ -236,7 +236,8 @@ (define-public webkitgtk
(sha256
(base32
"1vix0w24m7mq82rzxrk8xvcrkli44gimzs282xs29q2xf0b16g24"))
- (patches (search-patches "webkitgtk-share-store.patch"
+ (patches (search-patches "webkitgtk-dont-detect-sse2.patch"
+ "webkitgtk-share-store.patch"
"webkitgtk-bind-all-fonts.patch"))))
(build-system cmake-build-system)
(outputs '("out" "doc"))
@@ -295,23 +296,19 @@ (define-public webkitgtk
(("libWPEBackend-fdo-([\\.0-9]+)\\.so" all version)
(string-append wpebackend-fdo "/lib/" all)))
#t)))
- ,@(if (string-prefix? "x86_64" (or (%current-target-system)
- (%current-system)))
- '()
- '((add-after 'unpack 'disable-sse2
- (lambda _
- (substitute* "Source/cmake/DetectSSE2.cmake"
- (("CHECK_FOR_SSE2\\(\\)") ""))))))
(add-before 'configure 'prepare-build-environment
(lambda* (#:key inputs #:allow-other-keys)
(setenv "CC" "clang")
(setenv "CXX" "clang++")
;; XXX Until we switch back to using GCC,
- ;; work around <https://bugs.gnu.org/51591>.
+ ;; work around <https://bugs.gnu.org/51591>
+ ;; and compile for i686 without extensions.
,@(if (target-x86-32?)
'((substitute* "Source/WTF/wtf/CheckedArithmetic.h"
(("#define USE_MUL_OVERFLOW 1")
- "#define USE_MUL_OVERFLOW 0")))
+ "#define USE_MUL_OVERFLOW 0"))
+ (setenv "CFLAGS" "-march=i686")
+ (setenv "CXXFLAGS" "-march=i686"))
'())
#t))
(add-after 'install 'move-doc-files
base-commit: d29a9aa54b9df9167f4641dd8ca42c561b460c4c
--
2.33.1