Configuring Build Options

  • Revision slug: Configuring_Build_Options
  • Revision title: Configuring Build Options
  • Revision id: 376367
  • Created:
  • Creator: gps
  • Is current revision? No
  • Comment

Revision Content

Note: Do not make substantive changes to this document without consulting Benjamin Smedberg <benjamin@smedbergs.us> or one of the build-config peers.

In order to build Firefox, a .mozconfig is not required.

The default options are the most well-supported, so it is preferable to add as few options as possible.

Please read the following directions carefully before building, and follow them in order. If you skip any steps, you may find that you can't build the software, or that the build result isn't usable. Note that build options, including options not usable from the command-line, may appear in "confvars.sh" files in the source tree.

Note: On Mac OS X, you may want to take into consideration the concept of building universal binaries.

{{BuildDocsTOC()}}

Using a .mozconfig configuration file

The choice of which Mozilla application to build and other configuration options should be set in a .mozconfig file. (It is possible to manually call configure with command-line options, but this is not recommended.) The .mozconfig file should be in your source directory (that is, mozilla/.mozconfig).

Note: Placing .mozconfig as mentioned above is appropriate for Firefox or XULRunner. For SeaMonkey, Thunderbird, and other comm-central apps, you place it in /src and not in /src/mozilla.

This will also help when troubleshooting as people will want to know which build options you have selected and will assume that you have put them in your .mozconfig file.

 echo "# My first mozilla config" > .mozconfig
Note: You can also use the name mozconfig (without the leading dot) for this file, which has the advantage that the file will be visible in directory listings.

.mozconfig contains two types of options:

  • Options prefixed with mk_add_options are passed to client.mk.  The most important of these is MOZ_OBJDIR, which controls where your application gets built (also known as the object directory).
  • Options prefixed with ac_add_options are passed to configure, and affect the build process.

These options will be automatically used when ./configure or make -f client.mk are run.

At the bottom of this page are several example .mozconfig files.

You can also use the MOZCONFIG environment variable to specify the path to your .mozconfig, but the path you specify must be an absolute path or else client.mk will not find it:

export MOZCONFIG=~/mozilla/mozconfig-firefox

This is useful if you choose to have multiple .mozconfig files for different applications or configurations. Note that in this export example the filename was not .mozconfig. Regardless of the name of the actual file you use, we refer to this file as the .mozconfig file in the examples below.

Building with an objdir

This means that the source code and object files are not intermingled in your directory system and you can build multiple applications (e.g. Firefox and Thunderbird) from the same source tree. If you do not specify a MOZ_OBJDIR it will be automatically set to @TOPSRCDIR@/obj-@CONFIG_GUESS@

The act of using an objdir means that every Makefile.in file in your source tree will be turned into a Makefile in the objdir. The parent directories of the Makefile.in will be the same parent directories in objdir. For example, for the file mozilla/modules/plugin/base/src/Makefile.in, with an objdir value of @TOPSRCDIR@/obj-debug, the file and directory path mozilla/obj-debug/modules/plugin/base/src/Makefile will be created. This Makefile will magically refer to source files in the mozilla/modules/plugin/base/src directory.

If you need to re-run configure, the easiest way to do it is using make -f client.mk configure but if you want to run configure manually please do so from within your object directory, and do it by giving the absolute path to the configure script. For example, if you are running on Win32, and your source tree is in /c/Projects/FIREFOX/mozilla, then, from within your objdir you would need to run /c/Projects/FIREFOX/mozilla/configure whenever you need to manually run configure.

Adding the following line to your .mozconfig allows you to change the objdir:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@

It is a good idea to have your objdir name start with obj so that Mercurial ignores it.

Parallel compilation

Note: The build system automatically makes an intelligent guess for how many CPU cores to use when building. The option below is typically not needed.

Most modern systems have multiple cores and/or CPUs, and they can be optionally used concurrently to make the build faster. The "-j" flag controls how many parallel builds will run concurrently. You will see (diminishing) returns up to a value approximately 1.5x to 2.0x the number of cores on your system.

mk_add_options MOZ_MAKE_FLAGS="-j4"
Note: Windows users must use PyMake when doing parallel builds, in order to avoid deadlocks.

Choose an application

The --enable-application=application flag is used to select an application to build. Firefox is the default.

Choose one of the following options to add to your mozconfig file:

Browser (Firefox)
ac_add_options --enable-application=browser

Note: This is the default

Mail (Thunderbird)
ac_add_options --enable-application=mail
Mozilla Suite (SeaMonkey)
ac_add_options --enable-application=suite
Standalone Calendar (Sunbird)
ac_add_options --enable-application=calendar
XULRunner
ac_add_options --enable-application=xulrunner

Selecting build options

The build options you choose depends on what application you are building and what you will be using the build for. If you want to use the build regularly, you will want a release build without extra debugging information; if you are a developer who wants to hack the source code, you probably want a non-optimized build with extra debugging macros.

There are many options recognized by the configure script which are special-purpose options intended for embedders or other special situations, and should not be used to build the full suite/XUL applications. The full list of options can be obtained by running ./configure --help.

{{ Warning("Do not use a configure option unless you know what it does. The default values are usually the right ones.  Each additional option you add to your mozconfig file reduces the chance that your build will compile and run correctly.") }}

The following build options are very common:

Optimization

ac_add_options --enable-optimize 

Enables the default compiler optimization options

Note: This is enabled by default

ac_add_options --enable-optimize=-O2 
Choose particular compiler optimization options. In most cases, this will not give the desired results, unless you know the Mozilla codebase very well; note however that if you are building with the Microsoft compilers, you probably do want this as -O1 will optimise for size, unlike GCC.
ac_add_options --enable-debug 
Enables assertions and other debug-only code. This can significantly slow a build, but it is invaluable when writing patches.  People developing patches (especially in C++) should generally use this option.
ac_add_options --disable-optimize 
Disables compiler optimization. This makes it much easier to step through code in a debugger.

You can make an optimized build with debugging symbols. See Building Firefox with Debug Symbols.

Extensions

ac_add_options --enable-extensions=default|all|ext1,ext2,-skipext3
There are many optional pieces of code that live in {{ Source("extensions/") }}. Many of these extensions are now considered an integral part of the browsing experience. There is a default list of extensions for the suite, and each app-specific mozconfig specifies a different default set. Some extensions are not compatible with all apps, for example:
  • cookie is not compatible with thunderbird
  • typeaheadfind is not compatible with any toolkit app (Firefox, Thunderbird, Sunbird)

Unless you know which extensions are compatible with which apps, do not use the --enable-extensions option; the build system will automatically select the proper default set of extensions.

Tests

ac_add_options --disable-tests
By default, many auxiliary test applications are built, which can help debug and patch the mozilla source. Disabling these tests can speed build time and reduce disk space considerably. Developers should generally not use this option.

Other Options

ac_add_options --disable-crypto
Cryptography is enabled by default. In some countries, it may be illegal to use or export cryptographic software. You should become familiar with the cryptography laws in your country.

On the 1.7 and aviary branches, cryptography was off by default. You need to specify --enable-crypto if you want SSL, SMIME, or other software features that require cryptography. 

Example .mozconfig Files

Mozilla's official builds use mozconfig files from the appropriate directory within each repository. (Some of the options related to brand stamping are removed for simplicity. Follow the links to get the exact configuration.)

Firefox, Default Release Configuration (Mac OS X, universal build)

. $topsrcdir/build/macosx/universal/mozconfig

# Universal builds override the default of browser (bug 575283 comment 29)
ac_add_options --enable-application=browser

ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging

export MOZ_TELEMETRY_REPORTING=1

# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors

# Enable parallel compiling
mk_add_options MOZ_MAKE_FLAGS="-j4"

# Package js shell.
export MOZ_PACKAGE_JSSHELL=1

Firefox, Debugging Build (Mac OS X 64bits)

. $topsrcdir/build/macosx/common

ac_add_options --enable-debug
ac_add_options --enable-trace-malloc
ac_add_options --enable-accessibility
ac_add_options --enable-signmar

# Enable parallel compiling
mk_add_options MOZ_MAKE_FLAGS="-j12"

# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
ac_add_options --with-ccache

# Package js shell.
export MOZ_PACKAGE_JSSHELL=1

Thunderbird, Debugging Build (Linux 64 bits)

ac_add_options --enable-application=mail
ac_add_options --enable-debug
ac_add_options --enable-trace-malloc
ac_add_options --enable-signmar

. $topsrcdir/build/unix/mozconfig.linux

# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1

# Enable parallel compiling
CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"

# Use ccache
ac_add_options --with-ccache=/usr/bin/ccache

# Run client.py
mk_add_options CLIENT_PY_ARGS="--hg-options='--time' --hgtool=../tools/buildfarm/utils/hgtool.py --skip-chatzilla --skip-comm --skip-inspector --skip-venkman --tinderbox-print"
mk_add_options ALWAYS_RUN_CLIENT_PY=1

SeaMonkey, Optimized (but not static)

ac_add_options --enable-application=suite
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/suite-opt
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --enable-optimize
ac_add_options --disable-debug

XULRunner, Minimal Release Build

mk_add_options MOZ_OBJDIR=@topsrcdir@/obj-xulrunner
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --enable-application=xulrunner

Building multiple applications from the same source tree

It is possible to build multiple applications from the same source tree, as long as you have checked out all the necessary sources and you use a different objdir for each application.

You can either create multiple mozconfig files, or alternatively, use the MOZ_BUILD_PROJECTS make option.

Using MOZ_BUILD_PROJECTS in a single mozconfig

To use MOZ_BUILD_PROJECTS, you must specify a MOZ_OBJDIR, and a MOZ_BUILD_PROJECTS make option, containing space separated names. Each name can be an arbitrary directory name. For each name, a subdirectory is created under the toplevel objdir. You then need to use the ac_add_app_options with the specified names to enable different applications in each object directory.

For example:

 ac_add_options --disable-optimize --enable-debug 
 mk_add_options MOZ_OBJDIR=/mozilla/src/obj-@CONFIG_GUESS@
 mk_add_options MOZ_BUILD_PROJECTS="xulrunner browser mail"
 ac_add_app_options browser --enable-application=browser
 ac_add_app_options xulrunner --enable-application=xulrunner
 ac_add_app_options mail --enable-application=mail

If you want to build only one project using this mozconfig, use the following commandline:

 make -f client.mk build MOZ_CURRENT_PROJECT=browser

This will build only browser.

Using multiple mozconfig files

Alternatively, you may want to create separate mozconfig files.

As an example, the following steps can be used to build Firefox and Thunderbird. You should first create three mozconfig files.

mozconfig-common:

# add common options here, such as making an optimised release build and
# disabling tests
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --enable-optimize --disable-debug
ac_add_options --disable-tests

mozconfig-firefox:

# include the common mozconfig
. ./mozconfig-common

# Build Firefox
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-static
ac_add_options --enable-application=browser

mozconfig-thunderbird:

# include the common mozconfig
. ./mozconfig-common

# Build Thunderbird
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/thunderbird-static
ac_add_options --enable-application=mail

To checkout, run the following commands:

export MOZCONFIG=/path/to/mozilla/mozconfig-common
make -f client.mk checkout

To build Firefox, run the following commands:

export MOZCONFIG=/path/to/mozilla/mozconfig-firefox
make -f client.mk build

To build Thunderbird, run the following commands:

export MOZCONFIG=/path/to/mozilla/mozconfig-thunderbird
make -f client.mk build

Using mozconfigwrapper (unix only)

Mozconfigwrapper is similar to using multiple mozconfig files except that it abstracts and hides them so you don't have to worry about where they live or which ones you've created. It also saves you from having to export the MOZCONFIG variable each time. For information on installing and configuring mozconfigwrapper, see https://github.com/ahal/mozconfigwrapper.

Revision Source

<p><span class="comment"><strong>Note:</strong> Do not make substantive changes to this document without consulting Benjamin Smedberg &lt;<a class="link-mailto" href="mailto:benjamin@smedbergs.us" rel="freelink">benjamin@smedbergs.us</a>&gt; or one of the build-config peers.</span></p>
<div class="geckoVersionNote">
  <p>In order to build Firefox, a .mozconfig is not required.</p>
  <p>The default options are the most well-supported, so it is preferable to add as few options as possible.</p>
</div>
<p>Please read the following directions carefully before building, and follow them in order. If you skip any steps, you may find that you can't build the software, or that the build result isn't usable. Note that build options, including options not usable from the command-line, may appear in "confvars.sh" files in the source tree.</p>
<div class="note">
  <strong>Note:</strong> On Mac OS&nbsp;X, you may want to take into consideration the concept of <a href="/en-US/docs/Mac_OS_X_Universal_Binaries" title="en-US/docs/Mac_OS_X_Universal_Binaries">building universal binaries</a>.</div>
<p>{{BuildDocsTOC()}}</p>
<h3 id="Using_a_.mozconfig_Configuration_File" name="Using_a_.mozconfig_Configuration_File">Using a .mozconfig configuration file</h3>
<p>The choice of which Mozilla application to build and other configuration options should be set in a <code>.mozconfig</code> file. (It is possible to manually call <code>configure</code> with command-line options, but this is not recommended.) The <code>.mozconfig</code> file should be in your source directory (that is, <code>mozilla/.mozconfig</code>).</p>
<div class="note">
  <strong>Note:</strong> Placing .mozconfig as mentioned above is appropriate for Firefox or XULRunner. For SeaMonkey, Thunderbird, and other comm-central apps, you place it in /src and not in /src/mozilla.</div>
<p>This will also help when troubleshooting as people will want to know which build options you have selected and will assume that you have put them in your <code>.mozconfig</code> file.</p>
<pre class="eval">
 echo "# My first mozilla config" &gt; .mozconfig
</pre>
<div class="note">
  <strong>Note:</strong> You can also use the name <code>mozconfig</code> (without the leading dot) for this file, which has the advantage that the file will be visible in directory listings.</div>
<p><code>.mozconfig</code> contains two types of options:</p>
<ul>
  <li>Options prefixed with <code>mk_add_options</code> are passed to <code>client.mk</code>.&nbsp; The most important of these is MOZ_OBJDIR, which controls where your application gets built (also known as the object directory).</li>
  <li>Options prefixed with <code>ac_add_options</code> are passed to <code>configure</code>, and affect the build process.</li>
</ul>
<p>These options will be automatically used when <code>./configure</code> or <code>make -f client.mk</code> are run.</p>
<p>At the bottom of this page are several example <code>.mozconfig</code> files.</p>
<p>You can also use the <code>MOZCONFIG</code> environment variable to specify the path to your <code>.mozconfig</code>, but the path you specify <strong>must</strong> be an <strong>absolute</strong> path or else <code>client.mk</code> will not find it:</p>
<pre class="eval">
export MOZCONFIG=~/mozilla/mozconfig-firefox
</pre>
<p>This is useful if you choose to have multiple <code>.mozconfig</code> files for different applications or configurations. Note that in this <code>export</code> example the filename was not <code>.mozconfig</code>. Regardless of the name of the actual file you use, we refer to this file as the <code>.mozconfig</code> file in the examples below.</p>
<h3 id="Building_with_an_Objdir" name="Building_with_an_Objdir">Building with an objdir</h3>
<p>This means that the source code and object files are not intermingled in your directory system and you can build multiple applications (e.g. Firefox and Thunderbird) from the same source tree. If you do not specify a MOZ_OBJDIR&nbsp;it will be automatically set to @TOPSRCDIR@/obj-@CONFIG_GUESS@</p>
<p>The act of using an objdir means that every Makefile.in file in your source tree will be turned into a Makefile in the objdir. The parent directories of the Makefile.in will be the same parent directories in objdir. For example, for the file <code>mozilla/modules/plugin/base/src/Makefile.in</code>, with an objdir value of <code>@TOPSRCDIR@/obj-debug</code>, the file and directory path <code>mozilla/obj-debug/modules/plugin/base/src/Makefile</code> will be created. This Makefile will magically refer to source files in the <code>mozilla/modules/plugin/base/src</code> directory.</p>
<p>If you need to re-run configure, the easiest way to do it is using <code>make -f client.mk configure</code> but if you want to run configure manually please do so from within your object directory, and do it by giving the absolute path to the configure script. For example, if you are running on Win32, and your source tree is in <code>/c/Projects/FIREFOX/mozilla</code>, then, from within your objdir you would need to run <code>/c/Projects/FIREFOX/mozilla/configure</code> whenever you need to manually run configure.</p>
<p>Adding the following line to your <code>.mozconfig</code> allows you to change the objdir:</p>
<pre class="eval">
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
</pre>
<p>It is a good idea to have your objdir name start with <code>obj</code> so that Mercurial ignores it.</p>
<h3 id="Choose_an_Application" name="Choose_an_Application">Parallel compilation</h3>
<div class="note">
  <strong>Note</strong>: The build system automatically makes an intelligent guess for how many CPU cores to use when building. The option below is typically not needed.</div>
<p>Most modern systems have multiple cores and/or CPUs, and they can be optionally used concurrently to make the build faster. The "-j" flag controls how many parallel builds will run concurrently. You will see (diminishing) returns up to a value approximately 1.5x to 2.0x the number of cores on your system.</p>
<pre>
mk_add_options MOZ_MAKE_FLAGS="-j4"
</pre>
<div class="note">
  <strong>Note</strong>: Windows users must use <a href="/en-US/docs/pymake" title="en-US/docs/pymake">PyMake</a> when doing parallel builds, in order to avoid deadlocks.</div>
<h3 id="Choose_an_Application" name="Choose_an_Application">Choose an application</h3>
<p>The <code>--enable-application=<var>application</var></code> flag is used to select an application to build. Firefox is the default.</p>
<p>Choose one of the following options to add to your mozconfig file:</p>
<dl>
  <dt>
    Browser (Firefox)</dt>
  <dd>
    <pre class="eval">
ac_add_options --enable-application=browser
</pre>
    <div class="note">
      <p><strong>Note</strong>: This is the default</p>
    </div>
  </dd>
</dl>
<dl>
  <dt>
    Mail (Thunderbird)</dt>
  <dd>
    <pre class="eval">
ac_add_options --enable-application=mail
</pre>
  </dd>
  <dt>
    Mozilla Suite (SeaMonkey)</dt>
  <dd>
    <pre class="eval">
ac_add_options --enable-application=suite
</pre>
  </dd>
  <dt>
    Standalone Calendar (Sunbird)</dt>
  <dd>
    <pre class="eval">
ac_add_options --enable-application=calendar
</pre>
  </dd>
  <dt>
    XULRunner</dt>
  <dd>
    <pre class="eval">
ac_add_options --enable-application=xulrunner
</pre>
  </dd>
</dl>
<h3 id="Selecting_Build_Options" name="Selecting_Build_Options">Selecting build options</h3>
<p>The build options you choose depends on what application you are building and what you will be using the build for. If you want to use the build regularly, you will want a release build without extra debugging information; if you are a developer who wants to hack the source code, you probably want a non-optimized build with extra debugging macros.</p>
<p>There are many options recognized by the configure script which are special-purpose options intended for embedders or other special situations, and should not be used to build the full suite/XUL applications. The full list of options can be obtained by running <code>./configure --help</code>.</p>
<p>{{ Warning("Do not use a configure option unless you know what it does. The default values are usually the right ones.&nbsp; Each additional option you add to your <code>mozconfig</code> file reduces the chance that your build will compile and run correctly.") }}</p>
<p>The following build options are very common:</p>
<h4 id="Optimization" name="Optimization">Optimization</h4>
<dl>
  <dt>
    ac_add_options --enable-optimize&nbsp;</dt>
  <dd>
    <p>Enables the default compiler optimization options</p>
    <div class="note">
      <p><strong>Note</strong>: This is enabled by default</p>
    </div>
  </dd>
  <dt>
    ac_add_options --enable-optimize=-O2&nbsp;</dt>
  <dd>
    Choose particular compiler optimization options. In most cases, this will not give the desired results, unless you know the Mozilla codebase very well; note however that if you are building with the Microsoft compilers, you probably <strong>do</strong> want this as <code>-O1</code> will optimise for size, unlike GCC.</dd>
  <dt>
    ac_add_options --enable-debug&nbsp;</dt>
  <dd>
    Enables assertions and other debug-only code. This can significantly slow a build, but it is invaluable when writing patches.&nbsp; <strong>People developing patches (especially in C++) should generally use this option.</strong></dd>
  <dt>
    ac_add_options --disable-optimize&nbsp;</dt>
  <dd>
    Disables compiler optimization. This makes it much easier to step through code in a debugger.</dd>
</dl>
<p>You can make an optimized build with debugging symbols. See <a href="/en-US/docs/Building_Firefox_with_Debug_Symbols" title="en-US/docs/Building_Firefox_with_Debug_Symbols">Building Firefox with Debug Symbols</a>.</p>
<h4 id="Extensions" name="Extensions">Extensions</h4>
<dl>
  <dt>
    ac_add_options --enable-extensions=default|all|ext1,ext2,-skipext3</dt>
  <dd>
    There are many optional pieces of code that live in {{ Source("extensions/") }}. Many of these extensions are now considered an integral part of the browsing experience. There is a default list of extensions for the suite, and each app-specific mozconfig specifies a different default set. Some extensions are not compatible with all apps, for example:
    <ul>
      <li>cookie is not compatible with thunderbird</li>
      <li>typeaheadfind is not compatible with any toolkit app (Firefox, Thunderbird, Sunbird)</li>
    </ul>
    <p>Unless you know which extensions are compatible with which apps, do not use the --enable-extensions option; the build system will automatically select the proper default set of extensions.</p>
  </dd>
</dl>
<h4 id="Tests" name="Tests">Tests</h4>
<dl>
  <dt>
    ac_add_options --disable-tests</dt>
  <dd>
    By default, many auxiliary test applications are built, which can help debug and patch the mozilla source. Disabling these tests can speed build time and reduce disk space considerably. Developers should generally not use this option.</dd>
</dl>
<h4 id="Other_Options" name="Other_Options">Other Options</h4>
<dl>
  <dt>
    ac_add_options --disable-crypto</dt>
  <dd>
    Cryptography is enabled by default. In some countries, it may be illegal to use or export cryptographic software. You should become familiar with the cryptography laws in your country.
    <p>On the 1.7 and aviary branches, cryptography was off by default. You need to specify <code>--enable-crypto</code> if you want SSL, SMIME, or other software features that require cryptography.&nbsp;</p>
  </dd>
</dl>
<h3 id="Example_.mozconfig_Files" name="Example_.mozconfig_Files">Example .mozconfig Files</h3>
<p>Mozilla's official builds use mozconfig files from the appropriate directory within each repository. (Some of the options related to brand stamping are removed for simplicity. Follow the links to get the exact configuration.)</p>
<h4 id="Firefox.2C_Default_Release_Configuration" name="Firefox.2C_Default_Release_Configuration">Firefox, <a class="external" href="http://hg.mozilla.org/mozilla-central/file/tip/browser/config/mozconfigs/macosx-universal/release">Default Release Configuration (Mac OS X, universal build)</a></h4>
<pre class="eval">
. <a class="external" href="http://hg.mozilla.org/mozilla-central/file/tip/build/macosx/universal/mozconfig.common">$topsrcdir/build/macosx/universal/mozconfig</a>

# Universal builds override the default of browser (bug 575283 comment 29)
ac_add_options --enable-application=browser

ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging

export MOZ_TELEMETRY_REPORTING=1

# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors

# Enable parallel compiling
mk_add_options MOZ_MAKE_FLAGS="-j4"

# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
</pre>
<h4 id="Firefox.2C_Default_Release_Configuration" name="Firefox.2C_Default_Release_Configuration">Firefox, <a class="external" href="http://hg.mozilla.org/mozilla-central/file/tip/browser/config/mozconfigs/macosx64/debug">Debugging Build (Mac OS X 64bits)</a></h4>
<pre class="eval">
. <a class="external" href="http://hg.mozilla.org/mozilla-central/file/tip/build/macosx/common">$topsrcdir/build/macosx/common</a>

ac_add_options --enable-debug
ac_add_options --enable-trace-malloc
ac_add_options --enable-accessibility
ac_add_options --enable-signmar

# Enable parallel compiling
mk_add_options MOZ_MAKE_FLAGS="-j12"

# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
ac_add_options --with-ccache

# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
</pre>
<h4 id="Thunderbird.2C_Debugging_Build" name="Thunderbird.2C_Debugging_Build">Thunderbird, <a class="external" href="http://hg.mozilla.org/comm-central/file/tip/mail/config/mozconfigs/linux64/debug">Debugging Build (Linux 64 bits)</a></h4>
<pre class="eval">
ac_add_options --enable-application=mail
ac_add_options --enable-debug
ac_add_options --enable-trace-malloc
ac_add_options --enable-signmar

. <a class="external" href="http://hg.mozilla.org/mozilla-central/file/tip/build/unix/mozconfig.linux">$topsrcdir/build/unix/mozconfig.linux</a>

# Avoid dependency on libstdc++ 4.5
ac_add_options --enable-stdcxx-compat

# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1

# Enable parallel compiling
CONCURRENCY=$(( `grep processor /proc/cpuinfo | wc -l` + 2 ))
mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY"

# Use ccache
ac_add_options --with-ccache=/usr/bin/ccache

# Run client.py
mk_add_options CLIENT_PY_ARGS="--hg-options='--time' --hgtool=../tools/buildfarm/utils/hgtool.py --skip-chatzilla --skip-comm --skip-inspector --skip-venkman --tinderbox-print"
mk_add_options ALWAYS_RUN_CLIENT_PY=1
</pre>
<h4 id="SeaMonkey.2C_Optimized_.28but_not_static.29" name="SeaMonkey.2C_Optimized_.28but_not_static.29">SeaMonkey, Optimized (but not static)</h4>
<pre class="eval">
ac_add_options --enable-application=suite
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/suite-opt
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --enable-optimize
ac_add_options --disable-debug
</pre>
<h4 id="XULRunner.2C_Minimal_Release_Build" name="XULRunner.2C_Minimal_Release_Build">XULRunner, Minimal Release Build</h4>
<pre class="eval">
mk_add_options MOZ_OBJDIR=@topsrcdir@/obj-xulrunner
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --enable-application=xulrunner
</pre>
<h3 id="Building_multiple_applications_from_the_same_source_tree" name="Building_multiple_applications_from_the_same_source_tree">Building multiple applications from the same source tree</h3>
<p>It is possible to build multiple applications from the same source tree, as long as you have checked out all the necessary sources and you <a href="#Building_with_an_Objdir">use a different objdir</a> for each application.</p>
<p>You can either create multiple mozconfig files, or alternatively, use the <code>MOZ_BUILD_PROJECTS</code> make option.</p>
<h4 id="Using_MOZ_BUILD_PROJECTS_in_a_single_mozconfig" name="Using_MOZ_BUILD_PROJECTS_in_a_single_mozconfig">Using MOZ_BUILD_PROJECTS in a single mozconfig</h4>
<p>To use <code>MOZ_BUILD_PROJECTS</code>, you must specify a <code>MOZ_OBJDIR</code>, and a <code>MOZ_BUILD_PROJECTS</code> make option, containing space separated names. Each name can be an arbitrary directory name. For each name, a subdirectory is created under the toplevel objdir. You then need to use the <code>ac_add_app_options</code> with the specified names to enable different applications in each object directory.</p>
<p>For example:</p>
<pre class="eval">
 ac_add_options --disable-optimize --enable-debug 
 mk_add_options MOZ_OBJDIR=/mozilla/src/obj-@CONFIG_GUESS@
 mk_add_options MOZ_BUILD_PROJECTS="xulrunner browser mail"
 ac_add_app_options browser --enable-application=browser
 ac_add_app_options xulrunner --enable-application=xulrunner
 ac_add_app_options mail --enable-application=mail
</pre>
<p>If you want to build only one project using this <code>mozconfig</code>, use the following commandline:</p>
<pre class="eval">
 make -f client.mk build MOZ_CURRENT_PROJECT=browser
</pre>
<p>This will build only browser.</p>
<h4 id="Using_multiple_mozconfig_files" name="Using_multiple_mozconfig_files">Using multiple mozconfig files</h4>
<p>Alternatively, you may want to create separate <code>mozconfig</code> files.</p>
<p>As an example, the following steps can be used to build Firefox and Thunderbird. You should first create three <code>mozconfig</code> files.</p>
<p><code>mozconfig-common</code>:</p>
<pre class="eval">
# add common options here, such as making an optimised release build and
# disabling tests
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --enable-optimize --disable-debug
ac_add_options --disable-tests
</pre>
<p><code>mozconfig-firefox</code>:</p>
<pre class="eval">
# include the common mozconfig
. ./mozconfig-common

# Build Firefox
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-static
ac_add_options --enable-application=browser
</pre>
<p><code>mozconfig-thunderbird</code>:</p>
<pre class="eval">
# include the common mozconfig
. ./mozconfig-common

# Build Thunderbird
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/thunderbird-static
ac_add_options --enable-application=mail
</pre>
<p>To checkout, run the following commands:</p>
<pre class="eval">
export MOZCONFIG=/path/to/mozilla/mozconfig-common
make -f client.mk checkout
</pre>
<p>To build Firefox, run the following commands:</p>
<pre class="eval">
export MOZCONFIG=/path/to/mozilla/mozconfig-firefox
make -f client.mk build
</pre>
<p>To build Thunderbird, run the following commands:</p>
<pre class="eval">
export MOZCONFIG=/path/to/mozilla/mozconfig-thunderbird
make -f client.mk build
</pre>
<h4 id="Using_mozconfigwrapper" name="Using_mozconfigwrapper">Using mozconfigwrapper (unix only)</h4>
<p>Mozconfigwrapper is similar to using multiple mozconfig files except that it abstracts and hides them so you don't have to worry about where they live or which ones you've created. It also saves you from having to export the MOZCONFIG variable each time. For information on installing and configuring mozconfigwrapper, see <a href="https://github.com/ahal/mozconfigwrapper" title="https://github.com/ahal/mozconfigwrapper">https://github.com/ahal/mozconfigwrapper</a>.</p>
Revert to this revision