This page covers the basic steps needed to build a Thunderbird up to version 59. For Thunderbird 60 and later, see the new build instructions. For additional information, see the build documentation.
Depending on your Operating System you will need to carry out a different process to prepare your machine. So firstly complete the instructions for your OS and then continue following these build instructions.
To build on Windows, please read the prerequisites so you don't skip preparing the MAPI headers needed to compile Thunderbird.
Get the latest source code from Mozilla's comm-central
Mercurial code repository:
hg clone https://hg.mozilla.org/comm-central
Then, get all the repositories it depends on. The comm-central repository includes a script to do just that. This may take a while, it's a lot of code! First, cd into the comm-central
subdirectory (created automatically by the previous command):
cd comm-central
then run:
python client.py checkout
The source code requires 3.6GB of free space or more and additionally 5GB or more for default build. For more on getting the source code, see the page Getting comm-central Source Code Using Mercurial [en-US].
To build Thunderbird, you need to add a file named mozconfig
to the root directory of the comm-central checkout that contains the following line:
ac_add_options --enable-application=mail
You can create a file with this line by doing this:
cd comm-central echo 'ac_add_options --enable-application=mail' > mozconfig
If you omit this line, the build system will build Firefox instead. Other build configuration options can be added to this file, although it's strongly recommended that you only use options that you fully understand. For example, to create a debug build instead of a release build, that file would contain:
ac_add_options --enable-debug
For more on configuration options, see the page Configuring build options. Note that if you use an MOZ_OBJDIR it cannot be a sibling folder to your source directory. Use an absolute path to be sure!
Before you start, make sure that the version you checked out is not busted. For hg tip, you should see green Bs on https://treeherder.mozilla.org/#/jobs?repo=comm-central
To start the build, cd into the comm-central
subdirectory, and run:
./mozilla/mach build
mach is our command-line tool to streamline common developer tasks. See the mach article for more.
Building can take a significant amount of time, depending on your system, OS, and chosen build options. Linux builds on a fast box may take under 15 minutes, but Windows builds on a slow box may take several hours. Tips for making builds faster.
The executable will be at the location listed under Running below.
If you've set up your build environment as above, then all you need to do is:
echo 'ac_add_options --enable-calendar' >> mozconfig
in the comm-central
directory, or just add the ac_add_options --enable-calendar
line to your mozconfig with your favorite editor.
Then just re-run the mach command above (you can do the addition before running mach for the first time).
To run your build, you can use
./mozilla/mach run
There are various command line parameters you can add, e.g. to specify a profile.
Various temporary files, libraries, and the Thunderbird executable will be found in your object directory (under comm-central/
), which is prefixed with obj-
. The exact name depends on your system and OS. For example, a Mac user may get an object directory name of obj-x86_64-apple-darwin10.7.3/
.
The Thunderbird executable in particular, and its dependencies, are located under the dist/bin
folder under the object directory. To run the executable from your comm-central
working directory:
obj-.../dist/bin/thunderbird.exe
obj-.../dist/bin/thunderbird
obj-.../dist/Daily.app/Contents/MacOS/thunderbird
In your comm-central
directory, run the same command as before:
python client.py checkout
Then just re-run the mach command above. This will only recompile files that changed, but it's still a long haul.
To build after making changes, run
./mozilla/mach build
again. This will only rebuild what is necessary for these changes. It is also possible to rebuild specifically.
If you changed C or C++ files, run:
./mozilla/mach build binaries
If you changed JavaScript or XUL files, on Mac OS X or Linux you don't have to rebuild since the files in the object directory are linked to the ones in the source directory. On Windows run:
./mozilla/mach build path/to/dir
This is the tricky bit, since you need to specify the directory that installs the files, which may be a parent directory of the changed file's directory.
For all other changes run the full rebuild:
./mozilla/mach build
Have you:
C:\Program Files (x86)\Windows Kits\8.1\Include\shared
and/or C:\Program Files (x86)\Windows Kits\10\Include\10.0.nnnnn.0\shared
respectively, where nnnnn
is the highest number present on the system.@TOPSRCDIR@
or relative paths in your mozconfig. Those have caused several problems historically and tend to be poorly tested when the build system changes../mozilla/mach clobber