下載最新的firefox源碼並編譯

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章