Refer to https://developer.mozilla.org/En/Simple_Firefox_build
先进行准备工作, 安装所需要的开发软件 (参考 Windows Build Prerequisites https://developer.mozilla.org/en/Windows_Build_Prerequisites
准备工作
1. 安装Visual Studio 2005
2. 安装Visual Studio 2005 Service Pack 1
3. 安装MS Windows SDK, 参考https://developer.mozilla.org/En/Windows_SDK_versions, 下载地址http://www.microsoft.com/downloads/details.aspx?familyid=4377F86D-C913-4B5C-B87E-EF72E5B4E065&displaylang=en
4. 安装MozillaBuild http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe, 我是将其安装在D:/mozilla-build
编译步骤
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:/Documents and Settings/frank>d:
D:/>cd mozilla-build
D:/mozilla-build>start-msvc8.bat
"Mozilla tools directory: D:/mozilla-build/"
Windows SDK directory: D:/Program Files/Microsoft SDKs/Windows/v6.0/
Windows SDK version: 6.0
Setting environment for using Microsoft Visual Studio 2005 x86 tools.
Mozilla build environment: MSVC version 8.
frank@MY-XP ~
$ cd e:
frank@MY-XP /e
$ cd misc_work/
frank@MY-XP /e/misc_work
$ hg clone http://hg.mozilla.org/mozilla-central/
(该命令会将Firefox源代码下载到e:/misc_work/mozilla-central/目录, 就不用单独下载源代码了)
...
$ cd mozilla-central
frank@MY-XP /e/misc_work/mozilla-central
$ echo '. $topsrcdir/browser/config/mozconfig' > mozconfig
frank@MY-XP /e/misc_work/mozilla-central
$ echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-release' >> mozconfig
frank@MY-XP /e/misc_work/mozilla-central
$ echo 'mk_add_options MOZ_MAKE_FLAGS="-j4"' >> mozconfig
frank@MY-XP /e/misc_work/mozilla-central
$ make -f client.mk
...
我的机器配置是CPU: Pentium 4 2.8G, RAM: 1G, 编译时间大概为一个半小时. 如果编译成功的话, firefox就在E:/misc_work/mozilla-central/objdir-ff-release/dist/bin. 编译之后mozilla-central目录大小为1.17G.