webkit2gtk: Re-enable and update to 2.32.4

This commit is contained in:
Tee KOBAYASHI 2022-04-06 12:11:25 +09:00 committed by Yaksh Bariya
parent f830a48ccd
commit a30a6e73c5
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
4 changed files with 153 additions and 0 deletions

View File

@ -0,0 +1,22 @@
diff --git a/Source/WTF/wtf/PlatformGTK.cmake b/Source/WTF/wtf/PlatformGTK.cmake
index fa6958fbd3..c6d4a51fec 100644
--- a/Source/WTF/wtf/PlatformGTK.cmake
+++ b/Source/WTF/wtf/PlatformGTK.cmake
@@ -13,7 +13,7 @@ list(APPEND WTF_PUBLIC_HEADERS
glib/WTFGType.h
)
-if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+if (CMAKE_SYSTEM_NAME MATCHES "Android")
list(APPEND WTF_PUBLIC_HEADERS
linux/ProcessMemoryFootprint.h
linux/CurrentProcessMemoryStatus.h
@@ -47,7 +47,7 @@ list(APPEND WTF_SOURCES
unix/UniStdExtrasUnix.cpp
)
-if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+if (CMAKE_SYSTEM_NAME MATCHES "Android")
list(APPEND WTF_SOURCES
linux/CurrentProcessMemoryStatus.cpp
linux/MemoryFootprintLinux.cpp

View File

@ -0,0 +1,70 @@
diff --git a/Source/WebKit/Platform/unix/SharedMemoryUnix.cpp b/Source/WebKit/Platform/unix/SharedMemoryUnix.cpp
index aff7b0d18d..7d22cb5f5c 100644
--- a/Source/WebKit/Platform/unix/SharedMemoryUnix.cpp
+++ b/Source/WebKit/Platform/unix/SharedMemoryUnix.cpp
@@ -54,6 +54,65 @@
#include "ArgumentCoders.h"
#endif
+static int shm_unlink(const char *name) {
+ size_t namelen;
+ char *fname;
+
+ /* Construct the filename. */
+ while (name[0] == '/') ++name;
+
+ if (name[0] == '\0') {
+ /* The name "/" is not supported. */
+ errno = EINVAL;
+ return -1;
+ }
+
+ namelen = strlen(name);
+ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1);
+ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1);
+ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1);
+
+ return unlink(fname);
+}
+
+static int shm_open(const char *name, int oflag, mode_t mode) {
+ size_t namelen;
+ char *fname;
+ int fd;
+
+ /* Construct the filename. */
+ while (name[0] == '/') ++name;
+
+ if (name[0] == '\0') {
+ /* The name "/" is not supported. */
+ errno = EINVAL;
+ return -1;
+ }
+
+ namelen = strlen(name);
+ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1);
+ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1);
+ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1);
+
+ fd = open(fname, oflag, mode);
+ if (fd != -1) {
+ /* We got a descriptor. Now set the FD_CLOEXEC bit. */
+ int flags = fcntl(fd, F_GETFD, 0);
+ flags |= FD_CLOEXEC;
+ flags = fcntl(fd, F_SETFD, flags);
+
+ if (flags == -1) {
+ /* Something went wrong. We cannot return the descriptor. */
+ int save_errno = errno;
+ close(fd);
+ fd = -1;
+ errno = save_errno;
+ }
+ }
+
+ return fd;
+}
+
namespace WebKit {
SharedMemory::Handle::Handle()

View File

@ -0,0 +1,22 @@
TERMUX_PKG_HOMEPAGE=https://webkitgtk.org
TERMUX_PKG_DESCRIPTION="A full-featured port of the WebKit rendering engine"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=2.32.4
TERMUX_PKG_SRCURL=https://webkitgtk.org/releases/webkitgtk-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=00ce2d3f798d7bc5e9039d9059f0c3c974d51de38c8b716f00e94452a177d3fd
TERMUX_PKG_DEPENDS="atk, enchant, fontconfig, freetype, glib, gst-plugins-base, gstreamer, gtk3, harfbuzz, harfbuzz-icu, libc++, libcairo, libgcrypt, libhyphen, libicu, libjpeg-turbo, libnotify, libpng, libsoup, libtasn1, libwebp, libxml2, libx11, libxcomposite, libxdamage, libxslt, libxt, openjpeg, pango, woff2"
TERMUX_PKG_BUILD_DEPENDS="xorgproto"
TERMUX_PKG_BREAKS="webkit, webkitgtk"
TERMUX_PKG_REPLACES="webkit, webkitgtk"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DPORT=GTK
-DENABLE_GAMEPAD=OFF
-DUSE_SYSTEMD=OFF
-DUSE_LIBSECRET=OFF
-DENABLE_INTROSPECTION=OFF
-DUSE_WPE_RENDERER=OFF
-DENABLE_BUBBLEWRAP_SANDBOX=OFF
-DUSE_LD_GOLD=OFF
"

View File

@ -0,0 +1,39 @@
diff --git a/Source/JavaScriptCore/jsc.cpp b/Source/JavaScriptCore/jsc.cpp
index 31d9abcb31..863514e97c 100644
--- a/Source/JavaScriptCore/jsc.cpp
+++ b/Source/JavaScriptCore/jsc.cpp
@@ -127,7 +127,7 @@
#if OS(DARWIN)
#include <wtf/spi/darwin/ProcessMemoryFootprint.h>
-#elif OS(LINUX)
+#elif OS(LINUX) || OS(ANDROID)
#include <wtf/linux/ProcessMemoryFootprint.h>
#endif
@@ -2662,7 +2662,7 @@ JSC_DEFINE_HOST_FUNCTION(functionDropAllLocks, (JSGlobalObject* globalObject, Ca
int jscmain(int argc, char** argv);
-#if OS(DARWIN) || OS(LINUX)
+#if OS(DARWIN) || OS(LINUX) || OS(ANDROID)
static size_t memoryLimit;
static void crashIfExceedingMemoryLimit()
@@ -2697,7 +2697,7 @@ static void startMemoryMonitoringThreadIfNeeded()
}
});
}
-#endif // OS(DARWIN) || OS(LINUX)
+#endif // OS(DARWIN) || OS(LINUX) || OS(ANDROID)
static double s_desiredTimeout;
static double s_timeoutMultiplier = 1.0;
@@ -3498,7 +3498,7 @@ int jscmain(int argc, char** argv)
#endif
initializeTimeoutIfNeeded();
-#if OS(DARWIN) || OS(LINUX)
+#if OS(DARWIN) || OS(LINUX) || OS(ANDROID)
startMemoryMonitoringThreadIfNeeded();
#endif