In the past few days, because the project needs to compile a WebKit, It is very costly, so I will share my summary of the compilation process and hope to help you.
Reference websiteHttp://www.webkit.org/
1. Build the compilation environment
(1) Visual Studio
According to the official instructions, Versions later than vs2005 are not supported.(Newer versions of Visual Studio are currently unsupported)
To avoid unexpected errors, I gave up vs2010, created a new win7 virtual machine, and installedVs2005 team suite CHS
Next, install various patches for vs2005.
Microsoft Visual Studio 2005 team Suite Service Pack 1
Service Pack 1 Update for Windows Vista(This is to solve the problem of system compatibility after vs2005 in Vista)
Visual Studio 2005 Service Pack 1 ATL Security Update
Kb943969(These two kb files are required to improve compilation performance and stability)
Kb947315
Because the Chinese version is installed, the corresponding patch must also be installed with the Chinese version. Two patches are not installed because they do not have a Chinese version. Looking at the patch instructions seems to improve the compilation performance. I don't know whether the Chinese version is included or not. However, I have no installation errors, that is, I feel that the compilation is slow and I don't know if it is the problem. (Maybe I think too much)
(2) cygwin
This is relatively simple. Although more than 100 components need to be installed, the official download tool is provided...
Cygwin-downloader.zip
The component is automatically downloaded after running, and the installation is automatically started.
Select to install from a local file (the release folder automatically downloaded previously) and have a cup of tea.
(3) QuickTime SDK
This is also very simple, that is, the need for Apple id, because it is originally fruit powder, so directly log on to download...
Http://developer.apple.com/quicktime/download/
(4) install DirectX SDK
If vs2005 is used, you can only installFebruary 2010 DirectX SDK
Official prompt: the new version of DirectX SDK does not support vs2005(Newer versions do not support Visual Studio 2005)
(5) Others
Debugging tools for Windows and Hotfix are installed selectively, so they are ignored...
2. GetSource code
Download is the most convenientWebKit nightly builds, Only about 20 mb.
There is anotherHttp://nightly.webkit.org/files/WebKit-SVN-source.tar.bz2This contains all versions and update information on SVN, which is close to 2 GB. If the network speed is good, try again.
CodeAfter downloading the package, decompress the package to a specific location. It is recommended that the remaining disk space be greater than 4 GB.
Download anotherWebKit support libraries, This does not need to be decompressed, just put it under the root directory of the source code.
Then start our cygwin and go to the root directory of the source code./Tools/scripts/, Run the script Update-WebKit
The specific command is:
CD/cygdrive/drive letter
CD/source code root directory/tools/scripts/
./Update-WebKit
The dependencies required for compilation will be automatically downloaded later.
3. Compile WebKit
After so much preparation work, the compilation phase is finally reached. In fact, the real challenge has just begun. Now action!
First, you must set several environment variables:
Webkit_dir= WebKit source code root directory
Webkitlibrariesdir= % Webkit_dir %/webkitlibraries/win
Webkitoutputdir= This custom (the path of the generated result)
Next, open the source code root directory.\ Source \ WebKit \ win \ WebKit. vcproj \ WebKit. sln
In this way, vs2005 is started, and the projects in the Left row are really scary.
Select debug or release for compiling. Note: Some ProjectsProperties> Configuration Properties> C/C ++> GeneralThe warning must be removed, or a compilation error may occur.
Then use the Chinese version of.WebCore \ platform \ localizationstrategy. cppThere will be garbled characters. You need to modify the following function.
String contextmenuitemtaglookupindictionary ( Const String & Selectedstring ){ # If Defined (building_on_leopard) | defined (building_on_snow_leopard) Unused_param (selectedstring ); Return Web_ui_string ( " Look up in dictionary " , " Look up in dictionary context menu item " ); # Else # If Use (CF) Retainptr <Cfstringref>Selectedcfstring (adoptcf, truncatedstringforlookupmenuitem (selectedstring). createcfstring ()); Return Formatlocalizedstring (web_ui_string ( " Look up "% @" " , " Look upcontext menu item with selected word " ), Selectedcfstring. Get ()); # Else Return Web_ui_string ( " Look up "<selection>" " , " Look up contextmenu item with selected word " ). Replace ( " <Selection> " , Truncatedstringforlookupmenuitem (selectedstring )); # Endif # Endif }
Then wait for compilation.
I personally think it is best to manually select the compilation sequence, otherwise there may be problems
WTF-> javascriptcore-> WebCore-> random behind
It took more than an hour to compile the program, and failed several times because I didn't notice the previous problem. It took several hours to complete the decommission.
Then you can debug and run it. It is best to installSafariOtherwise, some dll may be missing.
Run webkit.exe,Tool-> attach to process-> select SafariYou can debug it.
You must be patient during compilation. If you are afraid of errors, you can configure a clean compiling environment in a virtual machine like me.
Finally, I wish you a successful WebKit compilation!