How To build WebKit on Haiku
============================

Author:	Maxime Simon <simon.maxime@gmail.com>


Requirements
------------
* GCC4, available on hybrid Haiku builds or gcc4-only builds.

* GPerf, you can find the executable here:
http://ryanleavengood.com/haiku/gperf

* ICU, the libs are part of default Haiku builds since r33176. However you still need to install the development optional package, ICU-devel:
$ installoptionalpackage -a ICU-devel
(or http://haiku-files.org/files/optional-packages/)

* Curl, might be already present in your Haiku install, otherwise:
$ installoptionalpackage -a Curl
(or http://haiku-files.org/files/optional-packages/)

* Perl, might be already present in your Haiku install, otherwise:
$ installoptionalpackage -a Perl
(or http://haiku-files.org/files/optional-packages/)

* Python and Ruby, are optional but may be needed if you want to
go further with WebKit (testing, etc).


Building
--------

Be sure to have all the requirements above before continuing,
and to be placed in the directory where you checked out WebKit.

Don't forget to switch the current toolchain too gcc4 (unless you're on a pure gcc4 Haiku):
$ setgcc gcc4

* First step, generate derived sources:
$ sh WebKitTools/haiku/make-generated-sources.sh

Next, if you want to build the release version:

$ export NDEBUG=1

Don't export NDEBUG at all for a debug build.

* Then, building WebKit:
$ jam -q <target>
with target in:
	- libjavascriptcore.so  (the JavaScriptCore library)
	- jsc                   (the JavaScriptCore executable shell)
	- libwebcore.so         (the WebCore library, including
                             libjavascriptcore.so)
	- libwebkit.so          (the WebKit library including libwebcore.so,
                             the API and some specific files)
	- HaikuLauncher         (*default target* the test shell, including
                             libwebkit.so and a simple browsing window)
    - DumpRenderTree        (the tree parsing tool, required to test
                             WebKit, including libwebkit.so)
    - WebPositive           (the Haiku browser)

If you just run

$ jam jsc

followed by

$ jam WebPositive

you will automatically build everything required for the browser.

All targets end up in WebKitBuild, and additionally they are installed in the
system automatically!

If you switch between Release and Debug build versions, make sure to always
have matching libs in /boot/home/config/lib. For example, if you switch to
release build, do something which updates libwebcore.so, it will be placed
in /boot/home/config/lib, along with libwebkit.so and WebPositive, since
they depend on it. But it won't update libjavascriptcore.so, since it didn't
change. But you need the matching version. As long as our build system doesn't
take care of that, you need to make sure of this manually.


Caution
-------

The WebKit port evolves really fast, so you may run into troubles
when building it with a recent version of WebKit.
We are making our best for this not to happen, but you're warned. :)
