Build and Install

  • Revision slug: Build_and_Install
  • Revision title: Build and Install
  • Revision id: 61264
  • Created:
  • Creator: Aqualon
  • Is current revision? No
  • Comment Undo revision 54940 by [[Special:Contributions/Aqualon]] ([[User talk:Aqualon]])

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.

{{template.Note("Do not begin a build without <a href=\"en/Configuring_Build_Options\">configuring your build options</a> first!")}}

{{wiki.template(':en/Build_Documentation/TOC')}}

Building

You must use GNU make to check out and build Mozilla. No other "make" program is acceptable. On Windows, Mac OS X, and GNU/Linux use "make" to run GNU make; on most non-GNU unixes, use "gmake".

Once you have checked out the source, be sure to configure an application as described on the Configuring Build Options page.

For Windows, Mac OS X, and GNU/Linux, make sure that you are in the top level of the source directory ("mozilla"), when you invoke the <tt>make</tt> command:

$ make -f client.mk build

Note for Mac OS X: The path to the source directory that is created on untaring the source tar ball should not have spaces in it!

For most non-GNU unixes:

$ gmake -f client.mk build

If you wish to manually configure and build, <tt>cd</tt> to your objdir, run <tt>configure</tt>, and then run <tt>make</tt>/<tt>gmake</tt>. Configure will still pick up options specified in your .mozconfig file.

Running Your New Build

It is possible to run your new build directly from the directory in which it was built. However, the build directory may contain symlinks into the build tree; you must run the installation/packaging step to produce a standalone build which can be shared or moved.

Windows and Linux

On non-macintosh build system, the finished build can be found in objdir/dist/bin. On POSIX platforms (BSD, GNU/Linux, Solaris), you should run the file "mozilla" or "firefox", not the binary "mozilla-bin" or "firefox-bin".

Mac OS X

On Macintosh, the build system produces an application bundle at objdir/dist/AppName.app, for example objdir/dist/Minefield.app.

Please note that when you are building with <tt>--enable-debug</tt>, the application is placed in objdir/dist/AppNameDebug.app, e.g. objdir/dist/MinefieldDebug.app.

You can run the application by either opening the application bundle via the Finder, or from the command line using

$ objdir/dist/AppName[Debug].app/Contents/MacOS/appname

for instance

$ objdir/dist/MinefieldDebug.app/Contents/MacOS/firefox
Building a .dmg for a XULRunner build

These instructions are for building a .dmg file from a Mac OS X Universal binary build.

  1. Perform a Universal Binary Build
  2. Create a chown_root.c and chown_revert.c source files from mxr:chown_root.c and mxr:chown_revert.c
  3. Use gcc to compile these files somewhere: gcc -o chown_root chown_root.c and gcc -o chown_revert chown_revert.c
  4. cd to «objdir»/«arch»/xulrunner/installer and issue make CHOWN_ROOT=«absolute_path_to_your_chown_root_binary» CHOWN_REVERT=«absolute_path_to_your_chown_revert_binary»

This should build a binary at «arch»/dist.

Installing Your Build

On POSIX platforms, you can install your build to the system by running gmake install. However, this is not recommended, and you should instead follow the steps below to make a tarball, then unpack the tarball.

For trunk (Firefox 3)

For trunk builds, you can simply run <tt>make package</tt> in your object directory to create a packaged build. This will create a zip or tar.gz file in objdir/dist which you can then unpack anywhere. To build a Windows installer, simply use <tt>make installer</tt> in your object directory.

For the 1.8 branch (Firefox 2)

For most apps, prepare a tarball/zip of your build by making in an app-specific directory:

  • Firefox: <tt>$ make -C objdir/browser/installer</tt>
  • Thunderbird: <tt>$ make -C objdir/mail/installer</tt>
  • SeaMonkey: <tt>$ make -C objdir/xpinstall/packager</tt>

To make a windows installer, make the "installer" target in the above directory:

  • Firefox: <tt>$ make -C objdir/browser/installer installer</tt>
  • Thunderbird: <tt>$ make -C objdir/mail/installer installer</tt>
  • SeaMonkey: <tt>$ make -C objdir/xpinstall/packager installer</tt>

{{template.Note("To make the highly compressed installer used by Firefox and Thunderbird using a Cygwin-based build system, you must install a few additional programs:")}}

  • 7-zip
  • UPX (Windows users: this package is available in Cygwin setup so you can select to install (Utils category). Do not use the DOS version, it will not work)

Both of these utilities must exist in the PATH. In addition, MOZ_INSTALLER_USE_7ZIP must be exported in your environment. If you are using the MozillaBuild system, 7-Zip and UPX will be installed automatically.

{{ wiki.languages( { "es": "es/Compilar_e_instalar", "fr": "fr/Compilation_et_installation", "ja": "ja/Build_and_Install", "zh-cn": "cn/\u7f16\u8bd1\u4e0e\u5b89\u88c5" } ) }}

Revision Source

<p>
<span class="comment">NOTE: Do not make substantive changes to this document   without consulting Benjamin Smedberg &lt;benjamin@smedbergs.us&gt;   or one of the build-config peers.</span>
</p><p>{{template.Note("Do not begin a build without &lt;a href=\"en/Configuring_Build_Options\"&gt;configuring your build options&lt;/a&gt; first!")}}
</p><p>{{wiki.template(':en/Build_Documentation/TOC')}}
</p>
<h3 name="Building"> Building </h3>
<p>You must use GNU make to check out and build Mozilla. No other "make" program is acceptable. On Windows, Mac OS X, and GNU/Linux use "make" to run GNU make; on most non-GNU unixes, use "gmake".
</p><p>Once you have checked out the source, be sure to configure an application as described on the <a href="en/Configuring_Build_Options">Configuring Build Options</a> page.
</p><p>For Windows, Mac OS X, and GNU/Linux, make sure that you are in the top level of the source directory ("mozilla"), when you invoke the <tt>make</tt> command:
</p>
<pre class="eval">$ make -f client.mk build
</pre>
<p>Note for Mac OS X: The path to the source directory that is created on untaring the source tar ball should not have spaces in it!
</p><p>For most non-GNU unixes:
</p>
<pre class="eval">$ gmake -f client.mk build
</pre>
<p>If you wish to manually configure and build, <tt>cd</tt> to your objdir, run <tt>configure</tt>, and then run <tt>make</tt>/<tt>gmake</tt>. Configure will still pick up options specified in your .mozconfig file.
</p>
<h3 name="Running_Your_New_Build"> Running Your New Build </h3>
<p>It is possible to run your new build directly from the directory in which it was built. However, the build directory may contain symlinks into the build tree; you must run the installation/packaging step to produce a standalone build which can be shared or moved.
</p>
<h4 name="Windows_and_Linux"> Windows and Linux </h4>
<p>On non-macintosh build system, the finished build can be found in <i>objdir</i>/dist/bin. On POSIX platforms (BSD, GNU/Linux, Solaris), you should run the file "mozilla" or "firefox", not the binary "mozilla-bin" or "firefox-bin".
</p>
<h4 name="Mac_OS_X"> Mac OS X </h4>
<p>On Macintosh, the build system produces an application bundle at <i>objdir</i>/dist/<i>AppName</i>.app, for example <i>objdir</i>/dist/Minefield.app.
</p><p>Please <b>note</b> that when you are building with <tt>--enable-debug</tt>, the application is placed in <i>objdir</i>/dist/<i>AppName</i>Debug.app, e.g. <i>objdir</i>/dist/MinefieldDebug.app.
</p><p>You can run the application by either opening the application bundle via the Finder, or from the command line using
</p>
<pre class="eval">$ objdir/dist/AppName[Debug].app/Contents/MacOS/appname
</pre>
<p>for instance
</p>
<pre class="eval">$ objdir/dist/MinefieldDebug.app/Contents/MacOS/firefox
</pre>
<h5 name="Building_a_.dmg_for_a_XULRunner_build"> Building a .dmg for a XULRunner build </h5>
<p>These instructions are for building a .dmg file from a Mac OS X Universal binary build.  
</p>
<ol><li> Perform a Universal Binary Build
</li><li> Create a chown_root.c and chown_revert.c source files from <a class="external" href="http://mxr.mozilla.org/seamonkey/source/build/macosx/permissions/chown_revert.c">mxr:chown_root.c</a> and <a class="external" href="http://mxr.mozilla.org/seamonkey/source/build/macosx/permissions/chown_revert.c">mxr:chown_revert.c</a>
</li><li> Use gcc to compile these files somewhere: <code>gcc -o chown_root chown_root.c</code> and <code>gcc -o chown_revert chown_revert.c</code>
</li><li> cd to «objdir»/«arch»/xulrunner/installer and issue <code>make CHOWN_ROOT=«absolute_path_to_your_chown_root_binary» CHOWN_REVERT=«absolute_path_to_your_chown_revert_binary»
</code></li></ol>
<p>This should build a binary at «arch»/dist.
</p>
<h3 name="Installing_Your_Build"> Installing Your Build </h3>
<p>On POSIX platforms, you can install your build to the system by running <i>gmake install</i>. However, this is not recommended, and you should instead follow the steps below to make a tarball, then unpack the tarball.
</p>
<h4 name="For_trunk_.28Firefox_3.29"> For trunk (Firefox 3) </h4>
<p>For trunk builds, you can simply run <tt>make package</tt> in your object directory to create a packaged build.  This will create a zip or tar.gz file in objdir/dist which you can then unpack anywhere.  To build a Windows installer, simply use <tt>make installer</tt> in your object directory.
</p>
<h4 name="For_the_1.8_branch_.28Firefox_2.29"> For the 1.8 branch (Firefox 2) </h4>
<p>For most apps, prepare a tarball/zip of your build by making in an app-specific directory:
</p>
<ul><li> Firefox: <tt>$ make -C objdir/browser/installer</tt>
</li><li> Thunderbird: <tt>$ make -C objdir/mail/installer</tt>
</li><li> SeaMonkey: <tt>$ make -C objdir/xpinstall/packager</tt>
</li></ul>
<p>To make a windows installer, make the "installer" target in the above directory:
</p>
<ul><li> Firefox: <tt>$ make -C objdir/browser/installer installer</tt>
</li><li> Thunderbird: <tt>$ make -C objdir/mail/installer installer</tt>
</li><li> SeaMonkey: <tt>$ make -C objdir/xpinstall/packager installer</tt>
</li></ul>
<p>{{template.Note("To make the highly compressed installer used by Firefox and Thunderbird using a Cygwin-based build system, you must install a few additional programs:")}}
</p>
<ul><li> <a class="external" href="http://www.7-zip.org/">7-zip</a>
</li><li> <a class="external" href="http://upx.sourceforge.net/">UPX</a> (Windows users: this package is available in <a class="external" href="http://cygwin.com/">Cygwin</a> setup so you can select to install (Utils category). Do not use the DOS version, it will not work)
</li></ul>
<p>Both of these utilities must exist in the PATH. In addition, MOZ_INSTALLER_USE_7ZIP must be exported in your environment.
If you are using the MozillaBuild system, 7-Zip and UPX will be installed automatically.
</p>
<div class="noinclude">
</div>
{{ wiki.languages( { "es": "es/Compilar_e_instalar", "fr": "fr/Compilation_et_installation", "ja": "ja/Build_and_Install", "zh-cn": "cn/\u7f16\u8bd1\u4e0e\u5b89\u88c5" } ) }}
Revert to this revision