From fe4fc9839de44f565b5a6b91f782f55f8b22ce93 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Thu, 27 Sep 2018 02:08:39 +0000
Subject: [PATCH] experimental/qt5-qtwebkit: another patch that doesn't fix it
 but should

---
 experimental/qt5-qtwebkit/APKBUILD            |  4 +-
 .../qt5-qtwebkit/jsc-port-to-musl.patch       | 81 +++++++++++++++++++
 .../qt5-qtwebkit/musl-thread-stacksize.patch  | 12 +--
 3 files changed, 91 insertions(+), 6 deletions(-)
 create mode 100644 experimental/qt5-qtwebkit/jsc-port-to-musl.patch

diff --git a/experimental/qt5-qtwebkit/APKBUILD b/experimental/qt5-qtwebkit/APKBUILD
index 440956b14a..fb6c396315 100644
--- a/experimental/qt5-qtwebkit/APKBUILD
+++ b/experimental/qt5-qtwebkit/APKBUILD
@@ -18,6 +18,7 @@ makedepends="$depends_dev ninja sqlite-dev icu-dev ruby perl bison flex gperf
 	libxrender-dev gst-plugins-base-dev hyphen-dev libexecinfo-dev"
 subpackages="$pkgname-dev $pkgname-doc"
 source="https://github.com/annulen/webkit/releases/download/$_realname-$_realver/$_realname-$_realver.tar.xz
+	jsc-port-to-musl.patch
 	musl-thread-stacksize.patch
 	"
 builddir="$srcdir"/$_realname-$_realver
@@ -89,4 +90,5 @@ package() {
 }
 
 sha512sums="b15985aab20c5618dc1f71a0d91f02dbed993516272090a4a12990714bf4c9554ccbdcf9d6a143bf46fcc2c170f691e571114d61686fe49791f8d5c540785758  qtwebkit-5.212.0-alpha2.tar.xz
-2b778d55a00107f226231d00f13efb3064f539e2b9b690e3c542ee8b6be975b06b673efa27ececf09e0707c8319cb00f72177d9487ca1c36be5a98ab9eb33124  musl-thread-stacksize.patch"
+19efd97c5f628108d30cc0e5e53f689725cc480ffe1ea90577e5f961d7f35a6a434dda5a03c73c0fb74a30c46ced32bcf580340a2eaf4e72960e61c28ed34dba  jsc-port-to-musl.patch
+a8df6d20346882e49745dbdf9bdf2eddf2f3e1ac3301e9fd826397fa746d1d9228deaf2eab0316fa977a85032d6c091559cd5404b7a576e3adc0bec64a5a4ad9  musl-thread-stacksize.patch"
diff --git a/experimental/qt5-qtwebkit/jsc-port-to-musl.patch b/experimental/qt5-qtwebkit/jsc-port-to-musl.patch
new file mode 100644
index 0000000000..0b2d7dfce3
--- /dev/null
+++ b/experimental/qt5-qtwebkit/jsc-port-to-musl.patch
@@ -0,0 +1,81 @@
+diff -Naur qtwebkit-5.212.0-alpha2-original/Source/JavaScriptCore/heap/MachineStackMarker.cpp qtwebkit-5.212.0-alpha2/Source/JavaScriptCore/heap/MachineStackMarker.cpp
+--- qtwebkit-5.212.0-alpha2-original/Source/JavaScriptCore/heap/MachineStackMarker.cpp	2017-06-04 20:16:05.000000000 +0000
++++ qtwebkit-5.212.0-alpha2/Source/JavaScriptCore/heap/MachineStackMarker.cpp	2018-09-26 02:13:44.660000000 +0000
+@@ -566,7 +566,7 @@
+ #error Unknown Architecture
+ #endif
+ 
+-#elif defined(__GLIBC__) && ENABLE(JIT)
++#elif defined(__linux__) && ENABLE(JIT)
+ 
+ #if CPU(X86)
+     return reinterpret_cast<void*>((uintptr_t) regs.machineContext.gregs[REG_ESP]);
+@@ -665,7 +665,7 @@
+ #error Unknown Architecture
+ #endif
+ 
+-#elif defined(__GLIBC__)
++#elif defined(__linux__)
+ 
+ // The following sequence depends on glibc's sys/ucontext.h.
+ #if CPU(X86)
+@@ -747,7 +747,7 @@
+ #error Unknown Architecture
+ #endif
+ 
+-#elif defined(__GLIBC__)
++#elif defined(__linux__)
+ 
+ // The following sequence depends on glibc's sys/ucontext.h.
+ #if CPU(X86)
+@@ -838,7 +838,7 @@
+ #error Unknown Architecture
+ #endif
+ 
+-#elif defined(__GLIBC__)
++#elif defined(__linux__)
+ 
+ // The following sequence depends on glibc's sys/ucontext.h.
+ #if CPU(X86)
+diff -Naur qtwebkit-5.212.0-alpha2-original/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp qtwebkit-5.212.0-alpha2/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
+--- qtwebkit-5.212.0-alpha2-original/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp	2017-06-04 20:16:06.000000000 +0000
++++ qtwebkit-5.212.0-alpha2/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp	2018-09-26 02:12:36.770000000 +0000
+@@ -828,7 +828,7 @@
+ #if YYERROR_VERBOSE
+ 
+ # ifndef yystrlen
+-#  if defined __GLIBC__ && defined _STRING_H
++#  if defined __linux__ && defined _STRING_H
+ #   define yystrlen strlen
+ #  else
+ /* Return the length of YYSTR.  */
+@@ -844,7 +844,7 @@
+ # endif
+ 
+ # ifndef yystpcpy
+-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
++#  if defined __linux__ && defined _STRING_H && defined _GNU_SOURCE
+ #   define yystpcpy stpcpy
+ #  else
+ /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+diff -Naur qtwebkit-5.212.0-alpha2-original/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp qtwebkit-5.212.0-alpha2/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp
+--- qtwebkit-5.212.0-alpha2-original/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp	2017-06-04 20:16:06.000000000 +0000
++++ qtwebkit-5.212.0-alpha2/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp	2018-09-26 02:12:54.740000000 +0000
+@@ -1835,7 +1835,7 @@
+ #if YYERROR_VERBOSE
+ 
+ # ifndef yystrlen
+-#  if defined __GLIBC__ && defined _STRING_H
++#  if defined __linux__ && defined _STRING_H
+ #   define yystrlen strlen
+ #  else
+ /* Return the length of YYSTR.  */
+@@ -1851,7 +1851,7 @@
+ # endif
+ 
+ # ifndef yystpcpy
+-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
++#  if defined __linux__ && defined _STRING_H && defined _GNU_SOURCE
+ #   define yystpcpy stpcpy
+ #  else
+ /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
diff --git a/experimental/qt5-qtwebkit/musl-thread-stacksize.patch b/experimental/qt5-qtwebkit/musl-thread-stacksize.patch
index b1e42b7d0c..e790222dc1 100644
--- a/experimental/qt5-qtwebkit/musl-thread-stacksize.patch
+++ b/experimental/qt5-qtwebkit/musl-thread-stacksize.patch
@@ -32,16 +32,18 @@
  #if HAVE(QOS_CLASSES)
      pthread_attr_set_qos_class_np(&attr, QOS_CLASS_USER_INITIATED, 0);
  #endif
---- qtwebkit-5.212.0-alpha2/Source/JavaScriptCore/runtime/Options.h.old	2017-06-04 15:16:05.000000000 -0500
-+++ qtwebkit-5.212.0-alpha2/Source/JavaScriptCore/runtime/Options.h	2018-09-04 22:29:51.050000000 -0500
+--- qtwebkit-5.212.0-alpha2/Source/JavaScriptCore/runtime/Options.h.old	2017-06-04 20:16:05.000000000 +0000
++++ qtwebkit-5.212.0-alpha2/Source/JavaScriptCore/runtime/Options.h	2018-09-26 03:02:39.700000000 +0000
 @@ -112,9 +112,9 @@
      \
      v(bool, reportMustSucceedExecutableAllocations, false, nullptr) \
      \
 -    v(unsigned, maxPerThreadStackUsage, 4 * MB, nullptr) \
-+    v(unsigned, maxPerThreadStackUsage, 1 * MB, nullptr) \
-     v(unsigned, reservedZoneSize, 128 * KB, nullptr) \
-     v(unsigned, errorModeReservedZoneSize, 64 * KB, nullptr) \
+-    v(unsigned, reservedZoneSize, 128 * KB, nullptr) \
+-    v(unsigned, errorModeReservedZoneSize, 64 * KB, nullptr) \
++    v(unsigned, maxPerThreadStackUsage, 512 * KB, nullptr) \
++    v(unsigned, reservedZoneSize, 32 * KB, nullptr) \
++    v(unsigned, errorModeReservedZoneSize, 16 * KB, nullptr) \
      \
      v(bool, crashIfCantAllocateJITMemory, false, nullptr) \
      v(unsigned, jitMemoryReservationSize, 0, "Set this number to change the executable allocation size in ExecutableAllocatorFixedVMPool. (In bytes.)") \
-- 
GitLab