Skip to content

Instantly share code, notes, and snippets.

@aperezdc
Created March 13, 2023 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aperezdc/d2fbab6f4ace226efd72dfb398114c6c to your computer and use it in GitHub Desktop.
Save aperezdc/d2fbab6f4ace226efd72dfb398114c6c to your computer and use it in GitHub Desktop.
Patch to build meta-webkit with WPE WebKit 2.39.91 and Cog 0.17.1
# To be added in the local.conf file for a configured Yocto build
EXTRA_IMAGE_FEATURES += "debug-tweaks tools-profile"
INHIBIT_PACKAGE_STRIP = "1"
PREFERRED_VERSION_cog = "0.17.%"
PREFERRED_VERSION_wpewebkit = "2.39.%"
PACKAGECONFIG:pn-wpewebkit:append = " mediastream mediasource"
PACKAGECONFIG:pn-wpewebkit:remove = "experimental-features"
diff --git a/recipes-browser/cog/cog_0.17.1.bb b/recipes-browser/cog/cog_0.17.1.bb
new file mode 100644
index 0000000..2f1b547
--- /dev/null
+++ b/recipes-browser/cog/cog_0.17.1.bb
@@ -0,0 +1,12 @@
+require cog.inc
+require cog-meson.inc
+require conf/include/devupstream.inc
+
+SRC_URI[sha256sum] = "69e7d3b62c206210c3c436746d1241bfb99a1e789e6c4b7cb65dd9ae72459d42"
+PACKAGECONFIG[soup2] = ",,libsoup-2.4"
+
+# Required since https://github.com/Igalia/cog/commit/48dfac2ba637e223eeea1b289526d0f51e39ab88
+DEPENDS:append = " libxkbcommon"
+
+RDEPENDS:${PN} += "wpewebkit (>= 2.36)"
+
diff --git a/recipes-browser/wpewebkit/wpewebkit/0002-Fix-build-error-with-MEDIA_STREAM-OFF.patch b/recipes-browser/wpewebkit/wpewebkit/0002-Fix-build-error-with-MEDIA_STREAM-OFF.patch
new file mode 100644
index 0000000..3c59e8f
--- /dev/null
+++ b/recipes-browser/wpewebkit/wpewebkit/0002-Fix-build-error-with-MEDIA_STREAM-OFF.patch
@@ -0,0 +1,40 @@
+From f86d288403eec12b32eff1ff5a34d785bbd0969b Mon Sep 17 00:00:00 2001
+From: Pablo Saavedra <psaavedra@igalia.com>
+Date: Sat, 25 Feb 2023 15:10:57 -0800
+Subject: [PATCH] Fix build error with MEDIA_STREAM=OFF
+ https://bugs.webkit.org/show_bug.cgi?id=252892
+
+Reviewed by Philippe Normand.
+
+* Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
+(WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
+
+Canonical link: https://commits.webkit.org/260843@main
+---
+ .../platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp b/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp
+index 0e0083449a4a..98ffc6eda1f0 100644
+--- a/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp
++++ b/Source/WebCore/platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp
+@@ -178,7 +178,9 @@ AudioSourceProviderGStreamer::AudioSourceProviderGStreamer(MediaStreamTrackPriva
+
+ AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer()
+ {
++#if ENABLE(MEDIA_STREAM)
+ GST_DEBUG_OBJECT(m_pipeline.get(), "Disposing");
++#endif
+ m_notifier->invalidate();
+
+ auto deinterleave = adoptGRef(gst_bin_get_by_name(GST_BIN_CAST(m_audioSinkBin.get()), "deinterleave"));
+@@ -192,8 +194,8 @@ AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer()
+ #if ENABLE(MEDIA_STREAM)
+ if (m_pipeline)
+ gst_element_set_state(m_pipeline.get(), GST_STATE_NULL);
+-#endif
+ GST_DEBUG_OBJECT(m_pipeline.get(), "Disposing DONE");
++#endif
+ }
+
+ void AudioSourceProviderGStreamer::configureAudioBin(GstElement* audioBin, GstElement* audioSink)
diff --git a/recipes-browser/wpewebkit/wpewebkit/0003-jsc-linker-missing-inline.patch b/recipes-browser/wpewebkit/wpewebkit/0003-jsc-linker-missing-inline.patch
new file mode 100644
index 0000000..9b133c3
--- /dev/null
+++ b/recipes-browser/wpewebkit/wpewebkit/0003-jsc-linker-missing-inline.patch
@@ -0,0 +1,123 @@
+diff --git a/Source/JavaScriptCore/tools/JSDollarVM.cpp b/Source/JavaScriptCore/tools/JSDollarVM.cpp
+index 12ee0b7f5232..da9c41289f53 100644
+--- a/Source/JavaScriptCore/tools/JSDollarVM.cpp
++++ b/Source/JavaScriptCore/tools/JSDollarVM.cpp
+@@ -34,6 +34,7 @@
+ #include "DOMAttributeGetterSetter.h"
+ #include "DOMJITGetterSetter.h"
+ #include "Debugger.h"
++#include "ExecutableBaseInlines.h"
+ #include "FrameTracers.h"
+ #include "FunctionCodeBlock.h"
+ #include "GetterSetter.h"
+diff --git a/Source/WebCore/animation/KeyframeEffect.cpp b/Source/WebCore/animation/KeyframeEffect.cpp
+index d3390f582088..6970ea7e4667 100644
+--- a/Source/WebCore/animation/KeyframeEffect.cpp
++++ b/Source/WebCore/animation/KeyframeEffect.cpp
+@@ -39,6 +39,7 @@
+ #include "CSSValue.h"
+ #include "CSSValueKeywords.h"
+ #include "ComputedStyleExtractor.h"
++#include "DocumentInlines.h"
+ #include "Element.h"
+ #include "FontCascade.h"
+ #include "FrameView.h"
+diff --git a/Source/WebCore/bindings/js/DOMGCOutputConstraint.cpp b/Source/WebCore/bindings/js/DOMGCOutputConstraint.cpp
+index ac2791095f26..3f796ce7c994 100644
+--- a/Source/WebCore/bindings/js/DOMGCOutputConstraint.cpp
++++ b/Source/WebCore/bindings/js/DOMGCOutputConstraint.cpp
+@@ -29,6 +29,7 @@
+ #include "WebCoreJSClientData.h"
+ #include <JavaScriptCore/BlockDirectoryInlines.h>
+ #include <JavaScriptCore/HeapInlines.h>
++#include <JavaScriptCore/JSCellInlines.h>
+ #include <JavaScriptCore/MarkedBlockInlines.h>
+ #include <JavaScriptCore/SlotVisitorInlines.h>
+ #include <JavaScriptCore/SubspaceInlines.h>
+diff --git a/Source/WebCore/bindings/js/JSPaintRenderingContext2DCustom.cpp b/Source/WebCore/bindings/js/JSPaintRenderingContext2DCustom.cpp
+index f31e7582e999..b0a1094dbc1b 100644
+--- a/Source/WebCore/bindings/js/JSPaintRenderingContext2DCustom.cpp
++++ b/Source/WebCore/bindings/js/JSPaintRenderingContext2DCustom.cpp
+@@ -29,7 +29,8 @@
+ #if ENABLE(CSS_PAINTING_API)
+
+ #include "WebCoreOpaqueRoot.h"
+-#include "WebCoreOpaqueRoot.h"
++#include <JavaScriptCore/AbstractSlotVisitorInlines.h>
++#include <JavaScriptCore/JSCJSValueInlines.h>
+
+ namespace WebCore {
+ using namespace JSC;
+diff --git a/Source/WebCore/bindings/js/JSWorkerNavigatorCustom.cpp b/Source/WebCore/bindings/js/JSWorkerNavigatorCustom.cpp
+index f737e296d194..e244a1d46746 100644
+--- a/Source/WebCore/bindings/js/JSWorkerNavigatorCustom.cpp
++++ b/Source/WebCore/bindings/js/JSWorkerNavigatorCustom.cpp
+@@ -27,7 +27,7 @@
+ #include "JSWorkerNavigator.h"
+
+ #include "WebCoreOpaqueRoot.h"
+-#include "WebCoreOpaqueRoot.h"
++#include <JavaScriptCore/AbstractSlotVisitorInlines.h>
+
+ namespace WebCore {
+
+diff --git a/Source/WebCore/css/parser/CSSPropertyParser.cpp b/Source/WebCore/css/parser/CSSPropertyParser.cpp
+index 4ccc5940d72a..97624988a9fa 100644
+--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp
++++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp
+@@ -46,6 +46,7 @@
+ #include "CSSPendingSubstitutionValue.h"
+ #include "CSSPrimitiveValueMappings.h"
+ #include "CSSPropertyParsing.h"
++#include "CSSQuadValue.h"
+ #include "CSSTokenizer.h"
+ #include "CSSTransformListValue.h"
+ #include "CSSValuePair.h"
+diff --git a/Source/WebCore/html/ValidatedFormListedElement.cpp b/Source/WebCore/html/ValidatedFormListedElement.cpp
+index 3c718a371405..d3370d03bb60 100644
+--- a/Source/WebCore/html/ValidatedFormListedElement.cpp
++++ b/Source/WebCore/html/ValidatedFormListedElement.cpp
+@@ -45,6 +45,7 @@
+ #include "HTMLLegendElement.h"
+ #include "HTMLParserIdioms.h"
+ #include "PseudoClassChangeInvalidation.h"
++#include "RenderElement.h"
+ #include "ScriptDisallowedScope.h"
+ #include "ValidationMessage.h"
+ #include <wtf/Ref.h>
+diff --git a/Source/WebCore/loader/LinkLoader.cpp b/Source/WebCore/loader/LinkLoader.cpp
+index 28e80e704ba4..c67155db20f9 100644
+--- a/Source/WebCore/loader/LinkLoader.cpp
++++ b/Source/WebCore/loader/LinkLoader.cpp
+@@ -57,6 +57,7 @@
+ #include "MediaQueryParser.h"
+ #include "NodeRenderStyle.h"
+ #include "PlatformStrategies.h"
++#include "RenderElement.h"
+ #include "ResourceError.h"
+ #include "Settings.h"
+ #include "SizesAttributeParser.h"
+diff --git a/Source/WebCore/page/WindowOrWorkerGlobalScope.cpp b/Source/WebCore/page/WindowOrWorkerGlobalScope.cpp
+index c4eb5b120908..65d616959d3b 100644
+--- a/Source/WebCore/page/WindowOrWorkerGlobalScope.cpp
++++ b/Source/WebCore/page/WindowOrWorkerGlobalScope.cpp
+@@ -32,6 +32,7 @@
+ #include "MessagePort.h"
+ #include "SerializedScriptValue.h"
+ #include "StructuredSerializeOptions.h"
++#include <JavaScriptCore/JSCJSValueInlines.h>
+
+ namespace WebCore {
+
+diff --git a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
+index 78b72c5835d7..2c3190eeba00 100644
+--- a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
++++ b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
+@@ -32,6 +32,7 @@
+ #include "WebImage.h"
+ #include <WebCore/BitmapImage.h>
+ #include <WebCore/Document.h>
++#include <WebCore/Element.h>
+ #include <WebCore/Frame.h>
+ #include <WebCore/FrameDestructionObserverInlines.h>
+ #include <WebCore/FrameLoader.h>
diff --git a/recipes-browser/wpewebkit/wpewebkit_2.39.91.bb b/recipes-browser/wpewebkit/wpewebkit_2.39.91.bb
new file mode 100644
index 0000000..c936245
--- /dev/null
+++ b/recipes-browser/wpewebkit/wpewebkit_2.39.91.bb
@@ -0,0 +1,44 @@
+require wpewebkit.inc
+require conf/include/devupstream.inc
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI = "https://wpewebkit.org/releases/${BPN}-${PV}.tar.xz;name=tarball \
+ file://0001-FELightningNEON.cpp-fails-to-build-NEON-fast-path-se.patch \
+ file://0002-Fix-build-error-with-MEDIA_STREAM-OFF.patch \
+ file://0003-jsc-linker-missing-inline.patch \
+ "
+
+SRC_URI[tarball.sha256sum] = "1dab45e12697157d7970469620ce706fe3fc01daed4a4674b7a61dad1ee64259"
+
+DEPENDS += " libwpe unifdef-native"
+RCONFLICTS:${PN} = "libwpe (< 1.12)"
+
+SRC_URI:class-devupstream = "\
+ git://github.com/WebKit/WebKit.git;protocol=https;branch=main \
+"
+
+# Speech synthesis needs flite, which is not available.
+EXTRA_OECMAKE:append = " -DENABLE_SPEECH_SYNTHESIS=OFF"
+
+# Experimental, and the build is broken with it enabled.
+EXTRA_OECMAKE:append = " -DENABLE_WEB_CODECS=OFF"
+
+# WPE 2.40.X branch was forked from the main branch in this commit
+SRCREV:class-devupstream = "5b60400f474f318e45cd713638e365366b98dd87"
+
+# documentation: Needed from 2.38
+PACKAGECONFIG[documentation] = "-DENABLE_DOCUMENTATION=ON,-DENABLE_DOCUMENTATION=OFF, gi-docgen-native gi-docgen"
+
+# introspection: Needed from 2.38
+PACKAGECONFIG[introspection] = "-DENABLE_INTROSPECTION=ON,-DENABLE_INTROSPECTION=OFF, gobject-introspection-native"
+
+# webgl2: Activated by default from >2.38
+PACKAGECONFIG:append:class-devupstream = " webgl2"
+
+# TODO: documentation and introspection are disabled by default because the are
+# causing cross-compiling build errors
+# PACKAGECONFIG:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'documentation', '' ,d)} introspection"
+
+# Layer-Based SVG Engine
+PACKAGECONFIG[lbse] = "-DENABLE_LAYER_BASED_SVG_ENGINE=ON,-DENABLE_LAYER_BASED_SVG_ENGINE=OFF, "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment