Building WebKitGTK+ for Windows

I've searched long for a way to write HTML5 applications for desktops. WebKitGTK+ was one of the various technologies in my list for achieving that.
Update (Jul 2014): Nah, I'd rather use node-webkit to do that.

I've previously tried to build WebKitGTK+ on Windows and failed.
But recently I came to know that openSUSE has done some cross-compiling work on WebKitGTK+ for windows. They have pre-built binaries for Windows that I could just download and use.
However, I wanted to see whether I could get the binary size to a minimum, by excluding features that I don't need.


Let's Build!

So here we go. I first downloaded OpenSUSE 13.1 and booted it through VirtualBox.
The way to build openSUSE packages is by using the `osc` tool (read more here).

sudo zypper install osc
Now fetch the "mingw32-webkitgtk" package from the project named "windows:mingw:win32" and do the following:
osc co windows:mingw:win32 mingw32-webkitgtk

The version of WebKitGTK I've got is 1.10.2.
I modified the configure parameters in mingw32-webkitgtk.spec file by disabling support for things like video, svg, webgl and few more.
#line number 149
%{_mingw32_configure} \
    --disable-debug --enable-debug-symbols --disable-debug-features \
    --with-gtk=2.0 --disable-webkit2 --disable-glibtest \
    --enable-shared --disable-static --with-target=win32 \
    --with-unicode-backend=icu --disable-jit \
    --with-font-backend=freetype \
    --disable-webgl \
    --disable-video \
    --disable-svg \
    --disable-svg-fonts \
    --disable-geolocation \
    --disable-mathml \
    --disable-web-sockets \
    --enable-3D-transforms
        
I started building by doing a: osc build --disable-debuginfo openSUSE_13.1 x86_64 mingw32-webkitgtk.spec
It will take an hour or two to complete. Everything went fine for me (don't you love it when that happens?), and I get the built files in /var/tmp/

I tested the built binary on Windows using the sample "GTKLauncher-1.0.exe" application that I got from downloading webkitgtk-tools. I had to download a *lot* of other stuff (dependencies/DLLs) to get the GTKLauncher application running. Take a look at the dependency list here


The final result is that I managed to reduce the libwebkitgtk dll size from 24MB to 18.8MB (not much), and also avoided dependencies like GStreamer.
Here is the final build that includes GTKLauncher, my webkitgtk build and all dependencies required to run GTKLauncher.

Created on Dec 28, 2013
blog comments powered by Disqus