# My first bug fix: Mozilla

In this post I’ll be sharing about my experience on my first open-source contribution and installing the Mozilla browser source code for experimenting. This post contains answers for almost all the problems which you will be facing during the build (Mozilla Build). For beginners, simply this is what you have to follow if you want to contribute to Mozilla.

My experience with open-source contribution:

Before when I was in first year by seeing all my seniors, fixing bugs and contributing to open-source. After a while, when our sir told to start open-source contribution, I was completely confused at one point when I have to choose an organization to work on. Finally I have decided to work for Mozilla. It was really like solving the puzzle when I was trying to install the Mozilla source code. After doing lot’s of experiments some how I finally managed to complete the build. It was really funny trying to get through the errors and completing the build. After that it took a while for me to find some minor bugs to work on. When I was assigned to a bug and I was blank in the sense don’t know where to start and what to do. At that time I have decided to take help from IRC.  During my first bug fix I was asking silly silly questions and the people are a kind of irritated on me. But in IRC you will get help for almost all the questions which you have. Anyway it was really fun doing open-source contribution.

Installing Mozilla-browser source code:

Installing Mozilla Source code mainly involves the following steps:

• Installing the dependencies required for the build.
• Building the Mozilla source code.

You can get the mozilla.hg file either from here or from the Mozilla site. The mozilla.hg file is from where you will be installing the source code of the latest browser.

Installing the dependencies required for the build:

To get the build installed in your system you need to install the following the Linux build prerequisites which are nothing but the libraries which all are necessary for the build to get installed.

• sudo apt-get install mercurial g++ make autoconf2.13 yasm libgtk2.0-dev libglib2.0-dev libdbus-1-dev libdbus-glib-1-dev libasound2-dev libcurl4-openssl-dev libiw-dev libxt-dev mesa-common-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

Building the Mozilla source code:

The following installation process explains for people who all are installing the source code through mercurial(.hg) file. The mercurial build is preferred for the people who have very poor Internet connections. The mercurial bundle is nothing but like the off-line version of the hg clone which you can download and install when ever you want.

1. Initialize a new repository (in a directory called ‘mozilla-central’ here):

mkdir mozilla-central

hg init mozilla-central

Un-bundle the bundle file to that repository:

To use the below command in windows, export the \path\to\hg and invoke the command from command prompt.

cd mozilla-centeral

hg unbundle /path/to/your/bundle.hg

(The unbundle will take quite a lot of time)

3. Add the following lines to the file mozilla-central/.hg/hgrc which you may have to create it, so that hg will automatically know where to pull changes from in future (replacing  mozilla-central‘ as appropriate):

      [paths]
default = https://hg.mozilla.org/mozilla-central/

4. Update the repository to get all the changes since the bundle was created long back. To get the update run the following command in the mozilla folder.

      hg pull

5. Check out a working copy from your new up to date repository:

      hg up or hg update

You now have a clone of mozilla-central that is identical to one made via “hg clone”.

6. Now, you have done all the requirements to be done for the building the source code. The build is going to take quite a lot of time approximately 2 hours. So please be patient. To start the build run the following command in the terminal.

./mach build

7. Once if you have completed the build you can run the browser by using the following command.

/home/user-name/mozilla-central/obj-x86_64-unknown-linux-gnu/dist/bin/firefox

Note: If you have any problems during the build then feel free to comment in the post. 🙂