Skip to content

Commit

Permalink
Reduce binary size of WebKit Linux build bundles (GTK and WPE)
Browse files Browse the repository at this point in the history
This patch changes the build system to use the JHBuild minimal dependency
system introduced in WebKit r264092 <https://trac.webkit.org/r264092>

The build has been tested with Ubuntu-18.04

The binary size of the zip bundles is now: 37M (WPE) and 40M (GTK).
Previously it was 54M and 59M (respectively)
  • Loading branch information
clopez committed Jul 8, 2020
1 parent 040c6a6 commit 78321ad
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 55 deletions.
4 changes: 2 additions & 2 deletions browser_patches/webkit/BUILD_NUMBER
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1303
Changed: [email protected] Tue Jul 7 12:51:44 PDT 2020
1304
Changed: [email protected] Wed Jul 8 11:31:52 PDT 2020
2 changes: 1 addition & 1 deletion browser_patches/webkit/UPSTREAM_CONFIG.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
REMOTE_URL="https://github.com/webkit/webkit"
BASE_BRANCH="master"
BASE_REVISION="19d11039faa6e4da8cf7487e9c54a00a7c6e18e2"
BASE_REVISION="822da5711ad337e1a7da82e813aa99e14fb79e49"
18 changes: 12 additions & 6 deletions browser_patches/webkit/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,15 @@ createZipForLinux() {
# Copy libvpx.so.5 as Ubuntu 20.04 comes with libvpx.so.6
ldd WebKitBuild/WPE/Release/bin/MiniBrowser | grep -o '[^ ]*\/libvpx.so.5[^ ]*' | xargs cp -t $tmpdir
# Copy some wayland libraries required for Web Process t
cp -d -t $tmpdir WebKitBuild/WPE/DependenciesWPE/Root/lib/libva\-*
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
mkdir -p $tmpdir/gio/modules
cp -t $tmpdir/gio/modules $PWD/WebKitBuild/WPE/DependenciesWPE/Root/lib/gio/modules/*
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
Expand All @@ -100,11 +104,13 @@ createZipForLinux() {
cp -t $tmpdir WebKitBuild/GTK/Release/lib/libwebkit2gtkinjectedbundle.so
# Copy libvpx.so.5 as Ubuntu 20.04 comes with libvpx.so.6
ldd WebKitBuild/GTK/Release/bin/MiniBrowser | grep -o '[^ ]*\/libvpx.so.5[^ ]*' | xargs cp -t $tmpdir
mkdir -p $tmpdir/gio/modules
cp -t $tmpdir/gio/modules $PWD/WebKitBuild/GTK/DependenciesGTK/Root/lib/gio/modules/*
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 $tmpdir/libgdk_pixbuf*
rm -f $tmpdir/libgdk_pixbuf*
else
echo "ERROR: must specify --gtk or --wpe"
exit 1
Expand Down
8 changes: 4 additions & 4 deletions browser_patches/webkit/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ cd "$(dirname $0)"

build_gtk() {
if ! [[ -d ./WebKitBuild/GTK/DependenciesGTK ]]; then
yes | WEBKIT_JHBUILD=1 WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK DEBIAN_FRONTEND=noninteractive ./Tools/Scripts/update-webkitgtk-libs
yes | WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK DEBIAN_FRONTEND=noninteractive ./Tools/Scripts/update-webkitgtk-libs
fi
WEBKIT_JHBUILD=1 WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK ./Tools/Scripts/build-webkit --gtk --release --touch-events --orientation-events MiniBrowser
WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/GTK ./Tools/Scripts/build-webkit --gtk --release --touch-events --orientation-events --no-bubblewrap-sandbox MiniBrowser
}

build_wpe() {
if ! [[ -d ./WebKitBuild/WPE/DependenciesWPE ]]; then
yes | WEBKIT_JHBUILD=1 WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE DEBIAN_FRONTEND=noninteractive ./Tools/Scripts/update-webkitwpe-libs
yes | WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE DEBIAN_FRONTEND=noninteractive ./Tools/Scripts/update-webkitwpe-libs
fi
WEBKIT_JHBUILD=1 WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE ./Tools/Scripts/build-webkit --wpe --release --touch-events --orientation-events MiniBrowser
WEBKIT_JHBUILD=1 WEBKIT_JHBUILD_MODULESET=minimal WEBKIT_OUTPUTDIR=$(pwd)/WebKitBuild/WPE ./Tools/Scripts/build-webkit --wpe --release --touch-events --orientation-events --no-bubblewrap-sandbox MiniBrowser
}

if [[ "$(uname)" == "Darwin" ]]; then
Expand Down
Loading

0 comments on commit 78321ad

Please sign in to comment.