下载最新的firefox源码并编译

来源:互联网 发布:双向dijkstra算法 编辑:程序博客网 时间:2024/06/11 09:58
1.准备MozillaBuild 
在下面地址下载最新的MozillaBuild 
http://ftp.mozilla.org/pub/mozilla/libraries/win32/ 
目前最新的是 
http://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-1.4.exe 
推荐安装到c:\mozilla-build,我安装到了其他目录,也成功了 
运行下面的命令,得到一个MinGW shell,下面的编译都要在这个shell中运行 
start-msvc6.bat 
start-msvc71.bat (VS 2003) 
start-msvc8.bat  (VS 2005) 
start-msvc9.bat  (VS 2008) 
注意firefox 3以后的版本不能用msvc6编译 


2.准备firefox源码 
firefox的源码在 
http://releases.mozilla.org/pub/mozilla.org/firefox/releases/ 
找到最新的或自己需要的下载一个即可,最新的在 
http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.5.5/source/firefox-3.5.5.source.tar.bz2 

如果需要从Mercurial下载最新的代码,则需要通过start-msvc[x].bat进入MinGW shell,然后执行 
hg clone http://hg.mozilla.org/mozilla-central/ firefox-src 
如果需要签出其它版本的代码可以参考这里 
https://developer.mozilla.org/En/Developer_Guide/Source_Code/Mercurial 


3.编写配置文件.mozconfig 
在源码目录下编写.mozconfig文件,内容类似如下 
-------------------------------------------------------- 
#以下两行表示编译browser,即firefox 
mk_add_options MOZ_CO_PROJECT=browser 
ac_add_options --enable-application=browser 
#最终编译的结果放在这里 
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-Release 
ac_add_options --disable-installer 
#不编译测试 
ac_add_options --disable-tests 
ac_add_options --disable-mochitest 
#不使用vista sdk,实在懒的安装这个 
ac_add_options --with-windows-version=502 
#debug/release 
ac_add_options --disable-static --enable-shared 
#如果想调试改成--enable-debug即可 
ac_add_options --enable-optimize --disable-debug 
具体配置内容经常变化,可以参考 
https://developer.mozilla.org/en/Configuring_Build_Options 


4.make编译 
make -f client.mk build 


参考链接 
https://developer.mozilla.org/En/Developer_Guide/Build_Instructions
0 0