Title: [272643] trunk
Revision
272643
Author
ph...@webkit.org
Date
2021-02-10 02:18:43 -0800 (Wed, 10 Feb 2021)

Log Message

[WPE] Optionally build Cog as external project and replacement for MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=221518

Reviewed by Adrian Perez de Castro.

.:

* Source/cmake/OptionsWPE.cmake: New variable for JSC forwarded headers path, useful
uninstalled builds of projects depending on JSC.

Source/WebKit:

* PlatformWPE.cmake: Produce uninstalled pkg-config files for wpe-webkit and web-extension
libraries. Also populate the JSC ForwardedHeaders path during the build.
* wpe/wpe-web-extension-uninstalled.pc.in: Added.
* wpe/wpe-webkit-uninstalled.pc.in: Added.

Tools:

By passing `-DENABLE_COG=ON` during the WPE build, the Cog browser is now built as an
external project. The repository is cloned in Tools/wpe/cog and the code can be edited
there.

The run-minibrowser --wpe script will now first try to execute cog and fallback to
MiniBrowser if it wasn't found. Cog is also a MiniBrowser, but with some additional
features, see https://github.com/Igalia/cog for more informations.

* PlatformWPE.cmake: Configure Cog as an external project in developer builds.
* Scripts/webkitpy/port/wpe.py:
(WPEPort.run_minibrowser): First check for cog, fallback to MiniBrowser if not found.
* flatpak/flatpakutils.py:
(WebkitFlatpak.run_in_sandbox): Set pkg-config path to lookup libraries in the WebKit's
build directory as well.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (272642 => 272643)


--- trunk/ChangeLog	2021-02-10 09:42:11 UTC (rev 272642)
+++ trunk/ChangeLog	2021-02-10 10:18:43 UTC (rev 272643)
@@ -1,3 +1,13 @@
+2021-02-10  Philippe Normand  <pnorm...@igalia.com>
+
+        [WPE] Optionally build Cog as external project and replacement for MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=221518
+
+        Reviewed by Adrian Perez de Castro.
+
+        * Source/cmake/OptionsWPE.cmake: New variable for JSC forwarded headers path, useful
+        uninstalled builds of projects depending on JSC.
+
 2021-02-09  Jonathan Bedard  <jbed...@apple.com>
 
         AX: introduction.md broken architecture.png link

Modified: trunk/Source/WebKit/ChangeLog (272642 => 272643)


--- trunk/Source/WebKit/ChangeLog	2021-02-10 09:42:11 UTC (rev 272642)
+++ trunk/Source/WebKit/ChangeLog	2021-02-10 10:18:43 UTC (rev 272643)
@@ -1,3 +1,15 @@
+2021-02-10  Philippe Normand  <pnorm...@igalia.com>
+
+        [WPE] Optionally build Cog as external project and replacement for MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=221518
+
+        Reviewed by Adrian Perez de Castro.
+
+        * PlatformWPE.cmake: Produce uninstalled pkg-config files for wpe-webkit and web-extension
+        libraries. Also populate the JSC ForwardedHeaders path during the build.
+        * wpe/wpe-web-extension-uninstalled.pc.in: Added.
+        * wpe/wpe-webkit-uninstalled.pc.in: Added.
+
 2021-02-10  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [SOUP] Simplify ResourceRequest and ResourceResponse

Modified: trunk/Source/WebKit/PlatformWPE.cmake (272642 => 272643)


--- trunk/Source/WebKit/PlatformWPE.cmake	2021-02-10 09:42:11 UTC (rev 272642)
+++ trunk/Source/WebKit/PlatformWPE.cmake	2021-02-10 10:18:43 UTC (rev 272643)
@@ -10,10 +10,13 @@
 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_DIR})
 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_EXTENSION_DIR})
 file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_DOM_DIR})
+file(MAKE_DIRECTORY ${FORWARDING_HEADERS_WPE_JSC_DIR})
 
 configure_file(UIProcess/API/wpe/WebKitVersion.h.in ${DERIVED_SOURCES_WPE_API_DIR}/WebKitVersion.h)
 configure_file(wpe/wpe-webkit.pc.in ${WPE_PKGCONFIG_FILE} @ONLY)
 configure_file(wpe/wpe-web-extension.pc.in ${WPEWebExtension_PKGCONFIG_FILE} @ONLY)
+configure_file(wpe/wpe-webkit-uninstalled.pc.in ${CMAKE_BINARY_DIR}/wpe-webkit-${WPE_API_VERSION}-uninstalled.pc @ONLY)
+configure_file(wpe/wpe-web-extension-uninstalled.pc.in ${CMAKE_BINARY_DIR}/wpe-web-extension-${WPE_API_VERSION}-uninstalled.pc @ONLY)
 
 add_definitions(-DWEBKIT2_COMPILATION)
 
@@ -53,10 +56,18 @@
     VERBATIM
 )
 
+add_custom_command(
+    OUTPUT ${FORWARDING_HEADERS_WPE_JSC_DIR}/jsc
+    DEPENDS ${_javascript_CORE_DIR}/API/glib/
+    COMMAND ln -n -s -f ${_javascript_CORE_DIR}/API/glib ${FORWARDING_HEADERS_WPE_JSC_DIR}/jsc
+    VERBATIM
+)
+
 add_custom_target(webkitwpe-fake-api-headers
     DEPENDS ${FORWARDING_HEADERS_WPE_DIR}/wpe
             ${FORWARDING_HEADERS_WPE_EXTENSION_DIR}/wpe
             ${FORWARDING_HEADERS_WPE_DOM_DIR}/wpe
+            ${FORWARDING_HEADERS_WPE_JSC_DIR}/jsc
 )
 
 list(APPEND WebKit_DEPENDENCIES

Added: trunk/Source/WebKit/wpe/wpe-web-extension-uninstalled.pc.in (0 => 272643)


--- trunk/Source/WebKit/wpe/wpe-web-extension-uninstalled.pc.in	                        (rev 0)
+++ trunk/Source/WebKit/wpe/wpe-web-extension-uninstalled.pc.in	2021-02-10 10:18:43 UTC (rev 272643)
@@ -0,0 +1,12 @@
+prefix=@CMAKE_BINARY_DIR@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/DerivedSources/ForwardingHeaders
+
+Name: WPE WebKit Web process extensions
+Description: Embeddable Web content engine - Web process extensions
+URL: https://wpewebkit.org
+Version: @PROJECT_VERSION@
+Requires: glib-2.0 libsoup-2.4 wpe-1.0
+Libs: -L${libdir} -lWPEWebKit-@WPE_API_VERSION@
+Cflags: -I${includedir}/wpe-extension

Added: trunk/Source/WebKit/wpe/wpe-webkit-uninstalled.pc.in (0 => 272643)


--- trunk/Source/WebKit/wpe/wpe-webkit-uninstalled.pc.in	                        (rev 0)
+++ trunk/Source/WebKit/wpe/wpe-webkit-uninstalled.pc.in	2021-02-10 10:18:43 UTC (rev 272643)
@@ -0,0 +1,12 @@
+prefix=@CMAKE_BINARY_DIR@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/DerivedSources
+
+Name: WPE WebKit
+Description: Embeddable Web content engine
+URL: https://wpewebkit.org
+Version: @PROJECT_VERSION@
+Requires: glib-2.0 libsoup-2.4 wpe-1.0
+Libs: -L${libdir} -lWPEWebKit-@WPE_API_VERSION@
+Cflags: -I${includedir}/ForwardingHeaders/wpe -I${includedir}/WebKit/ -I${includedir}/ForwardingHeaders/wpe-jsc -I${includedir}/_javascript_Core/_javascript_corewpe/

Modified: trunk/Source/cmake/OptionsWPE.cmake (272642 => 272643)


--- trunk/Source/cmake/OptionsWPE.cmake	2021-02-10 09:42:11 UTC (rev 272642)
+++ trunk/Source/cmake/OptionsWPE.cmake	2021-02-10 10:18:43 UTC (rev 272643)
@@ -246,6 +246,7 @@
 set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
 set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
 set(FORWARDING_HEADERS_WPE_DOM_DIR ${FORWARDING_HEADERS_DIR}/wpe-dom)
+set(FORWARDING_HEADERS_WPE_JSC_DIR ${FORWARDING_HEADERS_DIR}/wpe-jsc)
 set(DERIVED_SOURCES_JAVASCRIPCOREWPE_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/_javascript_corewpe)
 set(DERIVED_SOURCES_JAVASCRIPCORE_GLIB_API_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/_javascript_corewpe/jsc)
 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT_DIR}/wpe)

Modified: trunk/Tools/ChangeLog (272642 => 272643)


--- trunk/Tools/ChangeLog	2021-02-10 09:42:11 UTC (rev 272642)
+++ trunk/Tools/ChangeLog	2021-02-10 10:18:43 UTC (rev 272643)
@@ -1,3 +1,25 @@
+2021-02-06  Philippe Normand  <pnorm...@igalia.com>
+
+        [WPE] Optionally build Cog as external project and replacement for MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=221518
+
+        Reviewed by Adrian Perez de Castro.
+
+        By passing `-DENABLE_COG=ON` during the WPE build, the Cog browser is now built as an
+        external project. The repository is cloned in Tools/wpe/cog and the code can be edited
+        there.
+
+        The run-minibrowser --wpe script will now first try to execute cog and fallback to
+        MiniBrowser if it wasn't found. Cog is also a MiniBrowser, but with some additional
+        features, see https://github.com/Igalia/cog for more informations.
+
+        * PlatformWPE.cmake: Configure Cog as an external project in developer builds.
+        * Scripts/webkitpy/port/wpe.py:
+        (WPEPort.run_minibrowser): First check for cog, fallback to MiniBrowser if not found.
+        * flatpak/flatpakutils.py:
+        (WebkitFlatpak.run_in_sandbox): Set pkg-config path to lookup libraries in the WebKit's
+        build directory as well.
+
 2021-02-09  Devin Rousso  <drou...@apple.com>
 
         [iOS] Add support for the language/subtitle tracks button using `UIMenu`

Modified: trunk/Tools/PlatformWPE.cmake (272642 => 272643)


--- trunk/Tools/PlatformWPE.cmake	2021-02-10 09:42:11 UTC (rev 272642)
+++ trunk/Tools/PlatformWPE.cmake	2021-02-10 10:18:43 UTC (rev 272643)
@@ -15,3 +15,12 @@
 if (ENABLE_MINIBROWSER)
     add_subdirectory(MiniBrowser/wpe)
 endif ()
+
+if (DEVELOPER_MODE AND ENABLE_COG)
+    include(ExternalProject)
+    ExternalProject_Add(cog
+        GIT_REPOSITORY "https://github.com/Igalia/cog.git"
+        SOURCE_DIR "${CMAKE_SOURCE_DIR}/Tools/wpe/cog"
+        INSTALL_COMMAND "")
+    ExternalProject_Add_StepDependencies(cog build WebKit)
+endif ()

Modified: trunk/Tools/Scripts/webkitpy/port/wpe.py (272642 => 272643)


--- trunk/Tools/Scripts/webkitpy/port/wpe.py	2021-02-10 09:42:11 UTC (rev 272642)
+++ trunk/Tools/Scripts/webkitpy/port/wpe.py	2021-02-10 10:18:43 UTC (rev 272643)
@@ -1,4 +1,5 @@
-# Copyright (C) 2014-2017 Igalia S.L.  All rights reserved.
+# -*- coding: utf-8 -*-
+# Copyright (C) 2014-2021 Igalia S.L.  All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -143,10 +144,20 @@
         return configuration
 
     def run_minibrowser(self, args):
-        miniBrowser = self._build_path('bin', 'MiniBrowser')
-        if not self._filesystem.isfile(miniBrowser):
-            print("%s not found... Did you run build-webkit?" % miniBrowser)
-            return 1
+        env = None
+        cog = self._build_path('Tools', 'cog-prefix', 'src', 'cog-build', 'cog')
+        if self._filesystem.isfile(cog):
+            miniBrowser = cog
+            env = os.environ.copy()
+            env.update({'WEBKIT_EXEC_PATH': self._build_path('bin'),
+                        'WEBKIT_INJECTED_BUNDLE_PATH': self._build_path('lib')})
+            args = ['-P', 'fdo'] + args
+        else:
+            print("Cog not found 😢. If you wish to enable it, rebuild with `-DENABLE_COG=ON`. Falling back to good old MiniBrowser")
+            miniBrowser = self._build_path('bin', 'MiniBrowser')
+            if not self._filesystem.isfile(miniBrowser):
+                print("%s not found... Did you run build-webkit?" % miniBrowser)
+                return 1
         command = [miniBrowser]
         if os.environ.get("WEBKIT_MINI_BROWSER_PREFIX"):
             command = shlex.split(os.environ["WEBKIT_MINI_BROWSER_PREFIX"]) + command
@@ -153,4 +164,4 @@
 
         if self._should_use_jhbuild():
             command = self._jhbuild_wrapper + command
-        return self._executive.run_command(command + args, cwd=self.webkit_base(), stdout=None, return_stderr=False, decode_output=False)
+        return self._executive.run_command(command + args, cwd=self.webkit_base(), stdout=None, return_stderr=False, decode_output=False, env=env)

Modified: trunk/Tools/flatpak/flatpakutils.py (272642 => 272643)


--- trunk/Tools/flatpak/flatpakutils.py	2021-02-10 09:42:11 UTC (rev 272642)
+++ trunk/Tools/flatpak/flatpakutils.py	2021-02-10 10:18:43 UTC (rev 272643)
@@ -726,6 +726,7 @@
                 "--share=ipc",
                 "--share=network",
                 "--socket=pulseaudio",
+                "--socket=session-bus",
                 "--socket=system-bus",
                 "--socket=wayland",
                 "--socket=x11",
@@ -874,6 +875,13 @@
             "WEBKIT_FLATPAK_USER_DIR": os.environ["FLATPAK_USER_DIR"],
         })
 
+        pkg_config_path = flatpak_env.get("PKG_CONFIG_PATH")
+        if pkg_config_path:
+            pkg_config_path = "%s:%s" % (self.build_path, pkg_config_path)
+        else:
+            pkg_config_path = self.build_path
+        flatpak_env["PKG_CONFIG_PATH"] = pkg_config_path
+
         env_file = os.path.join(self.build_root, 'flatpak-env.json')
         if not os.path.exists(env_file):
             with open(env_file, 'w') as f:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to