Development:Building:mozconfig

From Camino Wiki
Revision as of 06:44, 24 April 2009 by Smorgan (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In your mozilla directory, create a plain text file called .mozconfig (note the leading period). This file is where you will set up the options for your Camino build. To begin, add the following line to your .mozconfig file (note the leading dot and space):

           . $topsrcdir/camino/config/mozconfig
Universal builds will need to add the following line immediately after the above line:
           . $topsrcdir/build/macosx/universal/mozconfig
Universal builds must also be built using an OBJDIR; be sure to add an OBJDIR line to your .mozconfig:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoUni

.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

N.B. It is not necessary to build a Universal Camino for development (unless you plan on doing evil things that only work with gcc 4 and you need failed builds as a reminder). In fact, the Mozilla build system will fail towards the end of an attempt to make a Universal debug build.

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 dual core, dual processor Xserve uses -j4 while Camino’s dual processor G5 tinderbox uses -j2.