new package: webkit2gtk (#264)

This commit is contained in:
Ludea 2021-02-22 18:04:20 +01:00 committed by Yaksh Bariya
parent 56548253c3
commit 09cdaba749
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
4 changed files with 140 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,9 @@
TERMUX_PKG_HOMEPAGE=https://webkit.org/
TERMUX_PKG_DESCRIPTION="WebKit is the web browser engine"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=2.31.1
TERMUX_PKG_SRCURL=https://webkitgtk.org/releases/webkitgtk-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_GAMEPAD=OFF -DUSE_SYSTEMD=OFF -DUSE_LIBSECRET=OFF -DENABLE_INTROSPECTION=OFF"
TERMUX_PKG_SHA256=6b1bb3e0efcfcb6e4a8e18b6a5f1cac27cda203d46a7dfbb0f150784a47e908f
TERMUX_PKG_DEPENDS="libtasn1, libxt, libnotify, libcairo, libgcrypt, gtk3, libsoup, libwebp, libxslt, woff2, enchant, libhyphen, openjpeg, gst-plugins-base, gstreamer"

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