browser(webkit): use webkit generate-bundle tool to generate the bundles (#3563)
* This changes the archive.sh script to use the webkit generate-bundle tool to generate the MiniBrowser bundles instead of using our custom logic. * pw_run.sh is simplified because the new bundles include a wrapper script that sets the needed LD_LIBRARY_PATH environment variables. pw_run.sh now calls this wrapper script (for GTK or WPE) instead of calling the MiniBrowser binary directly when running from a bundle. Co-authored-by: Andrey Lushnikov <aslushnikov@gmail.com>
This commit is contained in:
parent
4386cd4e7f
commit
19f21b1bde
|
|
@ -1,2 +1,2 @@
|
|||
1334
|
||||
Changed: yurys@chromium.org Tue Aug 25 18:01:13 PDT 2020
|
||||
1335
|
||||
Changed: aslushnikov@gmail.com Fri Aug 28 10:47:53 PDT 2020
|
||||
|
|
|
|||
|
|
@ -44,92 +44,25 @@ main() {
|
|||
fi
|
||||
}
|
||||
|
||||
copyLibrariesForWPE() {
|
||||
# Expect target directory to be passed in as first argument.
|
||||
local tmpdir=$1
|
||||
|
||||
# copy all relevant binaries
|
||||
cp -t $tmpdir ./WebKitBuild/WPE/Release/bin/MiniBrowser ./WebKitBuild/WPE/Release/bin/WPE*Process
|
||||
# copy all relevant shared objects
|
||||
# - exclude gstreamer plugins
|
||||
LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/MiniBrowser \
|
||||
| grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' \
|
||||
| grep -v '/libgst.*so' \
|
||||
| xargs cp -t $tmpdir
|
||||
LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/WPENetworkProcess \
|
||||
| grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' \
|
||||
| grep -v '/libgst.*so' \
|
||||
| xargs cp -t $tmpdir
|
||||
LD_LIBRARY_PATH="$PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib" ldd WebKitBuild/WPE/Release/bin/WPEWebProcess \
|
||||
| grep -o '[^ ]*WebKitBuild/WPE/[^ ]*' \
|
||||
| grep -v '/libgst.*so' \
|
||||
| xargs cp -t $tmpdir
|
||||
# Copy some wayland libraries required for Web Process
|
||||
if ls WebKitBuild/WPE/DependenciesWPE/Root/lib/libva\-* 2>&1 >/dev/null; then
|
||||
cp -d -t $tmpdir WebKitBuild/WPE/DependenciesWPE/Root/lib/libva\-*
|
||||
fi
|
||||
# Injected bundle is loaded dynamicly via dlopen => not bt listed by ldd.
|
||||
cp -t $tmpdir WebKitBuild/WPE/Release/lib/libWPEInjectedBundle.so
|
||||
if test -d $PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib/gio/modules/; then
|
||||
mkdir -p $tmpdir/gio/modules
|
||||
cp -t $tmpdir/gio/modules $PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib/gio/modules/*
|
||||
fi
|
||||
|
||||
cd $tmpdir
|
||||
ln -s libWPEBackend-fdo-1.0.so.1 libWPEBackend-fdo-1.0.so
|
||||
cd -
|
||||
|
||||
# Strip copied binaries.
|
||||
cd $tmpdir
|
||||
strip --strip-unneeded * || true
|
||||
cd -
|
||||
}
|
||||
|
||||
copyLibrariesForGTK() {
|
||||
# Expect target directory to be passed in as first argument.
|
||||
local tmpdir=$1
|
||||
|
||||
# copy all relevant binaries
|
||||
cp -t $tmpdir ./WebKitBuild/GTK/Release/bin/MiniBrowser ./WebKitBuild/GTK/Release/bin/WebKit*Process
|
||||
# copy all relevant shared objects
|
||||
# - exclude gstreamer plugins
|
||||
# - exclude libdrm
|
||||
LD_LIBRARY_PATH="$PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib" ldd WebKitBuild/GTK/Release/bin/MiniBrowser \
|
||||
| grep -o '[^ ]*WebKitBuild/GTK/[^ ]*' \
|
||||
| grep -v '/libgst.*so' \
|
||||
| grep -v '/libdrm.so' \
|
||||
| xargs cp -t $tmpdir
|
||||
|
||||
# Injected bundle is loaded dynamicly via dlopen => not bt listed by ldd.
|
||||
cp -t $tmpdir WebKitBuild/GTK/Release/lib/libwebkit2gtkinjectedbundle.so
|
||||
if test -d $PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib/gio/modules; then
|
||||
mkdir -p $tmpdir/gio/modules
|
||||
cp -t $tmpdir/gio/modules $PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib/gio/modules/*
|
||||
fi
|
||||
|
||||
# we failed to nicely build libgdk_pixbuf - expect it in the env
|
||||
rm -f $tmpdir/libgdk_pixbuf*
|
||||
|
||||
# tar resulting directory and cleanup TMP.
|
||||
cd $tmpdir
|
||||
strip --strip-unneeded * || true
|
||||
cd -
|
||||
}
|
||||
|
||||
createZipForLinux() {
|
||||
# create a TMP directory to copy all necessary files
|
||||
local tmpdir=$(mktemp -d -t webkit-deploy-XXXXXXXXXX)
|
||||
mkdir -p $tmpdir
|
||||
mkdir -p $tmpdir/minibrowser-gtk
|
||||
mkdir -p $tmpdir/minibrowser-wpe
|
||||
|
||||
# copy runner
|
||||
cp -t $tmpdir $SCRIPTS_DIR/pw_run.sh
|
||||
# copy protocol
|
||||
node $SCRIPTS_DIR/concat_protocol.js > $tmpdir/protocol.json
|
||||
|
||||
copyLibrariesForWPE $tmpdir/minibrowser-wpe
|
||||
copyLibrariesForGTK $tmpdir/minibrowser-gtk
|
||||
# Generate and unpack MiniBrowser bundles for each port
|
||||
for port in gtk wpe; do
|
||||
WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/${port^^} Tools/Scripts/generate-bundle \
|
||||
--bundle=MiniBrowser --release \
|
||||
--platform=${port} --destination=${tmpdir}
|
||||
unzip ${tmpdir}/MiniBrowser_${port}_release.zip -d ${tmpdir}/minibrowser-${port}
|
||||
rm -f ${tmpdir}/MiniBrowser_${port}_release.zip
|
||||
done
|
||||
|
||||
# tar resulting directory and cleanup TMP.
|
||||
cd $tmpdir
|
||||
|
|
|
|||
|
|
@ -18,19 +18,21 @@ function runOSX() {
|
|||
|
||||
function runLinux() {
|
||||
# if script is run as-is
|
||||
GIO_DIR="";
|
||||
LD_PATH="";
|
||||
BUNDLE_DIR="";
|
||||
DEPENDENCIES_FOLDER="DependenciesGTK";
|
||||
MINIBROWSER_FOLDER="minibrowser-gtk";
|
||||
BUILD_FOLDER="WebKitBuild/GTK";
|
||||
GIO_DIR="";
|
||||
if [[ "$*" == *--headless* ]]; then
|
||||
DEPENDENCIES_FOLDER="DependenciesWPE";
|
||||
MINIBROWSER_FOLDER="minibrowser-wpe";
|
||||
BUILD_FOLDER="WebKitBuild/WPE";
|
||||
fi
|
||||
# Setting extra environment variables like LD_LIBRARY_PATH or WEBKIT_INJECTED_BUNDLE_PATH
|
||||
# is only needed when calling MiniBrowser from the build folder. The MiniBrowser from
|
||||
# the zip bundle wrapper already sets itself the needed env variables.
|
||||
if [[ -d $SCRIPT_PATH/$MINIBROWSER_FOLDER ]]; then
|
||||
LD_PATH="$SCRIPT_PATH/$MINIBROWSER_FOLDER"
|
||||
GIO_DIR="$SCRIPT_PATH/$MINIBROWSER_FOLDER/gio/modules"
|
||||
BUNDLE_DIR="$LD_PATH"
|
||||
MINIBROWSER="$SCRIPT_PATH/$MINIBROWSER_FOLDER/MiniBrowser"
|
||||
elif [[ -d $SCRIPT_PATH/checkout/$BUILD_FOLDER ]]; then
|
||||
LD_PATH="$SCRIPT_PATH/checkout/$BUILD_FOLDER/$DEPENDENCIES_FOLDER/Root/lib:$SCRIPT_PATH/checkout/$BUILD_FOLDER/Release/bin"
|
||||
|
|
@ -38,9 +40,6 @@ function runLinux() {
|
|||
BUNDLE_DIR="$SCRIPT_PATH/checkout/$BUILD_FOLDER/Release/lib"
|
||||
MINIBROWSER="$SCRIPT_PATH/checkout/$BUILD_FOLDER/Release/bin/MiniBrowser"
|
||||
elif [[ -f $SCRIPT_PATH/MiniBrowser ]]; then
|
||||
LD_PATH="$SCRIPT_PATH"
|
||||
GIO_DIR="$SCRIPT_PATH/gio/modules"
|
||||
BUNDLE_DIR="$SCRIPT_PATH"
|
||||
MINIBROWSER="$SCRIPT_PATH/MiniBrowser"
|
||||
elif [[ -d $SCRIPT_PATH/$BUILD_FOLDER ]]; then
|
||||
LD_PATH="$SCRIPT_PATH/$BUILD_FOLDER/$DEPENDENCIES_FOLDER/Root/lib:$SCRIPT_PATH/$BUILD_FOLDER/Release/bin"
|
||||
|
|
@ -52,11 +51,19 @@ function runLinux() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d "$GIO_DIR" ]]; then
|
||||
if [[ -n "$GIO_DIR" ]]; then
|
||||
export GIO_EXTRA_MODULES="$GIO_DIR"
|
||||
fi
|
||||
|
||||
WEBKIT_FORCE_COMPLEX_TEXT="1" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LD_PATH" WEBKIT_INJECTED_BUNDLE_PATH="$BUNDLE_DIR" "$MINIBROWSER" "$@"
|
||||
if [[ -n "$LD_PATH" ]]; then
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LD_PATH"
|
||||
fi
|
||||
|
||||
if [[ -n "$BUNDLE_DIR" ]]; then
|
||||
export WEBKIT_INJECTED_BUNDLE_PATH="$BUNDLE_DIR"
|
||||
fi
|
||||
|
||||
WEBKIT_FORCE_COMPLEX_TEXT="1" "$MINIBROWSER" "$@"
|
||||
}
|
||||
|
||||
SCRIPT_PATH="$(cd "$(dirname "$0")" ; pwd -P)"
|
||||
|
|
|
|||
Loading…
Reference in a new issue