From 39126a4f9b3f85ba9e478afc58127859f75e0969 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Wed, 30 Nov 2022 11:39:31 +1000 Subject: [PATCH] webkit_gtk: enable bmalloc, introspection --- .../patches/webkit_gtk-2.38.2.patchset | 252 +++++++++++------- net-libs/webkit-gtk/webkit_gtk-2.38.2.recipe | 15 +- 2 files changed, 170 insertions(+), 97 deletions(-) diff --git a/net-libs/webkit-gtk/patches/webkit_gtk-2.38.2.patchset b/net-libs/webkit-gtk/patches/webkit_gtk-2.38.2.patchset index d3444a1d6..385dc55ba 100644 --- a/net-libs/webkit-gtk/patches/webkit_gtk-2.38.2.patchset +++ b/net-libs/webkit-gtk/patches/webkit_gtk-2.38.2.patchset @@ -44,34 +44,6 @@ index e52143c..4ac504c 100644 + network + ) +endif () -diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl b/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl -index 0b08d2a..d3c8a9b 100644 ---- a/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl -+++ b/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl -@@ -1,4 +1,4 @@ --#! /usr/bin/env perl -+#! /bin/env perl - # - # This file is part of the WebKit project - # -@@ -43,7 +43,7 @@ if (!$preprocessor) { - $preprocessor = $ENV{CC} || "cl"; - push(@args, qw(/nologo /EP /TP /C)); - } else { -- $preprocessor = $ENV{CC} || (-x "/usr/bin/clang" ? "/usr/bin/clang" : "/usr/bin/gcc"); -+ $preprocessor = $ENV{CC} || (-x "/bin/clang" ? "/bin/clang" : "/bin/gcc"); - push(@args, qw(-E -P -x c++ -C)); - } - } -@@ -64,7 +64,7 @@ my $pid = 0; - if ($Config{osname} eq "cygwin") { - $ENV{PATH} = "$ENV{PATH}:/cygdrive/c/cygwin/bin"; - my @preprocessorAndFlags; -- if ($preprocessor eq "/usr/bin/gcc") { -+ if ($preprocessor eq "/bin/gcc") { - @preprocessorAndFlags = split(' ', $preprocessor); - } else { - $preprocessor =~ /"(.*)"/; diff --git a/Source/ThirdParty/ANGLE/src/common/system_utils_posix.cpp b/Source/ThirdParty/ANGLE/src/common/system_utils_posix.cpp index cc8c618..8b9d638 100644 --- a/Source/ThirdParty/ANGLE/src/common/system_utils_posix.cpp @@ -214,19 +186,6 @@ index e9d9d58..bc4d1c7 100644 // e.g. on FreeBSD 5.4, neundorf@kde.org pthread_attr_get_np(thread, &sattr); #else -diff --git a/Source/WebCore/bindings/scripts/preprocessor.pm b/Source/WebCore/bindings/scripts/preprocessor.pm -index 31a991f..c512764 100644 ---- a/Source/WebCore/bindings/scripts/preprocessor.pm -+++ b/Source/WebCore/bindings/scripts/preprocessor.pm -@@ -50,7 +50,7 @@ sub applyPreprocessor - $preprocessor = $ENV{CC} || "cl"; - push(@args, qw(/EP)); - } else { -- $preprocessor = $ENV{CC} || (-x "/usr/bin/clang" ? "/usr/bin/clang" : "/usr/bin/gcc"); -+ $preprocessor = $ENV{CC} || (-x "/bin/clang" ? "/bin/clang" : "/bin/gcc"); - push(@args, qw(-E -P -x c++)); - if ($keepComments) { - push(@args, qw(-C)); diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index 54d6b1c..761ebca 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -456,35 +415,6 @@ index 1dfae4a..69f1889 100644 inline void LayerTreeHost::adjustTransientZoom(double, WebCore::FloatPoint) { } inline void LayerTreeHost::commitTransientZoom(double, WebCore::FloatPoint) { } #endif -diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp -index 6d6e4f6..2a16fd3 100644 ---- a/Source/WebKit/WebProcess/WebProcess.cpp -+++ b/Source/WebKit/WebProcess/WebProcess.cpp -@@ -264,7 +264,7 @@ namespace WebKit { - using namespace JSC; - using namespace WebCore; - --#if !PLATFORM(GTK) && !PLATFORM(WPE) -+#if (!PLATFORM(GTK) && !PLATFORM(WPE)) || defined(__HAIKU__) - NO_RETURN static void callExit(IPC::Connection*) - { - #if OS(WINDOWS) -@@ -375,13 +375,13 @@ void WebProcess::initializeConnection(IPC::Connection* connection) - - // Do not call exit in background queue for GTK and WPE because we need to ensure - // atexit handlers are called in the main thread to cleanup resources like EGL displays. --#if !PLATFORM(GTK) && !PLATFORM(WPE) -+#if (!PLATFORM(GTK) && !PLATFORM(WPE)) || defined(__HAIKU__) - // We call _exit() directly from the background queue in case the main thread is unresponsive - // and AuxiliaryProcess::didClose() does not get called. - connection->setDidCloseOnConnectionWorkQueueCallback(callExit); - #endif - --#if !PLATFORM(GTK) && !PLATFORM(WPE) && !ENABLE(IPC_TESTING_API) -+#if (!PLATFORM(GTK) && !PLATFORM(WPE) && !ENABLE(IPC_TESTING_API)) || defined(__HAIKU__) - connection->setShouldExitOnSyncMessageSendFailure(true); - #endif - diff --git a/Source/cmake/WebKitCommon.cmake b/Source/cmake/WebKitCommon.cmake index cd78c8c..87cb5a5 100644 --- a/Source/cmake/WebKitCommon.cmake @@ -605,29 +535,6 @@ index 2605e1c..c01a1a0 100644 2.37.3 -From 5904e33007e48afce68eda900ca3af68f5ca5316 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Wed, 23 Nov 2022 17:50:41 +1000 -Subject: Remove fullpath for gcc - - -diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl b/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl -index d3c8a9b..2b16edc 100644 ---- a/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl -+++ b/Source/JavaScriptCore/inspector/scripts/codegen/preprocess.pl -@@ -43,7 +43,7 @@ if (!$preprocessor) { - $preprocessor = $ENV{CC} || "cl"; - push(@args, qw(/nologo /EP /TP /C)); - } else { -- $preprocessor = $ENV{CC} || (-x "/bin/clang" ? "/bin/clang" : "/bin/gcc"); -+ $preprocessor = $ENV{CC} || (-x "clang" ? "clang" : "gcc"); - push(@args, qw(-E -P -x c++ -C)); - } - } --- -2.37.3 - - From 15195b11b69b080ec88ffe2c0fae4f540920a41e Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Fri, 25 Nov 2022 17:49:09 +1000 @@ -820,3 +727,162 @@ index 47a6001..c10cfa0 100644 -- 2.37.3 + +From 758993fc64a16dbab32487bffe146915a9c08cb8 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Mon, 28 Nov 2022 15:49:52 +1000 +Subject: fix bmalloc for haiku + + +diff --git a/Source/bmalloc/bmalloc/AvailableMemory.cpp b/Source/bmalloc/bmalloc/AvailableMemory.cpp +index c89de56..c342e71 100644 +--- a/Source/bmalloc/bmalloc/AvailableMemory.cpp ++++ b/Source/bmalloc/bmalloc/AvailableMemory.cpp +@@ -47,6 +47,9 @@ + #if BOS(FREEBSD) || BOS(LINUX) + #include + #endif ++#if BOS(HAIKU) ++#include ++#endif + #if BOS(LINUX) + #include + #include +@@ -166,6 +169,11 @@ static size_t computeAvailableMemory() + if (!sysinfo(&info)) + return info.totalram * info.mem_unit; + return availableMemoryGuess; ++#elif BOS(HAIKU) ++ system_info info; ++ if (get_system_info(&info) != B_OK) ++ return availableMemoryGuess; ++ return info.max_pages * B_PAGE_SIZE; + #elif BOS(UNIX) + long pages = sysconf(_SC_PHYS_PAGES); + long pageSize = sysconf(_SC_PAGE_SIZE); +diff --git a/Source/bmalloc/bmalloc/BPlatform.h b/Source/bmalloc/bmalloc/BPlatform.h +index 0eae025..7000e28 100644 +--- a/Source/bmalloc/bmalloc/BPlatform.h ++++ b/Source/bmalloc/bmalloc/BPlatform.h +@@ -48,6 +48,10 @@ + #define BOS_LINUX 1 + #endif + ++#ifdef __HAIKU__ ++#define BOS_HAIKU 1 ++#endif ++ + #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) + #define BOS_FREEBSD 1 + #endif +diff --git a/Source/bmalloc/bmalloc/Scavenger.cpp b/Source/bmalloc/bmalloc/Scavenger.cpp +index 86dbb86..b2199d7 100644 +--- a/Source/bmalloc/bmalloc/Scavenger.cpp ++++ b/Source/bmalloc/bmalloc/Scavenger.cpp +@@ -44,6 +44,10 @@ + #include + #endif + ++#if BOS(HAIKU) ++#include ++#endif ++ + #if !BUSE(LIBPAS) + + namespace bmalloc { +@@ -363,6 +367,8 @@ void Scavenger::setThreadName(const char* name) + BUNUSED(name); + #if BOS(DARWIN) || BPLATFORM(PLAYSTATION) + pthread_setname_np(name); ++#elif BOS(HAIKU) ++ rename_thread(find_thread(NULL), name); + #elif BOS(LINUX) + // Truncate the given name since Linux limits the size of the thread name 16 including null terminator. + std::array buf; +diff --git a/Source/bmalloc/bmalloc/VMAllocate.h b/Source/bmalloc/bmalloc/VMAllocate.h +index de8e8b2..c14d19a 100644 +--- a/Source/bmalloc/bmalloc/VMAllocate.h ++++ b/Source/bmalloc/bmalloc/VMAllocate.h +@@ -39,13 +39,17 @@ + #include + #endif + ++#if BOS(HAIKU) ++#include ++#endif ++ + namespace bmalloc { + + #ifndef BMALLOC_VM_TAG + #define BMALLOC_VM_TAG VM_TAG_FOR_TCMALLOC_MEMORY + #endif + +-#if BOS(LINUX) ++#if BOS(LINUX) || BOS(HAIKU) + #define BMALLOC_NORESERVE MAP_NORESERVE + #else + #define BMALLOC_NORESERVE 0 +@@ -53,6 +57,9 @@ namespace bmalloc { + + inline size_t vmPageSize() + { ++#if BOS(HAIKU) ++ return B_PAGE_SIZE; ++#else + static size_t cached; + if (!cached) { + long pageSize = sysconf(_SC_PAGESIZE); +@@ -61,6 +68,7 @@ inline size_t vmPageSize() + cached = pageSize; + } + return cached; ++#endif + } + + inline size_t vmPageShift() +@@ -96,6 +104,8 @@ inline size_t vmPageSizePhysical() + { + #if BOS(DARWIN) && (BCPU(ARM64) || BCPU(ARM)) + return vm_kernel_page_size; ++#elif BOS(HAIKU) ++ return B_PAGE_SIZE; + #else + static size_t cached; + if (!cached) +-- +2.37.3 + + +From 0d0f84f09c8a0f23ec5d4cad4efc1c4bc58af1f8 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Tue, 29 Nov 2022 23:49:50 +1000 +Subject: Exit after stopping RunLoop + + +diff --git a/Source/WebKit/Shared/AuxiliaryProcess.cpp b/Source/WebKit/Shared/AuxiliaryProcess.cpp +index b7f04d4..a9c8ffc 100644 +--- a/Source/WebKit/Shared/AuxiliaryProcess.cpp ++++ b/Source/WebKit/Shared/AuxiliaryProcess.cpp +@@ -191,10 +191,18 @@ void AuxiliaryProcess::stopRunLoop() + platformStopRunLoop(); + } + +-#if !PLATFORM(COCOA) ++#if !PLATFORM(COCOA) && !OS(HAIKU) ++void AuxiliaryProcess::platformStopRunLoop() ++{ ++ RunLoop::main().stop(); ++} ++#endif ++ ++#if OS(HAIKU) + void AuxiliaryProcess::platformStopRunLoop() + { + RunLoop::main().stop(); ++ _exit(EXIT_SUCCESS); + } + #endif + +-- +2.37.3 + diff --git a/net-libs/webkit-gtk/webkit_gtk-2.38.2.recipe b/net-libs/webkit-gtk/webkit_gtk-2.38.2.recipe index a7cec5c76..a409657e7 100644 --- a/net-libs/webkit-gtk/webkit_gtk-2.38.2.recipe +++ b/net-libs/webkit-gtk/webkit_gtk-2.38.2.recipe @@ -12,7 +12,7 @@ COPYRIGHT="2009‒2022 The WebKitGTK Team" LICENSE="GNU LGPL v2 BSD (2-clause) " -REVISION="5" +REVISION="6" SOURCE_URI="https://www.webkitgtk.org/releases/webkitgtk-$portVersion.tar.xz" CHECKSUM_SHA256="f3eb82899651f583b4d99cacd16af784a1a7710fce9e7b6807bd6ccde909fe3e" SOURCE_DIR="webkitgtk-$portVersion" @@ -45,6 +45,7 @@ REQUIRES=" lib:libgcrypt$secondaryArchSuffix lib:libgdk_pixbuf_2.0$secondaryArchSuffix lib:libgio_2.0$secondaryArchSuffix + lib:libgirepository_1.0$secondaryArchSuffix lib:libGL$secondaryArchSuffix lib:libgcrypt$secondaryArchSuffix lib:libgobject_2.0$secondaryArchSuffix @@ -96,6 +97,7 @@ PROVIDES_devel=" " REQUIRES_devel=" webkit_gtk$secondaryArchSuffix == $portVersion base + devel:libgirepository_1.0$secondaryArchSuffix devel:libglib_2.0$secondaryArchSuffix devel:libgstapp_1.0$secondaryArchSuffix devel:libgtk_3$secondaryArchSuffix @@ -108,6 +110,7 @@ BUILD_REQUIRES=" haiku${secondaryArchSuffix}_devel gcc${secondaryArchSuffix}_syslibs gcc${secondaryArchSuffix}_syslibs_devel + harfbuzz${secondaryArchSuffix}_glib devel:libavif$secondaryArchSuffix devel:libbrotlidec$secondaryArchSuffix devel:libcrypto$secondaryArchSuffix @@ -117,6 +120,7 @@ BUILD_REQUIRES=" devel:libfreetype$secondaryArchSuffix devel:libgdk_3$secondaryArchSuffix devel:libgdk_pixbuf_2.0$secondaryArchSuffix + devel:libgirepository_1.0$secondaryArchSuffix devel:libGL$secondaryArchSuffix devel:libgcrypt$secondaryArchSuffix devel:libglib_2.0$secondaryArchSuffix @@ -131,6 +135,7 @@ BUILD_REQUIRES=" devel:libgstwebrtc_1.0$secondaryArchSuffix devel:libgtk_3$secondaryArchSuffix devel:libharfbuzz$secondaryArchSuffix + devel:libharfbuzz_gobject$secondaryArchSuffix devel:libhyphen$secondaryArchSuffix devel:libicuuc$secondaryArchSuffix devel:libintl$secondaryArchSuffix @@ -202,13 +207,14 @@ BUILD() -DENABLE_ACCESSIBILITY=OFF \ -DENABLE_API_TESTS=OFF \ -DENABLE_BUBBLEWRAP_SANDBOX=OFF \ - -DENABLE_EXPERIMENTAL_FEATURES=ON \ + -DENABLE_DOCUMENTATION=OFF \ + -DENABLE_EXPERIMENTAL_FEATURES=OFF \ -DENABLE_FTPDIR=ON \ -DENABLE_GAMEPAD=OFF \ -DENABLE_GEOLOCATION=ON \ -DENABLE_GLES2=OFF \ -DENABLE_GTKDOC=OFF \ - -DENABLE_INTROSPECTION=OFF \ + -DENABLE_INTROSPECTION=ON \ -DENABLE_JOURNALD_LOG=OFF \ -DENABLE_MEDIA_STREAM=ON \ -DENABLE_MEDIA_RECORDER=OFF \ @@ -220,6 +226,7 @@ BUILD() -DENABLE_SMOOTH_SCROLLING=OFF \ -DENABLE_SPELLCHECK=ON \ -DENABLE_UNIFIED_BUILDS=ON \ + -DENABLE_VARIATION_FONTS=OFF \ -DENABLE_VIDEO=ON \ -DENABLE_WEB_AUDIO=ON \ -DENABLE_WEBDRIVER=OFF \ @@ -242,7 +249,7 @@ BUILD() -DUSE_OPENGL=ON \ -DUSE_OPENJPEG=ON \ -DUSE_SOUP2=OFF \ - -DUSE_SYSTEM_MALLOC=ON \ + -DUSE_SYSTEM_MALLOC=OFF \ -DUSE_SYSTEMD=OFF \ -DUSE_WOFF2=ON \ -DUSE_WPE_RENDERER=OFF