Revision 490603 of Simple Firefox build

  • Revision slug: Simple_Firefox_build
  • Revision title: Simple Firefox build
  • Revision id: 490603
  • Created:
  • Creator: Ms2ger
  • Is current revision? No
  • Comment Suggest best practices

Revision Content

This page covers the basic steps needed to build a bleeding-edge, development version of Firefox. For additional, more detailed information, see the build documentation.

Build prerequisites

Hardware Requirements:

  • Recommended: 4GB of RAM (having only 2GB RAM and 2GB swap may give memory errors during compile)
  • High speed internet

Setup:

Depending on your Operating System you will need to carry out a different process to prepare your machine. So firstly complete the instructions for your OS and then continue following these build instructions.

Windows build prerequisites [en-US]

Linux and MacOS build preparation [en-US]

Firefox Release Channels

Knowing the Firefox release channels will be useful for you to know which branch of the source tree to build. The following two links provide an overview. In simple terms, the flow is this: Nightly -> Aurora -> Beta -> Release.

The mozilla-central branch that you will be checking out corresponds to the Nightly channel

Get the source

Get the latest source code from Mozilla's Mercurial code repository. This may take a while; it's a lot of code!

hg clone https://hg.mozilla.org/mozilla-central
On some types of network connections, "hg clone" might fail because it gets interrupted.  If your "hg clone" command won't finish, try using a Mercurial bundle instead.

Build configuration (optional)

By default, the build system creates a release build of Firefox roughly equivalent to the official Firefox release builds. If that's not exactly what you want, there are many build configuration options to choose from, although it's strongly recommended that you only use options that you fully understand.

The normal way to specify build options is to place them in a file named mozconfig at the root of your mozilla source tree (that is, directly under the mozilla-central directory created by the hg clone command). On Windows, you can create the file from the MozillaBuild command-line:

cd /path/to/mozilla-central
touch mozconfig

For example, to create a debug build instead of a release build, that file would contain:

ac_add_options --enable-debug

For more on configuration options, see the page on configuring build options.

Building

To start the build, cd into the mozilla-central subdirectory (created automatically by the hg clone command), and run:

./mach build

mach is our command-line tool to streamline common developer tasks. See the mach article for more.

Building can take a significant amount of time, depending on your system, OS and chosen build options. Linux builds on a fast box may take under 15 minutes, but Windows builds on a slow box may take several hours. See tips for making builds faster.

Running

Various temporary files, libraries, and the Firefox executable will be found in your object directory (under mozilla-central/), which is prefixed with obj-. The exact name depends on your system and OS. For example, a Mac user may get an object directory name of obj-x86_64-apple-darwin10.7.3/.

To run the newly created Firefox instance, use the mach command

./mach run

The Firefox executable and its dependencies are located under the dist/bin folder under the object directory. In particular, Firefox is (depending on the OS) at

  • Windows: obj-.../dist/bin/firefox.exe
  • Linux: obj-.../dist/bin/firefox
  • OS X: obj-.../dist/Nightly.app/Contents/MacOS/firefox

Rebuilding

To build after making changes, run

./mach build

again. This will only rebuild what is necessary for these changes. It is also possible to use

./mach build path/to/dir

to build parts of the tree. However, this approach may or may not yield correct results, so it is not recommended.

How to update

To pull the latest changes and update the code in your mozilla-central working directory, run the command:

hg pull -u

and run ./mach build. Due to the high rate of changes to Firefox, this may take quite long.

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

Revision Source

<p>This page covers the basic steps needed to build a bleeding-edge, development version of Firefox. For additional, more detailed information, see the <a class="internal" href="/En/Developer_Guide/Build_Instructions" title="En/Build Documentation">build documentation</a>.</p>
<h2 id="Build_prerequisites">Build prerequisites</h2>
<h4 id="Hardware_Requirements.3A">Hardware Requirements:</h4>
<ul>
 <li>Recommended: 4GB of RAM (having only 2GB RAM and 2GB swap may give memory errors during compile)</li>
 <li>High speed internet</li>
</ul>
<h4 id="Setup.3A">Setup:</h4>
<p>Depending on your Operating System you will need to carry out a different process to prepare your machine. So firstly complete the instructions for your OS and then continue following these build instructions.</p>
<p><a href="/en-US/docs/Developer_Guide/Build_Instructions/Windows_Prerequisites" title="/en-US/docs/Developer_Guide/Build_Instructions/Windows_Prerequisites">Windows build prerequisites [en-US]</a></p>
<p><a href="/en-US/docs/Simple_Firefox_build/Linux_and_MacOS_build_preparation" title="/en-US/docs/Simple_Firefox_build/Linux_and_MacOS_build_preparation">Linux and MacOS build preparation [en-US]</a></p>
<h2 id="Firefox_Release_Channels">Firefox Release Channels</h2>
<p>Knowing the Firefox release channels will be useful for you to know which branch of the source tree to build. The following two links provide an overview. In simple terms, the flow is this: Nightly -&gt; Aurora -&gt; Beta -&gt; Release.</p>
<p>The <code>mozilla-central</code> branch that you will be checking out corresponds to the Nightly channel</p>
<ul>
 <li><a href="https://hacks.mozilla.org/2012/05/firefox-and-the-release-channels/">Firefox Release Channels</a></li>
 <li><a href="https://blog.mozilla.org/channels/2011/07/18/every-six-weeks/">Every six weeks</a></li>
</ul>
<h2 id="Get_the_source">Get the source</h2>
<p>Get the latest source code from Mozilla's Mercurial code repository. This may take a while; it's a lot of code!</p>
<pre>
hg clone https://hg.mozilla.org/mozilla-central
</pre>
<div class="warning">
 On some types of network connections, "hg clone" might fail because it gets interrupted.&nbsp; If your "hg clone" command won't finish, try using a <a href="/En/Developer_Guide/Source_Code/Mercurial/Bundles" title="https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29#Bundles">Mercurial bundle</a> instead.</div>
<h2 id="Build_configuration_(optional)">Build configuration (optional)</h2>
<p>By default, the build system creates a release build of Firefox roughly equivalent to the official Firefox release builds. If that's not exactly what you want, there are many build configuration options to choose from, although it's <strong>strongly</strong> recommended that you only use options that you fully understand.</p>
<p>The normal way to specify build options is to place them in a file named <code>mozconfig</code> at the root of your mozilla source tree (that is, directly under the <code>mozilla-central</code> directory created by the <code>hg clone</code> command). On Windows, you can create the file from the MozillaBuild command-line:</p>
<pre class="eval">
cd /path/to/mozilla-central
touch mozconfig
</pre>
<p>For example, to create a debug build instead of a release build, that file would contain:</p>
<pre>
ac_add_options --enable-debug
</pre>
<p>For more on configuration options, see the page on <a href="/en/Configuring_Build_Options" title="en/Configuring Build Options">configuring build options</a>.</p>
<h2 id="Building">Building</h2>
<p>To start the build, cd into the <code>mozilla-central </code>subdirectory (created automatically by the <code>hg clone</code> command), and run:</p>
<pre>
./mach build
</pre>
<p>mach is our command-line tool to streamline common developer tasks. See the <a href="/en-US/docs/Developer_Guide/mach" title="/en-US/docs/Developer_Guide/mach">mach</a> article for more.</p>
<p>Building can take a significant amount of time, depending on your system, OS and chosen build options. Linux builds on a fast box may take under 15 minutes, but Windows builds on a slow box may take several hours. See <strong><a href="/en/Developer_Guide/Mozilla_build_FAQ#Making_builds_faster" title="https://developer.mozilla.org/en/Mozilla_Build_FAQ#Making_builds_faster">tips for making builds faster</a></strong>.</p>
<h2 id="Running">Running</h2>
<p>Various temporary files, libraries, and the Firefox executable will be found in your <strong>object directory</strong> (under <code>mozilla-central/</code>), which is prefixed with <strong><code>obj-</code></strong>. The exact name depends on your system and OS. For example, a Mac user may get an object directory name of <strong><code>obj-x86_64-apple-darwin10.7.3/</code></strong>.</p>
<p>To run the newly created Firefox instance, use the mach command</p>
<pre>
./mach run</pre>
<p>The Firefox executable and its dependencies are located under the <code>dist/bin</code> folder under the object directory. In particular, Firefox is (depending on the OS) at</p>
<ul>
 <li><strong>Windows:</strong> <code>obj-.../dist/bin/firefox.exe</code></li>
 <li><strong>Linux:</strong> <code>obj-.../dist/bin/firefox</code></li>
 <li><strong>OS X:</strong> <code>obj-.../dist/Nightly.app/Contents/MacOS/firefox</code></li>
</ul>
<h2 id="How_to_update_and_build_again">Rebuilding</h2>
<p>To build after making changes, run</p>
<pre>
./mach build
</pre>
<p>again. This will only rebuild what is necessary for these changes. It is also possible to use</p>
<pre>
./mach build <var>path/to/dir</var>
</pre>
<p>to build parts of the tree. However, this approach may or may not yield correct results, so it is <strong>not recommended</strong>.</p>
<h2>How to update</h2>
<p>To pull the latest changes and update the code in your <code>mozilla-central</code> working directory, run the command:</p>
<pre>
hg pull -u
</pre>
<p>and run <code>./mach build</code>. Due to the high rate of changes to Firefox, this may take quite long.</p>
<p>{{ languages( { "ja": "ja/Simple_Firefox_build" } ) }}</p>
Revert to this revision