WebKit编译教程 下载本文

内容发布更新时间 : 2024/11/2 19:32:02星期一 下面是文章的全部内容请认真阅读。

WebKit内核编译实在是一项折磨人的事情,虽然webkit.org官方有一个文档,但是有时候机器本身配置环境还是和教程有差别。其实,官方的描述已经非常到位,只要保证每一步都执行了,差别应该不大,需要多加处理的就是本机实际环境导致的具体问题。 首先按照官方文档进行操作

http://www.webkit.org/building/tools.html 一、安装Visual 2005

If you own Visual Studio 2005 (newer versions of Visual Studio are currently unsupported):

Install Microsoft Visual Studio 2005 Team Suite Service Pack 1.

If you are building from Vista, install Service Pack 1 Update for Windows Vista. Install Visual Studio 2005 Service Pack 1 ATL Security Update.

Install the following hotfixes to improve Visual Studio's performance and responsiveness:

KB918559 KB935225 KB943969 KB947315

Use the default options for these installations.

注意点: 如果Visual Studio 2005装的是中文版,补丁程序必须要是中文版

二、安装cygwin Install Cygwin

Cygwin is a collection of utilities for Windows that includes not only a Subversionclient, but also additional tools that are required to build the WebKit source. Wehave made a downloader available that automatically collects all of the requiredpackages.

Download cygwin-downloader.zip.

Extract the content of the archive to some folder and start

cygwin-downloader.exe from that folder.This will download all the Cygwin packages you need.

When all the packages have finished downloading, the Cygwin installer will launch. ChooseInstall from Local Directory, then clickNext until theinstall is complete. If you are running Vista, the installer won't be able to launch automatically, so you will have to manually launch Cygwin's Setup.exe.

Note: If you are behind a proxy you need to set the http_proxy environment variable to the URL of the proxy. This wouldlikely match this

pattern:http[s]://[username[:password]@]somehost.com[:port]. Where the square brackets ([]) are not part of the url but enclose url elements that are optional indicating that those elements might be missing in your case together with their enclosed delimiter such as @ and :.

Note: Vista may warn you that Cygwin did not install correctly. Ignore this warning and tell Vista that the install was successful.

Warning: If you are running Vista or Windows 7, Cygwin may have trouble with

implementingfork(the POSIX function frequently used to start child processes, needed by many of the WebKit build tools).In order to enablecygwin1.dll to implement fork successfully it is better if no DLL loaded in the parent process is relocated at runtime.One way to achive this is to rebase all cygwin dlls exceptcyglsa64.dll andcygwin1.dll to base addresses that cause them to not overlap in memory.

In order to rebase all cygwin dlls a rebaseall script is provided in the cygwin installation'sbin directory(usuallyC:\\cygwin\\bin).This script must be run

fromash.exe (found in the same directory) while no other cygwin application is running.

ash.exe has very limited command line editing features so cutting and pasting to the commandline is recommended.

The PATH environment variable may not contain the /bin directory by defaultthus the script should be launched as/bin/rebaseall.

If rebaseall is complaining about failure to write to a Windows Temp directory (i.e./cygdrive/c/Users/you/AppData/Local/Temp),fix the permissions on that folder (i.e./bin/chown you /cygdrive/c/Users/you/AppData/Local/Temp) orchange the TMP environment variable to point to a directory with the appropriate permission flags (i.e.:export TMP=/tmp).

Note: The rebase process may need to be repeated to include any new libraries added later to cygwin by listing these libraries by full cygwin path in a file and passing the file torebaseall via the-T fileName commandline argument.The dlls underLayoutTests/http/conf are a relevant use case.

Remove the following lines from /home/[username]/.bashrc (if present): unset TMP unset TEMP

Those lines would prevent picking up the Windows TMP and TEMP environment variables.

If you are behind a proxy you need to do the following to allow cygwin svn to get through the proxy (similar steps are available for your Windows svn):

In bash (Cygwin) run: svn help. This will create in your cygwin home directory the file .subversion/servers.

Edit the file mentioned above and follow the instructions in the file to set up your proxy settings.

本人用的是XP,只需默认安装,不需配置。

三、 安装 QuickTime SDK和 DirectX SDK Install QuickTime SDK

Download QuickTime SDK for Windows from

http://developer.apple.com/quicktime/download/ and install it to the default location (\\Program Files\\QuickTime SDK). This is needed for media support.

Install DirectX SDK

Download the February 2010 DirectX SDK (newer versions do not support Visual Studio 2005). This is needed for accelerated compositing.

四 、其他

Optional: Install the 32-bit version of Debugging Tools for Windows

Debugging Tools for Windows includes many useful debugging tools such as WinDbg and NTSD. Some of WebKit’s tests and scripts use these tools. Follow theinstructions for installing the 32-bit version of Debugging Tools for Windows.

Optional: Hotfix for 64-bit Windows to disable the user-mode callback filter for exceptions

Without the 976038 hotfix, exceptions may be thrown in callback routines that do not cause a crash but leave the application in an inconsistent state that might cause a crash later. You will need to click on \and fill out the form. A link to download the hotfix and a password will be emailed to you.

注:可以不安装

五、 编译

1.打开Cygwin,进入WebKit/WebKitTools/Scripts文件夹运行一下 ./update-webkit是个更新脚本,不运行这个编译的时候是肯定要出错的。

Update-webkit可能出现的错误

原因:你的cygwin安装不完全,最好重新运行cygwin-downloader.exe,重新安装cygwin.

2、先设置两个环境变量WEBKITOUTPUTDIR和WEBKITLIBRARIESDIR。第一个环境变量可以随便设,如果要保持和其他Build方式的一致性,那么就设置成

为%WEBKIT_DIR%\\WebKitBuild,这里%WEBKIT_DIR%当然就是指您的Webkit文件夹的绝对路径。第二个环境变量必须设置为%WEBKIT_DIR%\\WebKitLibraries\\win文件夹。

3. 如果您机器上安装过Qt,那么检查一下环境变量里面是不是有QTDIR,如有,删了先;如果有这个环境变量,Webkit的build脚本会认为要编译Qt的port。

4. 用vs2005打开WebKit-r44906\\WebKit\\win\\WebKit.vcproj\\WebKit.sln,选择正确的Configuration,也就是Debug和Release,为啥要说这个呢,因为Webkit在Windows下不止一个port,也就不止一个Debug和一个Release,这里我们要选的就是单纯的Debug和Release,其他的Build配置就忽略吧。

5. 虽然理论上说现在已经可以编译了,但是由于该死的quicktime sdk,您还得再忙活一下:选择DumpRenderTree, QTMovieWin, WebCore, WebKit, WinLauncher等项目(反