Building Mozilla Firefox in Ubuntu

The following are the steps to build Firefox on your own. I got stuck at many points when I was following the Mozilla Docs on Building the Firefox. So I decided to blog about the right way through which I build the Mozilla Firefox.. 🙂

You need to download the source code first. You can get the latest version from the following link.

Select the .tar.bz2 file out of it. You can extract the file using the command

$ tar -xjf <source-file.tar.bz2> Once you extract the file, run the following commands in a shell to install the needed tools:

$ sudo apt-get build-dep firefox
$ sudo apt-get install mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev 
  mesa-common-dev autoconf2.13 yasm

After that you can give the make command as follows:

$ make -f

 ( While I was doing that, I got an error report saying that the yasm that I installed previously need to 
  be upgraded. So I removed the previous one which was yasm-0.8.0 to yasm-1.0.1. Mozilla requires atleast 
  this version to work with.
 You can do that by first removing the yasm as
 $ apt-get remove yasm

 Now download the new version of yasm.
 Give the following commands
 $ ./configure
 $ make
 $ make check
 $ make install

 Now the yasm will be upgraded. )

It will take around 15 minutes for the building of Firefox. There will be a folder starting with 
 obj- created in the folder where you are working. Go into that folder.

$ cd obj-*/dist/bin

In the bin directory, you will find an executable file named firefox. Run it as follows.
$ ./firefox

The window of firefox browser will be opened.
Now if you want to open the Browser from any path , follow the following steps.
$ sudo su
$ <password>
$ mv firefox /usr/local
$ chown -R root:root /usr/local/firefox

If you want to reduce the path you may also create a link as follows
$ cd /usr/local/bin
$ ls -s ../firefox/firefox

Hope this will help you. :)