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...
This commit is contained in:
Augustin Cavalier
2024-09-04 23:48:13 -04:00
parent cca5e34089
commit 0e476428ef
2 changed files with 62 additions and 4 deletions

View File

@@ -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"
}

View File

@@ -0,0 +1,50 @@
From ef2fbf5c3c1a980ee97abe34f37ad1df4b294cdc Mon Sep 17 00:00:00 2001
From: Augustin Cavalier <waddlesplash@gmail.com>
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 <epoxy/egl.h>
#else
+#if PLATFORM(HAIKU)
+#define EGL_NO_X11
+#endif
#include <EGL/egl.h>
#include <EGL/eglext.h>
#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 <wtf/Noncopyable.h>
#if !PLATFORM(GTK) && !PLATFORM(WPE)
+#if PLATFORM(HAIKU)
+#define EGL_NO_X11
+#endif
#include <EGL/eglplatform.h>
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