BuildingGtk – WebKit (original) (raw)

  1. Building WebKitGTK from a release tarball
  2. Building WebKitGTK from git
    1. Getting the source
    2. Dependencies
        1. Notes
    3. Building
        1. Notes
          1. Speeding up the build process
      1. Building the GTK port on MacOS
    4. Cross Compiling
      1. Yocto / OpenEmbedded
      2. Using a cross-toolchain
  3. Running
    1. Running from git
    2. Running from a tarball

Building WebKitGTK from a release tarball

You can build and install WebKitGTK from a ​release tarball the same as you would any other CMake project. The only trick is that you must pass the CMake option -DPORT=GTK. For example, to do a release build with debug info and install the result:

$ cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja $ ninja $ sudo ninja install

If you want to build WebKit for production use, you should stop reading here. The rest of the instructions on this page are only suitable for development and testing.

Building WebKitGTK from git

If you want to do development on WebKit itself, you'll need a git checkout. You'll also need to use our Flatpak-based SDK, as using other versions of dependencies may cause layout tests to fail. The following steps are suitable for WebKit development only, not for production builds. Our Flatpak SDK does not receive security or bugfix updates and it is not suitable for any purpose other than development and running layout tests. Do not run against untrusted websites.

Getting the source

To get the WebKitGTK source, please follow the instructions on the ​WebKit page. Many WebKit developer also use git to interact with the repository and the WebKit developer tools have strong support for git. ​http://trac.webkit.org/wiki/UsingGitWithWebKit contains tips for using git with WebKit.

Dependencies

Download and locally install the Flatpak SDK:

$ Tools/Scripts/update-webkitgtk-libs

Notes

apt-get install flatpak

Building

$ Tools/Scripts/build-webkit --gtk

Notes

Speeding up the build process

There are several tricks that can be used to build WebKitGTK in less time. Check the WebKitGTK/SpeedUpBuild page for the details.

Building the GTK port on MacOS

The code on MacOS may [1] build like any Linux distribution, as long as you install the above build dependencies (in addition to an "ordinary build environment" that includes XCode Tools 2.3 or newer). ​MacPorts users can get the dependencies via:

$ sudo port install webkit-gtk

If you get an error about libjpeg when the build does the configuration step, you may find the following fixes it:

$ export CPPFLAGS="-I/opt/local/include" $ export LDFLAGS="-L/opt/local/lib"

[1] Note: The MacOS build is not actively maintained to the same standards than the Linux one. So your mileage may vary.

Cross Compiling

Below there are some tips for cross-compiling

Yocto / OpenEmbedded

One of the easiest ways to build WebKitGTK is with Yocto. There are recipes for webkitgtk in the main Yocto layer. On top of that there is also the ​meta-webkit layer with extra recipes.

Using a cross-toolchain

The instructions below are a bit old and won't work as such (you need a new GCC version now), but you can get an idea of how this can be done:

  1. Build it:
    $ make VERBOSE=1 -j12 # Or anything else, this is just what I use

This has been tested with WebKit2GTK 2.12.x and 2.14.x releases as well as with trunk. If you find any issue/comment, please comment on the ​github repo, or open a pull request.

Running

Running from git

$ Tools/Scripts/run-minibrowser --gtk

Running from a tarball

  1. Install the built product
  2. Execute your program using WebKitGTK, or try to use the MiniBrowser (you need to enable it on the build, its disabled by default)