Menu

BuildInstructions

Featured (2)
Anonymous Tobias Netzel

Build instructions for WebKit 601 and later are not available yet - the main difference is the switch to a modified version of GCC 6.

Requirements

  • MacPorts is the recommended way to get the following necessary tools
  • gcc 4.2.4 Apple build 5666.3
    for Blocks support and additional bugfixes missing in Apple's 4.2.1
  • ruby >=1.9
    for building the Offline Assembler and the Low Level Interpreter for the JavaScript engine
  • Python >=2.6
  • JSON library for Python
  • Perl >=5.10
  • flex >=2.5.35
  • developer_cmds >=58
  • subversion

Preparing the toolchain

Here the steps to prepare the build environment using MacPorts:

  1. install MacPorts as described
  2. install Python 2.7 which already includes a JSON library

    sudo port install python27

  3. select Python 2.7 to be the default version

    sudo port select python python27

  4. install Apple gcc build 5666.3 (will take some hours)
    Make sure you get the gpl3 variant!

    sudo port install apple-gcc42 +gpl3

  5. install ruby 2.1

    sudo port install ruby21
    sudo port select ruby ruby21

  6. install Perl

    sudo port install perl5

  7. install flex

    sudo port install flex

  8. install developer_cmds

    sudo port install developer_cmds

  9. Now backup the existing Xcode tools:
    in order to force Xcode to use the recently built tools

    cd {path to your Xcode installation}/usr/bin
    mv gcc-4.2 gcc-4.2.bak
    mv g++-4.2 g++-4.2.bak
    mv nm nm.bak
    mv install_name_tool install_name_tool.bak
    mv flex flex.bak
    mv unifdef unifdef.bak

  10. Then create symlinks to the MacPorts versions (staying in the same directory):

    ln -s /opt/local/bin/gcc-apple-4.2 gcc-4.2
    ln -s /opt/local/bin/g++-apple-4.2 g++-4.2
    ln -s /opt/local/bin/nm nm
    ln -s /opt/local/bin/install_name_tool install_name_tool
    ln -s /opt/local/bin/flex flex
    ln -s /opt/local/bin/unifdef unifdef

  11. Now backup some existing system tools:
    in order to force all scripts to use the recently built tools

    cd /usr/bin
    mv perl perl.bak
    mv python python.bak

  12. Then create symlinks to the MacPorts versions (staying in the same directory):

    ln -s /opt/local/bin/perl perl
    ln -s /opt/local/bin/python python

  13. install subversion

    sudo port install subversion

Getting the sources

It is recommended to avoid checking out and updating the whole test suite as it is not needed for building anyway.

  1. Check out the root directory and the immediate childs of the WebKit SVN repository (inserting i.e. "Safari-536.25" as the version tag)
    15 GB disk space is needed for building all four architectures.

    cd {destination path}
    svn checkout http://svn.webkit.org/repository/webkit/tags/{some version tag} --depth=immediates WebKit
    cd WebKit

  2. Checkout the content of the needed subdirectories of the WebKit SVN repository (staying in the same directory "WebKit")

    svn update --set-depth=infinity Source Tools WebKitLibraries

  3. Checkout the JavaScriptGlue directory

    svn checkout ^/trunk/Source/JavaScriptGlue@105839 Source/JavaScriptGlue

  4. Checkout the WebKitSystemInterface static libraries
    They have been removed from the subversion trunk at revision 133670

    svn merge -c -133670 ^/trunk --accept=mf

  5. Apply the patchfiles corresponding to the version tag you checked out

    svn patch --strip 2 {path to the WebKit patchfile}
    svn patch --strip 3 {path to the JavaScriptGlue patchfile} Source/JavaScriptGlue

Building the WebKit frameworks

Safari in 10.5 doesn't support 64 bit so building x86_64 and ppc64 does only make sense when you also build a browser (like Sunrise) as 64 bit.

Issue the following commands from within the root directory of the source tree:

  • Release build
    You can choose to add to ARCHS any of i386, x86_64, ppc, ppc64, ppc7400, ppc970

    Tools/Scripts/build-webkit --release ARCHS="ppc" ONLY_ACTIVE_ARCH=NO

  • Debug build
    You can choose to add to ARCHS any of i386, x86_64, ppc, ppc64, ppc7400, ppc970

    Tools/Scripts/build-webkit --debug ARCHS="ppc" ONLY_ACTIVE_ARCH=NO

  • Building with distcc requires adding the following to the command line:

    GCC_PRECOMPILE_PREFIX_HEADER=NO

  • In order to build targetting 10.6 when running a different version of OS X add the following to the command line:

    TARGET_MAC_OS_X_VERSION_MAJOR=1060

Running the built code

Issue the following commands from within the root directory of the source tree:

  • Run Safari in the gdb debugger

    Tools/Scripts/debug-safari

  • Launch Safari, forcing it to use the freshly built frameworks

    Tools/Scripts/run-safari

  • Launch a WebKit based application, forcing it to use the freshly built frameworks

    Tools/Scripts/run-webkit-app {path to the application}/Contents/MacOS/{application binary}

Updating the sources

In order to update your source tree to a newer tag, issue the following commands from within the root directory of the source tree:

  1. Undo the previous patchset and remove non-versioned files and directories

    svn revert -R .
    svn status | grep ^\? | cut -c9- | tr '\n' '\0' | xargs -0 rm -r

    svn revert -R Source/JavaScriptGlue
    svn status Source/JavaScriptGlue | grep ^\? | cut -c9- | tr '\n' '\0' | xargs -0 rm -r

  2. Update to the new tag

    svn switch ^/tags/{some version tag}

  3. Apply the patchfiles corresponding to the version tag you checked out

    svn patch --strip 2 {path to the WebKit patchfile}
    svn patch --strip 3 {path to the JavaScriptGlue patchfile} Source/JavaScriptGlue


Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.