[[PageOutline]] = Building WebKitGTK from a release tarball = You can build and install WebKitGTK from a [https://webkitgtk.org/releases/ 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 [wiki:WebKitGTK WebKitGTK] source, please follow the instructions on the [http://webkit.org/building/checkout.html 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 == 1. '''Install the base WebKitGTK dependencies:''' {{{ #!sh $ Tools/gtk/install-dependencies }}} 2. '''Download and build all JHBuild modules:''' {{{ #!sh $ Tools/Scripts/update-webkitgtk-libs }}} == Building == {{{ #!sh $ Tools/Scripts/build-webkit --gtk }}} === Notes === * You can pass parameters to the make command with the ''--makeargs'' argument. * For example, you can pass ''--makeargs="-jXX"'', where XX is an integer, to set the number of threads make will use. The default is one per logical CPU detected, but you might want fewer if it's bogging down your system. * If everything builds properly tests should typically pass on your system. Please file a bug if they do not. * If you get build errors saying a library could not be found but you have the appropriate packages installed make sure you have up-to-date multiarch-support and binutils (or binutils-gold) packages. * You can also [wiki:WebKitGtkExtendingJHBuild add more modules to the default WebKit JHBuild]. === Speeding up the build process === There are several tricks that can be used to build [wiki:WebKitGTK WebKitGTK] in less time. Check the [[WebKitGTK/SpeedUpBuild]] page for the details. == OS X == The code on Mac OS X should built 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). [http://www.macports.org/ MacPorts] users can get the dependencies via: {{{ #!sh $ 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" }}} == Cross Compiling for ARM devices == If you need to make ARM builds you might find useful the [https://github.com/mariospr/webkit2gtk-ARM resources hosted in this git repository] which basically provide a [https://cmake.org/cmake/help/v3.6/manual/cmake-toolchains.7.html#cross-compiling-for-linux CMake Toolchain File] to build WebKit2GTK+, together with instructions on how to setup a local chroot environment to use it, so that both the environment and the build are reproducible. Wrapping up the instructions in there a bit, you'd basically have to follow 3 steps (or 2, after the initial setup): 1. Create the chroot and provision it, running the [https://github.com/mariospr/webkit2gtk-ARM/blob/master/bootstrap.sh bootstrap script] provided (only once) as root (or with sudo) 2. Configure the build as you please, pointing to the [https://github.com/mariospr/webkit2gtk-ARM/blob/master/armv7l-toolchain.cmake CMake Toolchain provided], which you placed somewhere in your disk {{{ $ mkdir /path/to/your/WebKit/BUILD && cd /path/to/your/WebKit/BUILD $ cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/armv7l-toolchain.cmake \ -DPORT=GTK \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_SYSCONFDIR=/etc \ -DCMAKE_INSTALL_LOCALSTATEDIR=/var \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_LIBDIR=lib/arm-linux-gnueabihf \ -DCMAKE_INSTALL_LIBEXECDIR=lib/arm-linux-gnueabihf \ -DENABLE_PLUGIN_PROCESS_GTK2=OFF \ -DENABLE_GEOLOCATION=OFF \ -DENABLE_GLES2=ON \ -DUSE_LD_GOLD=OFF \ /path/to/your/WebKit }}} 3. 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 [https://github.com/mariospr/webkit2gtk-ARM github repo], or open a pull request.