WebKit是跨平台的,可以在各种平台上运行,所以WebKit的开发环境也有很多的情况。官方网站为:
http://www.webkit.org/building/tools.html。主要分为以下几个平台:WebKit on MacOS、WebKit on MacOS、WebKit on GTK、WebKit on QT、WebKit on EFL。
这里介绍一下QTWebKit的环境搭建,详情可见:
http://trac.webkit.org/wiki/BuildingQtOnLinux#DependenciesforspecificLinuxdistributions
1.Dependencies依赖库等:
The code should be easily built on any Linux distribution which has development packages for Qt installed. Below is the list of dependencies:
- Qt version 4.8.0 or later
- gperf (v3.0 or later)
- bison (v2.4.1 or later)
- flex (v2.5.33 or later)
- sqlite (development files)
- fontconfig (development files)
- xrender (development files)
- phonon (development files)
可以用命令完成:
sudo apt-get install bison flex libqt4-dev libqt4-opengl-dev libphonon-dev libicu-dev libsqlite3-dev libxext-dev libxrender-dev gperf libfontconfig1-dev libphonon-dev g++2.Building WebKit
First follow the instructions there to get the sources. The Qt port is part of the WebKit source tree, so you don't need anything extra.
获得源码,建议使用Git和GitHub托管自己的代码。
Finally, set the QTDIR environment variable to Qt 4.x's installation path and make sure Qt 4.x's qmake is the first qmake in your PATH (typically by running export PATH=$QTDIR/bin:$PATH).
If you are planning to compile it with Qt 5, QTDIR should point to PathToRepository/qt5/qtbase/. You should also use this script build-qt5.sh to build Qt5 (this is what the buildbots are using). Usually once a week we update the current Qt5 hash, so keep checking out this script.
If your qmake binary has a different name, e.g. when using Debian, use the --qmake= option to specify the name.
Build WebKit and the Qt test browser with
WebKit/Tools/Scripts/build-webkit --qt
You can also build using Intel® compilers with the following command.
WebKit/Tools/Scripts/build-webkit --qt --qmakearg="CONFIG+=icc -spec linux-icc"
build-webkit (see above) also supports special variable for specifying the OBJDIR directory, as well as some configure and build arguments
WEBKITOUTPUTDIR=`pwd`/qtbuild WebKit/Tools/Scripts/build-webkit --qt --makeargs="-j20 -s" --no-video --debug
If you are planning to compile webkit2, Qt5 is required ( build instructions) and it'll be compiling both webkit1 and webkit2 by default.