编译mozilla firefox

1.准备MozillaBuild 
在下面地址下载最新的MozillaBuild 
http://ftp.mozilla.org/pub/mozilla/libraries/win32/ 

推荐安装到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/ 

如果需要从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 ,注意文件前面的".",最好在MozillaBuild的shell中touch一个,我没在windows上建

成这样的文件。在源码目录里建一个名字叫my-firfox的目录用来存放编译结果。


在源码目录下编写.mozconfig文件,

第一种编译组合:
-------------------------------------------------------- 
#以下两行表示编译browser,即firefox 
mk_add_options MOZ_CO_PROJECT=browser 
ac_add_options --enable-application=browser 
#最终编译的结果放在这里 
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/my-firefox
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 
#如果不想调试改成--disable-debug即可 

ac_add_options --disable-optimize --enable-debug

-------------------------------------------------------- 

第二种编译组合:

因为我们在“.mozconfig”文件里面使用了debug模式,编译出来的是一个debug模式下的名字叫做firefox.exe 的文件,如果你是用它进行网络连接的话,你会发现常常跳出错误窗口,这个是用来测试的(你需要每次点忽略才能继续执行)。会十分的麻烦的,所以,你可以把 “ac_add_options --enable-debug”这一行去掉,免得麻烦。换上:“ac_add_options --disable-debug”,记住,这样处理后能够加快编译的速度!加快速度的另外一个办法是加上:“ac_add_options --disable-tests”,这样就不会生成许多测试程序了。推荐的,编译firefox时,最好的“.mozconfig”是这样的: 

-------------------------------------------------------- 
. $topsrcdir/browser/config/mozconfig 
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/my-firefox 
ac_add_options --enable-optimize 
ac_add_options --disable-debug 
ac_add_options --disable-static 
ac_add_options --enable-shared 
ac_add_options --disable-tests 
mk_add_options MOZ_CO_PROJECT=browser 

-------------------------------------------------------- 
具体配置内容经常变化,可以参考 
https://developer.mozilla.org/en/Configuring_Build_Options 

4.make编译 
make -f client.mk build 
时间很长,耐心等待....


5.编译好了的文件在    源码目录/my-firefox/dist/bin  目录下,名字叫firefox.exe,如果选择了

带有--enable-optimize 和--enable-debug选项的第一种编译组合你就可以用Microsoft Visual Studio

打开自己的mozilla firefox并能够自己看着源代码调试了,快去试试吧。

 

6. 如果你想编译成一个安装的版本,你可以删除:“ac_add_options --disable-installer”。
参考链接 
https://developer.mozilla.org/En/Developer_Guide/Build_Instructions

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值