add WPE WebKit packages
authorDaniel Golle <daniel@makrotopia.org>
Tue, 12 Nov 2024 02:23:26 +0000 (03:23 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 5 Dec 2024 01:27:37 +0000 (01:27 +0000)
Add WPE WebKit HTML5 application runtime.
 * libwpe: backend abstraction (Wayland or KMS/DRM)
 * wpebackend-fdo: FreeDesktop Linux backend for WPE
 * wpewebkit: official WebKit port
 * cog: simple browser canvas application (best used with 'cage')

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libs/cog/Makefile [new file with mode: 0644]
libs/libwpe/Makefile [new file with mode: 0644]
libs/wpebackend-fdo/Makefile [new file with mode: 0644]
libs/wpewebkit/Makefile [new file with mode: 0644]
libs/wpewebkit/patches/100-fix-compile-with-ICU76.patch [new file with mode: 0644]
libs/wpewebkit/patches/110-fix-gstreamer-id-tracking.patch [new file with mode: 0644]

diff --git a/libs/cog/Makefile b/libs/cog/Makefile
new file mode 100644 (file)
index 0000000..a0bca94
--- /dev/null
@@ -0,0 +1,76 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=cog
+PKG_VERSION:=0.18.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://wpewebkit.org/releases
+PKG_HASH:=31d7079db2eeed790899d2f1f824dd6a54bf30d072d196d737be572f105d99b1
+
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+PKG_LICENSE:=BSD-2-clause
+PKG_LICENSE_FILES:=COPYING
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/meson.mk
+
+define Package/cog
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=launcher for WPE WebKit
+  URL:=https://wpewebkit.org/
+  DEPENDS:=+libcogcore
+  USERID:=cog:video=40
+endef
+
+define Package/cog/description/default
+Cog is a small single "window" launcher for the WebKit WPE port.
+It is small, provides no user interface, and is suitable to be used as a Web
+application container. The "window" may be fullscreen depending on the WPE
+backend being used.
+endef
+
+define Package/libcogcore
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=WPE WebKit API library
+  URL:=https://wpewebkit.org/
+  DEPENDS:=+libdbus +libmanette +libwpewebkit +wpebackend-fdo
+endef
+
+define Package/libcogcore/description/default
+libcogcore is a library with ready-to-use components typically needed
+for implementing applications which use the WPE WebKit API.
+endef
+
+MESON_ARGS += \
+       -Dcog_dbus_control=system \
+       -Dcog_dbus_system_owner=cog \
+       -Ddocumentation=false \
+       -Dmanpages=false
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/cog
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/cog/*.h $(1)/usr/include/cog
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
+endef
+
+define Package/libcogcore/install
+       $(INSTALL_DIR) $(1)/usr/lib/cog/modules
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/cog/modules/* $(1)/usr/lib/cog/modules
+endef
+
+define Package/cog/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/share/dbus-1/system.d
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/dbus-1/system.d/com.igalia.Cog.conf $(1)/usr/share/dbus-1/system.d
+endef
+
+$(eval $(call BuildPackage,libcogcore))
+$(eval $(call BuildPackage,cog))
diff --git a/libs/libwpe/Makefile b/libs/libwpe/Makefile
new file mode 100644 (file)
index 0000000..d6c8787
--- /dev/null
@@ -0,0 +1,53 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libwpe
+PKG_VERSION:=1.16.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://wpewebkit.org/releases
+PKG_HASH:=c7f3a3c6b3d006790d486dc7cceda2b6d2e329de07f33bc47dfc53f00f334b2a
+
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+PKG_LICENSE:=BSD-2-clause
+PKG_LICENSE_FILES:=COPYING
+
+PKG_BUILD_DEPENDS:=mesa
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/meson.mk
+
+define Package/libwpe
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=WPE backend abstraction library
+  URL:=https://wpewebkit.org/
+  DEPENDS:=+libstdcpp +libxkbcommon
+endef
+
+define Package/libwpe/description
+ An Open Source WebKit port for Linux-based embedded devices designed
+ with flexibility and hardware acceleration in mind, leveraging common 3D
+ graphics APIs for best performance.
+endef
+
+MESON_ARGS += \
+       -Denable-xkb=true \
+       -Dbuild-docs=false \
+       -Ddefault_library=shared
+
+define Package/libwpe/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/wpe-1.0/wpe
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/wpe-1.0/wpe/*.h $(1)/usr/include/wpe-1.0/wpe
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
+endef
+
+$(eval $(call BuildPackage,libwpe))
diff --git a/libs/wpebackend-fdo/Makefile b/libs/wpebackend-fdo/Makefile
new file mode 100644 (file)
index 0000000..a4e7fd2
--- /dev/null
@@ -0,0 +1,51 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=wpebackend-fdo
+PKG_VERSION:=1.14.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://wpewebkit.org/releases
+PKG_HASH:=10121842595a850291db3e82f3db0b9984df079022d386ce42c2b8508159dc6c
+
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+PKG_LICENSE:=BSD-2-clause
+PKG_LICENSE_FILES:=COPYING
+
+PKG_BUILD_DEPENDS:=mesa
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/meson.mk
+
+define Package/wpebackend-fdo
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=WPE's backend based on a freedesktop.org stack
+  URL:=https://wpewebkit.org/
+  DEPENDS:=+glib2 +libepoxy +libstdcpp +libwayland +libwpe
+endef
+
+define Package/wpebackend-fdo/description
+ An Open Source WebKit port for Linux-based embedded devices designed
+ with flexibility and hardware acceleration in mind, leveraging common 3D
+ graphics APIs for best performance.
+endef
+
+MESON_ARGS += \
+       -Dbuild_docs=false
+
+define Package/wpebackend-fdo/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/wpe-fdo-1.0/wpe
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/wpe-fdo-1.0/wpe/* $(1)/usr/include/wpe-fdo-1.0/wpe
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
+endef
+
+$(eval $(call BuildPackage,wpebackend-fdo))
diff --git a/libs/wpewebkit/Makefile b/libs/wpewebkit/Makefile
new file mode 100644 (file)
index 0000000..d544bc8
--- /dev/null
@@ -0,0 +1,162 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=wpewebkit
+PKG_VERSION:=2.46.4
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://wpewebkit.org/releases
+PKG_HASH:=a22f6acf5574f9415f5007c6e79c5f8527363d1ae1dbd8d786e67a935ef56d8b
+
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+PKG_LICENSE:=LGPL-2.1-or-later BSD-2-Clause
+PKG_LICENSE_FILES:=Source/WebCore/LICENSE-Apple Source/Webcore/LICENSE-LGPL-2.1
+
+PKG_BUILD_DEPENDS:=unifdef/host ruby/host
+CMAKE_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_BINARY_SUBDIR:=openwrt-build
+
+CMAKE_OPTIONS += \
+       -DBWRAP_EXECUTABLE=/usr/bin/bwrap \
+       -DDBUS_PROXY_EXECUTABLE=/usr/bin/xdg-dbus-proxy \
+       -DGLIB_COMPILE_RESOURCES_EXECUTABLE="$(STAGING_DIR_HOSTPKG)/bin/glib-compile-resources" \
+       -DENABLE_ACCESSIBILITY=OFF \
+       -DENABLE_API_TESTS=OFF \
+       -DENABLE_BUBBLEWRAP_SANDBOX=ON \
+       -DENABLE_INTROSPECTION=OFF \
+       -DENABLE_DOCUMENTATION=OFF \
+       -DENABLE_WEB_CRYPTO=ON \
+       -DENABLE_JOURNALD_LOG=OFF \
+       -DENABLE_MINIBROWSER=$(if $(CONFIG_PACKAGE_wpewebkit-minibrowser),ON,OFF) \
+       -DENABLE_WPE_PLATFORM=ON \
+       -DENABLE_WPE_PLATFORM_WAYLAND=ON \
+       -DENABLE_WPE_PLATFORM_DRM=ON \
+       -DENABLE_SPELLCHECK=OFF \
+       -DENABLE_SPEECH_SYNTHESIS=OFF \
+       -DENABLE_TOUCH_EVENTS=ON \
+       -DENABLE_JIT=ON \
+       -DENABLE_C_LOOP=OFF \
+       -DENABLE_WEBGL=ON \
+       -DENABLE_VIDEO=ON \
+       -DPORT=WPE \
+       -DUSE_ATK=OFF \
+       -DUSE_LIBBACKTRACE=OFF \
+       -DUSE_LIBHYPHEN=OFF \
+       -DUSE_LIBSECRET=OFF \
+       -DUSE_SOUP2=OFF \
+       -DUSE_JPEGXL=OFF \
+       -DUSE_WOFF2=OFF \
+       -DUSE_AVIF=OFF \
+       -DUSE_LCMS=OFF \
+       -DUSE_SYSTEM_SYSPROF_CAPTURE=OFF
+
+define Package/libwpewebkit
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=WPEWebKit Library
+  URL:=https://wpewebkit.org
+  DEPENDS:=+bubblewrap +glib2 +gst1-mod-opengl +harfbuzz +icu-full-data \
+          +libepoxy +libgcrypt +libgst1allocators +libgst1app +libgst1audio \
+          +libgst1fft +libgst1gl +libgst1pbutils +libgst1tag \
+          +libgst1transcoder +libgst1video +libinput +libjpeg +libpng \
+          +libseccomp +libsoup3 +libsqlite3 +libtasn1 +libudev +libwayland \
+          +libwebp +libwpe +libxml2 +libxslt +zlib
+endef
+
+define Package/libwpewebkit/description
+ WebKitGTK is a full-featured port of the WebKit rendering engine,
+ suitable for projects requiring any kind of web integration, from
+ hybrid HTML/CSS applications to full-fledged web browsers.
+endef
+
+define Package/wpewebkit-driver
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=WebDriver service implementation for WPE WebKit
+  URL:=https://wpewebkit.org
+  DEPENDS:=+libwpewebkit
+endef
+
+define Package/wpewebkit-driver/description
+ WebDriver is an automation API to control a web browser. It allows the
+ user to create automated tests for web applications independently of the
+ browser and platform.
+
+ The WebKitWebDriver binary provides the WebDriver service implementation
+ for WebKitGTK. It works as a server, processing client requests to spawn
+ and control the web browser. This driver is not tied to any specific
+ browser and can be used with any WebKitGTK-based browser, but it uses
+ MiniBrowser as the default.
+endef
+
+define Package/wpewebkit-minibrowser
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=WPE WebKit Mini Browser
+  URL:=https://wpewebkit.org/
+  DEPENDS:=+libwpewebkit +wpebackend-fdo
+endef
+
+define Package/wpewebkit-minibrowser/description
+ Minimalistic Web browser based on WPE WebKit.
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/wpe-webkit-2.0/jsc \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/drm \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/headless \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/wayland \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe-platform/wpe \
+                      $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/wpe-webkit-2.0/jsc/*.h \
+                      $(1)/usr/include/wpe-webkit-2.0/jsc
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/wpe-webkit-2.0/wpe/*.h \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/*.h \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe-platform/wpe
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/drm/*.h \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/drm
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/headless/*.h \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/headless
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/wayland/*.h \
+                      $(1)/usr/include/wpe-webkit-2.0/wpe-platform/wpe/wayland
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+                      $(1)/usr/lib/pkgconfig
+endef
+
+define Package/libwpewebkit/install
+       $(INSTALL_DIR) $(1)/usr/lib/wpe-webkit-2.0/injected-bundle
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/wpe-webkit-2.0/injected-bundle/*.so \
+               $(1)/usr/lib/wpe-webkit-2.0/injected-bundle
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/wpe-webkit-2.0/*.so \
+                      $(1)/usr/lib/wpe-webkit-2.0
+       $(INSTALL_DIR) $(1)/usr/libexec/wpe-webkit-2.0
+#      $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/wpe-webkit-2.0/WPEGPUProcess \
+#              $(1)/usr/libexec/wpe-webkit-2.0
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/wpe-webkit-2.0/WPENetworkProcess \
+               $(1)/usr/libexec/wpe-webkit-2.0
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/wpe-webkit-2.0/WPEWebProcess \
+               $(1)/usr/libexec/wpe-webkit-2.0
+endef
+
+define Package/wpewebkit-driver/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/WPEWebDriver $(1)/usr/bin
+endef
+
+define Package/wpewebkit-minibrowser/install
+       $(INSTALL_DIR) $(1)/usr/libexec/wpe-webkit-2.0
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/libexec/wpe-webkit-2.0/MiniBrowser \
+               $(1)/usr/libexec/wpe-webkit-2.0
+endef
+
+$(eval $(call BuildPackage,libwpewebkit))
+$(eval $(call BuildPackage,wpewebkit-driver))
+$(eval $(call BuildPackage,wpewebkit-minibrowser))
diff --git a/libs/wpewebkit/patches/100-fix-compile-with-ICU76.patch b/libs/wpewebkit/patches/100-fix-compile-with-ICU76.patch
new file mode 100644 (file)
index 0000000..0facd94
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/Source/WTF/wtf/Platform.h
++++ b/Source/WTF/wtf/Platform.h
+@@ -114,7 +114,6 @@
+ /* FIXME: This does not belong in Platform.h and should instead be included in another mechanism (compiler option, prefix header, config.h, etc) */
+ /* ICU configuration. Some of these match ICU defaults on some platforms, but we would like them consistently set everywhere we build WebKit. */
+ #define U_HIDE_DEPRECATED_API 1
+-#define U_SHOW_CPLUSPLUS_API 0
+ #ifdef __cplusplus
+ #define UCHAR_TYPE char16_t
+ #endif
diff --git a/libs/wpewebkit/patches/110-fix-gstreamer-id-tracking.patch b/libs/wpewebkit/patches/110-fix-gstreamer-id-tracking.patch
new file mode 100644 (file)
index 0000000..fb4bfe9
--- /dev/null
@@ -0,0 +1,47 @@
+--- a/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp
++++ b/Source/WebCore/platform/graphics/gstreamer/mse/MediaSourcePrivateGStreamer.cpp
+@@ -170,6 +170,7 @@ void MediaSourcePrivateGStreamer::startP
+     m_playerPrivate.startSource(tracks);
+ }
++#if !RELEASE_LOG_DISABLED
+ TrackID MediaSourcePrivateGStreamer::registerTrackId(TrackID preferredId)
+ {
+     ASSERT(isMainThread());
+@@ -203,6 +204,7 @@ bool MediaSourcePrivateGStreamer::unregi
+     return res;
+ }
++#endif
+ void MediaSourcePrivateGStreamer::notifyActiveSourceBuffersChanged()
+ {
+--- a/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp
++++ b/Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp
+@@ -270,6 +270,7 @@ WTFLogChannel& SourceBufferPrivateGStrea
+ }
+ #endif
++#if !RELEASE_LOG_DISABLED
+ std::optional<TrackID> SourceBufferPrivateGStreamer::tryRegisterTrackId(TrackID preferredId)
+ {
+     ASSERT(isMainThread());
+@@ -291,6 +292,18 @@ bool SourceBufferPrivateGStreamer::tryUn
+     return downcast<MediaSourcePrivateGStreamer>(mediaSource)->unregisterTrackId(trackId);
+ }
++#else
++std::optional<TrackID> SourceBufferPrivateGStreamer::tryRegisterTrackId(TrackID preferredId)
++{
++    return std::nullopt;
++}
++
++bool SourceBufferPrivateGStreamer::tryUnregisterTrackId(TrackID trackId)
++{
++    return false;
++}
++#endif
++
+ size_t SourceBufferPrivateGStreamer::platformMaximumBufferSize() const
+ {