Development:Building:mozconfig
Contents
.mozconfig
basics
Build settings are controlled by a plain text file called .mozconfig
(note the leading period) in your mozilla
directory. All .mozconfig
files should start by including ("sourcing") the default Camino .mozconfig
:
. $topsrcdir/camino/config/mozconfig
Universal builds will need the following line immediately after the above line (but note that it is not necessary to build a Universal Camino for development):
. $topsrcdir/build/macosx/universal/mozconfig
We also recommend using an OBJDIR, which keeps build output separate from source. Universal builds must also be built using an OBJDIR:
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoBuild
(This example will put all your build output in a folder called CaminoBuild next to the top-level mozilla folder.)
.mozconfig
options
In addition to specifying ("sourcing") the default Camino (and Universal) .mozconfig
files and specifying an OBJDIR, your .mozconfig
should also contain settings to configure the type of build, and optionally to speed up builds on multi-processor or dual-core Macs.
Optimized or Debug Mode Build
The default settings will create an optimized build of Camino. To build in debug mode (for easier troubleshooting during development), add the following two lines:
ac_add_options --disable-optimize ac_add_options --enable-debug
Please Note: It's important to be aware of whether you've set up .mozconfig
for a debug or optimized build, because you must match that setting when building Camino from Xcode. If the settings are not matched, key build variables won't get set correctly and vtables will be out of alignment. The net result is that either you won't link, or you'll crash at startup.
If you are doing a Universal build, you must do an optimized (non-debug) build, as the Mozilla build system will fail towards the end of an attempt to make a Universal debug build.
Static or Dynamic Build
By default, Camino is built dynamically. To do a static build of Camino (which means that most of the components are compiled directly into the Camino binary), you can add the following lines to your .mozconfig
file:
ac_add_options --disable-shared ac_add_options --enable-static
Static builds are used for distribution but are not recommended for development.
Building More Quickly on Dual Core or Dual-CPU Machines
If your machine has two CPUs or a dual core processor (like the Core Duo), you can take advantage of that while building Camino. Add the following to your .mozconfig
file:
mk_add_options MOZ_MAKE_FLAGS=-j4
Sample .mozconfig
Below are some sample .mozconfig
files, pre-configured for typical usages.
Development:
. $topsrcdir/camino/config/mozconfig ac_add_options --disable-optimize ac_add_options --enable-debug mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoTrunk
Single-Architecture Distribution:
. $topsrcdir/camino/config/mozconfig ac_add_options --disable-shared ac_add_options --enable-static
Universal Distribution on a Dual-CPU Mac:
. $topsrcdir/camino/config/mozconfig . $topsrcdir/build/macosx/universal/mozconfig ac_add_options --disable-shared ac_add_options --enable-static mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoUni mk_add_options MOZ_MAKE_FLAGS=-j4
If you experience errors when using a -j flag, you might need to use a lower value with -j. Camino’s quad core, dual processor Xserve uses -j8 and the dual core, dual processor Xserve uses -j4, while Camino’s dual processor G5 tinderbox used -j2.