Doing good is a part of our code.
Mozilla is one of the most leading open source organizations in the world now. Since a lot of people works for Mozilla by fixing bugs and implementing new features. Since people use multiple platforms for this, here I will provide a small guide through which you can install the source code for Mozilla on multi platforms and how can you start your first contributions. As a Mozillian I prefer any one to start their open source contribution with Mozilla.
While installing Mozilla source code, first thing what you need to do is, that you need to install its dependencies. The minimum hardware requirements are:
- 2 GB RAM and lot’s of free space in it.
- For debug and builds: at least 8 GB of free space.
- For optimized builds: at least 1 GB of free space (recommended 6 GB)
Build Tools and Dependencies
All distro’s one line bootstrap command
This is the best way to install the dependencies irrespective of the distro what you are using. For this open a terminal and copy paste the following commands:
wget https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py &&
If the above command doesn’t work then proceed for one of the following based on the Operating System you are using.
With the help of the following command you can download and install the prerequisites required for Mozilla build in Ubuntu (as root).
sudo apt-get install zip unzip 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 libpulse-dev
With the help of the following command you can download and install the prerequisites required for Mozilla build in Debian(as root).
sudo aptitude install zip unzip mercurial g++ make autoconf2.13 yasm libgtk2.0-dev libglib2.0-dev libdbus-1-devlibdbus-glib-1-dev libasound2-dev libcurl4-openssl-dev libiw-dev libxt-dev mesa-common-dev libgstreamer0.10-devlibgstreamer-plugins-base0.10-dev libpulse-dev
Debian Squeez Edition
On Debian Squeeze, you need to install yasm-1.x from the squeez backports. You can also get the mercurial bundle if you need the compatibility with an existing mercurial repository.
echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
aptitude -t squeeze-backports install yasm mercurial
OpenSUSE/SUSE Linux Enterprise
Execute the following command as a root user in your terminal:
zypper install \
make cvs mercurial zip gcc-c++ gtk2-devel xorg-x11-libXt-devel libidl-devel \
freetype2-devel fontconfig-devel pkg-config dbus-1-glib-devel mesa-devel \
libcurl-devel libnotify-devel alsa-devel autoconf213 libiw-devel yasm \
gstreamer010-devel gstreamer010-plugins-base-devel pulseaudio-devel
RedHat Enterprise Linux (RHEL)/CentOS/Fedora
Execute the following command as a root user:
sudo yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'
sudo yum install mercurial autoconf213 glibc-static libstdc++-static yasm wireless-tools-devel mesa-libGL-develalsa-lib-devel libXt-devel gstreamer-devel gstreamer-plugins-base-devel pulseaudio-libs-devel
# 'Development tools' is defunct in Fedora 19 use the following
sudo yum groupinstall
'C Development Tools and Libraries'
sudo yum group mark install "X Software Development"
Execute the following command in your terminal:
-Syu --needed base-devel zip unzip freetype2 fontconfig pkg-config gtk2 dbus-glib iw libidl2 python2 mercurial alsa-lib curl libnotify libxt mesa autoconf2.13 yasm wireless_tools gstreamer0.10 gstreamer0.10-base-plugins libpulse
After doing these depending on the Operating system you use, you can proceed for building Mozilla source.
Building Mozilla Source code
Once after you finish the installation of the prerequisites required for the Mozilla build you can continue with the build process. Build process generally goes with the downloading and installing through the mozilla.hg file. You can download the latest mozilla bundle from here.
Once you have downloaded the mozilla bundle follow the steps given below to install the source code.
1) Create an empty directory and initialize a new repository (in a directory called ‘mozilla-central’ here):
hg init mozilla-central
2) Unbundle the mozilla.hg bundle in the created folder.
hg unbundle /home/path-to-the-bundle/mozilla.hg
3) Create a hgrc file in /mozilla-central/.hg/ , in this file we will be adding the path to the main repository so that we can pull the latest changes and update the bundle before we can start the build process.
in that file insert the following lines and save the file.
default = https://hg.mozilla.org/mozilla-central/
4) Enter the following command in the terminal, so that it will pull all the latest changes to the code.
and after that the next command to apply the changes to the repository file.
hg up (or) hg update
5) Once after the changes are applied you can start the build process with the help of the following command.
This process will take at least 45 min to complete. After that you can see some thing like this:
Your build was successful!
To take your build for a test drive, run: /home/path-to-mozilla/obj-x86_64-unknown-linux-gnu/dist/bin/firefox
For more information on what to do now, see https://developer.mozilla.org/docs/Developer_Guide/So_You_Just_Built_Firefox
Once you see this in your terminal you are ready to start with your first contribution.
Getting started with your first contribution
Now that you have completed the build and you are ready to start fixing a bug. Bug fixing is basically where you need to go through the code and find the part of code that is responsible for the bug. For this you can take the help of the Mozillans in Internet Relay Chat (IRC). You can follow steps for getting connected to Mozilla IRC and clarify your doubts regarding the bug which you got assigned to you.
Connecting to Mozilla IRC
If you are using Mozilla Firefox as your browser it got an extension for IRC called Chatzilla. Chatzilla is basically an IRC client developed by Mozilla. If not that you can use different clients such as Mibbit or IRCCloud as per your convenience.
After opening the chat client, for connecting to the Mozilla server just type the following in the IRC client.
Once after you have connected to the Mozilla Server you can join the channel introduction, it is a channel for beginners. For joining that channel you can give the following command in the
This is where you can start asking any questions related to bugs or in general also. Depending on the bug which you took and the availability of the mentor you can go and directly talk to him or you can ask any one there. There are a lot of people in Mozilla who are ready to help you at any point of time.
Selecting a Bug from Bugzilla
Once you are ready with the build you can go to bugzilla for searching for bugs. As for a beginner it is recommended to start with minor or trivial bugs. You can search for bugs using bugzilla and once you found out a bug just tell in the bug comments saying that you are interested in working for this bug. After some time you will get that bug assigned to you.
Once you are done with selecting a bug, you can go and ask any help regarding the bug in #introduction on IRC. While fixing a bug in Mozilla you have to find out a particular function which you need to modify. In that case you can use mxr or dxr. Using these two sites you can search for a file or a particular word or a module.
After you have fixed the bug, you have to make the patch. For making the patch you have to use mercurial.
Using Mercurial for creating a patch
Mercurial is used to create patch for the bug which you have fixed. Patch is one which gives you the changed you made to the code. Patch makes the mentor of the bug to review the changes and test it. For this you need to add the following lines to the hgrc file which you have created previously for giving a path to the Mozilla central repository.
username = Name
qnew = -Ue
git = 1
showfunc = 1
unified = 8
This helps you to create a perfect patch for the bug which you have fixed. Once after you attach the patch to the bug then you can wait until the mentor reviews the patch.
That’s it done, hurray….. you made your first contribution. 🙂