Building Firefox From Source
Firefox is my favorite browser since a long time. Usually, I install the release provided by the Mozilla foundation. Unfortunately, there are only 32-bit versions for Linux. Since I have a 64-bit Debian running, I searched the web for 64-bit firefox packages, but I didn’t find anything appropriate for me.
But where´s the problem? Firefox is Open Source. Hence, everybody can build firefox from its source code. This post describes the steps which are necessary for this purpose.
Preparing Your System
A good starting point are the build instructions from the Mozilla Development Center. In a nutshell, you need to install the development tools (including the GNU compiler collection gcc and the mozilla distributed version control software mercurial) and the development packages for several libraries. To do so, execute the following commands as super user:
The first command installs the packages, which are needed to build firefox. (Note: Debian renamed firefox to iceweasel, since they modified the sources). On Ubuntu, replace iceweasel by firefox. The second command installs the development packages which are needed for compilation.
Download The Source Files
The sources are checked out from the appropriate Mozilla repository. There are two alternatives:
- mozilla-1.9.1: Branch development on Firefox 3.5 and Gecko 1.9.1.
- mozilla-1.9.2: Branch development on Firefox 3.6 and Gecko 1.9.2.
You can either download an archive or download the source files directly with mercurial. For the latter, the command is:
The command creates the folder mozilla-1.9.2 in the current directory and downloads the source files of the firefox 3.6 release therein. Releases of firefox 3.5 are checked out similarly.
To build a localized version of firefox, a localization pack is required. Again, mercurial is used to check it out. For instance, the command to check out the German localization is:
The data is stored in the folder de in the current directory.
Configuration Of The Build Process
To create the build configuration, a config file is needed. Mine contains the following lines:
mk_add_options AUTOCONF=autoconf2.13
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../firefox-de
ac_add_options --enable-application=browser
ac_add_options --with-l10n-base=..
ac_add_options --enable-ui-locale=de
ac_add_options --enable-official-branding
The tell the configuration script to use this file, the absolute path has to be exported in the environment variable MOZCONFIG. If the configuration is stored in /usr/src/firefox/config/mozconfig-firefox-de, then the command is:
Alternatively, the configuration can be stored in the file .mozconfig in the user’s home directory. The dot is optional.
Build Firefox
To compile firefox, a compile configuration must be created. This is done with the following command:
If configure succeeds, then the actual build is done with:
The compilation process takes a little time (or a bit more
). Finally, the folder firefox-de contains the firefox build. To create a tar archive, change to that directory and execute
After that the folder firefox-de/dist contains an archive with the firefox build. For instance, on my machine the archive is firefox-3.6.de.linux-x86_64.tar.bz2.
That´s it!