Simple Firefox build

  • Revision slug: Simple_Firefox_build
  • Revision title: Simple Firefox build
  • Revision id: 18055
  • Created:
  • Creator: Mitch 1 2
  • Is current revision? No
  • Comment one or more formatting changes

Revision Content

You can build a bleeding-edge, development version of Firefox using the commands below. For complete information, see the build documentation.

Installing build tools

If your system is not listed below, see the build prerequisites page.

 

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 libstdc++-static yasm wireless-tools-devel mesa-libGL-devel

 

Mac:

  • Install Xcode 3. (You may have a recent enough version on your "Mac OS X Install Disc 2"; open XcodeTools.mpkg (for some Mac OS X versions, you will find it in a directory called "Optional Installs").)
  • If you're using OS X 10.6.5 or later, install Java Developer Package for Mac (for a file required by the MacPorts packages we install below).
  • 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:

  • Make sure your system is up-to-date through Windows Update. Windows XP needs at least Service Pack 2 and .NET Framework 2.0.
  • Install Visual C++ 2005 Professional, VC++ 2008 Professional or Express with SP1, or Visual C++ 2010 Professional. VC++ 2008 Express without SP1 will not work.
  • You may need to install one or more Windows SDKs. See Windows SDK versions for a quick guide.
  • Install MozillaBuild, a package of additional build tools. (If you see a Windows error dialog giving you the option to re-install with the 'correct settings', choose that option and 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 2.5 GB of disk space, 2-4 GB of system RAM (more is even better), and lots of available swap space.

hg clone http://hg.mozilla.org/mozilla-central/

On Windows, the shell may default to a directory with a space in the path (e.g. "Documents and Settings"). This will break things. Make sure your clone is not in such a path. For example, first do "cd /c" and then cloning will happen in /c/mozilla-central (which is C:\mozilla-central).

mozconfig

For a standard release build (optimized), a mozconfig file is not strictly required. For a debug build, you need different configuration options in your mozconfig.

Use as few configuration options as you can.

OS X 10.6 ("Snow Leopard") users will need extra options in their mozconfig, see the OS X Build Prerequisites page for details.

The source directory (topsrcdir) is the root directory of the checkout. It has many subdirectories within it, containing source code files and makefiles. An objdir is where object files and processed makefiles are put during the build. A mozconfig named ".mozconfig" in the top source dir is automatically used. If you do not specify a MOZ_OBJDIR within a mozconfig it will be automatically set to @TOPSRCDIR@/obj-@CONFIG_GUESS@.

"export MOZCONFIG=/c/some/path/mozconfig" in the shell will tell the build system to use that mozconfig instead.

Parallel compilation is generally faster. Use a value equal to the number of processor cores. Parallel compilation on Windows is unreliable due to bug 524149.

Here's a sample mozconfig for a debug build:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-debug
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --enable-debug
ac_add_options --disable-optimize

In your mozilla-central directory, run

make -f client.mk

to start building. After a successful build with the above configuration, the firefox executable can be found in objdir-ff-debug/dist/bin/ (on Mac, objdir-ff-debug/dist/Minefield.app/Contents/MacOS/).

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 client.mk" command above. make will only recompile files that changed, but it's still a long haul. An incremental build can be faster.

{{ languages( { "ja": "ja/Simple_Firefox_build" } ) }}

Revision Source

<p>You can build a bleeding-edge, development version of Firefox using the commands below. For complete information, see the <a class="internal" href="/En/Developer_Guide/Build_Instructions" title="En/Build Documentation">build documentation</a>.</p>
<h2>Installing build tools</h2>
<p>If your system is not listed below, see the <a class="internal" href="/En/Developer_Guide/Build_Instructions#Build_prerequisites" title="En/Build Documentation#Build prerequisites">build prerequisites page</a>.</p>
<p> </p>
<p>Ubuntu Linux:    </p>
<pre>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
</pre>
<p> </p>
<p>Fedora Linux:    </p>
<pre>sudo yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'
sudo yum install mercurial autoconf213 glibc-static libstdc++-static yasm wireless-tools-devel mesa-libGL-devel
</pre>
<p> </p>
<p>Mac:</p>
<ul> <li>Install <a class=" link-https" href="https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20792" title="https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20792">Xcode 3</a>. (You may have a recent enough version on your "Mac OS X Install Disc 2"; open <code>XcodeTools.mpkg</code> (for some Mac OS X versions, you will find it in a directory called "Optional Installs").)</li> <li>If you're using OS X 10.6.5 or later, install <a class=" external" href="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20719" title="http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20719">Java Developer Package for Mac</a> (for a file required by the MacPorts packages we install below).</li> <li>Install <a class="external" href="http://www.macports.org/install.php">MacPorts</a>.</li> <li>Run these commands to install the other build tools: <pre class="eval">sudo port sync
sudo port install mercurial libidl autoconf213 yasm
</pre> </li>
</ul>
<p>Problems? See <a class="internal" href="/En/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites" title="en/Mac_OS_X_Build_Prerequisites">Mac OS X build prerequisites</a>.</p>
<p> </p>
<p>Windows:</p>
<ul> <li>Make sure your system is up-to-date through Windows Update. Windows XP needs at least <a class="external" href="http://www.microsoft.com/windowsxp/sp2/default.mspx">Service Pack 2</a> and <a class="external" href="http://www.microsoft.com/downloads/info.aspx?na=47&amp;p=3&amp;SrcDisplayLang=en&amp;SrcCategoryId=&amp;SrcFamilyId=4377f86d-c913-4b5c-b87e-ef72e5b4e065&amp;u=details.aspx?familyid=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&amp;displaylang=en">.NET Framework 2.0</a>.</li> <li>Install Visual C++ 2005 Professional, VC++ 2008 Professional or <a class="external" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569&amp;displaylang=en" title="http://www.microsoft.com/downloads/details.aspx?FamilyId=F3FBB04E-92C2-4701-B4BA-92E26E408569&amp;displaylang=en">Express with SP1</a>, or Visual C++ 2010 Professional. VC++ 2008 Express without SP1 will not work.</li> <li>You may need to install one or more Windows SDKs. See <a class="internal" href="/En/Windows_SDK_versions" title="En/Windows SDK versions">Windows SDK versions</a> for a quick guide.</li> <li>Install <a class="external" href="http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe" title="http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe">MozillaBuild</a>, a package of additional build tools. (If you see a Windows error dialog giving you the option to re-install with the 'correct settings', choose that option and after that all should be well.)</li> <li>Open a shell window by running: <code>c:\mozilla-build\start-msvcX.bat</code> (where X is 8 for VS 2005, and 9 for VS 2008). <strong>Even if you're on 64-bit Windows, do not use the files ending in <code>-x64.bat</code>.</strong></li>
</ul>
<p>Problems? See <a class="internal" href="/En/Developer_Guide/Build_Instructions/Windows_Prerequisites" title="en/Windows_Build_Prerequisites">Windows build prerequisites</a>.</p>
<h2>Building Firefox</h2>
<p>Building Firefox requires at least 2.5 GB of disk space, 2-4 GB of system RAM (more is even better), and lots of available swap space.</p>
<pre>hg clone http://hg.mozilla.org/mozilla-central/
</pre>
<p>On Windows, the shell may default to a directory with a space in the path (e.g. "Documents and Settings"). This will break things. Make sure your clone is not in such a path. For example, first do "<code>cd /c</code>" and then cloning will happen in <code>/c/mozilla-central (which is C:\mozilla-central</code>).</p>
<h3>mozconfig</h3>
<p>For a standard release build (optimized), a mozconfig file is not strictly required. For a debug build, you need different <a href="/en/Configuring_Build_Options" title="en/Configuring Build Options">configuration options </a>in your <code>mozconfig</code>.</p>
<p>Use as few configuration options as you can.</p>
<p>OS X 10.6 ("Snow Leopard") users will need extra options in their <code>mozconfig</code>, see the <a class="internal" href="/En/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites" title="En/Developer Guide/Build Instructions/Mac OS X Prerequisites">OS X Build Prerequisites</a> page for details.</p>
<p>The source directory (topsrcdir) is the root directory of the checkout. It has many subdirectories within it, containing source code files and makefiles. An objdir is where object files and processed makefiles are put during the build. A <code>mozconfig</code> named ".mozconfig" in the top source dir is automatically used. If you do not specify a MOZ_OBJDIR within a mozconfig it will be automatically set to @TOPSRCDIR@/obj-@CONFIG_GUESS@.</p>
<p><code>"export MOZCONFIG=/c/some/path/mozconfig"</code> in the shell will tell the build system to use that mozconfig instead.</p>
<p>Parallel compilation is generally faster. Use a value equal to the number of processor cores. Parallel compilation on Windows is unreliable due to bug 524149.</p>
<p>Here's a sample <code>mozconfig</code> for a debug build:</p>
<pre>mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-debug
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --enable-debug
ac_add_options --disable-optimize</pre>
<p>In your <code>mozilla-central</code> directory, run</p>
<pre>make -f client.mk
</pre>
<p>to start building. After a successful build with the above configuration, the <code>firefox</code> executable can be found in <code>objdir-ff-debug/dist/bin</code>/ (on Mac, <code>objdir-ff-debug/dist/Minefield.app/Contents/MacOS/</code>).</p>
<h2>How to build again later</h2>
<p>In your <code>mozilla-central</code> directory, run these commands:</p>
<pre># Get the latest source
hg pull -r default
hg update
</pre>
<p>Then just re-run the "<code>make -f client.mk</code>" command above. <code>make</code> will only recompile files that changed, but it's still a long haul. An <a class="internal" href="/en/Incremental_Build" title="En/Incremental Build">incremental build</a> can be faster.</p>
<p>{{ languages( { "ja": "ja/Simple_Firefox_build" } ) }}</p>
Revert to this revision