|Dreamweaver Manual||Building Mozilla|
|MailNews Status Icons|
When you are running Linux or other Unix derivatives you will probably find yourself building something from source sooner or later. Then why not something big right from the start? Mozilla for instance. Below I will describe how to build SeaMonkey, formerly known as the Mozilla Application Suite.
Why, you ask? Maybe because it is fun to be at the "bleeding edge" and tweak some settings that are disabled in mozilla.org's nightlies like Xft, GTK 2, SVG and Xinerama. You can even enable optimizing which will result in a program that runs faster in most cases. Now and then you might also want to make a debug build to get a meaningful stack trace (bt) for a bug report. That will take precious space on your harddisk, though...
There are also special cases where building yourself allows to solve problems. For example, mozilla.org's builds for Sparc/Solaris have Xprint support enabled which you might not want. You might also want to build with Forte (cc) here in order to be able to use certain plugins.
On Windows, however, there is barely a need for building oneself, except for cases where you do not like the pre-built nightly builds (maybe you want to optimize or other features and patches). Beyond that, you would also have to build with MSVC in order to have all plugins work properly. If that is not essential for you there is always the possibility to build with the GCC of course; the way how that is done is described on the pages linked at the end of this page.
What you primarily need is a working build environment, i.e. a compiler, some special tools (especially MozillaBuild on Windows) and lots of free disk space, of course — not only for the sources, but also for building.
I will not describe how to install a compiler and tools here. On Linux, this depends on the distribution used. The minimum requirements are a compiler (gcc/g++, for example) and the libraries of the toolkit used (e.g. GTK2) and IDL, all with the respective development packages. On Windows, you first have to decide whether you want to work with the GNU Compiler Collection (GCC) or the Microsoft compilers (MSVC). Some requirements are named on the sites linked at the bottom of the page.
You can use the
MOZ_OBJDIR variable in order to distribute
the disk space required for building. This way, you can use a common base
directory for the sources of different Mozilla applications; each
application will be assigned its own OBJDIR for building. The contents of
the OBJDIR should be deleted prior to any rebuilding since obscure errors
can appear otherwise (e.g. Bug 330571).
Beyond that, you always have to specify a UNIX path regardless of the
platform you are building on. So on Windows, you would have to supply
/c/mozilla-src/objdir-seamonkey instead of
If you want to start with the latest sources (e.g. because an important patch has just been checked into the repository) you can pull them from the Mozilla Mercurial server. SeaMonkey itself resides in comm-central, together with Thunderbird and the Calendar project. SeaMonkey also uses many parts of the Firefox backend (e.g. the Gecko rendering engine) which resides in the mozilla-central repository but is checked out by the SeaMonkey scripts automatically.
To ease the process of fetching the sources, building and patching I wrote a set of scripts that are modular to such a degree that Windows and Linux running on a dual-boot system can share the same set of core scripts. Only some paths need to be set according to the operating system.
You only need to completely pull the repositories once initially. That can
be done using
mozhgpull which will take up approx. 1.3 GB on an
NTFS drive. After that you can use
will start building,
mozinst installs the result and
mozbuild does everything together (including cleaning up before
building). Finally you can start the program with
SM. All scripts
support the optional "unattended" parameter which ensures that under
normal circumstances no questions are asked. So
MBU in short builds and installs an up-to-date trunk SeaMonkey
without asking any questions.
The settings mentioned earlier can usually be found in the file
.mozconfig which you should either place in your $HOME or
any other directory, whereas you need to specify the full path using the
environment variable MOZCONFIG in the latter case. The former has
the advantage that you do not have to copy it every time; the latter allows
for building SeaMonkey and Firefox without damaging the file in $HOME. You
can find examples for Windows and Linux next to my scripts.
On Windows there are some differences. Meanwhile there is a dedicated build environment called MozillaBuild.You can now simply download the base package and start over (given that the compiler suite has already been set up). For further information, see Windows Build Prerequisites.
Compiler- and linker flags as well as configure options are platform-dependent, too — you can configure most things in the .mozconfig.
The hard question is actually which compiler suite to use. Only the commercial option (Mircosofts Visual Studio) is supported officially; How to cope with GCC, MSVC Free and Visual Studio Express is up to you. You can make use of fora and mailing lists but there are more problems. It starts with setting the correct environment variables and might even go as far as not being able to compile something usable at all because certain libraries have simply been left out here and there in the for-free versions.
Switching to Visual Studio 8 saved me a great deal of pain here. The scripts that I provide are optimized for exactly that version.
If you have any questions, do not hesitate to direct them at me. Though I
cannot guarantee anything, the very fact that I managed to build SeaMonkey
from the sources and to be able to explain how says it all, right?
December 26, 2008