wiki:BuildingCairoOnWindows

Version 9 (modified by bfulgham@macports.org, 14 years ago) (diff)

--

Building on Windows

As with Apple's Windows Port, you must first follow the instructions on http://webkit.org/building/tools.html to install the necessary developer tools, support libraries, and check out the WebKit code.

Note that it is safest to build WebKit in your Cygwin home directory. At the moment, there seems to be an implicit assumption in the build scripts that paths will be relative to the home directory.

Required Libraries

Just like the CoreGraphics Windows and Mac build, you must have the QuickTime SDK installed. In addition, you will need to manually obtain the following libraries:

  • GIFLIB - GIF libraries (both the -bin and -lib packges).
  • libJPEG - JPEG libraries. Since all existing win32 versions of this library seem to be missing important patches, I would recommend downloading the source source tarball, then apply the debian patches. You can then build it from the DOS shell using the included Makefile.vc. I generally build the static library and link it directly to WebKit.
  • libPNG - PNG libraries (both the -bin and -lib packages).
  • Cairo - Cairo libraries (both the -bin and -dev packages).

Once you have them, unpack them someplace (such as C:\graphics_formats) and add the underlying include and lib directories to the Visual Studio Directory list.

Building from within Visual Studio

WebKit can be built from within Visual Studio by setting two environment variables:

  • WEBKITOUTPUTDIR - An absolute Windows-style path pointing to the directory where you want the build products to go.
  • WEBKITLIBRARIESDIR - An absolute Windows-style path pointing to the WebKitLibraries/win folder in your WebKit checkout.

Configuring the build

You must update the WebCore/config.h file to indicate that you wish to build with Cairo.

#if 0

#if PLATFORM(WIN)
// Safari-Style build
#define WTF_USE_JAVASCRIPTCORE_BINDINGS 1
#define WTF_USE_NPOBJECT 1
#define WTF_PLATFORM_CG 1
#undef WTF_PLATFORM_CAIRO
#define WTF_USE_CFNETWORK 1
#undef WTF_USE_WININET
#define WTF_PLATFORM_CF 1
#define WTF_USE_PTHREADS 0
#endif

#else

#if PLATFORM(WIN)
#if 1
// Cairo-based (stock everything else)
#define WTF_USE_JAVASCRIPTCORE_BINDINGS 1
#define WTF_USE_NPOBJECT 1
#undef WTF_USE_CURL
#define WTF_PLATFORM_CAIRO 1
#define WTF_USE_CFNETWORK 1
#undef WTF_USE_WININET
#define WTF_PLATFORM_CF 1
#define WTF_USE_PTHREADS 0
#else
// All-redistributable
#define WTF_USE_JAVASCRIPTCORE_BINDINGS 1
#define WTF_USE_NPOBJECT 1
#define WTF_USE_CURL 1
#define WTF_PLATFORM_CAIRO 1
#undef WTF_USE_CFNETWORK
#undef WTF_USE_WININET
#define WTF_PLATFORM_CF 1
#define WTF_USE_PTHREADS 0
#endif
#endif

#endif

Common Build Errors

Error spawning cmd.exe

Sometimes, Visual Studio complains that it 'cannot spawn cmd.exe'. Should this happen, check if both your Cygwin\bin folder and c:\windows\sytem32 are both in the Visual Studio list of executable files (Tools -> Options -> VC++ Directories).

Bad line endings

When you see errors in WebCore/css/makeprops or WebCore/css/maketokenizer, open those files in a suitable editor (SciTE works) and convert the line endings to LF only (Unix-style). Then restart the build.

Visual C++ Express Edition

1>c:\cygwin\home\admin\webkit\javascriptcore\wtf\assertions.cpp(45) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

If you see errors like this you probably need to install the platform SDK.

Running the tests

After successfully building WebKit, in order to run the tests you need to:

  1. copy the DLLs from C:\Program Files\Safari\ into your WebKitBuild\bin folder, otherwise testkjs won't run properly. When you are doing this, be careful not to overwrite the WebKit.dll file in WebKitBuild\bin with the one in C:\Program Files\Safari. (If you use the DOS copy command, it will ask you before overwriting.)
  2. Make sure the Cairo, JPEG, and PNG libraries are either in this directory, or in your PATH.

Note: Safari will most likely not work, as various methods needed for Safari may not be implemented. I am only aware of WinLauncher working with Cairo-based WebKit at this time.