MDN’s new design is in Beta! A sneak peek:

火狐浏览器 编译简介



如果你的系统没有以下列表中的工具, 请参见编译先决条件页面

Ubuntu Linux:
sudo apt-get build-dep firefox
sudo apt-get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm
Fedora Linux:
sudo yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'
sudo yum install mercurial autoconf213 glibc-static
  • Install Xcode Tools. Insert "Mac OS X Install Disc 2", then open XcodeTools.mpkg. (For some Mac OS X versions, you will find it in a directory called "Optional Installs".)
  • Install MacPorts.
  • Run these commands to install the other build tools:
    sudo port sync
    sudo port install mercurial libidl autoconf213 yasm

Problems? See Mac OS X build prerequisites.

  • 如果你使用的是Windows XP操作系统, 你必须安装Windows XP Service Pack 2 补丁包和.NET Framework 2.0
  • 安装 Visual C++ 2005 or 2008. 它们的professional edition版本和express edition 都可以正常工作。
  • 你可能需要安装一个或者多个Windows SDK。详见Windows SDK versions的快速向导页。
  • 安装MozillaBuild, a package of additional build tools. (If you get a message saying this application did not install properly then you should see a windows dialog giving you the option to re-install with the 'correct settings'. After that all should be well.)
  • Open a shell window by running: c:\mozilla-build\start-msvcX.bat (where X is 8 for VS 2005, and 9 for VS 2008). Even if you're on 64-bit Windows, do not use the files ending in -x64.bat.

Problems? See Windows build prerequisites.

Building Firefox

Building Firefox requires at least 1 GB of disk space, 500 MB of RAM, and lots of available swap space.

# Get the source
hg clone
cd mozilla-central

# Setup a basic mozconfig file
echo '. $topsrcdir/browser/config/mozconfig' > mozconfig                      # let's build Firefox...
echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-release' >> mozconfig   # this directory...

# Parallel compilation is a nice speedup.
# USE THIS ONLY IF NOT ON WINDOWS!  Parallel compilation on Windows is
# unreliable now due to bug 524149.
echo 'mk_add_options MOZ_MAKE_FLAGS="-j4"' >> mozconfig

# Build
make -f
  • On Windows, the shell may default to a directory with a space in the path (eg "Documents and Settings"). This will break things. Make sure your clone is not in such a path. For example, first do "cd /c" to clone to C:\mozilla-central.
  • OS X 10.6 ("Snow Leopard") users will need extra options in their mozconfig, see the OS X Build Prerequisites page for details.
  • For a debug build, you need different configuration options in your mozconfig file.  This requires more disk space, about 2.5 GB.
    . $topsrcdir/browser/config/mozconfig
    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-debug
    ac_add_options --enable-debug
    ac_add_options --disable-optimize
  • The firefox executable can be found in objdir-ff-release/dist/bin/ (on Mac, objdir-ff-release/dist/

How to build again later

In your mozilla-central directory, run these commands:

# Get the latest source
hg pull -r default
hg update

Then just re-run the "make -f" command above. make will only recompile files that changed, but it's still a long haul. An incremental build can be faster.



 此页面的贡献者: I9500, ziyunfei, mozstudy
 最后编辑者: ted423,