19. July 2010 14:52
(Updated December 18 2010. The build process has changed subtly – updated info is marked in bold.)
With summer upon us, I’m finally getting a bit more time to work on some WebKit and WebKit .NET stuff. My intention is to make my way through the TODOs in the project roadmap and blog about any interesting bits as I go. As can be seen, there is a fair amount to be done, hence the ‘Part 1!’
I started, as I usually do, with the mammoth task of compiling WebKit, which inevitably takes much longer than I anticipate. The exact process seems to change very subtly each time. Here I’ll describe the exact steps I went though this time (with WebKit revision 63600 or so). Although mainly for my own reference, it may save someone else a couple of hours if they run into the same problems that I did. So, to get it building (assuming a build environment is configured as described here, Visual Studio 2008 is installed, and the WebKit source and support libraries have been downloaded):
- Grab the dependencies required to build the Cairo port (updated October 2 2010; thanks Brent Fulgham) and extract them somewhere.
- Fire up Visual Studio 2008 and open WebKit/win/WebKit.vcproj/WebKit.sln. Run through the conversion process and finish. Add the ‘include’ and ‘include/cairo’ directories from the dependencies in the previous step to the Visual C++ include directory list. Similarly, add the ‘lib’ directory to the Visual C++ libraries directory list. Close Visual Studio.
- Open a cygwin prompt, navigate to the WebKit root directory and run the script (Updated December 18 2010: The WebKitTools directory has been renamed to Tools):
This downloads another set of libraries and installs them, along with the support libraries. As we’ve converted the project to VS 2008, and the script is configured to build with VS 2005, the build will fail, but we can ignore that. There is probably a more elegant way to install these libraries, but this method suffices for the moment. No worries there.
- Added December 18 2010: It's now also necessary to run the following script to install another set of libraries:
This will also update to the latest SVN revision.
- In the WebCore librarian configuration properties, add the following switch to the command line options:
This is a workaround for a problem where the linker runs out of memory and issues a “LNK1106: invalid file or disk full: cannot seek to 0x…” error message. More information can be found in this Microsoft KB article.
- Optionally, but required for the DOM access functionality in WebKit .NET 0.4+, replace WebKit/win/DOMCoreClasses.cpp and WebKit/win/DOMCoreClasses.h with these modified versions. Hopefully I’ll get these changes committed to the actual WebKit repository at some point, but until then you can grab them from here.
- We’re pretty much done. Hit build and go make a cup of tea or do something else constructive for a while. In my experience, it takes about 45-60 minutes to build from scratch with optimizations disabled, and 2-3 hours with them enabled.
And voila, we (should) have a fully-functioning WebKit Cairo build to use.
As it turns out, I did get enough time to implement basic printing functionality in WebKit .NET (no page setup or print preview yet) as well, but I’ll leave that for part 2 when it’s more complete. The changes should be up on SVN very soon, and a 0.5 release is well on its way.