How to Work on the Haiku WebKit Port

Once the above is completed, you need to download and set up the following four files:

  1. WebKitHaikuSource.tgz (10.8 MB, Haikuware) - The current source for the Haiku WebKit port directly from my copy. This includes all the core WebKit files you will need to build the Haiku WebKit port. I have also included the source for other ports in case other developers wish to reference them. This should be extracted into the 3rdparty directory of the Haiku source:
    cd ~/develop/haiku/trunk/3rdparty
    tar zxf <your download directory>/WebKitSource.tgz
    This is NOT the full WebKit tree from SVN, just the directories that affect the Haiku port. In addition the .svn directories have been stripped out to conserve space. You may want to also download the full tree from the WebKit SVN as per instructions on the WebKit site.
  2. WebKitDependencies.tgz (14.4 MB) - A copy of my "WebKitLibs" directory that contains the installed versions of the various libraries that WebKit depends on, like ICU, libxml2, CURL and SQLite. All of these have been compiled with the GCC4 cross compiler to run on Haiku. Currently only ICU and libxml2 seem to work 100% correctly, but the others can at least be compiled against. This also should be extracted into the 3rdparty directory like the source code above.
  3. WebKitBuildConfig (2.5 KB) - This file adds the WebKit port to the Haiku build system. This should be put into the build/jam directory of the Haiku source tree. Then the following line needs to be added to the UserBuildConfig in that same directory (create that file if it does not exist yet):
    include [ FDirName $(HAIKU_BUILD_RULES_DIR) WebKitBuildConfig ] ;
    Please note and include ALL the spaces in the above, they are required for Jam!
  4. linkicu.sh (0.5 KB) - This script is added to the Haiku image and must be run prior to using any WebKit libraries. This file needs to be put in the build/jam folder also. See below for more information.

Once the above is done, the HaikuLauncher can be built by typing:

jam HaikuLauncher

This will also compile JavaScriptCore and WebCore since the HaikuLauncher depends on them. To only compile JavaScriptCore or WebCore, use the following commands:

jam libjavascriptcore.so
jam libwebcore.so

I generally add the -q option to the jam command-line so it quits on the first error. I find this makes it easier to fix build problems by fixing them one at a time.

To test the port just build the Haiku image as you normally would. The WebKitBuildConfig will add the WebKit related files to the image, which is also made bigger to accomodate the added files. Once you have booted Haiku, be sure to run the linkicu.sh script above. This sets up the appropriate symlinks for the ICU library. One day I may see about removing this, but for now we have to deal with it. The HaikuLauncher can be run by typing "HaikuLauncher" in the Terminal. Right now it is very ugly and pretty much does nothing.

When doing normal Haiku development it would be wise to set one or both of the variables at the top of the UserBuildConfig, COMPILE_WEBKIT and ADD_WEBKIT_TO_IMAGE to 0, so that WebKit isn't compiled or added to the image, respectively. This is especially important when switching back to the GCC2 compiler, since this compiler cannot currently (or probably ever) compile WebKit.

Eventually the Haiku platform files will be added to the WebKit SVN repository, so Step 1 above will be replaced with downloading the WebKit source from SVN. But for now I'm periodically updating my tree from their SVN and making any needed changes/fixes which I will then package up into the above file.

Any changes or fixes made to the code should be diffed against the original version of my code and emailed to me at the address shown in the copyright header of most of the Haiku port files (hint: my last name at gmail.) Please use diff -u to produce a unified diff. I know this is a bit of a pain, but until we get the port in the WebKit SVN we need to deal with it. Hopefully that will happen soon.