2007 04 22 02 36 如何編譯Firefox 2.0.0.3

今天心血來潮,想說自己來編譯Firefox 2.0.0.3,
就上網找找資料。
http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites
看了一下,事實上很簡單,
MozillaBuildSetup-1.1.exe 下載回來執行,
它自動會安裝一些必要的軟體和程式庫,
不過資料上有說最好是安裝在預設目錄,
也就是 c:mozilla-build 下,是比較安全的。
因為我是想用vc6,需要去安裝 Visual C++ 6.0 Processor Pack
但是我怎樣都安裝不起來,
後來才想到我是裝 vc6-sp6,但是這個就是要 sp5,
所以才會安裝失敗。
知道這一點後,就去偷偷改 registry。
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio6.0\ServicePacks\latest
從6改成5,再安裝一次就成功,等安裝成功後,我再改回來。
剩下就到 c:\mozilla-build 下,去執行 start-msvc6.bat,
會出現一個MINGW32的環境。

再來把 firefox 2.0.0.3 的 source codes 解開後,
放置到 C:\mozilla-build\msys\mozilla
並且新增一個設定檔 C:\mozilla-build\msys\mozilla\mozconfig

mk_add_options MOZ_CO_PROJECT=browser
ac_add_options --enable-application=browser
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --enable-optimize
ac_add_options --without-system-nspr
ac_add_options --without-system-zlib
ac_add_options --without-system-jpeg
ac_add_options --without-system-png
ac_add_options --without-system-mng
ac_add_options --enable-crypto
ac_add_options --enable-static
ac_add_options --disable-shared

設定環境變數 export MOZCONFIG=/mozilla/mozconfig
切到那個目錄下,然後使用 make -f client.mk build
剩下就等 make 完成了,
就在我打一篇文章的時候,
電腦還在背景中 make firefox ...

PS1: 如果是用VC6來編譯的,因為pixman無法用VC6來編譯。
所以原本就會有一份pixman-vc71.lib放在mozilla/gfx/cairo/libpixman/src,
如果是使用make distclean,這個檔案會被刪除掉,
所以在使用make distclean,記得要先備份這個檔案。
等完成後,再把備份檔拷貝回去就可以了!

PS2: 如果要把程式打包成zip檔,請下 make -C browser/installer
就會生成 firefox-2.0.0.3.en-US.win32.zip 放在 dist 目錄下。