From 0e476428ef3d04743f2f413cee8e7aa2e70edfe7 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 4 Sep 2024 23:48:13 -0400 Subject: [PATCH] HaikuWebKit: Build with Clang. The build still fails with ASLR enabled, but with ASLR disabled Clang does manage to compile the one file that GCC gives an OOM on (JSDOMWindow.cpp). It needs 1.5GB of RAM to do so, so we're in dangerous territory either way... --- .../haikuwebkit/haikuwebkit-1.9.14.recipe | 16 ++++-- .../patches/haikuwebkit-1.9.14.patchset | 50 +++++++++++++++++++ 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 haiku-libs/haikuwebkit/patches/haikuwebkit-1.9.14.patchset diff --git a/haiku-libs/haikuwebkit/haikuwebkit-1.9.14.recipe b/haiku-libs/haikuwebkit/haikuwebkit-1.9.14.recipe index a437a391c..fcc9512af 100644 --- a/haiku-libs/haikuwebkit/haikuwebkit-1.9.14.recipe +++ b/haiku-libs/haikuwebkit/haikuwebkit-1.9.14.recipe @@ -11,9 +11,10 @@ LICENSE="GNU LGPL v2 MIT" REVISION="1" SOURCE_URI="https://github.com/haiku/haikuwebkit/archive/HaikuWebKit-$portVersion.tar.gz" +CHECKSUM_SHA256="ee0ea9a478f2b825430dc86c6c7586dc020f02ab8ec3ec9a2ddb4b427677da63" SOURCE_FILENAME="haikuwebkit-$portVersion.tar.gz" SOURCE_DIR="haikuwebkit-HaikuWebKit-$portVersion" -CHECKSUM_SHA256="ee0ea9a478f2b825430dc86c6c7586dc020f02ab8ec3ec9a2ddb4b427677da63" +PATCHES="haikuwebkit-$portVersion.patchset" ARCHITECTURES="all !x86_gcc2" SECONDARY_ARCHITECTURES="x86" @@ -63,7 +64,8 @@ REQUIRES_devel=" BUILD_REQUIRES=" haiku${secondaryArchSuffix}_devel - haiku_devel + gcc${secondaryArchSuffix}_syslibs + gcc${secondaryArchSuffix}_syslibs_devel devel:libavif$secondaryArchSuffix >= 16 devel:libcurl$secondaryArchSuffix devel:libexecinfo$secondaryArchSuffix @@ -85,13 +87,18 @@ BUILD_REQUIRES=" devel:libxslt$secondaryArchSuffix devel:libz$secondaryArchSuffix " + +# Note: llvm_ar is the command needed from llvm, not llvm_config, but only llvm_config +# has a version constraint in current llvm packages. BUILD_PREREQUIRES=" cmd:bison cmd:cmake >= 3.0.0 cmd:flex cmd:gcc$secondaryArchSuffix + cmd:clang >= 18 + cmd:clang++ >= 18 cmd:gperf - cmd:ld$secondaryArchSuffix + cmd:llvm_config >= 18 cmd:m4 cmd:make cmd:ninja @@ -106,7 +113,8 @@ BUILD() { export DISABLE_ASLR=1 export PKG_CONFIG_LIBDIR="`finddir B_SYSTEM_DIRECTORY`/$relativeDevelopLibDir/pkgconfig" - export CC=`which gcc` + export CC="/bin/clang" + export CXX="/bin/clang++" Tools/Scripts/build-webkit --haiku --no-webkit2 --no-fatal-warnings \ --cmakeargs="-DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_BUILD_TYPE=Release -DSHOULD_INSTALL_JS_SHELL=ON -DENABLE_UNIFIED_BUILDS=OFF" } diff --git a/haiku-libs/haikuwebkit/patches/haikuwebkit-1.9.14.patchset b/haiku-libs/haikuwebkit/patches/haikuwebkit-1.9.14.patchset new file mode 100644 index 000000000..0eba2f5a7 --- /dev/null +++ b/haiku-libs/haikuwebkit/patches/haikuwebkit-1.9.14.patchset @@ -0,0 +1,50 @@ +From ef2fbf5c3c1a980ee97abe34f37ad1df4b294cdc Mon Sep 17 00:00:00 2001 +From: Augustin Cavalier +Date: Wed, 4 Sep 2024 21:29:17 -0400 +Subject: Hacks to fix the build on Haiku with Clang. + + +diff --git a/Source/WebCore/platform/graphics/PlatformDisplay.cpp b/Source/WebCore/platform/graphics/PlatformDisplay.cpp +index 1b12e87..f4c1a8e 100644 +--- a/Source/WebCore/platform/graphics/PlatformDisplay.cpp ++++ b/Source/WebCore/platform/graphics/PlatformDisplay.cpp +@@ -83,6 +83,9 @@ + #if USE(LIBEPOXY) + #include + #else ++#if PLATFORM(HAIKU) ++#define EGL_NO_X11 ++#endif + #include + #include + #endif +diff --git a/Source/WebCore/platform/graphics/egl/GLContext.h b/Source/WebCore/platform/graphics/egl/GLContext.h +index 4485676..3a16aa6 100644 +--- a/Source/WebCore/platform/graphics/egl/GLContext.h ++++ b/Source/WebCore/platform/graphics/egl/GLContext.h +@@ -25,6 +25,9 @@ + #include + + #if !PLATFORM(GTK) && !PLATFORM(WPE) ++#if PLATFORM(HAIKU) ++#define EGL_NO_X11 ++#endif + #include + typedef EGLNativeWindowType GLNativeWindowType; + #else +diff --git a/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp b/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp +index 39c0353..caba9ba 100644 +--- a/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp ++++ b/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp +@@ -71,7 +71,7 @@ String MIMETypeRegistry::mimeTypeForExtension(const StringView ext) + // Try WebCore built-in types. + const ExtensionMap* extMap = extensionMap; + while (extMap->extension) { +- if (str == extMap->extension) ++ if (str == StringView::fromLatin1(extMap->extension)) + return String::fromUTF8(extMap->mimeType); + ++extMap; + } +-- +2.45.2 +