[GTK][WPE] Migrate to Flatpak-based dev SDK
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Mar 2020 09:54:55 +0000 (09:54 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Mar 2020 09:54:55 +0000 (09:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=205658

Reviewed by Carlos Alberto Lopez Perez.

Source/WebCore:

* platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::scanTestDictionariesDirectoryIfNecessary): Check for flatpak-installed dictionaries.

Tools:

JHBuild will now be used only if the WEBKIT_JHBUILD environment
variable is set to 1, which is the case for the time being on the
GTK and WPE EWS/build bots.

By default the build dependencies are now locally installed from a
Flatpak repository hosted at https://software.igalia.com. The
repository can be regenerated with the scripts from the
webkit-flatpak-sdk Github project
(https://github.com/Igalia/webkit-flatpak-sdk). This is done
transparently with the update-webkit{gtk,wpe}-libs scripts. As
there is no need to rebuild the dependencies from scratch, the
developer user-experience should now be much more friendly and
overall build times reduced.

As an additional commodity, the new environment supports the
GStreamer gst-build-based workflow. Just set the GST_BUILD_PATH
environment variable to your gst-build path. This feature was
contributed by Thibault Saunier.

The JHBuild infrastructure will be removed once all the bots have
been switched over to Flatpak.

* BuildSlaveSupport/ews-build/steps.py:
(InstallGtkDependencies):
(InstallWpeDependencies):
(CompileWebKit.start):
* BuildSlaveSupport/gtk/buildbot/run:
* Scripts/build-webkit:
* Scripts/run-bindings-tests:
* Scripts/run-builtins-generator-tests:
* Scripts/run-gtk-tests:
* Scripts/run-javascriptcore-tests:
* Scripts/run-minibrowser:
* Scripts/run-qt-wpe-minibrowser:
* Scripts/run-webdriver-tests:
* Scripts/run-wpe-tests:
* Scripts/test-webkitperl:
* Scripts/test-webkitpy:
* Scripts/test262-runner:
* Scripts/update-webkit-flatpak: Renamed from Tools/Scripts/update-webkitgtk-flatpak.
* Scripts/update-webkitgtk-libs:
* Scripts/update-webkitwpe-flatpak: Removed.
* Scripts/update-webkitwpe-libs:
* Scripts/webkitdirs.pm:
(getUserFlatpakPath):
(inFlatpakSandbox):
(runInFlatpakIfAvailable):
(wrapperPrefixIfNeeded):
(shouldUseJhbuild):
(shouldUseFlatpak):
(shouldRemoveCMakeCache):
* Scripts/webkitpy/common/system/executive.py:
(Executive.kill_all):
* Scripts/webkitpy/port/base.py:
(Port._path_to_apache):
(Port._should_run_as_pixel_test):
(Port._in_flatpak_sandbox):
* Scripts/webkitpy/port/gtk.py:
(GtkPort.setup_environ_for_server):
(GtkPort._get_crash_log):
* Scripts/webkitpy/port/linux_get_crash_log.py:
(GDBCrashLogGenerator):
(GDBCrashLogGenerator.__init__):
(GDBCrashLogGenerator.generate_crash_log):
* Scripts/webkitpy/port/linux_get_crash_log_unittest.py:
(GDBCrashLogGeneratorTest.test_generate_crash_log):
* Scripts/webkitpy/port/wpe.py:
(WPEPort.setup_environ_for_server):
(WPEPort._get_crash_log):
* Scripts/webkitpy/port/xvfbdriver.py:
(XvfbDriver._setup_environ_for_test):
* WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp:
(WTR::getFontsPath):
* WebKitTestRunner/InjectedBundle/wpe/ActivateFontsWPE.cpp:
(WTR::getFontsPath):
* flatpak/files/default.xkm: Removed.
* flatpak/files/httpd-autogen.sh: Removed.
* flatpak/flatpakutils.py:
(check_flatpak):
(FlatpakRepos.update):
(FlatpakPackage.__repr__):
(FlatpakPackage.__str__):
(WebkitFlatpak.load_from_args):
(WebkitFlatpak.__init__):
(WebkitFlatpak.clean_args):
(WebkitFlatpak.setup_builddir):
(WebkitFlatpak):
(WebkitFlatpak.setup_gstbuild):
(WebkitFlatpak.run_in_sandbox):
(WebkitFlatpak.run):
(WebkitFlatpak.has_environment):
(WebkitFlatpak.save_config):
(WebkitFlatpak.setup_dev_env):
(WebkitFlatpak.install_all):
(WebkitFlatpak.run_gdb):
* flatpak/org.webkit.CommonModules.yaml: Removed.
* flatpak/org.webkit.GTK.yaml: Removed.
* flatpak/org.webkit.WPE.yaml: Removed.
* flatpak/org.webkit.WPEModules.yaml: Removed.
* flatpak/org.webkit.WPEQT.yaml: Removed.
* flatpak/org.webkit.WebKit.yaml: Removed.
* flatpak/patches/httpd-0001-configure-use-pkg-config-for-PCRE-detection.patch: Removed.
* flatpak/patches/libgcrypt-0001-Use-pkg-config-to-detect-gpg-error.patch: Removed.
* flatpak/patches/xvfb-0001-HACK-Avoid-compiling-a-kbm-file.patch: Removed.

LayoutTests:

* http/conf/flatpak-httpd.conf: Adjust paths.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258626 268f45cc-cd09-0410-ab3c-d52691b4dbfc

50 files changed:
LayoutTests/ChangeLog
LayoutTests/http/conf/flatpak-httpd.conf
Source/WebCore/ChangeLog
Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp
Tools/BuildSlaveSupport/gtk/README [deleted file]
Tools/BuildSlaveSupport/gtk/buildbot/log/run [deleted file]
Tools/BuildSlaveSupport/gtk/buildbot/run [deleted file]
Tools/BuildSlaveSupport/gtk/daemontools-buildbot.conf [deleted file]
Tools/BuildSlaveSupport/gtk/pulseaudio/run [deleted file]
Tools/ChangeLog
Tools/Scripts/build-jsc
Tools/Scripts/build-webkit
Tools/Scripts/run-bindings-tests
Tools/Scripts/run-builtins-generator-tests
Tools/Scripts/run-gtk-tests
Tools/Scripts/run-javascriptcore-tests
Tools/Scripts/run-minibrowser
Tools/Scripts/run-perf-tests
Tools/Scripts/run-qt-wpe-minibrowser
Tools/Scripts/run-webdriver-tests
Tools/Scripts/run-wpe-tests
Tools/Scripts/test-webkitperl
Tools/Scripts/test-webkitpy
Tools/Scripts/test262-runner
Tools/Scripts/update-webkit-flatpak [moved from Tools/Scripts/update-webkitgtk-flatpak with 93% similarity]
Tools/Scripts/update-webkitgtk-libs
Tools/Scripts/update-webkitwpe-flatpak [deleted file]
Tools/Scripts/update-webkitwpe-libs
Tools/Scripts/webkitdirs.pm
Tools/Scripts/webkitpy/port/base.py
Tools/Scripts/webkitpy/port/gtk.py
Tools/Scripts/webkitpy/port/linux_get_crash_log.py
Tools/Scripts/webkitpy/port/linux_get_crash_log_unittest.py
Tools/Scripts/webkitpy/port/wpe.py
Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp
Tools/WebKitTestRunner/InjectedBundle/wpe/ActivateFontsWPE.cpp
Tools/flatpak/files/default.xkm [deleted file]
Tools/flatpak/files/httpd-autogen.sh [deleted file]
Tools/flatpak/flatpakutils.py
Tools/flatpak/org.webkit.CommonModules.yaml [deleted file]
Tools/flatpak/org.webkit.GTK.yaml [deleted file]
Tools/flatpak/org.webkit.WPE.yaml [deleted file]
Tools/flatpak/org.webkit.WPEModules.yaml [deleted file]
Tools/flatpak/org.webkit.WPEQT.yaml [deleted file]
Tools/flatpak/org.webkit.WebKit.yaml [deleted file]
Tools/flatpak/patches/httpd-0001-configure-use-pkg-config-for-PCRE-detection.patch [deleted file]
Tools/flatpak/patches/libgcrypt-0001-Use-pkg-config-to-detect-gpg-error.patch [deleted file]
Tools/flatpak/patches/xvfb-0001-HACK-Avoid-compiling-a-kbm-file.patch [deleted file]
Tools/gtk/install-dependencies
Tools/wpe/install-dependencies

index 99e9309..8075baf 100644 (file)
@@ -1,3 +1,12 @@
+2020-03-18  Philippe Normand  <pnormand@igalia.com>
+
+        [GTK][WPE] Migrate to Flatpak-based dev SDK
+        https://bugs.webkit.org/show_bug.cgi?id=205658
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * http/conf/flatpak-httpd.conf: Adjust paths.
+
 2020-03-17  Pinki Gyanchandani  <pgyanchandani@apple.com>
 
         Crash in CSSPrimitiveValue::cleanup
index 3c03e42..bf5215d 100644 (file)
@@ -1,5 +1,5 @@
 ServerTokens OS
-ServerRoot "/app/"
+ServerRoot "/usr/"
 
 PidFile "/tmp/WebKit/httpd.pid"
 ScoreBoardFile "/tmp/WebKit/httpd.scoreboard"
@@ -33,9 +33,7 @@ LoadModule log_config_module    modules/mod_log_config.so
 LoadModule ssl_module           modules/mod_ssl.so
 LoadModule php7_module          modules/libphp7.so
 LoadModule asis_module          modules/mod_asis.so
-LoadModule env_module           modules/mod_env.so
 
-SetEnv PERL5LIB /app/lib/perl
 
 ServerName 127.0.0.1
 
@@ -54,7 +52,7 @@ AccessFileName .htaccess
 UseCanonicalName On
 HostnameLookups Off
 
-TypesConfig /etc/mime.types
+TypesConfig /usr/conf/mime.types
 
 LogLevel warn
 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
index 84dd239..bf0c4fb 100644 (file)
@@ -1,3 +1,13 @@
+2020-03-18  Philippe Normand  <pnormand@igalia.com>
+
+        [GTK][WPE] Migrate to Flatpak-based dev SDK
+        https://bugs.webkit.org/show_bug.cgi?id=205658
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * platform/text/hyphen/HyphenationLibHyphen.cpp:
+        (WebCore::scanTestDictionariesDirectoryIfNecessary): Check for flatpak-installed dictionaries.
+
 2020-03-17  Pinki Gyanchandani  <pgyanchandani@apple.com>
 
         Crash in CSSPrimitiveValue::cleanup
index 12baa4c..f3359d8 100644 (file)
@@ -121,8 +121,15 @@ static void scanTestDictionariesDirectoryIfNecessary(HashMap<AtomString, Vector<
     // libhyphen doesn't have the concept of installed dictionaries. Instead,
     // we have this special case for WebKit tests.
 #if PLATFORM(GTK)
+    // Try alternative dictionaries path for people using Flatpak.
+    GUniquePtr<char> dictionariesPath(g_build_filename("/usr", "share", "webkitgtk-test-dicts", nullptr));
+    if (g_getenv("FLATPAK_ID") && g_file_test(dictionariesPath.get(), static_cast<GFileTest>(G_FILE_TEST_IS_DIR))) {
+        scanDirectoryForDictionaries(dictionariesPath.get(), availableLocales);
+        return;
+    }
+
     CString buildDirectory = webkitBuildDirectory();
-    GUniquePtr<char> dictionariesPath(g_build_filename(buildDirectory.data(), "DependenciesGTK", "Root", "webkitgtk-test-dicts", nullptr));
+    dictionariesPath.reset(g_build_filename(buildDirectory.data(), "DependenciesGTK", "Root", "webkitgtk-test-dicts", nullptr));
     if (g_file_test(dictionariesPath.get(), static_cast<GFileTest>(G_FILE_TEST_IS_DIR))) {
         scanDirectoryForDictionaries(dictionariesPath.get(), availableLocales);
         return;
@@ -130,7 +137,9 @@ static void scanTestDictionariesDirectoryIfNecessary(HashMap<AtomString, Vector<
 
     // Try alternative dictionaries path for people not using JHBuild.
     dictionariesPath.reset(g_build_filename(buildDirectory.data(), "webkitgtk-test-dicts", nullptr));
-    scanDirectoryForDictionaries(dictionariesPath.get(), availableLocales);
+    if (g_file_test(dictionariesPath.get(), static_cast<GFileTest>(G_FILE_TEST_IS_DIR)))
+        scanDirectoryForDictionaries(dictionariesPath.get(), availableLocales);
+
 #elif defined(TEST_HYPHENATAION_PATH)
     scanDirectoryForDictionaries(TEST_HYPHENATAION_PATH, availableLocales);
 #else
diff --git a/Tools/BuildSlaveSupport/gtk/README b/Tools/BuildSlaveSupport/gtk/README
deleted file mode 100644 (file)
index f9f89f9..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-==============================================
- Running a GTK+ build slave under daemontools
-==============================================
-
-This directory contains several scripts which can be used to run a WebKitGTK
-build slave under daemontools [1]. This is convenient because daemontools
-will automatically restart services when they die, and that means less human
-intervention is needed.
-
-
-Dependencies
-============
-
-In order to use the provided service control files, you will need the
-following:
-
-* The GNU Bash shell (the scripts contain some bash-isms)
-
-* The daemontools package (or one of its drop-in replacements, like runit
-  or freedt; but only daemontools has been tested so far).
-
-In short, in a Debian-based system you can ensure you have the needed bits
-with the following command:
-
-  apt-get install daemontools-run
-
-
-Setup
-=====
-
-1. Follow the instructions at http://trac.webkit.org/wiki/BuildBot
-
-2. Install the dependencies outlined above.
-
-3. Copy "daemontools-buildbot.conf" to "/etc/daemontools-buildbot.conf"
-
-4. Edit the configuration file to suit your needs, the comments should
-   be self-explanatory.
-
-5. Drop the "buildbot" and "pulseaudio" directories to the service control directory of
-   daemontools; for Debian-based setups that would be "/etc/service"
-
-
-References
-==========
-
-[1] http://cr.yp.to/daemontools.html
-
diff --git a/Tools/BuildSlaveSupport/gtk/buildbot/log/run b/Tools/BuildSlaveSupport/gtk/buildbot/log/run
deleted file mode 100755 (executable)
index f6c744c..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#! /usr/bin/env bash
-#
-# Copyright (C) 2010 Igalia S.L. All rights reserved.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-: ${BUILDBOT_CONFIG:=/etc/daemontools-buildbot.conf}
-
-# Read configuration file
-[ -r "${BUILDBOT_CONFIG}" ] && . "${BUILDBOT_CONFIG}"
-
-: ${buildbot_user:=${HOME}}
-: ${buildbot_log_path:=/var/log/buildbot}
-
-# Expand all "env_*" environment variables
-for varname in ${!env_*} ; do
-       eval "export ${varname#env_}=\${${varname}}"
-done
-
-mkdir -p "${buildbot_log_path}"
-chown "${buildbot_user}" "${buildbot_log_path}"
-
-exec /usr/bin/setuidgid "${buildbot_user}" \
-     /usr/bin/multilog t "${buildbot_log_path}"
-
diff --git a/Tools/BuildSlaveSupport/gtk/buildbot/run b/Tools/BuildSlaveSupport/gtk/buildbot/run
deleted file mode 100755 (executable)
index 166c383..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#! /usr/bin/env bash
-#
-# Copyright (C) 2010 Igalia S.L. All rights reserved.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-exec 2>&1
-
-: ${BUILDBOT_CONFIG:=/etc/daemontools-buildbot.conf}
-
-# Read configuration file
-[ -r "${BUILDBOT_CONFIG}" ] && . "${BUILDBOT_CONFIG}"
-
-# Expand all "env_*" environment variables
-for varname in ${!env_*} ; do
-       eval "export ${varname#env_}=\${${varname}}"
-done
-
-
-if ! [ "${buildbot_path}" ] ; then
-       echo "No \${buildbot_path} defined! (will sleep for 5 minutes)"
-       sleep 300
-       exit 111
-fi
-
-
-if ! [ "${WEBKIT_TESTFONTS}" ] ; then
-       echo "No \${WEBKIT_TESTFONTS} environment variable! (will sleep for 5 minutes)"
-       sleep 300
-       exit 111
-fi
-
-
-if [ "${coredump_output:=''}" ] ; then
-       # Ensure that the output directory exists.
-       if [[ ! -d ${crashmon_output} ]] ; then
-               mkdir -p "${crashmon_output}"
-       fi
-
-       ulimit -c "${crashmon_max_size:=unlimited}"
-fi
-
-
-if [ "${ccache_path}" ] ; then
-       export PATH="${ccache_path}:${PATH}"
-fi
-
-: ${buildbot_user:=${USER}}
-
-cd "${buildbot_path}"
-exec /usr/bin/env -          \
-               TERM=dumb                 \
-               TZ=PST8PDT                 \
-               PATH="${PATH}"              \
-               SHELL=/bin/bash              \
-               LANG=en_US.UTF-8              \
-               USER="${buildbot_user}"        \
-               LOGNAME="${buildbot_user}"      \
-               HOME="/home/${buildbot_user}"    \
-               DISPLAY="${xvfb_display:-':10'}"  \
-               MAIL="/var/mail/${buildbot_user}"  \
-       /usr/bin/setuidgid "${buildbot_user}" \
-       /usr/bin/twistd -noy buildbot.tac
-
diff --git a/Tools/BuildSlaveSupport/gtk/daemontools-buildbot.conf b/Tools/BuildSlaveSupport/gtk/daemontools-buildbot.conf
deleted file mode 100644 (file)
index 06af29f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2010 Igalia S.L. All rights reserved.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-
-# Path to the Buildbot slave directory
-#
-buildbot_path="/home/slave/webkitgtk"
-
-# User account used to run Buildbot.
-#
-buildbot_user="slave"
-
-# Path to a directory where to log Buildbot output
-#
-buildbot_log_path="/var/log/buildbot"
-
-
-# If you want to use ccache, set a path to where synlinks with tool
-# names pointing to ccache are installed. In Debian systems this
-# would be /usr/lib/ccache. Set to empty to disable.
-#
-ccache_path="/usr/lib/ccache"
-
-
-# Environment variables. Prefix them with "env_".
-#
-env_CFLAGS="-pipe"
-env_CXXFLAGS="-pipe"
-env_LDFLAGS="-no-install -no-fast-install"
-env_WEBKIT_TESTFONTS="/home/${buildbot_user}/testfonts"
-
diff --git a/Tools/BuildSlaveSupport/gtk/pulseaudio/run b/Tools/BuildSlaveSupport/gtk/pulseaudio/run
deleted file mode 100755 (executable)
index 7c117ad..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#! /usr/bin/env bash
-#
-# Copyright (C) 2010 Igalia S.L. All rights reserved.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-exec 2>&1
-exec /usr/bin/pulseaudio --system \
-       --disallow-exit --disallow-module-loading \
-       --log-target=syslog
-
index d2fdde1..90a0861 100644 (file)
@@ -1,3 +1,115 @@
+2020-03-18  Philippe Normand  <pnormand@igalia.com>
+
+        [GTK][WPE] Migrate to Flatpak-based dev SDK
+        https://bugs.webkit.org/show_bug.cgi?id=205658
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        JHBuild will now be used only if the WEBKIT_JHBUILD environment
+        variable is set to 1, which is the case for the time being on the
+        GTK and WPE EWS/build bots.
+
+        By default the build dependencies are now locally installed from a
+        Flatpak repository hosted at https://software.igalia.com. The
+        repository can be regenerated with the scripts from the
+        webkit-flatpak-sdk Github project
+        (https://github.com/Igalia/webkit-flatpak-sdk). This is done
+        transparently with the update-webkit{gtk,wpe}-libs scripts. As
+        there is no need to rebuild the dependencies from scratch, the
+        developer user-experience should now be much more friendly and
+        overall build times reduced.
+
+        As an additional commodity, the new environment supports the
+        GStreamer gst-build-based workflow. Just set the GST_BUILD_PATH
+        environment variable to your gst-build path. This feature was
+        contributed by Thibault Saunier.
+
+        The JHBuild infrastructure will be removed once all the bots have
+        been switched over to Flatpak.
+
+        * BuildSlaveSupport/ews-build/steps.py:
+        (InstallGtkDependencies):
+        (InstallWpeDependencies):
+        (CompileWebKit.start):
+        * BuildSlaveSupport/gtk/buildbot/run:
+        * Scripts/build-webkit:
+        * Scripts/run-bindings-tests:
+        * Scripts/run-builtins-generator-tests:
+        * Scripts/run-gtk-tests:
+        * Scripts/run-javascriptcore-tests:
+        * Scripts/run-minibrowser:
+        * Scripts/run-qt-wpe-minibrowser:
+        * Scripts/run-webdriver-tests:
+        * Scripts/run-wpe-tests:
+        * Scripts/test-webkitperl:
+        * Scripts/test-webkitpy:
+        * Scripts/test262-runner:
+        * Scripts/update-webkit-flatpak: Renamed from Tools/Scripts/update-webkitgtk-flatpak.
+        * Scripts/update-webkitgtk-libs:
+        * Scripts/update-webkitwpe-flatpak: Removed.
+        * Scripts/update-webkitwpe-libs:
+        * Scripts/webkitdirs.pm:
+        (getUserFlatpakPath):
+        (inFlatpakSandbox):
+        (runInFlatpakIfAvailable):
+        (wrapperPrefixIfNeeded):
+        (shouldUseJhbuild):
+        (shouldUseFlatpak):
+        (shouldRemoveCMakeCache):
+        * Scripts/webkitpy/common/system/executive.py:
+        (Executive.kill_all):
+        * Scripts/webkitpy/port/base.py:
+        (Port._path_to_apache):
+        (Port._should_run_as_pixel_test):
+        (Port._in_flatpak_sandbox):
+        * Scripts/webkitpy/port/gtk.py:
+        (GtkPort.setup_environ_for_server):
+        (GtkPort._get_crash_log):
+        * Scripts/webkitpy/port/linux_get_crash_log.py:
+        (GDBCrashLogGenerator):
+        (GDBCrashLogGenerator.__init__):
+        (GDBCrashLogGenerator.generate_crash_log):
+        * Scripts/webkitpy/port/linux_get_crash_log_unittest.py:
+        (GDBCrashLogGeneratorTest.test_generate_crash_log):
+        * Scripts/webkitpy/port/wpe.py:
+        (WPEPort.setup_environ_for_server):
+        (WPEPort._get_crash_log):
+        * Scripts/webkitpy/port/xvfbdriver.py:
+        (XvfbDriver._setup_environ_for_test):
+        * WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp:
+        (WTR::getFontsPath):
+        * WebKitTestRunner/InjectedBundle/wpe/ActivateFontsWPE.cpp:
+        (WTR::getFontsPath):
+        * flatpak/files/default.xkm: Removed.
+        * flatpak/files/httpd-autogen.sh: Removed.
+        * flatpak/flatpakutils.py:
+        (check_flatpak):
+        (FlatpakRepos.update):
+        (FlatpakPackage.__repr__):
+        (FlatpakPackage.__str__):
+        (WebkitFlatpak.load_from_args):
+        (WebkitFlatpak.__init__):
+        (WebkitFlatpak.clean_args):
+        (WebkitFlatpak.setup_builddir):
+        (WebkitFlatpak):
+        (WebkitFlatpak.setup_gstbuild):
+        (WebkitFlatpak.run_in_sandbox):
+        (WebkitFlatpak.run):
+        (WebkitFlatpak.has_environment):
+        (WebkitFlatpak.save_config):
+        (WebkitFlatpak.setup_dev_env):
+        (WebkitFlatpak.install_all):
+        (WebkitFlatpak.run_gdb):
+        * flatpak/org.webkit.CommonModules.yaml: Removed.
+        * flatpak/org.webkit.GTK.yaml: Removed.
+        * flatpak/org.webkit.WPE.yaml: Removed.
+        * flatpak/org.webkit.WPEModules.yaml: Removed.
+        * flatpak/org.webkit.WPEQT.yaml: Removed.
+        * flatpak/org.webkit.WebKit.yaml: Removed.
+        * flatpak/patches/httpd-0001-configure-use-pkg-config-for-PCRE-detection.patch: Removed.
+        * flatpak/patches/libgcrypt-0001-Use-pkg-config-to-detect-gpg-error.patch: Removed.
+        * flatpak/patches/xvfb-0001-HACK-Avoid-compiling-a-kbm-file.patch: Removed.
+
 2020-03-17  Kate Cheney  <katherine_cheney@apple.com>
 
         Expand In-App-Browser-Privacy testing
index d0afccd..123f3b9 100755 (executable)
@@ -42,6 +42,13 @@ sub writeCongrats();
 
 prohibitUnknownPort();
 
+if (shouldUseFlatpak()) {
+    print "Building flatpak based environment\n";
+    my @command = (File::Spec->catfile(sourceDir(), "Tools", "Scripts", "build-jsc"));
+    runInFlatpak(@command);
+}
+
+
 my $shouldRunStaticAnalyzer = 0;
 my $minimal = 0;
 my $coverageSupport = 0;
index fc0664a..099d33a 100755 (executable)
@@ -53,8 +53,8 @@ setConfiguration();
 
 if (shouldUseFlatpak()) {
     print "Building flatpak based environment\n";
-
-    runInFlatpak("/app/webkit/Tools/Scripts/build-webkit");
+    my @command = (File::Spec->catfile(sourceDir(), "Tools", "Scripts", "build-webkit"));
+    runInFlatpak(@command);
 }
 
 my $originalWorkingDirectory = getcwd();
index f6e4477..0ac0b3a 100755 (executable)
@@ -33,6 +33,11 @@ import os
 import sys
 from webkitpy.common.system import executive
 
+top_level_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
+sys.path.insert(0, os.path.join(top_level_directory, 'Tools', 'flatpak'))
+import flatpakutils
+flatpakutils.run_in_sandbox_if_available(sys.argv)
+
 def main(argv):
     """Runs WebCore bindings code generators on test IDL files and compares
     the results with reference files.
index 2398c78..fbb0864 100755 (executable)
 import sys
 from webkitpy.common.system import executive
 
+import os
+top_level_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
+sys.path.insert(0, os.path.join(top_level_directory, 'Tools', 'flatpak'))
+import flatpakutils
+flatpakutils.run_in_sandbox_if_available(sys.argv)
+
 def main(argv):
     """Runs the JS builtins code generator on test input files and compares
     the results with reference files.
index 41b05e2..d39748f 100755 (executable)
@@ -133,7 +133,7 @@ if __name__ == "__main__":
     if not flatpakutils.is_sandboxed() and not jhbuildutils.enter_jhbuild_environment_if_available("gtk"):
         print '***'
         print '*** Warning: jhbuild environment not present and not running in flatpak.'
-        print '*** Run update-webkitgtk-libs or update-webkitgtk-flatpak before build-webkit to ensure proper testing..'
+        print '*** Run update-webkitgtk-libs or update-webkit-flatpak before build-webkit to ensure proper testing..'
         print '***'
 
     option_parser = optparse.OptionParser(usage='usage: %prog [options] [test...]')
index 9f14507..6a5d1d1 100755 (executable)
@@ -46,6 +46,12 @@ use Text::ParseWords;
 setConfiguration();
 my $configuration = configuration();
 
+if (shouldUseFlatpak()) {
+    my @command = (File::Spec->catfile(sourceDir(), "Tools", "Scripts", "run-javascriptcore-tests"));
+    runInFlatpak(@command);
+}
+
+
 # These variables are intentionally left undefined.
 my $root;
 my $showHelp;
@@ -539,7 +545,7 @@ sub runTest {
     chdir($productDir) or die "Failed to switch directory to '$productDir'\n";
     my @command = (testPath($productDir, $testName));
     unshift @command, ("xcrun", "-sdk", xcodeSDK(), "sim") if willUseIOSSimulatorSDK();
-    unshift @command, wrapperPrefixIfNeeded() if shouldUseJhbuild();
+    unshift @command, wrapperPrefixIfNeeded() if isGtk() or isWPE();
 
     if ($envVars ne "") {
         foreach my $var (split(/\s+/, $envVars)) {
@@ -789,7 +795,7 @@ sub runJSCStressTests
         push(@jscStressDriverCmd, "--no-copy");
     }
 
-    unshift @jscStressDriverCmd, wrapperPrefixIfNeeded() if shouldUseJhbuild();
+    unshift @jscStressDriverCmd, wrapperPrefixIfNeeded() if isGtk() or isWPE();
 
     # End option processing, the rest of the arguments are tests
     push(@jscStressDriverCmd, "--");
index 4cf6be4..90cd3fa 100755 (executable)
@@ -45,7 +45,8 @@ prohibitUnknownPort();
 setConfiguration();
 
 if (isGtk() || isWPE()) {
-    runInFlatpakIfAvailable("/app/webkit/Tools/Scripts/run-minibrowser");
+    my @command = (File::Spec->catfile(sourceDir(), "Tools", "Scripts", "run-minibrowser"));
+    runInFlatpakIfAvailable(@command);
 
     # Check to see that all the frameworks are built.
     checkFrameworks();
index 1bf8ec8..c0d8783 100755 (executable)
 """Run performance tests."""
 
 import logging
+import os
 import sys
 
+top_level_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
+sys.path.insert(0, os.path.join(top_level_directory, 'Tools', 'flatpak'))
+import flatpakutils
+flatpakutils.run_in_sandbox_if_available(sys.argv)
+
 from webkitpy.performance_tests.perftestsrunner import PerfTestsRunner
 
 if '__main__' == __name__:
index 52a38e1..8c8ef70 100755 (executable)
@@ -38,9 +38,13 @@ my @jhbuildWrapper;
 my $configuration = passedConfiguration();
 my $productDir = productDir();
 
-$libPath = "/app/webkit/WebKitBuild/$configuration/lib/qt5/qml" if $configuration;
-$ENV{"QML2_IMPORT_PATH"} = "$libPath" if $libPath;
-runInFlatpakIfAvailable("/app/webkit/Tools/Scripts/run-qt-wpe-minibrowser");
+if ($configuration) {
+    $libPath = File::Spec->catfile(sourceDir(), "WebKitBuild", "$configuration", "lib", "qt5", "qml");
+    $ENV{"QML2_IMPORT_PATH"} = "$libPath";
+}
+
+my @command = (File::Spec->catfile(sourceDir(), "Tools", "Scripts", "run-qt-wpe-minibrowser"));
+runInFlatpakIfAvailable(@command);
 
 # Check to see that all the frameworks are built.
 checkFrameworks();
index acc35f7..c3004d4 100755 (executable)
@@ -78,7 +78,7 @@ if port.name() in ['gtk', 'wpe']:
         if not jhbuildutils.enter_jhbuild_environment_if_available(port.name()):
             print '***'
             print '*** Warning: jhbuild environment not present and not running in flatpak.'
-            print '*** Run update-webkitgtk-libs or update-webkitgtk-flatpak before build-webkit to ensure proper testing..'
+            print '*** Run update-webkitgtk-libs or update-webkit-flatpak before build-webkit to ensure proper testing..'
             print '***'
 
 port._display_server = options.display_server
index 8f7749e..f34c197 100755 (executable)
@@ -51,7 +51,7 @@ if __name__ == "__main__":
     if not flatpakutils.is_sandboxed() and not jhbuildutils.enter_jhbuild_environment_if_available("wpe"):
         print '***'
         print '*** Warning: jhbuild environment not present and not running in flatpak.'
-        print '*** Run update-webkitgtk-libs or update-webkitgtk-flatpak before build-webkit to ensure proper testing..'
+        print '*** Run update-webkitwpe-libs or update-webkit-flatpak before build-webkit to ensure proper testing..'
         print '***'
 
     option_parser = optparse.OptionParser(usage='usage: %prog [options] [test...]')
index 6495696..dc81c17 100755 (executable)
 
 use strict;
 use warnings;
+use File::Basename;
+use File::Find;
+use File::Spec;
+use FindBin;
+use Getopt::Long qw(:config pass_through no_auto_abbrev);
+use lib $FindBin::Bin;
+use webkitdirs;
 
 use File::Spec;
 use FindBin;
@@ -39,6 +46,11 @@ use Test::Harness;
 use lib $FindBin::Bin; # so this script can be run from any directory.
 use VCSUtils;
 
+if (shouldUseFlatpak()) {
+    my @command = (File::Spec->catfile(sourceDir(), "Tools", "Scripts", "test-webkitperl"));
+    runInFlatpak(@command);
+}
+
 # Change the working directory so that we can pass shorter, relative
 # paths to runtests(), rather than longer, absolute paths.
 #
index ee682cc..42388e9 100755 (executable)
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 from webkitpy.common import multiprocessing_bootstrap
 
+import os, sys
+top_level_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
+sys.path.insert(0, os.path.join(top_level_directory, 'Tools', 'flatpak'))
+import flatpakutils
+flatpakutils.run_in_sandbox_if_available(sys.argv)
+
 multiprocessing_bootstrap.run('webkitpy', 'test', 'main.py')
index a131bcf..af7ad5e 100755 (executable)
@@ -35,6 +35,26 @@ use FindBin;
 use Config;
 
 BEGIN {
+    use lib $FindBin::Bin;
+    use File::Spec::Functions qw(catfile);
+
+    if (!grep(/^--no-flatpak-check$/, @ARGV)) {
+        if (eval {require webkitdirs; 1;}) {
+            webkitdirs->import(qw(shouldUseFlatpak runInFlatpak sourceDir));
+            if (shouldUseFlatpak()) {
+                print "Running in flatpak based environment\n";
+                my @command = (File::Spec->catfile(sourceDir(), "Tools", "Scripts", "test262-runner"));
+                # Prevent exec'd test262-runner process from importing
+                # webkitdirs so that it can succeed later on in the Runner
+                # module... Perl. ¯\_(ツ)_/¯
+                push(@ARGV, "--no-flatpak-check");
+                runInFlatpak(@command);
+            }
+        }
+    }
+}
+
+BEGIN {
     $ENV{DBIC_OVERWRITE_HELPER_METHODS_OK} = 1;
     $ENV{T262_EXEC_BIN} = "$FindBin::Bin/test262";
     unshift @INC, "$FindBin::Bin/test262";
similarity index 93%
rename from Tools/Scripts/update-webkitgtk-flatpak
rename to Tools/Scripts/update-webkit-flatpak
index 0956f1f..a86b81a 100755 (executable)
@@ -25,4 +25,4 @@ sys.path.insert(0, os.path.join(top_level_directory, "Tools", "flatpak"))
 from flatpakutils import WebkitFlatpak
 
 if __name__ == "__main__":
-    WebkitFlatpak.load_from_args(["--gtk", "--update"] + sys.argv[1:]).run()
+    WebkitFlatpak.load_from_args(["--update"] + sys.argv[1:]).run()
index 2e1c02f..2e8a878 100755 (executable)
@@ -22,4 +22,8 @@ use lib $FindBin::Bin;
 use webkitdirs;
 
 my $scriptsDir = relativeScriptsDir();
-system("perl", "$scriptsDir/update-webkit-libs-jhbuild", "--gtk", @ARGV) == 0 or die $!;
+if (defined $ENV{'WEBKIT_JHBUILD'} and $ENV{'WEBKIT_JHBUILD'}) {
+    system("perl", "$scriptsDir/update-webkit-libs-jhbuild", "--gtk", @ARGV) == 0 or die $!;
+} else {
+    system("$scriptsDir/update-webkit-flatpak", @ARGV) == 0 or die $!;
+}
diff --git a/Tools/Scripts/update-webkitwpe-flatpak b/Tools/Scripts/update-webkitwpe-flatpak
deleted file mode 100755 (executable)
index 564e876..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-# Copyright (C) 2018 Igalia S.L.
-# Copyright (c) 2018, Thibault Saunier <tsaunier@igalia.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, write to the
-# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-# pylint: disable=missing-docstring,invalid-name
-import os
-import sys
-
-top_level_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", ".."))
-sys.path.insert(0, os.path.join(top_level_directory, "Tools", "flatpak"))
-from flatpakutils import WebkitFlatpak
-
-if __name__ == "__main__":
-    WebkitFlatpak.load_from_args(["--wpe", "--update"] + sys.argv[1:]).run()
index 6b4b46f..cdc4c7d 100755 (executable)
@@ -22,4 +22,8 @@ use lib $FindBin::Bin;
 use webkitdirs;
 
 my $scriptsDir = relativeScriptsDir();
-system("perl", "$scriptsDir/update-webkit-libs-jhbuild", "--wpe", @ARGV) == 0 or die $!;
+if (defined $ENV{'WEBKIT_JHBUILD'} and $ENV{'WEBKIT_JHBUILD'}) {
+    system("perl", "$scriptsDir/update-webkit-libs-jhbuild", "--wpe", @ARGV) == 0 or die $!;
+} else {
+    system("$scriptsDir/update-webkit-flatpak", @ARGV) == 0 or die $!;
+}
index 479bb43..8f867b5 100755 (executable)
@@ -91,7 +91,10 @@ BEGIN {
        &setupUnixWebKitEnvironment
        &sharedCommandLineOptions
        &sharedCommandLineOptionsUsage
+       &shouldUseFlatpak
+       &runInFlatpak
        &shutDownIOSSimulatorDevice
+       &sourceDir
        &willUseIOSDeviceSDK
        &willUseIOSSimulatorSDK
        DO_NOT_USE_OPEN_COMMAND
@@ -2048,20 +2051,11 @@ sub getJhbuildPath()
     return File::Spec->catdir(@jhbuildPath);
 }
 
-sub getFlatpakPath()
+sub getUserFlatpakPath()
 {
-    my @flatpakBuildPath = File::Spec->splitdir(baseProductDir());
-    if (isGtk()) {
-        push(@flatpakBuildPath, "GTK");
-    } elsif (isWPE()) {
-        push(@flatpakBuildPath, "WPE");
-    } else {
-        die "Cannot get Flatpak path for platform that isn't GTK+ or WPE.\n";
-    }
-    my @configuration = configuration();
-    push(@flatpakBuildPath, "FlatpakTree$configuration");
-
-    return File::Spec->catdir(@flatpakBuildPath);
+    my @flatpakPath = File::Spec->splitdir(baseProductDir());
+    push(@flatpakPath, "UserFlatpak");
+    return File::Spec->catdir(@flatpakPath);
 }
 
 sub isCachedArgumentfileOutOfDate($@)
@@ -2088,15 +2082,19 @@ sub isCachedArgumentfileOutOfDate($@)
 
 sub inFlatpakSandbox()
 {
-    if (-f "/.flatpak-info") {
-        return 1;
-    }
-
-    return 0;
+    return (-f "/.flatpak-info");
 }
 
 sub runInFlatpak(@)
 {
+    if (isGtk() && checkForArgumentAndRemoveFromARGV("--update-gtk")) {
+        system("perl", File::Spec->catfile(sourceDir(), "Tools", "Scripts", "update-webkitgtk-libs"), argumentsForConfiguration()) == 0 or die $!;
+    }
+
+    if (isWPE() && checkForArgumentAndRemoveFromARGV("--update-wpe")) {
+        system("perl", File::Spec->catfile(sourceDir(), "Tools", "Scripts", "update-webkitwpe-libs"), argumentsForConfiguration()) == 0 or die $!;
+    }
+
     my @arg = @_;
     my @command = (File::Spec->catfile(sourceDir(), "Tools", "Scripts", "webkit-flatpak"));
     exec @command, argumentsForConfiguration(), "--command", @_, argumentsForConfiguration(), @ARGV or die;
@@ -2113,45 +2111,65 @@ sub runInFlatpakIfAvailable(@)
         return 0;
     }
 
-    if (! -e getFlatpakPath()) {
-        return 0;
+    if (! -e getUserFlatpakPath()) {
+      return 0;
     }
 
     runInFlatpak(@_)
 }
 
-sub wrapperPrefixIfNeeded()
+sub jhbuildWrapperPrefix()
 {
+    my @prefix = (File::Spec->catfile(sourceDir(), "Tools", "jhbuild", "jhbuild-wrapper"));
+    if (isGtk()) {
+        push(@prefix, "--gtk");
+    } elsif (isWPE()) {
+        push(@prefix, "--wpe");
+    }
+    push(@prefix, "run");
+
+    return @prefix;
+}
 
+sub wrapperPrefixIfNeeded()
+{
     if (isAnyWindows() || isJSCOnly() || isPlayStation()) {
         return ();
     }
     if (isAppleCocoaWebKit()) {
         return ("xcrun");
     }
-    if (shouldUseJhbuild() and ! shouldUseFlatpak()) {
-        my @prefix = (File::Spec->catfile(sourceDir(), "Tools", "jhbuild", "jhbuild-wrapper"));
-        if (isGtk()) {
-            push(@prefix, "--gtk");
-        } elsif (isWPE()) {
-            push(@prefix, "--wpe");
-        }
-        push(@prefix, "run");
 
-        return @prefix;
+    # Returning () here means either Flatpak or no wrapper will be used.
+    if (isGtk() or isWPE()) {
+        # Respect user's choice.
+        if (defined $ENV{'WEBKIT_JHBUILD'}) {
+            if ($ENV{'WEBKIT_JHBUILD'} and -e getJhbuildPath()) {
+                return jhbuildWrapperPrefix();
+            } else {
+                return ();
+            }
+            # or let Flatpak take precedence over JHBuild.
+        } elsif (-e getUserFlatpakPath()) {
+            return ();
+        } elsif (-e getJhbuildPath()) {
+            return jhbuildWrapperPrefix();
+        }
     }
-
     return ();
 }
 
-sub shouldUseJhbuild()
-{
-    return ((isGtk() or isWPE()) and -e getJhbuildPath());
-}
-
 sub shouldUseFlatpak()
 {
-    return ((isGtk() or isWPE()) and ! inFlatpakSandbox() and -e getFlatpakPath());
+    # TODO: Use flatpak for JSCOnly on Linux? Could be useful when the SDK
+    # supports cross-compilation for ARMv7 and Aarch64 for instance.
+
+    if (!isGtk() and !isWPE()) {
+        return 0;
+    }
+
+    my @prefix = wrapperPrefixIfNeeded();
+    return ((! inFlatpakSandbox()) and (@prefix == 0) and -e getUserFlatpakPath());
 }
 
 sub cmakeCachePath()
@@ -2218,7 +2236,7 @@ sub shouldRemoveCMakeCache(@)
     }
 
     # If a change on the JHBuild moduleset has been done, we need to clean the cache as well.
-    if (isGtk() || isWPE()) {
+    if (! shouldUseFlatpak() and (isGtk() || isWPE())) {
         my $jhbuildRootDirectory = File::Spec->catdir(getJhbuildPath(), "Root");
         # The script update-webkit-libs-jhbuild shall re-generate $jhbuildRootDirectory if the moduleset changed.
         if (-d $jhbuildRootDirectory && $cacheFileModifiedTime < stat($jhbuildRootDirectory)->mtime) {
@@ -2408,12 +2426,14 @@ sub buildCMakeProjectOrExit($$$@)
 
     exit(exitStatus(cleanCMakeGeneratedProject())) if $clean;
 
-    if (isGtk() && checkForArgumentAndRemoveFromARGV("--update-gtk")) {
-        system("perl", "$sourceDir/Tools/Scripts/update-webkitgtk-libs") == 0 or die $!;
-    }
+    if (wrapperPrefixIfNeeded() == jhbuildWrapperPrefix()) {
+        if (isGtk() && checkForArgumentAndRemoveFromARGV("--update-gtk")) {
+            system("perl", File::Spec->catfile(sourceDir(), "Tools", "Scripts", "update-webkitgtk-libs")) == 0 or die $!;
+        }
 
-    if (isWPE() && checkForArgumentAndRemoveFromARGV("--update-wpe")) {
-        system("perl", "$sourceDir/Tools/Scripts/update-webkitwpe-libs") == 0 or die $!;
+        if (isWPE() && checkForArgumentAndRemoveFromARGV("--update-wpe")) {
+            system("perl", File::Spec->catfile(sourceDir(), "Tools", "Scripts", "update-webkitwpe-libs")) == 0 or die $!;
+        }
     }
 
     $returnCode = exitStatus(generateBuildSystemFromCMakeProject($prefixPath, @cmakeArgs));
index e1a19ce..2e968e3 100644 (file)
@@ -893,6 +893,7 @@ class Port(object):
             'LANG',
             'LD_LIBRARY_PATH',
             'TERM',
+            'TZ',
             'XDG_DATA_DIRS',
             'XDG_RUNTIME_DIR',
 
@@ -1220,7 +1221,7 @@ class Port(object):
         This is needed only by ports that use the apache_http_server module."""
         # The Apache binary path can vary depending on OS and distribution
         # See http://wiki.apache.org/httpd/DistrosDefaultLayout
-        for path in ["/usr/sbin/httpd", "/usr/sbin/apache2", "/app/bin/httpd"]:
+        for path in ["/usr/sbin/httpd", "/usr/sbin/apache2", "/usr/bin/httpd"]:
             if self._filesystem.exists(path):
                 return path
         _log.error("Could not find apache. Not installed or unknown path.")
@@ -1452,14 +1453,8 @@ class Port(object):
         # --pixel-test-directory is not specified.
         return True
 
-    def _should_use_flatpak(self):
-        suffix = ""
-        if self.port_name:
-            suffix = self.port_name.upper()
-        return self._filesystem.exists(self.path_from_webkit_base('WebKitBuild', suffix, "FlatpakTree"))
-
     def _in_flatpak_sandbox(self):
-        return os.path.exists("/.flatpak-info")
+        return self._filesystem.exists("/.flatpak-info")
 
     def _should_use_jhbuild(self):
         if self._in_flatpak_sandbox():
index 68bc169..0ce8aa4 100644 (file)
@@ -122,6 +122,7 @@ class GtkPort(Port):
         environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so')
         environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('lib', 'plugins')
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR')
+        self._copy_value_from_environ_if_set(environment, 'WEBKIT_JHBUILD')
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_TOP_LEVEL')
         self._copy_value_from_environ_if_set(environment, 'USE_PLAYBIN3')
         self._copy_value_from_environ_if_set(environment, 'GST_DEBUG')
@@ -134,10 +135,11 @@ class GtkPort(Port):
             if self._should_use_jhbuild():
                 llvmpipe_libgl_path = self.host.executive.run_command(self._jhbuild_wrapper + ['printenv', 'LLVMPIPE_LIBGL_PATH'],
                                                                     ignore_errors=True).strip()
+                dri_libgl_path = os.path.join(llvmpipe_libgl_path, "dri")
             else:  # in flatpak
-                llvmpipe_libgl_path = "/app/softGL/lib"
+                llvmpipe_libgl_path = "/usr/lib/x86_64-linux-gnu/"
+                dri_libgl_path = os.path.join(llvmpipe_libgl_path, "GL", "lib", "dri")
 
-            dri_libgl_path = os.path.join(llvmpipe_libgl_path, "dri")
             if os.path.exists(os.path.join(llvmpipe_libgl_path, "libGL.so")) and os.path.exists(os.path.join(dri_libgl_path, "swrast_dri.so")):
                 # Make sure va-api support gets disabled because it's incompatible with Mesa's softGL driver.
                 environment['LIBVA_DRIVER_NAME'] = "null"
@@ -148,7 +150,7 @@ class GtkPort(Port):
                 if os.environ.get('LD_LIBRARY_PATH'):
                     environment['LD_LIBRARY_PATH'] += ':%s' % os.environ.get('LD_LIBRARY_PATH')
             else:
-                _log.warning("Can't find Gallium llvmpipe driver. Try to run update-webkitgtk-libs or update-webkitgtk-flatpak")
+                _log.warning("Can't find Gallium llvmpipe driver. Try to run update-webkitgtk-libs or update-webkit-flatpak")
         if self.get_option("leaks"):
             # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind.
             environment['G_SLICE'] = 'always-malloc'
@@ -237,7 +239,7 @@ class GtkPort(Port):
 
     def _get_crash_log(self, name, pid, stdout, stderr, newer_than, target_host=None):
         return GDBCrashLogGenerator(self._executive, name, pid, newer_than,
-            self._filesystem, self._path_to_driver).generate_crash_log(stdout, stderr)
+                                    self._filesystem, self._path_to_driver, self.port_name, self.get_option('configuration')).generate_crash_log(stdout, stderr)
 
     def test_expectations_file_position(self):
         # GTK port baseline search path is gtk -> wk2 -> generic (as gtk-wk2 and gtk baselines are merged), so port test expectations file is at third to last position.
index 9adc463..2e03dff 100644 (file)
@@ -37,18 +37,22 @@ import time
 
 from webkitpy.common.system.executive import ScriptError
 from webkitpy.common.unicode_compatibility import decode_if_necessary
+from webkitpy.common.webkit_finder import WebKitFinder
 
 
 class GDBCrashLogGenerator(object):
     _find_pid_regex = re.compile(r'PID: (\d+) \(.*\)')
 
-    def __init__(self, executive, name, pid, newer_than, filesystem, path_to_driver):
+    def __init__(self, executive, name, pid, newer_than, filesystem, path_to_driver, port_name, configuration):
         self.name = name
         self.pid = pid
         self.newer_than = newer_than
         self._filesystem = filesystem
         self._path_to_driver = path_to_driver
         self._executive = executive
+        self._port_name = port_name
+        self._configuration = configuration
+        self._webkit_finder = WebKitFinder(filesystem)
 
     def _get_gdb_output(self, coredump_path):
         process_name = self._filesystem.join(os.path.dirname(str(self._path_to_driver())), self.name)
@@ -67,6 +71,9 @@ class GDBCrashLogGenerator(object):
         return filename
 
     def _get_trace_from_systemd(self, coredumpctl, pid):
+        if os.path.isfile("/.flatpak-info"):
+            return self._get_trace_from_flatpak()
+
         # Letting up to 5 seconds for the backtrace to be generated on the systemd side
         for try_number in range(5):
             if try_number != 0:
@@ -92,12 +99,24 @@ class GDBCrashLogGenerator(object):
                         temp_file.name], return_exit_code=True):
                     continue
 
-                res = self._get_gdb_output(self._get_tmp_file_name(coredumpctl, temp_file.name))
-
-                return res
+                return self._get_gdb_output(self._get_tmp_file_name(coredumpctl, temp_file.name))
 
         return '', []
 
+    def _get_trace_from_flatpak(self):
+        if self.newer_than:
+            coredump_since = "--gdb-stack-trace=@%f" % self.newer_than
+        else:
+            coredump_since = "--gdb-stack-trace"
+        webkit_flatpak_path = self._webkit_finder.path_to_script('webkit-flatpak')
+        cmd = ['flatpak-spawn', '--host', webkit_flatpak_path, '--%s' % self._port_name,
+               "--%s" % self._configuration.lower(), coredump_since]
+
+        proc = self._executive.popen(cmd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        crash_log, stderr = proc.communicate()
+        errors = decode_if_necessary(str(stderr or '<empty>'), errors='ignore').splitlines()
+        return crash_log, errors
+
     def generate_crash_log(self, stdout, stderr):
         pid_representation = str(self.pid or '<unknown>')
         log_directory = os.environ.get("WEBKIT_CORE_DUMPS_DIRECTORY")
index 9f3b7e3..3a39e84 100644 (file)
@@ -46,7 +46,7 @@ class GDBCrashLogGeneratorTest(unittest.TestCase):
         executive = MockExecutive()
         executive._proc = MockProcess()
         executive._proc.stdout = 'STDERR: <empty>'
-        generator = GDBCrashLogGenerator(executive, 'DumpRenderTree', 28529, newer_than=None, filesystem=MockFileSystem({'/path/to/coredumps': ''}), path_to_driver=None)
+        generator = GDBCrashLogGenerator(executive, 'DumpRenderTree', 28529, newer_than=None, filesystem=MockFileSystem({'/path/to/coredumps': ''}), path_to_driver=None, port_name="gtk", configuration="Debug")
 
         core_directory = os.environ.get('WEBKIT_CORE_DUMPS_DIRECTORY', '/path/to/coredumps')
         core_pattern = generator._filesystem.join(core_directory, "core-pid_%p.dump")
index 00ce527..546925f 100644 (file)
@@ -77,6 +77,7 @@ class WPEPort(Port):
         environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('lib', 'plugins')
         environment['WEBKIT_EXEC_PATH'] = self._build_path('bin')
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR')
+        self._copy_value_from_environ_if_set(environment, 'WEBKIT_JHBUILD')
         self._copy_value_from_environ_if_set(environment, 'WEBKIT_TOP_LEVEL')
         self._copy_value_from_environ_if_set(environment, 'USE_PLAYBIN3')
         self._copy_value_from_environ_if_set(environment, 'GST_DEBUG')
@@ -121,7 +122,8 @@ class WPEPort(Port):
         return 2
 
     def _get_crash_log(self, name, pid, stdout, stderr, newer_than, target_host=None):
-        return GDBCrashLogGenerator(self._executive, name, pid, newer_than, self._filesystem, self._path_to_driver).generate_crash_log(stdout, stderr)
+        return GDBCrashLogGenerator(self._executive, name, pid, newer_than,
+                                    self._filesystem, self._path_to_driver, self.port_name, self.get_option('configuration')).generate_crash_log(stdout, stderr)
 
     def configuration_for_upload(self, host=None):
         configuration = super(WPEPort, self).configuration_for_upload(host=host)
index 3f8e244..81bcd96 100644 (file)
@@ -65,8 +65,13 @@ CString getOutputDir()
 
 static CString getFontsPath()
 {
+    // Try flatpak sandbox path.
+    GUniquePtr<char>fontsPath(g_build_filename("/usr", "share", "webkitgtk-test-fonts", NULL));
+    if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+        return fontsPath.get();
+
     CString webkitOutputDir = getOutputDir();
-    GUniquePtr<char> fontsPath(g_build_filename(webkitOutputDir.data(), "DependenciesGTK", "Root", "webkitgtk-test-fonts", nullptr));
+    fontsPath.reset(g_build_filename(webkitOutputDir.data(), "DependenciesGTK", "Root", "webkitgtk-test-fonts", nullptr));
     if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
         return fontsPath.get();
 
index a49c7a2..8be736f 100644 (file)
@@ -58,8 +58,13 @@ CString getOutputDir()
 
 static CString getFontsPath()
 {
+    // Try flatpak sandbox path.
+    GUniquePtr<char>fontsPath(g_build_filename("/usr", "share", "webkitgtk-test-fonts", NULL));
+    if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+        return fontsPath.get();
+
     CString webkitOutputDir = getOutputDir();
-    GUniquePtr<char> fontsPath(g_build_filename(webkitOutputDir.data(), "DependenciesWPE", "Root", "webkitgtk-test-fonts", nullptr));
+    fontsPath.reset(g_build_filename(webkitOutputDir.data(), "DependenciesWPE", "Root", "webkitgtk-test-fonts", nullptr));
     if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
         return fontsPath.get();
 
diff --git a/Tools/flatpak/files/default.xkm b/Tools/flatpak/files/default.xkm
deleted file mode 100644 (file)
index 016f6b0..0000000
Binary files a/Tools/flatpak/files/default.xkm and /dev/null differ
diff --git a/Tools/flatpak/files/httpd-autogen.sh b/Tools/flatpak/files/httpd-autogen.sh
deleted file mode 100755 (executable)
index 1c0c483..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-automake --add-missing
-autoreconf --install
index 89ebc67..0514bca 100644 (file)
@@ -48,19 +48,15 @@ except ImportError:
     from urllib2 import urlopen
 
 FLATPAK_REQ = [
-    ("flatpak", "0.10.0"),
-    ("flatpak-builder", "0.10.0"),
+    ("flatpak", "1.4.4"),
 ]
 
 FLATPAK_VERSION = {}
 
-WPE_MANIFEST_MAP = {
-    "qt": "org.webkit.WPEQT.yaml",
-}
-
 scriptdir = os.path.abspath(os.path.dirname(__file__))
 _log = logging.getLogger(__name__)
 
+FLATPAK_USER_DIR_PATH = os.path.realpath(os.path.join(scriptdir, "../../WebKitBuild", "UserFlatpak"))
 
 class Colors:
     HEADER = "\033[95m"
@@ -123,132 +119,6 @@ def check_flatpak(verbose=True):
     return True
 
 
-def remove_extension_points(array):
-    result_args = []
-    for arg in array:
-        if(not arg.startswith('--extension')):
-            result_args.append(arg)
-    return result_args
-
-
-def remove_comments(string):
-    pattern = r"(\".*?\"|\'.*?\')|(/\*.*?\*/|//[^\r\n]*$)"
-    # first group captures quoted strings (double or single)
-    # second group captures comments (//single-line or /* multi-line */)
-    regex = re.compile(pattern, re.MULTILINE | re.DOTALL)
-
-    def _replacer(match):
-        # if the 2nd group (capturing comments) is not None,
-        # it means we have captured a non-quoted (real) comment string.
-        if match.group(2) is not None:
-            return ""  # so we will return empty to remove the comment
-        else:  # otherwise, we will return the 1st group
-            return match.group(1)  # captured quoted-string
-    return regex.sub(_replacer, string)
-
-
-def load_manifest(manifest_path, port_name=None, command=None):
-    is_yaml = manifest_path.endswith('.yaml')
-    with open(manifest_path, "r") as mr:
-        contents = mr.read()
-
-        contents = contents % {"COMMAND": command, "PORTNAME": port_name}
-        if is_yaml:
-            import yaml
-            yaml_load = getattr(yaml, "safe_load", yaml.load)
-            manifest = yaml_load(contents)
-        else:
-            contents = remove_comments(contents)
-            manifest = json.loads(contents)
-
-    return manifest
-
-
-def expand_submodules_recurse(modules, manifest_path, port_name, command):
-    all_modules = []
-    if type(modules) is str:
-        submanifest_path = os.path.join(os.path.dirname(manifest_path), modules)
-        submanifest = load_manifest(submanifest_path, port_name=port_name, command=command)
-        all_modules.extend(expand_submodules_recurse(submanifest, submanifest_path, port_name, command))
-        return all_modules
-
-    # The last recurse manifest expand iteration might lead to a single module.
-    if not isinstance(modules, list):
-        all_modules.append(modules)
-        return all_modules
-
-    for module in modules:
-        if type(module) is str:
-            submanifest_path = os.path.join(os.path.dirname(manifest_path), module)
-            submanifest = load_manifest(submanifest_path, port_name=port_name, command=command)
-            all_modules.extend(expand_submodules_recurse(submanifest, submanifest_path, port_name, command))
-        else:
-            all_modules.append(module)
-
-    return all_modules
-
-def expand_manifest(manifest_path, outfile, port_name, source_root, command):
-    """Creates the manifest file."""
-    try:
-        os.remove(outfile)
-    except OSError:
-        pass
-
-    manifest = load_manifest(manifest_path, port_name=port_name, command=command)
-    if not manifest:
-        return False
-
-    if "sdk-hash" in manifest:
-        del manifest["sdk-hash"]
-    if "runtime-hash" in manifest:
-        del manifest["runtime-hash"]
-
-    all_modules = []
-
-    overriden_modules = []
-    if "WEBKIT_EXTRA_MODULESETS" in os.environ:
-        overriden_modules = load_manifest(os.environ["WEBKIT_EXTRA_MODULESETS"])
-        if not overriden_modules:
-            overriden_modules = []
-    for modules in manifest["modules"]:
-        modules = expand_submodules_recurse(modules, manifest_path, port_name, command)
-
-        if not isinstance(modules, list):
-            modules = [modules]
-
-        for module in modules:
-            for overriden_module in overriden_modules:
-                if module['name'] == overriden_module['name']:
-                    module = overriden_module
-                    overriden_modules.remove(module)
-                    break
-
-            all_modules.append(module)
-
-    # And add overriden modules right before the webkit port build def.
-    for overriden_module in overriden_modules:
-        all_modules.insert(-1, overriden_module)
-
-    manifest["modules"] = all_modules
-    for module in manifest["modules"]:
-        if not module.get("sources"):
-            continue
-
-        if module["sources"][0]["type"] == "git":
-            if port_name == module["name"]:
-                repo = "file://" + source_root
-                module["sources"][0]["url"] = repo
-
-        for source in module["sources"]:
-            if source["type"] == "patch" or (source["type"] == "file" and source.get('path')):
-                source["path"] = os.path.join(os.path.dirname(manifest_path), source["path"])
-
-    with open(outfile, "w") as of:
-        of.write(json.dumps(manifest, indent=4))
-
-    return True
-
-
 class FlatpakObject:
 
     def __init__(self, user):
@@ -280,45 +150,25 @@ class FlatpakPackages(FlatpakObject):
 
         self.repos = repos
 
-        self.runtimes = self.__detect_runtimes()
-        self.apps = self.__detect_apps()
-        self.packages = self.runtimes + self.apps
-
+        self.packages = self.__detect_runtimes()
 
     def __detect_packages(self, *args):
         packs = []
-        if FLATPAK_VERSION["flatpak"] < (1, 1, 2):
-            out = self.flatpak("list", "-d", *args)
-            package_defs = [line for line in out.split("\n") if line]
-            for package_def in package_defs:
-                splited_packaged_def = package_def.split()
-                name, arch, branch = splited_packaged_def[0].split("/")
-
-                # If installed from a file, the package is in no repo
-                repo_name = splited_packaged_def[1]
-                repo = self.repos.repos.get(repo_name)
-
-                packs.append(FlatpakPackage(name, branch, repo, arch))
-        else:
-            out = self.flatpak("list", "--columns=application,arch,branch,origin", *args)
-            package_defs = [line for line in out.split("\n") if line]
-            for package_def in package_defs:
-                name, arch, branch, origin = package_def.split("\t")
+        out = self.flatpak("list", "--columns=application,arch,branch,origin", *args)
+        package_defs = [line for line in out.split("\n") if line]
+        for package_def in package_defs:
+            name, arch, branch, origin = package_def.split("\t")
 
-                # If installed from a file, the package is in no repo
-                repo = self.repos.repos.get(origin)
+            # If installed from a file, the package is in no repo
+            repo = self.repos.repos.get(origin)
 
-                packs.append(FlatpakPackage(name, branch, repo, arch))
+            packs.append(FlatpakPackage(name, branch, repo, arch))
 
         return packs
 
-
     def __detect_runtimes(self):
         return self.__detect_packages("--runtime")
 
-    def __detect_apps(self):
-        return self.__detect_packages()
-
     def __iter__(self):
         for package in self.packages:
             yield package
@@ -333,47 +183,16 @@ class FlatpakRepos(FlatpakObject):
 
     def update(self):
         self.repos = {}
-        if FLATPAK_VERSION["flatpak"] < (1, 1, 2):
-            out = self.flatpak("remote-list", "-d")
-            remotes = [line for line in out.split("\n") if line]
-            for repo in remotes:
-                for components in [repo.split(" "), repo.split("\t")]:
-                    if len(components) == 1:
-                        components = repo.split("\t")
-                    name = components[0]
-                    desc = ""
-                    url = None
-                    for elem in components[1:]:
-                        if not elem:
-                            continue
-                        parsed_url = urlparse(elem)
-                        if parsed_url.scheme:
-                            url = elem
-                            break
-
-                        if desc:
-                            desc += " "
-                        desc += elem
-
-                    if url:
-                        break
-
-                if not url:
-                    Console.message("No valid URI found for: %s", repo)
-                    continue
-
-                self.repos[name] = FlatpakRepo(name, url, desc, repos=self)
-        else:
-            out = self.flatpak("remote-list", "--columns=name,title,url")
-            remotes = [line for line in out.split("\n") if line]
-            for remote in remotes:
-                name, title, url = remote.split("\t")
-                parsed_url = urlparse(url)
-                if not parsed_url.scheme:
-                    Console.message("No valid URI found for: %s", remote)
-                    continue
+        out = self.flatpak("remote-list", "--columns=name,title,url")
+        remotes = [line for line in out.split("\n") if line]
+        for remote in remotes:
+            name, title, url = remote.split("\t")
+            parsed_url = urlparse(url)
+            if not parsed_url.scheme:
+                Console.message("No valid URI found for: %s", remote)
+                continue
 
-                self.repos[name] = FlatpakRepo(name, url, title, repos=self)
+            self.repos[name] = FlatpakRepo(name=name, url=url, desc=title, repos=self)
 
         self.packages = FlatpakPackages(self)
 
@@ -420,7 +239,10 @@ class FlatpakRepo(FlatpakObject):
         if repo_file and not url:
             repo = configparser.ConfigParser()
             repo.read(self.repo_file.name)
-            self.url = repo["Flatpak Repo"]["Url"]
+            try:
+                self.url = repo["Flatpak Repo"]["Url"]
+            except AttributeError:
+                self.url = repo.get("Flatpak Repo", "Url")
         else:
             assert url
 
@@ -449,9 +271,12 @@ class FlatpakPackage(FlatpakObject):
         self.arch = arch
         self.hash = hash
 
-    def __str__(self):
+    def __repr__(self):
         return "%s/%s/%s %s" % (self.name, self.arch, self.branch, self.repo.name)
 
+    def __str__(self):
+        return "%s/%s/%s" % (self.name, self.arch, self.branch)
+
     def is_installed(self, branch):
         if not self.repo:
             # Bundle installed from file
@@ -491,7 +316,7 @@ class FlatpakPackage(FlatpakObject):
         extra_args.append("--assumeyes")
 
         self.flatpak("update", self.name, self.branch, show_output=True,
-                    *extra_args, comment=comment)
+                     *extra_args, comment=comment)
 
 
 @contextmanager
@@ -519,54 +344,58 @@ class WebkitFlatpak:
         general.add_argument('--verbose', action='store_true',
                              help='Show debug message')
         general.add_argument("--debug",
-                            help="Compile with Debug configuration, also installs Sdk debug symboles.",
-                            action="store_true")
+                             help="Compile with Debug configuration, also installs Sdk debug symboles.",
+                             action="store_true")
         general.add_argument("--release", help="Compile with Release configuration.", action="store_true")
         general.add_argument('--platform', action='store', help='Platform to use (e.g., "mac-lion")'),
         general.add_argument('--gtk', action='store_const', dest='platform', const='gtk',
                              help='Alias for --platform=gtk')
         general.add_argument('--wpe', action='store_const', dest='platform', const='wpe',
-                            help=('Alias for --platform=wpe'))
+                             help=('Alias for --platform=wpe'))
         general.add_argument("-nf", "--no-flatpak-update", dest="no_flatpak_update",
-                            action="store_true",
-                            help="Do not update flaptak runtime/sdk")
+                             action="store_true",
+                             help="Do not update flaptak runtime/sdk")
         general.add_argument("-u", "--update", dest="update",
-                            action="store_true",
-                            help="Update the runtime/sdk/app and rebuild the development environment if needed")
+                             action="store_true",
+                             help="Update the runtime/sdk/app and rebuild the development environment if needed")
         general.add_argument("-b", "--build-webkit", dest="build_webkit",
-                            action="store_true",
-                            help="Force rebuilding the app.")
-        general.add_argument("-ba", "--build-all", dest="build_all",
-                            action="store_true",
-                            help="Force rebuilding the app and its dependencies.")
+                             action="store_true",
+                             help="Force rebuilding the app.")
+        general.add_argument("-bgst", "--build-gst", dest="build_gst",
+                             action="store_true",
+                             help="Force rebuilding gst-build, repository path is defined by the `GST_BUILD_PATH` environment variable.")
         general.add_argument("-q", "--quiet", dest="quiet",
-                            action="store_true",
-                            help="Do not print anything")
+                             action="store_true",
+                             help="Do not print anything")
         general.add_argument("-t", "--tests", dest="run_tests",
-                            nargs=argparse.REMAINDER,
-                            help="Run LayoutTests")
+                             nargs=argparse.REMAINDER,
+                             help="Run LayoutTests")
         general.add_argument("-c", "--command",
-                            nargs=argparse.REMAINDER,
-                            help="The command to run in the sandbox",
-                            dest="user_command")
+                             nargs=argparse.REMAINDER,
+                             help="The command to run in the sandbox",
+                             dest="user_command")
         general.add_argument('--available', action='store_true', dest="check_available", help='Check if required dependencies are available.'),
-        general.add_argument("--use-icecream", help="Use the distributed icecream (icecc) compiler.", action="store_true")
-        general.add_argument("--wpe-extension", action="store", dest="wpe_extension", help="WPE Extension to enable")
+        general.add_argument("--use-icecream", dest="use_icecream", help="Use the distributed icecream (icecc) compiler.", action="store_true")
 
         debugoptions = parser.add_argument_group("Debugging")
         debugoptions.add_argument("--gdb", nargs="?", help="Activate gdb, passing extra args to it if wanted.")
+        debugoptions.add_argument("--gdb-stack-trace", dest="gdb_stack_trace", nargs="?",
+                                  help="Dump the stacktrace to stdout. The argument is a timestamp to be parsed by coredumpctl.")
         debugoptions.add_argument("-m", "--coredumpctl-matches", default="", help='Arguments to pass to gdb.')
 
         buildoptions = parser.add_argument_group("Extra build arguments")
         buildoptions.add_argument("--makeargs", help="Optional Makefile flags")
         buildoptions.add_argument("--cmakeargs",
-                                help="One or more optional CMake flags (e.g. --cmakeargs=\"-DFOO=bar -DCMAKE_PREFIX_PATH=/usr/local\")")
+                                  help="One or more optional CMake flags (e.g. --cmakeargs=\"-DFOO=bar -DCMAKE_PREFIX_PATH=/usr/local\")")
 
         general.add_argument("--clean", dest="clean", action="store_true",
-            help="Clean previous builds and restart from scratch")
+                             help="Clean previous builds and restart from scratch")
 
         _, self.args = parser.parse_known_args(args=args, namespace=self)
 
+        if os.environ.get('CCACHE_PREFIX') == 'icecc':
+            self.use_icecream = True
+
         return self
 
     def __init__(self):
@@ -574,15 +403,14 @@ class WebkitFlatpak:
         self.runtime = None
         self.locale = None
         self.sdk = None
-        self.sdk_debug = None
         self.app = None
 
         self.verbose = False
         self.quiet = False
-        self.packs = []
         self.update = False
         self.args = []
         self.finish_args = None
+        self.gdb_stack_trace = False
 
         self.no_flatpak_update = False
         self.release = False
@@ -594,9 +422,10 @@ class WebkitFlatpak:
         self.sandbox_source_root = "/app/webkit"
 
         self.build_webkit = False
+        self.build_gst = False
         self.build_all = False
 
-        self.sdk_branch = None
+        self.sdk_branch = "0.1"
         self.platform = "gtk"
         self.build_type = "Release"
         self.manifest_path = None
@@ -607,7 +436,6 @@ class WebkitFlatpak:
         self.app_module = None
         self.flatpak_default_args = []
         self.check_available = False
-        self.wpe_extension = None
 
         # Default application to run in the sandbox
         self.command = None
@@ -625,7 +453,7 @@ class WebkitFlatpak:
         self.icc_version = None
 
     def clean_args(self):
-        os.environ["FLATPAK_USER_DIR"] = os.environ.get("WEBKIT_FLATPAK_USER_DIR", os.path.realpath(os.path.join(scriptdir, "../../WebKitBuild", "UserFlatpak")))
+        os.environ["FLATPAK_USER_DIR"] = os.environ.get("WEBKIT_FLATPAK_USER_DIR", FLATPAK_USER_DIR_PATH)
         try:
             os.makedirs(os.environ["FLATPAK_USER_DIR"])
         except OSError as e:
@@ -638,6 +466,7 @@ class WebkitFlatpak:
             factory = PortFactory(SystemHost())
             port = factory.get(self.platform)
             self.debug = port.default_configuration() == "Debug"
+
         self.build_type = "Debug" if self.debug else "Release"
 
         self.platform = self.platform.upper()
@@ -646,66 +475,33 @@ class WebkitFlatpak:
             self.gdb = ""
 
         self.command = "%s %s %s" % (os.path.join(self.sandbox_source_root,
-            "Tools/Scripts/run-minibrowser"),
-            "--" + self.platform.lower(),
-            " --debug" if self.debug else " --release")
-
-        self.name = "org.webkit.%s" % self.platform
-
-        if self.wpe_extension:
-            manifest_filename = WPE_MANIFEST_MAP[self.wpe_extension]
-        else:
-            manifest_filename = "org.webkit.WebKit.yaml"
-        self.manifest_path = os.path.abspath(os.path.join(scriptdir, '../flatpak/') + manifest_filename)
+                                                  "Tools/Scripts/run-minibrowser"),
+                                     "--" + self.platform.lower(),
+                                     " --debug" if self.debug else " --release")
 
-        self.build_name = self.name + "-generated"
+        self.flatpak_build_path = os.environ["FLATPAK_USER_DIR"]
 
         build_root = os.path.join(self.source_root, 'WebKitBuild')
-        self.flatpak_build_path = os.path.join(build_root, self.platform, "FlatpakTree" + self.build_type)
-        self.cache_path = os.path.join(build_root, "FlatpakCache")
         self.build_path = os.path.join(build_root, self.platform, self.build_type)
         try:
             os.makedirs(self.build_path)
         except OSError as e:
             if e.errno != errno.EEXIST:
                 raise e
-        self.config_file = os.path.join(self.build_path, 'webkit_flatpak_config.json')
+        self.config_file = os.path.join(self.flatpak_build_path, 'webkit_flatpak_config.json')
 
         Console.quiet = self.quiet
         if not check_flatpak():
             return False
 
-        repos = FlatpakRepos()
-        self.sdk_repo = repos.add(
-            FlatpakRepo("flathub",
-                        url="https://dl.flathub.org/repo/",
-                        repo_file="https://dl.flathub.org/repo/flathub.flatpakrepo"))
-
-        manifest = load_manifest(self.manifest_path, port_name=self.name)
-        if not manifest:
-            return False
+        self.finish_args = []
+        self.repos = FlatpakRepos()
+        self.sdk_repo = self.repos.add(
+            FlatpakRepo("webkit-sdk",
+                        url="https://software.igalia.com/webkit-sdk-repo/",
+                        repo_file="https://software.igalia.com/flatpak-refs/webkit-sdk.flatpakrepo")
+        )
 
-        self.app = manifest['app-id']
-
-        self.sdk_branch = manifest["runtime-version"]
-        self.finish_args = manifest.get("finish-args", [])
-        self.finish_args = remove_extension_points(self.finish_args)
-        self.runtime = FlatpakPackage(manifest['runtime'], self.sdk_branch,
-                                      self.sdk_repo, "x86_64",
-                                      hash=manifest.get("runtime-hash"))
-        self.locale = FlatpakPackage(manifest['runtime'] + '.Locale',
-                                     self.sdk_branch, self.sdk_repo, "x86_64")
-        self.sdk = FlatpakPackage(manifest['sdk'], self.sdk_branch,
-                                  self.sdk_repo, "x86_64",
-                                  hash=manifest.get("sdk-hash"))
-        self.packs = [self.runtime, self.locale, self.sdk]
-
-        if self.debug:
-            self.sdk_debug = FlatpakPackage(manifest['sdk'] + '.Debug', self.sdk_branch,
-                                      self.sdk_repo, "x86_64")
-            self.packs.append(self.sdk_debug)
-        self.manifest_generated_path = os.path.join(self.cache_path,
-                                                    self.build_name + ".json")
         try:
             with open(self.config_file) as config:
                 json_config = json.load(config)
@@ -715,7 +511,45 @@ class WebkitFlatpak:
 
         return True
 
+    def setup_builddir(self, **kwargs):
+        if os.path.exists(os.path.join(self.flatpak_build_path, "metadata")):
+            return
+
+        self.sdk_repo.flatpak("build-init",
+                              self.flatpak_build_path,
+                              "org.webkit.Webkit",
+                              str(self.sdk),
+                              str(self.runtime),
+                              self.sdk.branch,
+                              show_output="stdout" in kwargs.keys())
+
+    def setup_gstbuild(self, building):
+        gst_dir = os.environ.get('GST_BUILD_PATH')
+        if not gst_dir:
+            return []
+
+        if not os.path.exists(os.path.join(gst_dir, 'gst-env.py')):
+            raise RuntimeError('GST_BUILD_PATH set to %s but it doesn\'t seem to be a valid `gst-build` checkout.' % gst_dir)
+
+        gst_builddir = os.path.join(self.sandbox_source_root, "WebKitBuild", 'gst-build')
+        if not os.path.exists(os.path.join(self.source_root, 'WebKitBuild', 'gst-build', 'build.ninja')):
+            if not building:
+                raise RuntimeError('Trying to enter gst-build env from %s but it is not built, make sure to rebuild webkit.' % gst_dir)
+
+            Console.message("Running meson for `gst-build` %s ", gst_dir)
+            self.run_in_sandbox('meson', gst_dir, gst_builddir, building_gst=True)
+
+        if not building:
+            return [os.path.join(gst_dir, 'gst-env.py'), '--builddir', gst_builddir, '--srcdir', gst_dir]
+
+        Console.message("Building `gst-build` %s ", gst_dir)
+        if self.run_in_sandbox('ninja', '-C', gst_builddir, building_gst=True) != 0:
+            raise RuntimeError('Error while building gst-build.')
+
+        return [os.path.join(gst_dir, 'gst-env.py'), '--builddir', gst_builddir, '--srcdir', gst_dir]
+
     def run_in_sandbox(self, *args, **kwargs):
+        self.setup_builddir(stdout=kwargs.get("stdout", sys.stdout))
         cwd = kwargs.pop("cwd", None)
         extra_env_vars = kwargs.pop("env", {})
         stdout = kwargs.pop("stdout", sys.stdout)
@@ -723,6 +557,7 @@ class WebkitFlatpak:
 
         if not isinstance(args, list):
             args = list(args)
+
         if args:
             if os.path.exists(args[0]):
                 command = os.path.normpath(os.path.abspath(args[0]))
@@ -730,94 +565,122 @@ class WebkitFlatpak:
                 args[0] = command.replace(self.source_root, self.sandbox_source_root)
             if args[0].endswith("build-webkit"):
                 args.append("--prefix=/app")
+        building = os.path.basename(args[0]).startswith("build")
 
         sandbox_build_path = os.path.join(self.sandbox_source_root, "WebKitBuild", self.build_type)
-        with tempfile.NamedTemporaryFile(mode="w") as tmpscript:
-            flatpak_command = ["flatpak", "build", "--die-with-parent",
-                "--bind-mount=/run/shm=/dev/shm",
-                # Workaround for https://webkit.org/b/187384 to have our own perl modules usable inside the sandbox
-                # as setting the PERL5LIB envvar won't work inside apache (and for scripts using `perl -T``).
-                "--bind-mount=/run/host/%s=%s" % (tempfile.gettempdir(), tempfile.gettempdir()),
-                "--bind-mount=%s=%s" % (self.sandbox_source_root, self.source_root),
+        flatpak_command = ["flatpak", "build",
+                           "--die-with-parent",
+                           "--talk-name=org.a11y.Bus",
+                           "--talk-name=org.gtk.vfs",
+                           "--talk-name=org.gtk.vfs.*",
+                           "--bind-mount=/run/shm=/dev/shm",
+                           # Workaround for https://webkit.org/b/187384 to have our own perl modules usable inside the sandbox
+                           # as setting the PERL5LIB envvar won't work inside apache (and for scripts using `perl -T``).
+                           "--bind-mount=/run/host/%s=%s" % (tempfile.gettempdir(), tempfile.gettempdir()),
+                           "--bind-mount=%s=%s" % (self.sandbox_source_root, self.source_root),
+                           # We mount WebKitBuild/PORTNAME/BuildType to /app/webkit/WebKitBuild/BuildType
+                           # so we can build WPE and GTK in a same source tree.
+                           "--bind-mount=%s=%s" % (sandbox_build_path, self.build_path)]
+
+        forwarded = {
+            "WEBKIT_TOP_LEVEL": "/app/",
+            "TEST_RUNNER_INJECTED_BUNDLE_FILENAME": os.path.join(sandbox_build_path, "lib/libTestRunnerInjectedBundle.so"),
+        }
+
+        if not building:
+            flatpak_command.extend([
+                "--device=all",
+                "--device=dri",
+                "--filesystem=host",
+                "--share=ipc",
+                "--share=network",
+                "--socket=pulseaudio",
+                "--socket=system-bus",
+                "--socket=wayland",
+                "--socket=x11",
+                "--system-talk-name=org.a11y.Bus",
+                "--system-talk-name=org.freedesktop.GeoClue2",
                 "--talk-name=org.a11y.Bus",
-                "--talk-name=org.gtk.vfs",
-                "--talk-name=org.gtk.vfs.*",
-                # We mount WebKitBuild/PORTNAME/BuildType to /app/webkit/WebKitBuild/BuildType
-                # so we can build WPE and GTK in a same source tree.
-                "--bind-mount=%s=%s" % (sandbox_build_path, self.build_path)]
-
-            forwarded = {
-                "WEBKIT_TOP_LEVEL": "/app/",
-                "TEST_RUNNER_INJECTED_BUNDLE_FILENAME": "/app/webkit/lib/libTestRunnerInjectedBundle.so",
+                "--talk-name=org.freedesktop.Flatpak"
+            ])
+
+            forwarded.update({
+                "TZ": "PST8PDT",
+                "LANG": "en_US.UTF-8"
+            })
+
+        env_var_prefixes_to_keep = [
+            "G",
+            "GIGACAGE",
+            "GST",
+            "GTK",
+            "ICECC",
+            "JSC",
+            "WEBKIT",
+            "WEBKIT2",
+            "WPE",
+        ]
+
+        env_var_suffixes_to_keep = [
+            "JSC_ARGS",
+            "WEBKIT_ARGS",
+        ]
+
+        env_vars_to_keep = [
+            "CC",
+            "CCACHE_PREFIX",
+            "CFLAGS",
+            "CXX",
+            "CXXFLAGS",
+            "DISPLAY",
+            "JavaScriptCoreUseJIT",
+            "LANG",
+            "LDFLAGS",
+            "Malloc",
+            "NUMBER_OF_PROCESSORS",
+            "QML2_IMPORT_PATH",
+            "WAYLAND_DISPLAY",
+            "WAYLAND_SOCKET",
+        ]
+
+        env_vars = os.environ
+        env_vars.update(extra_env_vars)
+        for envvar, value in env_vars.items():
+            var_tokens = envvar.split("_")
+            if var_tokens[0] in env_var_prefixes_to_keep or envvar in env_vars_to_keep or var_tokens[-1] in env_var_suffixes_to_keep:
+                forwarded[envvar] = value
+
+        if self.use_icecream:
+            _log.debug('Enabling the icecream compiler')
+            flatpak_command.extend(["--share=network",
+                                    "--bind-mount=/var/run/icecc=/var/run/icecc"])
+
+            n_cores = multiprocessing.cpu_count() * 3
+            _log.debug('Following icecream recommendation for the number of cores to use: %d' % n_cores)
+            forwarded.update({
+                "CCACHE_PREFIX": "icecc",
                 "ICECC_VERSION": self.icc_version,
-            }
-
-            env_var_prefixes_to_keep = [
-                "GST",
-                "GTK",
-                "G",
-                "JSC",
-                "WEBKIT",
-                "WEBKIT2",
-                "WPE",
-                "GIGACAGE",
-            ]
-
-            env_vars_to_keep = [
-                "JavaScriptCoreUseJIT",
-                "Malloc",
-                "WAYLAND_DISPLAY",
-                "WAYLAND_SOCKET",
-                "DISPLAY",
-                "LANG",
-                "NUMBER_OF_PROCESSORS",
-                "CCACHE_PREFIX",
-                "QML2_IMPORT_PATH",
-            ]
-
-            if self.use_icecream:
-                _log.debug('Enabling the icecream compiler')
-                forwarded["CCACHE_PREFIX"] = "icecc"
-                if not os.environ.get('NUMBER_OF_PROCESSORS'):
-                    n_cores = multiprocessing.cpu_count() * 3
-                    _log.debug('Follow icecream recommendation for the number of cores to use: %d' % n_cores)
-                    forwarded["NUMBER_OF_PROCESSORS"] = n_cores
-
-            env_vars = os.environ
-            env_vars.update(extra_env_vars)
-            for envvar, value in env_vars.items():
-                if envvar.split("_")[0] in env_var_prefixes_to_keep or envvar in env_vars_to_keep:
-                    forwarded[envvar] = value
-
-            for envvar, value in forwarded.items():
-                flatpak_command.append("--env=%s=%s" % (envvar, value))
-
-            flatpak_command += self.finish_args + extra_flatpak_args + [self.flatpak_build_path]
-
-            shell_string = ""
-            if args:
-                if cwd:
-                    shell_string = 'cd "%s" && "%s"' % (cwd, '" "'.join(args))
-                else:
-                    shell_string = '"%s"' % ('" "'.join(args))
-            else:
-                shell_string = self.command
-                if self.args:
-                    shell_string += ' "%s"' % '" "'.join(self.args)
+                "NUMBER_OF_PROCESSORS": n_cores,
+            })
 
-            tmpscript.write(shell_string)
-            tmpscript.flush()
+        for envvar, value in forwarded.items():
+            flatpak_command.append("--env=%s=%s" % (envvar, value))
 
-            _log.debug('Running in sandbox: "%s" %s\n' % ('" "'.join(flatpak_command), shell_string))
-            flatpak_command.extend(['sh', "/run/host/" + tmpscript.name])
+        gst_env = []
+        if not kwargs.get('building_gst'):
+            gst_env = self.setup_gstbuild(building)
+        flatpak_command += self.finish_args + extra_flatpak_args + \
+            [self.flatpak_build_path] + gst_env + args
 
-            try:
-                subprocess.check_call(flatpak_command, stdout=stdout)
-            except subprocess.CalledProcessError as e:
-                sys.stderr.write(str(e) + "\n")
-                return e.returncode
-            except KeyboardInterrupt:
-                return 0
+        _log.debug('Running in sandbox: %s\n' % ' '.join(flatpak_command))
+
+        try:
+            subprocess.check_call(flatpak_command, stdout=stdout)
+        except subprocess.CalledProcessError as e:
+            sys.stderr.write(str(e) + "\n")
+            return e.returncode
+        except KeyboardInterrupt:
+            return 0
 
         return 0
 
@@ -835,64 +698,41 @@ class WebkitFlatpak:
                 shutil.rmtree(self.build_path)
 
         if self.update:
-            Console.message("Updating Flatpak environment for %s (%s)" % (
-                self.platform, self.build_type))
+            Console.message("Updating Flatpak %s environment" % self.build_type)
             if not self.no_flatpak_update:
                 self.update_all()
 
         return self.setup_dev_env()
 
     def has_environment(self):
-        return os.path.exists(os.path.join(self.build_path, self.flatpak_build_path))
+        return os.path.exists(self.flatpak_build_path)
 
     def save_config(self):
         with open(self.config_file, 'w') as config:
             json_config = {'icecc_version': self.icc_version}
             json.dump(json_config, config)
 
-    def setup_ccache(self):
-        for compiler in ["c++", "cc", "clang", "clang++", "g++", "gcc"]:
-            self.run_in_sandbox("ln", "-s", "../../usr/bin/ccache", compiler, cwd="/app/bin")
-
     def setup_icecc(self):
         with tempfile.NamedTemporaryFile() as tmpfile:
-            self.run_in_sandbox('icecc', '--build-native', stdout=tmpfile, cwd=self.build_path)
+            self.run_in_sandbox('icecc', '--build-native', stdout=tmpfile, cwd=self.source_root)
             tmpfile.flush()
             tmpfile.seek(0)
             icc_version_filename, = re.findall(r'.*creating (.*)', tmpfile.read())
-            self.icc_version = os.path.join(self.build_path, icc_version_filename)
+            self.icc_version = os.path.join(self.source_root, icc_version_filename)
 
     def setup_dev_env(self):
-        if not os.path.exists(os.path.join(self.build_path, self.flatpak_build_path)) \
-                or self.update or self.build_all:
+        if not os.path.exists(os.path.join(self.flatpak_build_path, "runtime", "org.webkit.Sdk")) or self.update or self.build_all:
             self.install_all()
-            Console.message("Building %s and dependencies in %s",
-                            self.name, self.flatpak_build_path)
-
-            # Create environment dirs if necessary
-            try:
-                os.makedirs(os.path.dirname(self.manifest_generated_path))
-            except OSError as e:
-                if e.errno != errno.EEXIST:
-                    raise e
-            if not expand_manifest(self.manifest_path, self.manifest_generated_path,
-                                   self.name, self.sandbox_source_root, self.command):
-                return 1
-
-            builder_args = ["flatpak-builder", "--disable-rofiles-fuse", "--state-dir",
-                            self.cache_path, "--ccache", self.flatpak_build_path, "--force-clean",
-                            self.manifest_generated_path]
-            builder_args.append("--build-only")
-            builder_args.append("--stop-at=%s" % self.app)
-
-            subprocess.check_call(builder_args)
-            self.setup_ccache()
             self.setup_icecc()
             self.save_config()
 
         build_type = "--debug" if self.debug else "--release"
+        if self.build_gst:
+            self.setup_gstbuild(True)
+
         if self.build_webkit:
-            builder = [os.path.join(self.sandbox_source_root, 'Tools/Scripts/build-webkit'),
+            builder = [
+                os.path.join(self.sandbox_source_root, 'Tools/Scripts/build-webkit'),
                 build_type, '--' + self.platform.lower()]
             if self.makeargs:
                 builder.append("--makeargs=%s" % self.makeargs)
@@ -903,27 +743,56 @@ class WebkitFlatpak:
 
             if res:
                 return res
-        else:
-            Console.message("Using %s prefix in %s", self.name, self.flatpak_build_path)
 
         if self.run_tests is not None:
             test_launcher = [os.path.join(self.sandbox_source_root, 'Tools/Scripts/run-webkit-tests'),
-                build_type, '--' + self.platform.lower()] + self.run_tests
+                             build_type, '--' + self.platform.lower()] + self.run_tests
             return self.run_in_sandbox(*test_launcher)
-        elif self.gdb is not None:
+        elif self.gdb or self.gdb_stack_trace:
             return self.run_gdb()
         elif self.user_command:
             return self.run_in_sandbox(*self.user_command)
-        elif not self.update and not self.build_webkit:
+        elif not self.update and not self.build_webkit and not self.build_gst:
             return self.run_in_sandbox()
 
         return 0
 
+    def _get_packages(self):
+        self.runtime = FlatpakPackage("org.webkit.Platform", self.sdk_branch,
+                                      self.sdk_repo, "x86_64")
+        self.locale = FlatpakPackage("org.webkit.Platform.Locale", self.sdk_branch,
+                                     self.sdk_repo, "x86_64")
+        self.sdk = FlatpakPackage("org.webkit.Sdk", self.sdk_branch,
+                                  self.sdk_repo, "x86_64")
+        packages = [self.runtime, self.locale, self.sdk]
+
+        # FIXME: For unknown reasons, the GL extension needs to be explicitely
+        # installed for Flatpak 1.2.x to be able to make use of it. Seems like
+        # it's not correctly inheriting it from the SDK.
+        self.flathub_repo = self.repos.add(
+            FlatpakRepo("flathub", repo_file="https://dl.flathub.org/repo/flathub.flatpakrepo")
+        )
+        gl_extension = FlatpakPackage("org.freedesktop.Platform.GL.default", "19.08",
+                                      self.flathub_repo, "x86_64")
+        packages.append(gl_extension)
+
+        if self.debug:
+            sdk_debug = FlatpakPackage('org.webkit.Sdk.Debug', self.sdk_branch,
+                                       self.sdk_repo, "x86_64")
+            packages.append(sdk_debug)
+        return packages
+
     def install_all(self):
-        for package in self.packs:
+        if os.path.exists(os.path.join(self.flatpak_build_path, "runtime", "org.webkit.Sdk")):
+            return
+        Console.message("Installing %s dependencies in %s", self.build_type, self.flatpak_build_path)
+        for package in self._get_packages():
             if not package.is_installed(self.sdk_branch):
                 package.install()
 
+    def update_all(self):
+        self.sdk_repo.flatpak("update")
+
     def run_gdb(self):
         with disable_signals():
             try:
@@ -935,31 +804,39 @@ class WebkitFlatpak:
         # We need access to the host from the sandbox to run.
         with tempfile.NamedTemporaryFile() as coredump:
             with tempfile.NamedTemporaryFile() as stderr:
-                subprocess.check_call(["coredumpctl", "dump"] + shlex.split(self.coredumpctl_matches),
-                                      stdout=coredump, stderr=stderr)
+                if self.gdb_stack_trace:
+                    cmd = ["coredumpctl", "--since=%s" % self.gdb_stack_trace, "dump"]
+                else:
+                    cmd = ["coredumpctl", "dump"] + shlex.split(self.coredumpctl_matches)
+                try:
+                    subprocess.check_call(cmd, stdout=coredump, stderr=stderr)
+                except subprocess.CalledProcessError as err:
+                    with open(stderr.name, 'r') as stderrf:
+                        stderr = stderrf.read()
+                    cmd = ' '.join(err.cmd)
+                    sys.stderr.write("'%s' returned a non-zero exit code. Stderr: %s" % (cmd, stderr))
+                    return err.returncode
 
                 with open(stderr.name, 'r') as stderrf:
                     stderr = stderrf.read()
-                executable, = re.findall(".*Executable: (.*)", stderr)
-                if not executable.startswith("/newroot"):
-                    sys.stderr.write("Executable %s doesn't seem to be a flatpaked application.\n" % executable)
-
-                executable = executable.replace("/newroot", "")
-                args = ["gdb", executable, "/run/host/%s" % coredump.name] + shlex.split(self.gdb)
 
-                return self.run_in_sandbox(*args)
+                executable, = re.findall(".*Executable: (.*)", stderr)
 
-    def update_all(self):
-        for m in [self.runtime, self.sdk, self.sdk_debug]:
-            if m:
-                m.update()
+                if self.gdb:
+                    bargs = ["gdb", executable, "/run/host/%s" % coredump.name] + shlex.split(self.gdb)
+                elif self.gdb_stack_trace:
+                    bargs = ["gdb", '-ex', "thread apply all backtrace", '--batch', executable, "/run/host/%s" % coredump.name]
 
+                return self.run_in_sandbox(*bargs)
 
 def is_sandboxed():
     return os.path.exists("/.flatpak-info")
 
 
 def run_in_sandbox_if_available(args):
+    if not os.path.isdir(FLATPAK_USER_DIR_PATH):
+        return None
+
     if is_sandboxed():
         return None
 
diff --git a/Tools/flatpak/org.webkit.CommonModules.yaml b/Tools/flatpak/org.webkit.CommonModules.yaml
deleted file mode 100644 (file)
index e1a07cf..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-# http and dependencies.
-- name: apr
-  sources:
-    - type: archive
-      url: https://www.apache.org/dist/apr/apr-1.6.5.tar.bz2
-      sha256: a67ca9fcf9c4ff59bce7f428a323c8b5e18667fdea7b0ebad47d194371b0a105
-- name: apr-util
-  sources:
-    - type: archive
-      url: https://www.apache.org/dist/apr/apr-util-1.6.1.tar.bz2
-      sha512: "40eff8a37c0634f7fdddd6ca5e596b38de15fd10767a34c30bbe49c632816e8f3e1e230678034f578dd5816a94f246fb5dfdf48d644829af13bf28de3225205d"
-  config-opts:
-    - --with-apr=/app/bin/apr-1-config
-- name: httpd
-  sources:
-    - type: git
-      url: https://github.com/apache/httpd.git
-      branch: 2.4.37
-    - type : file
-      path : files/httpd-autogen.sh
-      dest-filename : autogen.sh
-    # The version embedded in the sandbox doesn't have a working pcre-config
-    - type: patch
-      path: patches/httpd-0001-configure-use-pkg-config-for-PCRE-detection.patch
-  config-opts:
-    - --enable-mpms-shared=all
-    - --enable-modules=all
-    - --with-apr=/app/bin/apr-1-config
-    - --with-apr-util=/app/bin/apu-1-config
-    - --with-pcre=/app
-    - --enable-authnz-fcgi
-    - --enable-cgi
-    - --enable-cgid
-- name: php
-  sources:
-    - type: archive
-      url: https://php.net/distributions/php-7.2.6.tar.xz
-      sha512: da86b1ff2df3b9e2d46e59a80296b940d81132975b621bdec9602f8b4c8d91a3fdcd4ffd7cb982d63d3ec974b3a12a7854e42a73b7f2cc8eefade14335aa7c71
-  config-opts:
-    - --disable-xml
-    - --disable-dom
-    - --disable-libxml
-    - --disable-simplexml
-    - --disable-xmlreader
-    - --disable-xmlwriter
-    - --without-pear
-    - --with-apxs2
-    - --with-zlib
-    - --with-libzip
-    - --enable-sockets=shared
-- name: libevent
-  sources:
-    - type: git
-      url: https://github.com/libevent/libevent.git
-      branch: e7ff4ef # 2.1.8
-  config-opts:
-    - --disable-libevent-regress
-
-# Requirement for flatpkutils
-- name: python3-pyaml
-  buildsystem: simple
-  build-commands:
-  - pip3 install --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} pyaml
-  sources:
-  - type: file
-    url: https://files.pythonhosted.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz
-    sha256: 592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab
-  - type: file
-    url: https://files.pythonhosted.org/packages/9e/17/1d4ed6e1a4c0918a0357dfa2fdbe26bf63f6e616013c04a14bce9fd33e40/pyaml-17.12.1.tar.gz
-    sha256: 66623c52f34d83a2c0fc963e08e8b9d0c13d88404e3b43b1852ef71eda19afa3
-
-- name: python2-pyaml
-  buildsystem: simple
-  build-commands:
-  - pip2 install --no-index --find-links="file://${PWD}" --target=/app/lib/python2.7/site-packages/ pyaml
-  sources:
-  - type: file
-    url: https://files.pythonhosted.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz
-    sha256: 592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab
-  - type: file
-    url: https://files.pythonhosted.org/packages/9e/17/1d4ed6e1a4c0918a0357dfa2fdbe26bf63f6e616013c04a14bce9fd33e40/pyaml-17.12.1.tar.gz
-    sha256: 66623c52f34d83a2c0fc963e08e8b9d0c13d88404e3b43b1852ef71eda19afa3
-
-- name: python2-subprocess32
-  buildsystem: simple
-  build-commands:
-  - pip2 install --target=/app/lib/python2.7/site-packages/ .
-  sources:
-  - type: archive
-    url: https://files.pythonhosted.org/packages/be/2b/beeba583e9877e64db10b52a96915afc0feabf7144dcbf2a0d0ea68bf73d/subprocess32-3.5.3.tar.gz
-    sha256: 6bc82992316eef3ccff319b5033809801c0c3372709c5f6985299c88ac7225c3
-
-# GStreamer modules
-- name: libvpx
-  no-autogen: true
-  sources:
-    - type: git
-      url: https://chromium.googlesource.com/webm/libvpx
-      branch: v1.7.0
-  config-opts:
-    - --enable-pic
-    - --as=nasm
-    - --disable-unit-tests
-    - --size-limit=16384x16384
-    - --enable-postproc
-    - --enable-multi-res-encoding
-    - --enable-temporal-denoising
-    - --enable-vp9-temporal-denoising
-    - --enable-vp9-postproc
-    - --enable-shared
-- name: aom
-  sources:
-    - type: git
-      url: https://aomedia.googlesource.com/aom
-      branch: cdb083e84a71d6d31163a4f64f18dc1328fd782c
-  buildsystem: cmake-ninja
-  builddir: true
-  config-opts:
-    - -DBUILD_SHARED_LIBS=1
-- name: libunwind
-  sources:
-    - type: git
-      url: https://github.com/libunwind/libunwind.git
-      commit: v1.2.1
-- name: libopenh264
-  buildsystem: meson
-  sources:
-    - type: git
-      url: https://github.com/cisco/openh264.git
-      branch: a1b3f07c5271f312997fcc3451237031444c4475 # 1.8.0 + fix for gcc 8
-- name: gstreamer
-  buildsystem: meson
-  sources:
-    - type: git
-      url: https://gitlab.freedesktop.org/gstreamer/gstreamer.git
-      branch: 1.16.1
-  config-opts:
-    - -Dgtk_doc=disabled
-    - -Dintrospection=disabled
-    - -Dexamples=disabled
-    - -Dtests=disabled
-- name: gst-plugins-base
-  buildsystem: meson
-  sources:
-    - type: git
-      url: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base.git
-      branch: 1.16.1
-    - type: patch
-      path: ../gstreamer/patches/base-0001-playbin-Handle-error-message-with-redirection-indica.patch
-    - type: patch
-      path: ../gstreamer/patches/base-0001-glupload-Add-VideoMetas-and-GLSyncMeta-to-the-raw-up.patch
-  config-opts:
-    - -Dgtk_doc=disabled
-    - -Dintrospection=disabled
-    - -Dexamples=disabled
-    - -Dtests=disabled
-- name: gst-plugins-good
-  buildsystem: meson
-  sources:
-    - type: git
-      url: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good.git
-      branch: 1.16.1
-    - type: patch
-      path: ../gstreamer/patches/good-0001-qtdemux-Specify-REDIRECT-information-in-error-messag.patch
-  config-opts:
-    - -Dgtk_doc=disabled
-    - -Dintrospection=disabled
-    - -Dexamples=disabled
-    - -Dgtk3=disabled
-- name: x264
-  config-opts:
-    - "--enable-shared"
-    - "--enable-static"
-    - "--enable-pic"
-    - "--disable-lavf"
-    - "--disable-asm"
-  sources:
-    - type: archive
-      url: http://download.videolan.org/pub/x264/snapshots/x264-snapshot-20140212-2245-stable.tar.bz2
-      sha256: 5d98e9e4faf6dd55e7193ed379aff477b8acbda6777758956ef7e5f05067be18
-- name: gst-plugins-ugly
-  buildsystem: meson
-  sources:
-    - type: git
-      url: https://anongit.freedesktop.org/git/gstreamer/gst-plugins-ugly
-      branch: 1.16.0
-  config-opts:
-    - -Dgtk_doc=disabled
-- name: gst-plugins-bad
-  buildsystem: meson
-  sources:
-    - type: git
-      url: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad.git
-      branch: 1.16.1
-    - type: patch
-      path: ../gstreamer/patches/gst-plugins-bad-0001-h264parse-Post-a-WARNING-when-data-is-broken.patch
-  config-opts:
-    - -Dgtk_doc=disabled
-    - -Dintrospection=disabled
-    - -Dexamples=disabled
-- name: ffmpeg
-  sources:
-    - type: archive
-      url: https://ffmpeg.org/releases/ffmpeg-4.0.4.tar.gz
-      sha256: 80bb685abfcdda7c9b6c9c5caf1d8dbb927858050d7377c2b8f3488c7e8a9b7f
-  config-opts:
-    - --enable-static
-    - --enable-pic
-    - --disable-avdevice
-    - --disable-postproc
-    - --disable-swscale
-    - --disable-programs
-    - --disable-ffplay
-    - --disable-ffprobe
-    - --disable-ffmpeg
-    - --disable-encoder=flac
-    - --disable-protocols
-    - --disable-devices
-    - --disable-network
-    - --disable-hwaccels
-    - --disable-dxva2
-    - --disable-vdpau
-    - --disable-filters
-    - --enable-filter=yadif
-    - --disable-doc
-    - --disable-d3d11va
-    - --disable-dxva2
-    - --disable-audiotoolbox
-    - --disable-videotoolbox
-    - --disable-vaapi
-    - --disable-crystalhd
-    - --disable-mediacodec
-    - --disable-nvenc
-    - --disable-mmal
-    - --disable-omx
-    - --disable-omx-rpi
-    - --disable-cuda
-    - --disable-cuvid
-    - --disable-libmfx
-    - --disable-libnpp
-    - --disable-iconv
-    - --disable-jni
-    - --disable-v4l2_m2m
-    - --enable-optimizations
-- name: gst-libav
-  buildsystem: meson
-  builddir: true
-  sources:
-    - type: archive
-      url: https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.16.1.tar.xz
-      sha256: e8a5748ae9a4a7be9696512182ea9ffa6efe0be9b7976916548e9d4381ca61c4
-  config-opts:
-    - -Dgtk_doc=disabled
-
-- name: libgcrypt # Speedup libgcrypt
-  sources:
-    - type: git
-      url: https://dev.gnupg.org/source/libgcrypt.git
-      branch: libgcrypt-1.8.4
-    - type: patch
-      path: patches/libgcrypt-0001-Use-pkg-config-to-detect-gpg-error.patch
-    - type: patch
-      path: ../gtk/patches/libgcrypt-use-only-dev-urandom-for-testing.patch
-  config-opts:
-    - --disable-doc
-
-- name: perl-cgi-pm
-  buildsystem: simple
-  build-commands:
-    - perl Makefile.PL PREFIX=/app LIB=/app/lib/perl/
-    - make install
-  sources:
-    - type: archive
-      url: https://cpan.metacpan.org/authors/id/L/LE/LEEJO/CGI-4.38.tar.gz
-      sha256: 8c58f4a529bb92a914b22b7e64c5e31185c9854a4070a6dfad44fe5cc248e7d4
-
-- name: python2-virtualenv
-  buildsystem: simple
-  build-commands:
-  - pip2 install --no-index --find-links="file://${PWD}" --target=/app/lib/python2.7/site-packages/ virtualenv
-  - ln -s /app/lib/python2.7/site-packages/virtualenv.py /app/bin/virtualenv
-  - chmod +x /app/bin/virtualenv
-  sources:
-  - type: file
-    url: https://files.pythonhosted.org/packages/33/bc/fa0b5347139cd9564f0d44ebd2b147ac97c36b2403943dbee8a25fd74012/virtualenv-16.0.0.tar.gz
-    sha256: ca07b4c0b54e14a91af9f34d0919790b016923d157afda5efdde55c96718f752
-
-- name: libcap-ng
-  sources:
-    - type: git
-      url: https://github.com/stevegrubb/libcap-ng
-      branch: v0.7.9
-  config-opts:
-    - --with-python=no
-    - --with-python3=no
-
-- name: lzo2
-  sources:
-    - type: archive
-      url: http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz
-      sha1: 4924676a9bae5db58ef129dc1cebce3baa3c4b5d
-
-- name: icecc
-  sources:
-    - type: git
-      url: https://github.com/icecc/icecream
-      tag: "1.2"
-      commit: e3d10a32bc6c046d8f3d1182e75c659d4b28ed49
-  config-opts:
-    - --without-man
-
-- name: brotli
-  sources:
-  - type: archive
-    url: https://github.com/google/brotli/archive/v1.0.5.tar.gz
-    sha256: 3d5bedd48edb909fe3b87cb99f7d139b987ef6f1616b7e22d74e928270a2fd20
-  buildsystem: cmake-ninja
-
-- name: woff2
-  sources:
-  - type: archive
-    url: https://github.com/google/woff2/archive/v1.0.2.tar.gz
-    sha256: add272bb09e6384a4833ffca4896350fdb16e0ca22df68c0384773c67a175594
-  buildsystem: cmake-ninja
-
-- name: openjpeg
-  sources:
-  - type: archive
-    url: http://github.com/uclouvain/openjpeg/archive/v2.3.0.tar.gz
-    sha256: 3dc787c1bb6023ba846c2a0d9b1f6e179f1cd255172bde9eb75b01f1e6c7d71a
-  buildsystem: cmake-ninja
diff --git a/Tools/flatpak/org.webkit.GTK.yaml b/Tools/flatpak/org.webkit.GTK.yaml
deleted file mode 100644 (file)
index 963b560..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-- name: mesa
-  sources:
-    - type: archive
-      url: https://mesa.freedesktop.org/archive/mesa-18.0.3.tar.xz
-      sha256: 099d9667327a76a61741a533f95067d76ea71a656e66b91507b3c0caf1d49e30
-  config-opts:
-    - --prefix=/app/softGL
-    - --disable-dri3
-    - --enable-dri
-    - --enable-glx
-    - --enable-egl
-    - --with-egl-platforms=x11,wayland
-    - --with-dri-drivers=swrast
-    - --with-gallium-drivers=swrast
-
-- name: webkitgtk-test-fonts
-  no-autogen: true
-  sources:
-    - type: git
-      url: https://github.com/WebKitGTK/webkitgtk-test-fonts.git
-  buildsystem: simple
-  build-commands:
-    # FIXME: Make ActivateFontWPE smarter.
-    - make install DESTDIR=/app/WebKitBuild/DependenciesGTK/Root
-
-- name: xorg-util-macros
-  sources:
-    - type: git
-      url: https://anongit.freedesktop.org/git/xorg/util/macros.git
-      branch: util-macros-1.19.2
-
-- name: xorg-font-util
-  sources:
-    - type: git
-      url: https://anongit.freedesktop.org/git/xorg/font/util.git
-      branch: font-util-1.3.1
-
-- name: xkbfile
-  sources:
-    - type: git
-      branch: libxkbfile-1.0.9
-      url: https://anongit.freedesktop.org/git/xorg/lib/libxkbfile.git
-
-- name: fontenc
-  sources:
-    - type: git
-      branch: libfontenc-1.1.3
-      url: https://anongit.freedesktop.org/git/xorg/lib/libfontenc.git
-
-- name: xfont
-  sources:
-    - type: git
-      branch: libXfont2-2.0.3
-      url: https://anongit.freedesktop.org/git/xorg/lib/libXfont.git
-
-- name: xvfb
-  sources:
-    - type: git
-      url: https://anongit.freedesktop.org/git/xorg/xserver.git
-      branch: xorg-server-1.19.6
-    - type: patch
-      path: patches/xvfb-0001-HACK-Avoid-compiling-a-kbm-file.patch
-    - type: patch
-      path: ../gtk/patches/xserver-remove-bogus-dependencies.patch
-    - type: patch
-      path: ../gtk/patches/xserver-search-for-DRI-drivers-at-LIBGL_DRIVERS_PATH-environ.patch
-  config-opts:
-    - --enable-xvfb
-    - --disable-xwayland
-    - --enable-xvfb
-    - --disable-xwayland
-    - --disable-xinerama
-    - --enable-glx
-    - --enable-composite
-    - --disable-xorg
-    - --disable-dmx
-    - --disable-xnest
-    - --disable-xquartz
-    - --disable-xwin
-    - --disable-xephyr
-    - --disable-xfake
-    - --disable-xfbdev
-    - --disable-install-setuid
-    - --disable-unit-tests
-    - --disable-present
-    - --enable-unix-transport
-    - --enable-tcp-transport
-    - --disable-local-transport
-    - --without-dtrace
-
-# Required for run-gtk-tests
-- name: pycairo
-  buildsystem: simple
-  build-commands:
-  - python2 setup.py install --prefix=/app
-  sources:
-  - type: archive
-    url: https://pypi.python.org/packages/ef/97/b33dc533ea6076d4ea9cbd2fe049a2b4a3df5c5b6fba9a182616f6f8d310/pycairo-1.15.4.tar.gz
-    sha256: ee4c3068c048230e5ce74bb8994a024711129bde1af1d76e3276c7acd81c4357
-  cleanup:
-  - "/include"
-  - "/lib/pkgconfig"
-
-- name: pygobject-python2
-  build-options:
-    env:
-      PYTHON: "/usr/bin/python2"
-  sources:
-  - type: archive
-    url: https://download.gnome.org/sources/pygobject/3.28/pygobject-3.28.1.tar.xz
-    sha256: 42312b4a5015571fa0a4f2d201005da46b71c251ea2625bc95702d071c4ff895
-  cleanup:
-  - "/include"
-  - "/lib/pkgconfig"
-  - "/lib/python2.7/site-packages/gi/*.la"
-
-- org.webkit.WPEModules.yaml
-
-- name: org.webkit.GTK
-  buildsystem: simple
-  build-commands:
-    - /app/webkit/Tools/Scripts/build-webkit --gtk --prefix=/app
-
diff --git a/Tools/flatpak/org.webkit.WPE.yaml b/Tools/flatpak/org.webkit.WPE.yaml
deleted file mode 100644 (file)
index 4cbabba..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-- org.webkit.WPEModules.yaml
-- name: webkitgtk-test-fonts
-  no-autogen: true
-  sources:
-    - type: git
-      url: https://github.com/WebKitGTK/webkitgtk-test-fonts.git
-  buildsystem: simple
-  build-commands:
-    # FIXME: Make ActivateFontWPE smarter.
-    - make install DESTDIR=/app/WebKitBuild/DependenciesWPE/Root
-- name: org.webkit.WPE
-  buildsystem: simple
-  build-commands:
-    - /app/webkit/Tools/Scripts/build-webkit --wpe --prefix=/app
diff --git a/Tools/flatpak/org.webkit.WPEModules.yaml b/Tools/flatpak/org.webkit.WPEModules.yaml
deleted file mode 100644 (file)
index a80e2cc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-- name: libwpe
-  buildsystem: cmake-ninja
-  sources:
-    - type: archive
-      url: https://wpewebkit.org/releases/libwpe-1.4.0.tar.xz
-      sha256: e2d3494fc33fe946ad917fd6a3abd127462b91bba62ef8b35507e92f8ede4188
-- name: wpebackend-fdo
-  buildsystem: cmake-ninja
-  sources:
-    - type: archive
-      url: https://wpewebkit.org/releases/wpebackend-fdo-1.4.0.tar.xz
-      sha256: a919ca4a5bc445f9419a5b7f3781cfc98e5abcf5d7259eb1869f5ab20fd18baf
diff --git a/Tools/flatpak/org.webkit.WPEQT.yaml b/Tools/flatpak/org.webkit.WPEQT.yaml
deleted file mode 100644 (file)
index de36957..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-app-id: org.webkit.WPEQT
-runtime: org.kde.Platform
-runtime-version: "5.12"
-# Control the exact version of the Sdk/Runtime that is being used.
-sdk-hash: d6efa24e27c1c878ad4fde76b73c96a11be32b598ae87aefbe339ee4bb19a8be
-runtime-hash: 101871e091000616ad2b635e06c414eb0e1c4e1c34292a205c5239935ee5ea44
-sdk: org.kde.Sdk
-command: %(COMMAND)s
-finish-args:
-  # Basically no sandboxing, the goal here is to make it flexible
-  # for developers, not really to isolate (openning all devices
-  # to allow acces video cameras until we have a portal at least).
-  - --share=ipc
-  - --socket=x11
-  - --socket=wayland
-  - --device=all
-  - --share=network
-  - --socket=pulseaudio
-  - --system-talk-name=org.freedesktop.GeoClue2
-  - --system-talk-name=org.a11y.Bus
-  - --filesystem=host
-  - --socket=system-bus
-  - --talk-name=org.freedesktop.Flatpak
-  - --env=GST_PRESET_PATH=/app/share/gstreamer-1.0/presets/
-build-options:
-  cflags: -O2 -g
-  cxxflags: -O2 -g
-  strip: false
-  no-debuginfo: true
-modules:
-  - org.webkit.CommonModules.yaml
-  - org.webkit.WPEModules.yaml
-
-  # This module is not actually built.
-  - name: org.webkit.WPEQT
-    buildsystem: cmake
-    sources:
-    - type: dir
-      path: /app/webkit/Source/WebKit/UIProcess/API/wpe/qt
diff --git a/Tools/flatpak/org.webkit.WebKit.yaml b/Tools/flatpak/org.webkit.WebKit.yaml
deleted file mode 100644 (file)
index b6d6126..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-app-id: %(PORTNAME)s
-runtime: org.gnome.Platform
-runtime-version: "3.32"
-# Control the exact version of the Sdk/Runtime that is being used.
-sdk-hash: b3b9b1d1b19ea2bb72019428ca75c7a78455e986a0f91dddf6a29c92990cc5a7
-runtime-hash: 7c9d5592d805d0b7c212190fd8118e4c78cb8ed8f81e687858972670daccff76
-sdk: org.gnome.Sdk
-command: %(COMMAND)s
-finish-args:
-  # Basically no sandboxing, the goal here is to make it flexible
-  # for developers, not really to isolate (openning all devices
-  # to allow acces video cameras until we have a portal at least).
-  - --share=ipc
-  - --socket=x11
-  - --socket=wayland
-  - --device=all
-  - --share=network
-  - --socket=pulseaudio
-  - --system-talk-name=org.freedesktop.GeoClue2
-  - --system-talk-name=org.a11y.Bus
-  - --filesystem=host
-  - --socket=system-bus
-  - --talk-name=org.freedesktop.Flatpak
-  - --env=GST_PRESET_PATH=/app/share/gstreamer-1.0/presets/
-build-options:
-  cflags: -O2 -g
-  cxxflags: -O2 -g
-  strip: false
-  no-debuginfo: true
-modules:
-  - org.webkit.CommonModules.yaml
-  # Port specific components.
-  - %(PORTNAME)s.yaml
diff --git a/Tools/flatpak/patches/httpd-0001-configure-use-pkg-config-for-PCRE-detection.patch b/Tools/flatpak/patches/httpd-0001-configure-use-pkg-config-for-PCRE-detection.patch
deleted file mode 100644 (file)
index d36a694..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-From b5ebe404f1388ddda3603e53277f87e0b96ba695 Mon Sep 17 00:00:00 2001
-From: Thibault Saunier <tsaunier@igalia.com>
-Date: Mon, 11 Jun 2018 16:14:38 -0400
-Subject: [PATCH] configure: use pkg-config for PCRE detection
-
----
- configure.in | 27 +++++----------------------
- 1 file changed, 5 insertions(+), 22 deletions(-)
-
-diff --git a/configure.in b/configure.in
-index 761e836..b155d4b 100644
---- a/configure.in
-+++ b/configure.in
-@@ -215,28 +215,11 @@ fi
- AC_ARG_WITH(pcre,
- APACHE_HELP_STRING(--with-pcre=PATH,Use external PCRE library))
--AC_PATH_PROG(PCRE_CONFIG, pcre-config, false)
--if test -d "$with_pcre" && test -x "$with_pcre/bin/pcre-config"; then
--   PCRE_CONFIG=$with_pcre/bin/pcre-config
--elif test -x "$with_pcre"; then
--   PCRE_CONFIG=$with_pcre
--fi
--
--if test "$PCRE_CONFIG" != "false"; then
--  if $PCRE_CONFIG --version >/dev/null 2>&1; then :; else
--    AC_MSG_ERROR([Did not find pcre-config script at $PCRE_CONFIG])
--  fi
--  case `$PCRE_CONFIG --version` in
--  [[1-5].*])
--    AC_MSG_ERROR([Need at least pcre version 6.0])
--    ;;
--  esac
--  AC_MSG_NOTICE([Using external PCRE library from $PCRE_CONFIG])
--  APR_ADDTO(PCRE_INCLUDES, [`$PCRE_CONFIG --cflags`])
--  APR_ADDTO(PCRE_LIBS, [`$PCRE_CONFIG --libs`])
--else
--  AC_MSG_ERROR([pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/])
--fi
-+PKG_CHECK_MODULES([PCRE], [libpcre], [
-+  AC_DEFINE([HAVE_PCRE], [1], [Define if you have PCRE library])
-+], [
-+  AC_MSG_ERROR([$PCRE_PKG_ERRORS])
-+])
- APACHE_SUBST(PCRE_LIBS)
- AC_MSG_NOTICE([])
--- 
-2.17.1
-
diff --git a/Tools/flatpak/patches/libgcrypt-0001-Use-pkg-config-to-detect-gpg-error.patch b/Tools/flatpak/patches/libgcrypt-0001-Use-pkg-config-to-detect-gpg-error.patch
deleted file mode 100644 (file)
index c57727f..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-From 9aff3f1b344fc8666b14c57629162c2b9007cad8 Mon Sep 17 00:00:00 2001
-From: Thibault Saunier <tsaunier@igalia.com>
-Date: Fri, 29 Jun 2018 09:05:52 -0400
-Subject: [PATCH] Use pkg-config to detect gpg-error
-
----
- m4/gpg-error.m4 | 88 +++++++------------------------------------------
- 1 file changed, 12 insertions(+), 76 deletions(-)
-
-diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4
-index 1661204c..5f9f33c2 100644
---- a/m4/gpg-error.m4
-+++ b/m4/gpg-error.m4
-@@ -41,81 +41,17 @@ AC_DEFUN([AM_PATH_GPG_ERROR],
-   AC_ARG_WITH(gpg-error-prefix,,
-               [gpg_error_config_prefix="$withval"])
--  if test x"${GPG_ERROR_CONFIG}" = x ; then
--     if test x"${gpg_error_config_prefix}" != x ; then
--        GPG_ERROR_CONFIG="${gpg_error_config_prefix}/bin/gpg-error-config"
--     else
--       case "${SYSROOT}" in
--         /*)
--           if test -x "${SYSROOT}/bin/gpg-error-config" ; then
--             GPG_ERROR_CONFIG="${SYSROOT}/bin/gpg-error-config"
--           fi
--           ;;
--         '')
--           ;;
--          *)
--           AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
--           ;;
--       esac
--     fi
--  fi
-+  PKG_CHECK_MODULES([GPG_ERROR], [gpg-error], [
-+    AC_DEFINE([HAVE_GPG_ERROR], [1], [Define if you have gpg-error library])
--  AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no)
--  min_gpg_error_version=ifelse([$1], ,0.0,$1)
--  AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
--  ok=no
--  if test "$GPG_ERROR_CONFIG" != "no" \
--     && test -f "$GPG_ERROR_CONFIG" ; then
--    req_major=`echo $min_gpg_error_version | \
--               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
--    req_minor=`echo $min_gpg_error_version | \
--               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
--    gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version`
--    major=`echo $gpg_error_config_version | \
--               sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
--    minor=`echo $gpg_error_config_version | \
--               sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
--    if test "$major" -gt "$req_major"; then
--        ok=yes
--    else
--        if test "$major" -eq "$req_major"; then
--            if test "$minor" -ge "$req_minor"; then
--               ok=yes
--            fi
--        fi
--    fi
--  fi
--  if test $ok = yes; then
--    GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags`
--    GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs`
--    GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --cflags 2>/dev/null`
--    GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --libs 2>/dev/null`
--    AC_MSG_RESULT([yes ($gpg_error_config_version)])
--    ifelse([$2], , :, [$2])
--    gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --host 2>/dev/null || echo none`
--    if test x"$gpg_error_config_host" != xnone ; then
--      if test x"$gpg_error_config_host" != x"$host" ; then
--  AC_MSG_WARN([[
--***
--*** The config script $GPG_ERROR_CONFIG was
--*** built for $gpg_error_config_host and thus may not match the
--*** used host $host.
--*** You may want to use the configure option --with-gpg-error-prefix
--*** to specify a matching config script or use \$SYSROOT.
--***]])
--        gpg_config_script_warn="$gpg_config_script_warn libgpg-error"
--      fi
--    fi
--  else
--    GPG_ERROR_CFLAGS=""
--    GPG_ERROR_LIBS=""
--    GPG_ERROR_MT_CFLAGS=""
--    GPG_ERROR_MT_LIBS=""
--    AC_MSG_RESULT(no)
--    ifelse([$3], , :, [$3])
--  fi
--  AC_SUBST(GPG_ERROR_CFLAGS)
--  AC_SUBST(GPG_ERROR_LIBS)
--  AC_SUBST(GPG_ERROR_MT_CFLAGS)
--  AC_SUBST(GPG_ERROR_MT_LIBS)
-+    GPG_ERROR_MT_CFLAGS="$GPG_ERROR_CFLAGS"
-+    GPG_ERROR_MT_LIBS="-lpthread $GPG_ERROR_LIBS"
-+
-+    AC_SUBST(GPG_ERROR_CFLAGS)
-+    AC_SUBST(GPG_ERROR_LIBS)
-+    AC_SUBST(GPG_ERROR_MT_CFLAGS)
-+    AC_SUBST(GPG_ERROR_MT_LIBS)
-+  ], [
-+    AC_MSG_ERROR([$GPG_ERROR_ERRORS])
-+  ])
- ])
--- 
-2.18.0
-
diff --git a/Tools/flatpak/patches/xvfb-0001-HACK-Avoid-compiling-a-kbm-file.patch b/Tools/flatpak/patches/xvfb-0001-HACK-Avoid-compiling-a-kbm-file.patch
deleted file mode 100644 (file)
index 898842b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-From aed1b6e8de41375c1b8b1dfc48a350e0a9b9cbba Mon Sep 17 00:00:00 2001
-From: Thibault Saunier <tsaunier@igalia.com>
-Date: Mon, 11 Jun 2018 10:55:43 -0400
-Subject: [PATCH xserver] HACK: Avoid compiling a kbm file
-
-This would need to be in /usr/share/X11/ as this is where
-resource files are in the sandbox but it is read only in there.
-
-Hack around that.
----
- xkb/ddxLoad.c | 9 +--------
- xkb/xkbInit.c | 2 +-
- 2 files changed, 2 insertions(+), 9 deletions(-)
-
-diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
-index bbe3952..a4a03a1 100644
---- a/xkb/ddxLoad.c
-+++ b/xkb/ddxLoad.c
-@@ -148,14 +148,7 @@ RunXkbComp(xkbcomp_buffer_callback callback, void *userdata)
-         }
-     }
--    if (asprintf(&buf,
--                 "\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
--                 "-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
--                 xkbbindir, xkbbindirsep,
--                 ((xkbDebugFlags < 2) ? 1 :
--                  ((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
--                 xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
--                 PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
-+    if (asprintf(&buf, "cp /app/webkit/Tools/flatpak/files/default.xkm \"%s%s.xkm\"",
-                  xkm_output_dir, keymap) == -1)
-         buf = NULL;
-diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
-index 9c772f5..4e0b774 100644
---- a/xkb/xkbInit.c
-+++ b/xkb/xkbInit.c
-@@ -87,7 +87,7 @@ typedef struct _SrvXkmInfo {
- #define       XKB_DFLT_RULES_PROP     TRUE
- #endif
--const char *XkbBaseDirectory = XKB_BASE_DIRECTORY;
-+const char *XkbBaseDirectory = "/usr/share/X11/xkb/";
- const char *XkbBinDirectory = XKB_BIN_DIRECTORY;
- static int XkbWantAccessX = 0;
--- 
-2.17.1
-
index ba62273..ea254c8 100755 (executable)
@@ -179,6 +179,10 @@ function installDependenciesWithApt {
         weston \
         xvfb"
 
+    # These are dependencies necessary for building with the Flatpak SDK.
+    packages="$packages \
+        flatpak"
+
     # These are dependencies necessary for building the jhbuild.
     packages="$packages \
         bison \
@@ -350,6 +354,10 @@ function installDependenciesWithPacman {
         weston \
         xorg-server-xvfb"
 
+    # These are dependencies necessary for building with the Flatpak SDK.
+    packages="$packages \
+        flatpak"
+
     # These are dependencies necessary for building the jhbuild.
     # Note: Could not find libegl-mesa
     packages="$packages \
@@ -525,6 +533,10 @@ function installDependenciesWithDnf {
         weston-devel \
         xorg-x11-server-Xvfb"
 
+    # These are dependencies necessary for building with the Flatpak SDK.
+    packages="$packages \
+        flatpak"
+
     # These are dependencies necessary for building the jhbuild.
     packages="$packages \
         bison \
index e428cd2..8dc1e90 100755 (executable)
@@ -112,6 +112,10 @@ function installDependenciesWithApt {
         ruby-highline \
         ruby-json"
 
+    # These are dependencies necessary for building with the Flatpak SDK.
+    packages="$packages \
+        flatpak"
+
     # These are dependencies necessary for building the jhbuild.
     packages="$packages \
         git \
@@ -216,6 +220,10 @@ function installDependenciesWithPacman {
         ruby \
         ttf-liberation"
 
+    # These are dependencies necessary for building with the Flatpak SDK.
+    packages="$packages \
+        flatpak"
+
     # These are dependencies necessary for building the jhbuild.
     packages="$packages \
         expat \
@@ -329,6 +337,10 @@ function installDependenciesWithDnf {
         rubygem-highline \
         rubygem-json"
 
+    # These are dependencies necessary for building with the Flatpak SDK.
+    packages="$packages \
+        flatpak"
+
     # These are dependencies necessary for building the jhbuild.
     packages="$packages \
         expat-devel \