The Haus

Roll Your Own Mozilla

October 14, 2003 -- by A.T. Hun

When switching to Linux, one of the things you have to get used to is compiling and installing programs all on your own. This sounds painfully complicated to the uninitiated, but usually it's just a matter of untarring the source and then doing the old "./configure, make, make install" three-step.

Some programs, due to their very nature, are very complex so the compilation process is more complex too. The compilation three-step will not work, for example, when compiling a custom kernel. Nor will it work if you want to compile your own xft build of Mozilla (xft adds antialiased fonts support to Mozilla). This HOWTO will walk you through the process and try to make it as painless as possible.

One note: I don't claim that any of this material is original. It was gleaned from various sources on the Internet. It just seems that every time I go to compile Mozilla, one of the resources I used to use has disappeared. From now on, I'll know where to find these instructions :) Also, this HOWTO assumes that you already have xft installed and functioning properly. Most (if not all) recent distributions do that by default.

Step 1: Get the Source

For my latest compilation, I was using the source for Mozilla 1.4.1 which can be found in There are two tarballs, one compressed with bzip2 and one with gzip. I downloaded the bzip2 version because its superior compression results in a tarball that is 25% smaller. The source for other versions is available in a src/ directory under each release.

Step 2: Configuration

Untar the tarball in a handy location. I usually use /usr/src. Thus, I go to that directory and issue the command tar xfvj mozilla-1.4.1.tar.bz2. Once that's done, use your favorite text editor to create a file called .mozconfig. Add these lines to it:

ac_add_options --enable-crypto
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --enable-strip
ac_add_options --enable-strip-libs
ac_add_options --enable-optimize="-O2 -march=athlon-xp"
ac_add_options --enable-xft

Save that file in the mozilla directory with the rest of the source. You will have to change the -march line to whatever processor you are using (such as i686, pentium4, etc.). Type man gcc for all the options. If you really want to know what all of those options mean or to get a complete list of all the options, visit Mozilla's Unix Build Configurator. The most important line is the last one, which instructs it to compile in xft support so you can get all those pretty antialiased fonts.

The last steps are to issue these two commands:


Step 3: Let's Get Compiling!

Issue the command ./configure and let it do its thing. The first information it spits out should indicate that it has added the options you specified in the .mozconfig file. Assuming there are no errors, type make and let it compile. You might want to find something to do. Mozilla takes a long time to compile. Even on my Athlon XP 1800+, compilation takes almost exactly an hour. Why not dust around your computer? Lord knows it could use it.

Step 4: Create Your Own Tarball

Once compilation is (finally) done, type make -C xpinstall/packager to create a tarball of the version of Mozilla you just built. That command will create a file called something like mozilla-i686-pc-linux-gnu.tar.gz in the dist directory. I usually copy this to a safe place and rename it so I remember what version it was. With the 1.4.1 source, I renamed it mozilla-i686-pc-linux-gnu-1.4.1.xft.tar.gz.

To install it, go to the directory of your choice (I usually use /usr/local) and untar your tarball. You are now ready to run Mozilla in all of its antialiased glory! Enjoy!