Migrate the WPE port from the legacy libwpe-based stack to the WPE
Platform API that is now built into wpewebkit itself.

wpewebkit.make:
- ENABLE_WPE_LEGACY_API=OFF, ENABLE_WPE_PLATFORM=ON: stop building the
  old libwpe API and use the in-tree WPE Platform implementation
- Drive ENABLE_WPE_PLATFORM_WAYLAND and ENABLE_WPE_PLATFORM_DRM from the
  new backend choice instead of hardcoding them OFF
- Add ENABLE_MINIBROWSER driven by PTXCONF_WPEWEBKIT_MINIBROWSER

wpewebkit.in:
- Add a "WPE platform backend" choice between Wayland (default) and
  DRM/KMS, pulling in the matching dependencies (wayland/wayland-protocols
  for Wayland; libinput/udev for DRM)
- Add MESALIB_GBM and the conditional MESALIB_EGL_WAYLAND
- Add WPEWEBKIT_MINIBROWSER option: a WPE Platform based launcher that
  can be used instead of cog
- Drop the LIBWPE and WPEBACKEND_FDO selects

Remove the now-unused packages, which only served the legacy API:
- libwpe
- wpebackend-fdo
- cog (its only platform backend was wpebackend-fdo)

Add patch 0003 to fix a double-definition build error: the no-op
gamepad provider stubs in UIGamepadProvider.cpp are guarded with the
never-defined USE(WPE_PLATFORM) instead of ENABLE(WPE_PLATFORM), so in
WPE-Platform-only builds (no libwpe, no libmanette) they are compiled
alongside the real implementation. Backported from upstream.

Signed-off-by: Artur Wiebe <[email protected]>
---
 ...guard-stubs-with-ENABLE-WPE_PLATFORM.patch | 55 ++++++++++++
 patches/wpewebkit-2.52.4/series               |  1 +
 rules/cog.in                                  | 24 ------
 rules/cog.make                                | 83 -------------------
 rules/libwpe.in                               | 11 ---
 rules/libwpe.make                             | 61 --------------
 rules/wpebackend-fdo.in                       | 17 ----
 rules/wpebackend-fdo.make                     | 68 ---------------
 rules/wpewebkit.in                            | 37 ++++++++-
 rules/wpewebkit.make                          |  9 +-
 10 files changed, 96 insertions(+), 270 deletions(-)
 create mode 100644 
patches/wpewebkit-2.52.4/0003-UIGamepadProvider-guard-stubs-with-ENABLE-WPE_PLATFORM.patch
 delete mode 100644 rules/cog.in
 delete mode 100644 rules/cog.make
 delete mode 100644 rules/libwpe.in
 delete mode 100644 rules/libwpe.make
 delete mode 100644 rules/wpebackend-fdo.in
 delete mode 100644 rules/wpebackend-fdo.make

diff --git 
a/patches/wpewebkit-2.52.4/0003-UIGamepadProvider-guard-stubs-with-ENABLE-WPE_PLATFORM.patch
 
b/patches/wpewebkit-2.52.4/0003-UIGamepadProvider-guard-stubs-with-ENABLE-WPE_PLATFORM.patch
new file mode 100644
index 000000000..cd84a1596
--- /dev/null
+++ 
b/patches/wpewebkit-2.52.4/0003-UIGamepadProvider-guard-stubs-with-ENABLE-WPE_PLATFORM.patch
@@ -0,0 +1,55 @@
+From: Artur Wiebe <[email protected]>
+Subject: [PATCH] UIGamepadProvider: guard fallback stubs with 
ENABLE(WPE_PLATFORM)
+
+The generic no-op implementations of platformSetDefaultGamepadProvider(),
+platformWebPageProxyForGamepadInput(), platformStopMonitoringInput() and
+platformStartMonitoringInput() in UIGamepadProvider.cpp are guarded with
+!USE(WPE_PLATFORM). That macro is never defined anywhere: the build system
+exposes ENABLE_WPE_PLATFORM (i.e. ENABLE(WPE_PLATFORM)), and every other
+gamepad source file uses ENABLE(WPE_PLATFORM) accordingly. USE(WPE_PLATFORM)
+therefore always evaluates to 0.
+
+The real implementations live in UIProcess/Gamepad/libwpe/
+UIGamepadProviderLibWPE.cpp, which is compiled unconditionally for the WPE
+port (guarded only by ENABLE(GAMEPAD)) and dispatches to either the WPE
+Platform or the legacy libwpe provider.
+
+When building the WPE port with ENABLE_WPE_PLATFORM=ON but without the legacy
+libwpe API (USE_LIBWPE=OFF) and without libmanette (USE_MANETTE=OFF), the
+guard stays true and the fallback stubs are compiled in addition to the real
+implementations, causing "redefinition of ..." errors at link/compile time of
+the unified sources.
+
+Fix the guard to use ENABLE(WPE_PLATFORM) to match the rest of the codebase,
+so the stubs are excluded whenever the WPE Platform implementation is present.
+
+This is the same fix applied upstream; drop this patch once it reaches a
+released 2.52.x tarball.
+
+Upstream-Bug: https://bugs.webkit.org/show_bug.cgi?id=317834
+Upstream-Commit: 0cab62d "[WPE] platformSetDefaultGamepadProvider is defined 
twice in WPEPlatform-only builds"
+
+---
+ Source/WebKit/UIProcess/Gamepad/UIGamepadProvider.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/Source/WebKit/UIProcess/Gamepad/UIGamepadProvider.cpp
++++ b/Source/WebKit/UIProcess/Gamepad/UIGamepadProvider.cpp
+@@ -250,7 +250,7 @@
+     });
+ }
+
+-#if !PLATFORM(COCOA) && !(USE(MANETTE) && OS(LINUX)) && !USE(LIBWPE) && 
!USE(WPE_PLATFORM)
++#if !PLATFORM(COCOA) && !(USE(MANETTE) && OS(LINUX)) && !USE(LIBWPE) && 
!ENABLE(WPE_PLATFORM)
+
+ void UIGamepadProvider::platformSetDefaultGamepadProvider()
+ {
+@@ -271,7 +271,7 @@
+ {
+ }
+
+-#endif // !PLATFORM(COCOA) && !(USE(MANETTE) && OS(LINUX)) && !USE(LIBWPE) && 
!USE(WPE_PLATFORM)
++#endif // !PLATFORM(COCOA) && !(USE(MANETTE) && OS(LINUX)) && !USE(LIBWPE) && 
!ENABLE(WPE_PLATFORM)
+
+ }
+
diff --git a/patches/wpewebkit-2.52.4/series b/patches/wpewebkit-2.52.4/series
index 444f4f1b2..7705f23cb 100644
--- a/patches/wpewebkit-2.52.4/series
+++ b/patches/wpewebkit-2.52.4/series
@@ -1 +1,2 @@
 0002-PlatformWPE-link-GLib-GioUnix-to-propagate-gio-unix-2.0-includes.patch
+0003-UIGamepadProvider-guard-stubs-with-ENABLE-WPE_PLATFORM.patch
diff --git a/rules/cog.in b/rules/cog.in
deleted file mode 100644
index 47651073b..000000000
--- a/rules/cog.in
+++ /dev/null
@@ -1,24 +0,0 @@
-## SECTION=applications
-
-menuconfig COG
-       tristate
-       prompt "cog                           "
-       select HOST_MESON
-       select DBUS
-       select WAYLAND_PROTOCOLS
-       select WPEWEBKIT
-       select WPEBACKEND_FDO
-       help
-         Cog launcher and webapp container.
-
-if COG
-
-config COG_REMOTE_DBUS_SYSTEM_BUS
-       bool
-       prompt "Expose remote control interface on system bus"
-
-config COG_COGCTL
-       bool
-       prompt "Install cogctl"
-
-endif
diff --git a/rules/cog.make b/rules/cog.make
deleted file mode 100644
index 7199fb514..000000000
--- a/rules/cog.make
+++ /dev/null
@@ -1,83 +0,0 @@
-# -*-makefile-*-
-#
-# Copyright (C) 2019 by Philippe Normand <[email protected]>
-#
-# For further information about the PTXdist project and license conditions
-# see the README file.
-#
-
-#
-# We provide this package
-#
-PACKAGES-$(PTXCONF_COG) += cog
-
-#
-# Paths and names
-#
-COG_VERSION            := 0.19.1
-COG_SHA256             := 
633760ba69e36e4fbc24757c927f46fa1fdb3c526d0a6ac6ab35a21d35ad57b3
-COG                    := cog-$(COG_VERSION)
-COG_SUFFIX             := tar.xz
-COG_URL                        := 
https://wpewebkit.org/releases/$(COG).$(COG_SUFFIX)
-COG_SOURCE             := $(SRCDIR)/$(COG).$(COG_SUFFIX)
-COG_DIR                        := $(BUILDDIR)/$(COG)
-COG_LICENSE            := MIT
-COG_LICENSE_FILES      := file://COPYING;md5=bf1229cd7425b302d60cdb641b0ce5fb
-
-# ----------------------------------------------------------------------------
-# Prepare
-# ----------------------------------------------------------------------------
-
-#
-# cmake
-#
-COG_CONF_TOOL  := meson
-COG_CONF_OPT   := \
-       $(CROSS_MESON_USR) \
-       -Dcog_appid=com.igalia.Cog \
-       -Dcog_dbus_control=$(call ptx/ifdef, 
PTXCONF_COG_REMOTE_DBUS_SYSTEM_BUS,system,user) \
-       -Dcog_dbus_system_owner= \
-       -Dcog_home_uri=https://ptxdist.org/ \
-       -Ddocumentation=false \
-       -Dexamples=false \
-       -Dlibportal=disabled \
-       -Dmanpages=false \
-       -Dplatforms=wayland \
-       -Dplugin_path=/usr/lib/cog/modules \
-       -Dprograms=true \
-       -Dwayland_weston_content_protection=false \
-       -Dwayland_weston_direct_display=false \
-       -Dwpe_api=2.0 \
-       -Dx11_keyboard=[]
-
-# ----------------------------------------------------------------------------
-# Target-Install
-# -----------------------------------------------------------------------------
-
-$(STATEDIR)/cog.targetinstall:
-       @$(call targetinfo)
-
-       @$(call install_init, cog)
-       @$(call install_fixup, cog,PRIORITY,optional)
-       @$(call install_fixup, cog,SECTION,base)
-       @$(call install_fixup, cog,AUTHOR,"Philippe Normand <[email protected]>")
-       @$(call install_fixup, cog,DESCRIPTION,"WPE launcher and webapp 
container")
-
-       @$(call install_copy, cog, 0, 0, 0755, -, /usr/bin/cog)
-       @$(call install_lib, cog, 0, 0, 0644, cog/modules/libcogplatform-wl)
-       @$(call install_lib, cog, 0, 0, 0644, libcogcore)
-
-ifdef PTXCONF_COG_REMOTE_DBUS_SYSTEM_BUS
-       @$(call install_copy, cog, 0, 0, 0644, -, \
-               /usr/share/dbus-1/system.d/com.igalia.Cog.conf)
-endif
-
-ifdef PTXCONF_COG_COGCTL
-       @$(call install_copy, cog, 0, 0, 0755, -, /usr/bin/cogctl)
-endif
-
-       @$(call install_finish, cog)
-
-       @$(call touch)
-
-# vim: syntax=make
diff --git a/rules/libwpe.in b/rules/libwpe.in
deleted file mode 100644
index 53c317b67..000000000
--- a/rules/libwpe.in
+++ /dev/null
@@ -1,11 +0,0 @@
-## SECTION=system_libraries
-
-config LIBWPE
-       tristate
-       prompt "libwpe"
-       select HOST_MESON
-       select MESALIB
-       select MESALIB_EGL
-       select LIBXKBCOMMON
-       help
-         General-purpose library for the WebPlatformForEmbedded-flavored port 
of WebKit.
diff --git a/rules/libwpe.make b/rules/libwpe.make
deleted file mode 100644
index 6561b0fec..000000000
--- a/rules/libwpe.make
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*-makefile-*-
-#
-# Copyright (C) 2018 by Steffen Trumtrar <[email protected]>
-#
-# For further information about the PTXdist project and license conditions
-# see the README file.
-#
-
-#
-# We provide this package
-#
-PACKAGES-$(PTXCONF_LIBWPE) += libwpe
-
-#
-# Paths and names
-#
-LIBWPE_VERSION         := 1.16.2
-LIBWPE_LIBRARY_VERSION := 1.0
-LIBWPE_SHA256          := 
960bdd11c3f2cf5bd91569603ed6d2aa42fd4000ed7cac930a804eac367888d7
-LIBWPE                 := libwpe-$(LIBWPE_VERSION)
-LIBWPE_SUFFIX          := tar.xz
-LIBWPE_URL             := 
https://wpewebkit.org/releases/$(LIBWPE).$(LIBWPE_SUFFIX)
-LIBWPE_SOURCE          := $(SRCDIR)/$(LIBWPE).$(LIBWPE_SUFFIX)
-LIBWPE_DIR             := $(BUILDDIR)/$(LIBWPE)
-LIBWPE_LICENSE         := BSD-2-Clause
-LIBWPE_LICENSE_FILES   := file://COPYING;md5=371a616eb4903c6cb79e9893a5f615cc
-
-# ----------------------------------------------------------------------------
-# Prepare
-# ----------------------------------------------------------------------------
-
-#
-# cmake
-#
-LIBWPE_CONF_TOOL       := meson
-LIBWPE_CONF_OPT        := \
-       $(CROSS_MESON_USR) \
-       -Dbuild-docs=false \
-       -Ddefault-backend= \
-       -Denable-xkb=true
-
-# ----------------------------------------------------------------------------
-# Target-Install
-# ----------------------------------------------------------------------------
-
-$(STATEDIR)/libwpe.targetinstall:
-       @$(call targetinfo)
-
-       @$(call install_init, libwpe)
-       @$(call install_fixup, libwpe,PRIORITY,optional)
-       @$(call install_fixup, libwpe,SECTION,base)
-       @$(call install_fixup, libwpe,AUTHOR,"Steffen Trumtrar 
<[email protected]>")
-       @$(call install_fixup, libwpe,DESCRIPTION,missing)
-
-       @$(call install_lib, libwpe, 0, 0, 0644, 
libwpe-$(LIBWPE_LIBRARY_VERSION))
-
-       @$(call install_finish, libwpe)
-
-       @$(call touch)
-
-# vim: syntax=make
diff --git a/rules/wpebackend-fdo.in b/rules/wpebackend-fdo.in
deleted file mode 100644
index dffadaf6f..000000000
--- a/rules/wpebackend-fdo.in
+++ /dev/null
@@ -1,17 +0,0 @@
-## SECTION=multimedia_libs
-
-config WPEBACKEND_FDO
-       tristate
-       prompt "wpebackend-fdo"
-       select HOST_MESON
-       select LIBEPOXY
-       select LIBWPE
-       select LIBXKBCOMMON
-       select GLIB
-       select MESALIB
-       select MESALIB_EGL
-       select MESALIB_EGL_WAYLAND
-       select WAYLAND
-       help
-         WPE backend based on freedesktop.org stack
-
diff --git a/rules/wpebackend-fdo.make b/rules/wpebackend-fdo.make
deleted file mode 100644
index 18c830d17..000000000
--- a/rules/wpebackend-fdo.make
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*-makefile-*-
-#
-# Copyright (C) 2018 by Steffen Trumtrar <[email protected]>
-#
-# For further information about the PTXdist project and license conditions
-# see the README file.
-#
-
-#
-# We provide this package
-#
-PACKAGES-$(PTXCONF_WPEBACKEND_FDO) += wpebackend-fdo
-
-#
-# Paths and names
-#
-WPEBACKEND_FDO_VERSION         := 1.16.1
-WPEBACKEND_FDO_LIBRARY_VERSION := 1.0
-WPEBACKEND_FDO_SHA256          := 
544ae14012f8e7e426b8cb522eb0aaaac831ad7c35601d1cf31d37670e0ebb3b
-WPEBACKEND_FDO                 := wpebackend-fdo-$(WPEBACKEND_FDO_VERSION)
-WPEBACKEND_FDO_SUFFIX          := tar.xz
-WPEBACKEND_FDO_URL             := 
https://wpewebkit.org/releases/$(WPEBACKEND_FDO).$(WPEBACKEND_FDO_SUFFIX)
-WPEBACKEND_FDO_SOURCE          := 
$(SRCDIR)/$(WPEBACKEND_FDO).$(WPEBACKEND_FDO_SUFFIX)
-WPEBACKEND_FDO_DIR             := $(BUILDDIR)/$(WPEBACKEND_FDO)
-WPEBACKEND_FDO_LICENSE         := BSD-2-Clause
-WPEBACKEND_FDO_LICENSE_FILES   := 
file://COPYING;md5=1f62cef2e3645e3e74eb05fd389d7a66
-
-# ----------------------------------------------------------------------------
-# Prepare
-# ----------------------------------------------------------------------------
-
-#
-# meson
-#
-WPEBACKEND_FDO_CONF_TOOL       := meson
-WPEBACKEND_FDO_CONF_OPT        := \
-       $(CROSS_MESON_USR) \
-       -Dbuild_docs=false
-
-# ----------------------------------------------------------------------------
-# Target-Install
-# ----------------------------------------------------------------------------
-
-$(STATEDIR)/wpebackend-fdo.targetinstall:
-       @$(call targetinfo)
-
-       @$(call install_init, wpebackend-fdo)
-       @$(call install_fixup, wpebackend-fdo,PRIORITY,optional)
-       @$(call install_fixup, wpebackend-fdo,SECTION,base)
-       @$(call install_fixup, wpebackend-fdo,AUTHOR,"Steffen Trumtrar 
<[email protected]>")
-       @$(call install_fixup, wpebackend-fdo,DESCRIPTION,missing)
-
-       @$(call install_lib, wpebackend-fdo, 0, 0, 0644, \
-               libWPEBackend-fdo-$(WPEBACKEND_FDO_LIBRARY_VERSION))
-
-       @$(call install_link, wpebackend-fdo, \
-               libWPEBackend-fdo-$(WPEBACKEND_FDO_LIBRARY_VERSION).so.1, \
-               /usr/lib/libWPEBackend-default.so)
-       @$(call install_link, wpebackend-fdo, \
-               libWPEBackend-fdo-$(WPEBACKEND_FDO_LIBRARY_VERSION).so.1, \
-               /usr/lib/libWPEBackend-fdo-$(WPEBACKEND_FDO_LIBRARY_VERSION).so)
-
-
-       @$(call install_finish, wpebackend-fdo)
-
-       @$(call touch)
-
-# vim: syntax=make
diff --git a/rules/wpewebkit.in b/rules/wpewebkit.in
index 507ba3d1f..884be90f3 100644
--- a/rules/wpewebkit.in
+++ b/rules/wpewebkit.in
@@ -14,7 +14,6 @@ menuconfig WPEWEBKIT
        select ALSA_LIB                         if WPEWEBKIT_WEBRTC
        select GCCLIBS_ATOMIC
        select GLIB
-       select LIBWPE
        select CAIRO
        select CAIRO_FREETYPE
        select CAIRO_PNG
@@ -39,8 +38,15 @@ menuconfig WPEWEBKIT
        select LIBXSLT_LIBXSLT
        select MESALIB
        select MESALIB_EGL
+       select MESALIB_GBM
+       select MESALIB_EGL_WAYLAND              if WPEWEBKIT_PLATFORM_WAYLAND
        select MESALIB_GLES2
        select LIBEPOXY
+       select WAYLAND                          if WPEWEBKIT_PLATFORM_WAYLAND
+       select WAYLAND_PROTOCOLS                if WPEWEBKIT_PLATFORM_WAYLAND
+       select LIBINPUT                         if WPEWEBKIT_PLATFORM_DRM
+       select UDEV                             if WPEWEBKIT_PLATFORM_DRM
+       select UDEV_LIBUDEV                     if WPEWEBKIT_PLATFORM_DRM
        select LIBGCRYPT
        select LIBTASN1
        select OPENSSL                          if WPEWEBKIT_WEBRTC
@@ -76,13 +82,40 @@ menuconfig WPEWEBKIT
        select GST_PLUGINS_BAD1_SUBENC          if WPEWEBKIT_VIDEO
        select GST_PLUGINS_BAD1_VIDEOPARSERS    if WPEWEBKIT_VIDEO
        select GST_PLUGINS_BAD1_WEBRTC          if WPEWEBKIT_WEBRTC
-       select WPEBACKEND_FDO
        select SYSTEMD                          if WPEWEBKIT_JOURNALD
        help
          WebPlatformForEmbedded port for the WebKit cross-platform web browser 
engine.
 
 if WPEWEBKIT
 
+choice
+       prompt "WPE platform backend"
+       default WPEWEBKIT_PLATFORM_WAYLAND
+       help
+         Select which WPE Platform backend to build.
+
+config WPEWEBKIT_PLATFORM_WAYLAND
+       bool
+       prompt "Wayland"
+       help
+         Build the Wayland backend of the WPE Platform library.
+
+config WPEWEBKIT_PLATFORM_DRM
+       bool
+       prompt "DRM/KMS"
+       help
+         Build the DRM/KMS backend of the WPE Platform library. Uses libinput
+         for input handling and udev for device discovery.
+
+endchoice
+
+config WPEWEBKIT_MINIBROWSER
+       bool
+       prompt "build MiniBrowser"
+       help
+         Build and install the MiniBrowser, a simple WPE Platform based browser
+         that can be used as a launcher instead of cog.
+
 config WPEWEBKIT_JOURNALD
        bool
        depends on INITMETHOD_SYSTEMD
diff --git a/rules/wpewebkit.make b/rules/wpewebkit.make
index 12aa869af..8da3b93d0 100644
--- a/rules/wpewebkit.make
+++ b/rules/wpewebkit.make
@@ -54,6 +54,7 @@ WPEWEBKIT_CONF_OPT    := \
        -DENABLE_INTROSPECTION=OFF \
        -DENABLE_JAVASCRIPTCORE=ON \
        -DENABLE_JOURNALD_LOG=$(call ptx/onoff,PTXCONF_WPEWEBKIT_JOURNALD) \
+       -DENABLE_MINIBROWSER=$(call ptx/onoff,PTXCONF_WPEWEBKIT_MINIBROWSER) \
        -DENABLE_PDFJS=ON \
        -DENABLE_SPEECH_SYNTHESIS=OFF \
        -DENABLE_VIDEO=$(call ptx/onoff,PTXCONF_WPEWEBKIT_VIDEO) \
@@ -62,11 +63,11 @@ WPEWEBKIT_CONF_OPT  := \
        -DENABLE_WEBKIT=ON \
        -DENABLE_WEB_AUDIO=$(call ptx/onoff,PTXCONF_WPEWEBKIT_AUDIO) \
        -DENABLE_WPE_1_1_API=OFF \
-       -DENABLE_WPE_LEGACY_API=ON \
-       -DENABLE_WPE_PLATFORM=OFF \
-       -DENABLE_WPE_PLATFORM_DRM=OFF \
+       -DENABLE_WPE_LEGACY_API=OFF \
+       -DENABLE_WPE_PLATFORM=ON \
+       -DENABLE_WPE_PLATFORM_DRM=$(call 
ptx/onoff,PTXCONF_WPEWEBKIT_PLATFORM_DRM) \
        -DENABLE_WPE_PLATFORM_HEADLESS=OFF \
-       -DENABLE_WPE_PLATFORM_WAYLAND=OFF \
+       -DENABLE_WPE_PLATFORM_WAYLAND=$(call 
ptx/onoff,PTXCONF_WPEWEBKIT_PLATFORM_WAYLAND) \
        -DENABLE_WPE_QT_API=OFF \
        -DENABLE_XSLT=ON \
        -DGCC_OFFLINEASM_SOURCE_MAP=OFF \
-- 
2.54.0


Reply via email to