`
cppmule
  • 浏览: 436088 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

编译 Google Chrome

 
阅读更多

google chrome出来已经很久了,虽然自己没有装过,但是又一次开会在同事电脑上用了一下感觉的确很速度,而且很轻巧。昨天查资料时看到一篇文章,于是便开始捣鼓编译起来了。

  整个过程其实很简单。

一:配置开发环境:
   1. 我的编译环境是vs2008 + Windows SDK 2008
   2. 安装Windows SDK 2008,安装完后,执行:开始|所有程序|microsoft windows SDK v6.1|Visual Studio Registration|Windows SDK Configuration tool 将最新的SDK与VS2008关联起来。

   
   注:安装后,SDK Versions默认为v6.1,如果想要切换为v6.0A, vs2008编译的时候还是include v6.1。
   找啊找啊找,原来Windows SDK Configuration tool 工具有一个Bug,具体请看:
http://blogs.msdn.com/windowssdk/archive/2008/06/30/winsdk-bug-notification-sdk-config-tool-appears-to-work-but-fails.aspx

       HKEY_CURRENT_USER\Software\Microsoft\Microsoft SDKs\Windows\@CurrentInstallFolder = C:\Program Files\Microsoft SDKs\Windows\v6.0A\ to build with the Windows SDK content included in VS2008;

 or

         HKEY_CURRENT_USER\Software\Microsoft\Microsoft SDKs\Windows\@CurrentInstallFolder = C:\Program Files\Microsoft SDKs\Windows\v6.1\ to build with the Windows SDK content included in the Windows SDK for Server 2008. ”

二:开发环境准备完毕,接下来下载Chrome的源代码:
   1. 下载depot_tools_win.zip,下完解压到一个目录,假设解压后的目录是:C:\depot_tools。
   2. 把depot_tools的路径加入PATH环境变量:我的电脑|属性|高级|环境变量。
   3. 创建一个存放代码的文件夹,假设是:c:\trunk;运行cmd并将当前路径定位到该文件夹: cd c:\trunk。
   4. 在cmd里执行:gclient config http://src.chromium.org/svn/trunk/src
   5. 执行完后,再执行:gclient sync,此时就开始检出Chrome的代码,需要很长的时间。

经过很长的时间(我下载了3个小时左右),代码终于取下来了,现在开始构建:
   1. 打开c:\trunk\src\chrome\chrome.sln。
   2. 会看到app目录下有一个chrome_exe工程,构建它就行了。

耐心地等待构建(我构建了1个半小时,看来我的本本性能还是不错的),幸运的话,目标文件会生成在:c:\trunk\src\chrome\debug
详细编译访问见:http://sites.google.com/a/chromium.org/dev/developers/how-tos/build-instructions-windows

三:关于chrome的内核引擎
    google chrome用的是WebKit内核引擎,看来firefox日子要开始不好过了。
    WebKit Open Source Project 内核引擎的前世今生

  WebKit 的前身是 KDE 小组的 KHTML。Apple将 KHTML 发扬光大,推出了装备 KHTML 改进型的 WebKit 引擎的浏览器 Safari,获得了非常好的反响。


  WebKit 引擎比 Gecko 引擎更受程序员欢迎的原因,除了其引擎的高效稳定,兼容性好外,其源码结构清晰,易于维护,是一个重要的原因。而 Gecko 的可维护性就差多了。我在 2008年6月时候,曾编译 Gecko 引擎,准备做一个基于 Gecko 的 Embed 应用程序,但文档缺乏、结构欠清晰,折腾了一星期之后,最终不得不承认自己水平有限,放弃了事。

  现在浏览器的内核引擎,基本上是三分天下:

  • Trident: IE 以Trident 作为内核引擎。
  • Gecko: Firefox 是基于 Gecko 开发。
  • WebKit: Safari, Google Chrome 基于 Webkit 开发。

 

  WebKit 内核在手机上的应用十分广泛,例如 Google 的手机 Gphone、 Apple 的 iPhone, Nokia’s Series 60 browser 等所使用的 Browser 内核引擎,都是基于 WebKit。

  下面是 WebKit 首页关于 WebKit 的介绍:http://www.xiaohui.com/dev/server/20080903-webkit-opensource-project.htm

四:chrome涉及开源项目
  Google Chrome是一个优秀的开源的浏览器,其开发过程大量地使用了网上现在成熟稳定的开源代码,目前Chrome所涉及25个开源代码:

1、Google Breakpad
    /src/breakpad
    开源的跨开台程序崩溃报告系统。
2、Google URL
    /src/googleurl
     Google小巧的URL解析整理库。
3、Skia
    /src/skia
    矢量图引擎。
4、Google v8
    /src/v8
    Google开源的JavaScript引擎。V8实现了ECMA-262第三版的ECMAScript规范,可运行于Windows XP 和 Vista, Mac OS X 10.5 (Leopard), 及 Linux等基于IA-32 或 ARM 的系统之上。V8可单独运行也可嵌入到任何C++程序中。
5、Webkit
    /src/webki
    开源的浏览器引擎
6、Netscape Portable Runtime (NSPR)
    /src/base/third_party/nspr
    Netscape Portable Runtime (NSPR) 提供了系统级平台无关的API及类似libc的函数。
7、Network Security Services (NSS)
    /src/base/third_party/nss
    Network Security Services (NSS) 一套用于支持服务器端与客户端安全开发的跨平台函数库。程序通过NSS可支持SSL v2 and v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 认证及其它一些安全标准。
8、Hunspell
    /src/chrome/third_party/hunspell
    Spell checker and morphological analyzer library and program designed for languages with rich morphology and complex word compounding or character encoding.
9、Windows Template Library
    /src/chrome/third_party/wtl
    用于开发Windows程序与UI组件的C++ library。WTL扩展了ATL (Active Template Library) 并提供一套用于controls, dialogs, frame windows, GDI objects等开发的类。
10、Google C++ Testing Framework
    /src/testing/gtest
    Google用于编写C++测试的基于xUnit架构的框架,可用于多种平台上:Linux, Mac OS X, Windows, Windows CE, and Symbian。支持自动测试发现,有一套丰富的Assertions断言,用于可自定义断言,death tests, fatal and non-fatal failures, various options for running the tests, and XML test report generation.
11、bsdiff 与 bspatch
    /src/third_party/bsdiff 及 /src/third_party/bspatch
    bsdiff 与 bspatch 用于为二进制文件生成补丁。
12、bzip2
    /src/third_party/bzip2
    bzip2使用Burrows-Wheeler block sorting text compression 算法与Huffman编码压缩文件。
13、International Components for Unicode (ICU)
    /src/third_party/icu38
    ICU是一套成熟并被广泛使用的C/C++ 及 Java 库,可为软件提供Unicode与全球化支持。
14、libjpeg
    /src/third_party/libjpeg
    用于处理JPEG (JFIF)图像格式的库。
15、libpng
    /src/third_party/libpng
    PNG图像格式库。支持绝大部分的PNG特性,可扩展。已经被广泛地使用了13年以上了。
16、libxml
    /src/third_party/libxml
    C语言的XML解析库。
17、libxslt
    /src/third_party/libxslt
    C语言的XSLT库。
18、LZMA
    /src/third_party/lzma_sdk
    LZMA为7-Zip软件中7z格式压缩所使用的压缩算法,有很好的压缩效果。
19、stringencoders
    /src/third_party/modp_b64
    一系列高性能的c-string转换函数,比如:base 64 encoding/decoding。通常比其标准实现快两倍以上。
20、Netscape Plugin Application Programming Interface (NPAPI)
    /src/third_party/npapi
    多种浏览器使用的跨平台插件架构。
21、Pthreads-w32
    /src/third_party/pthread
    用于编写多线程程序的API
22、SCons - a software construction tool
    /src/third_party/scons
    开源的软件构建工具——下一代的编译工具。可以认为SCons是改进过的跨平台配上autoconf/automake与ccache的Make工具的子系统。
23、sqlite
    /src/third_party/sqlite
    大名鼎鼎的嵌入式数据库引擎。自管理、零配置、无需服务器、支持事务。
24、TLS Lite
    /src/third_party/tlslite
     SSL 3.0, TLS 1.0, and TLS 1.1的Python免费实现库。TLS Lite支持这些安全验证方式:SRP, shared keys, and cryptoIDs in addition to X.509 certificates。注:Chrome并不包涵Python。TLS Lite用于Chrome开发过程中的代码覆盖、依赖检查、网页加载时间测试及生成html结果比较等。
25、zlib
    /src/third_party/zlib
    zlib为一套用于任意平台与机器的无损数据压缩的库,它免费、自由、无任何法律专利问题。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics