Build instructions for WebKit 601 and later are not available yet - the main difference is the switch to a modified version of GCC 6.
Here the steps to prepare the build environment using MacPorts:
install Python 2.7 which already includes a JSON library
sudo port install python27
select Python 2.7 to be the default version
sudo port select python python27
install Apple gcc build 5666.3 (will take some hours)
Make sure you get the gpl3 variant!
sudo port install apple-gcc42 +gpl3
install ruby 2.1
sudo port install ruby21
sudo port select ruby ruby21
install Perl
sudo port install perl5
install flex
sudo port install flex
install developer_cmds
sudo port install developer_cmds
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
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
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
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
install subversion
sudo port install subversion
It is recommended to avoid checking out and updating the whole test suite as it is not needed for building anyway.
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
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
Checkout the JavaScriptGlue directory
svn checkout ^/trunk/Source/JavaScriptGlue@105839 Source/JavaScriptGlue
Checkout the WebKitSystemInterface static libraries
They have been removed from the subversion trunk at revision 133670
svn merge -c -133670 ^/trunk --accept=mf
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
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
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}
In order to update your source tree to a newer tag, issue the following commands from within the root directory of the source tree:
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
Update to the new tag
svn switch ^/tags/{some version tag}
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