Difference between revisions of "Development:Building:mozconfig"

From Camino Wiki
Jump to navigation Jump to search
 
(→‎Universal Distribution on a Dual-CPU Mac:: add cb-x4's -j value; make maya past-tense)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
In your <code>mozilla</code> directory, create a plain text file called <code>.mozconfig</code> (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 <code>.mozconfig</code> file (note the leading dot and space):<br />
+
=<code>.mozconfig</code> basics=
 +
Build settings are controlled by a plain text file called <code>.mozconfig</code> (note the leading period) in your <code>mozilla</code> directory. All <code>.mozconfig</code> files should start by including ("sourcing") the default Camino <code>.mozconfig</code>:<br />
 +
<pre>. $topsrcdir/camino/config/mozconfig</pre>
 +
'''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):<br />
 +
<pre>. $topsrcdir/build/macosx/universal/mozconfig</pre>
  
            <code>. $topsrcdir/camino/config/mozconfig</code><br />
+
We also recommend using an OBJDIR, which keeps build output separate from source. <strong>Universal builds must also be built using an OBJDIR</strong>:<br />
 +
<pre>mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoBuild</pre>
 +
(This example will put all your build output in a folder called CaminoBuild next to the top-level mozilla folder.)
  
:'''Universal builds''' will need to add the following line immediately after the above line:<br />
+
=<code>.mozconfig</code> options=
            <code>. $topsrcdir/build/macosx/universal/mozconfig</code><br />
 
:<strong>Universal builds must also be built using an OBJDIR</strong>; be sure to add an OBJDIR line to your <code>.mozconfig</code>:<br />
 
<code>mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoUni</code><br />
 
 
 
===<code>.mozconfig</code> options===
 
 
In addition to specifying ("sourcing") the default Camino (and Universal) <code>.mozconfig</code> files and specifying an OBJDIR, your <code>.mozconfig</code> should also contain settings to configure the type of build, and optionally to speed up builds on multi-processor or dual-core Macs.
 
In addition to specifying ("sourcing") the default Camino (and Universal) <code>.mozconfig</code> files and specifying an OBJDIR, your <code>.mozconfig</code> 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====
+
==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:<br />
 
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:<br />
<code>ac_add_options --disable-optimize<br /> ac_add_options --enable-debug</code>
+
<pre>ac_add_options --disable-optimize
 +
ac_add_options --enable-debug</pre>
  
 
'''Please Note:''' It's important to be aware of whether you've set up <code>.mozconfig</code> 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.
 
'''Please Note:''' It's important to be aware of whether you've set up <code>.mozconfig</code> 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.
Line 19: Line 21:
 
'''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.
 
'''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====
+
==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 <code>.mozconfig</code> file:<br />
 
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 <code>.mozconfig</code> file:<br />
<code>ac_add_options --disable-shared<br />
+
<pre>ac_add_options --disable-shared
ac_add_options --enable-static</code>
+
ac_add_options --enable-static</pre>
  
 
Static builds are used for distribution but are '''not recommended for development.'''
 
Static builds are used for distribution but are '''not recommended for development.'''
  
====Building More Quickly on Dual Core or Dual-CPU Machines====
+
==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 <code>.mozconfig</code> file:<br />
 
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 <code>.mozconfig</code> file:<br />
<code>mk_add_options MOZ_MAKE_FLAGS=-j4</code>
+
<pre>mk_add_options MOZ_MAKE_FLAGS=-j4</pre>
  
===Sample <code>.mozconfig</code>===
+
=Sample <code>.mozconfig</code>=
 
Below are some sample <code>.mozconfig</code> files, pre-configured for typical usages. <!-- Need samples for Intel, G5, dual G4, etc. -->
 
Below are some sample <code>.mozconfig</code> files, pre-configured for typical usages. <!-- Need samples for Intel, G5, dual G4, etc. -->
  
====Development:====
+
==Development:==
 
<pre>. $topsrcdir/camino/config/mozconfig
 
<pre>. $topsrcdir/camino/config/mozconfig
 
ac_add_options --disable-optimize
 
ac_add_options --disable-optimize
Line 39: Line 41:
 
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoTrunk</pre>
 
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoTrunk</pre>
  
'''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:==
 
 
====Single-Architecture Distribution:====
 
 
<pre>. $topsrcdir/camino/config/mozconfig
 
<pre>. $topsrcdir/camino/config/mozconfig
 
ac_add_options --disable-shared
 
ac_add_options --disable-shared
 
ac_add_options --enable-static</pre>
 
ac_add_options --enable-static</pre>
  
====Universal Distribution on a Dual-CPU Mac:====
+
==Universal Distribution on a Dual-CPU Mac:==
 
<pre>. $topsrcdir/camino/config/mozconfig
 
<pre>. $topsrcdir/camino/config/mozconfig
 
. $topsrcdir/build/macosx/universal/mozconfig  
 
. $topsrcdir/build/macosx/universal/mozconfig  
Line 54: Line 54:
 
mk_add_options MOZ_MAKE_FLAGS=-j4</pre>
 
mk_add_options MOZ_MAKE_FLAGS=-j4</pre>
  
If you experience errors when using a <tt>-j</tt> flag, you might need to use a lower value with <tt>-j</tt>.  Camino’s dual core, dual processor Xserve uses <tt>-j4</tt> while Camino’s dual processor G5 tinderbox uses <tt>-j2</tt>.
+
If you experience errors when using a <tt>-j</tt> flag, you might need to use a lower value with <tt>-j</tt>.  Camino’s quad core, dual processor Xserve uses <tt>-j8</tt> and the dual core, dual processor Xserve uses <tt>-j4</tt>, while Camino’s dual processor G5 tinderbox used <tt>-j2</tt>.

Latest revision as of 19:00, 18 February 2010

.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.