Assignment 1 (mcparuze)
Contents
Assignment 1 - Building the Fox
Introduction
Much like everyone else in our course, I have never compiled Firefox. All of my Firefox experience is limited to what I did during the summer, which is not much. Everytime I thought about building firefox, thoughts along these lines started going through my mind:
1. Download Firefox Source 2. ??? 3. Profit
But since I was required to build the source in this course, I had to figure out Step 2. And here it is:
Required Software
Here is a list of software that I installed and used during the build. Obviously we need a compiler so Visual Studio 2005 came to mind and also we require some sort of UNIX runtime environment. Putty is required only because we had to tunnel out of the school intranet to the outside, else CVS would not work (more on this later).
- Microsoft Visual Studio 2005 (MSVC 8.0)
- Cygwin (with make 3.80!!)
- Putty
Build Instructions
This is where the fun starts. I basically followed David Humphrey's instructions on his website which outlines, in detail, the steps required to build Firefox. I had to slightly modify his steps to bypass the Seneca firewall, which ill point out later. The build instructions are as follows:
- The first thing that’s required is to install all the required software listed above.
- After that is done, load up cygwin and jump into the C:\ and create a directory called proj.
$> cd ../../cygdrive/c/ $> mkdir proj $> cd proj
- The proj directory will obviously be empty so we first need to extract the moztools we downloaded. The link is available in Resources Used section.
$> ls . .. moztools
- Next on the list is to create a file that will automate the creation of our build environment. Using David's tutorial, I created my setup inside a batch file named setupbuild.bat.
$> ls . .. moztools buildsetup.bat
- That batch file contained the following code in order to setup the build environment correctly.
rem --- CVS Setup SET CVSROOT=:pserver:anonymous@localhost:/cvsroot SET CVS_RSH=ssh rem --- Setup the paths to the moztools build libraries set MOZ_TOOLS=C:\proj\moztools set GLIB_PREFIX=%MOZ_TOOLS% set LIBIDL_PREFIX=%MOZ_TOOLS% rem --- Scrub these variables first SET INCLUDE= SET LIB= SET PATH=C:\;C:\windows\system32;C:\windows\system32\wbem rem --- Prepend cygwin SET PATH=C:\cygwin\bin;%PATH% rem --- Setup VC8 compiler environment vars CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 rem --- Add glib/libidl to build environment SET PATH=%PATH%;%GLIB_PREFIX%;%GLIB_PREFIX%\bin SET INCLUDE=%GLIB_PREFIX%\include;%INCLUDE% SET LIB=%GLIB_PREFIX%\lib;%LIB% rem --- moztools comes last after glib/libIDL SET PATH=%PATH%;%MOZ_TOOLS%\bin
- Notice that the CVSROOT has been changed to localhost rather then cvs-mirror.mozilla.org. This is done because we are going to use Putty in order to tunnel out of the school intranet.
- To execute this batch file we have created, the following steps need to be carried out:
$> cmd.exe -c C:\proj> buildsetup.bat
- If this worked correctly, the colorful prompt you have created should disappear and you should be in a regular DOS window. Don’t worry, all your UNIX commands still work :).
- Next you need to load up Putty. In order to tunnel out of the school intranet, you need to select the tunnels option from the Putty connection dialogue box. Here you input the values that you need to tunnel out:
Source Port: 2401 Destination: cvs-mirror.mozilla.org:2401
- Once that is entered in, click the Add button and connect to Matrix as you usually would.
- At this point, we have a wide open connection to the internet on Port 2401, the port that CVS communicates on. Therefore, you can continue to proceed with pulling the trunk:
C:\proj> cvs login Logging in to :pserver:anonymous@localhost:2401/cvsroot CVS password:
- Enter the password as specified on assignment 1 at the prompt. You know if it worked correctly if no errors appear. In fact, you should be at the prompt without any feedback. Now its time to pull the client.mk file:
C:\proj> cvs co mozilla/browser/config mozilla/client.mk
- A bunch of stuff will appear on the screen and it should pull the CVS correctly. If you load up explorer you should see a mozilla directory with a bunch of stuff in it. Traverse into the mozilla directory and create a file named .mozconfig.
C:\proj\mozilla> touch .mozconfig
- The .mozconfig file doesn’t contain anything at this point, so Open it up with Notepad and add the following lines into it:
# Building Firefox Trunk with Debugging . $topsrcdir/browser/config/mozconfig # Put all obj files in one place, not in src tree mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-objdir ac_add_options --disable-static ac_add_options --enable-shared # Debug Build Setup Options ac_add_options --disable-optimize ac_add_options --enable-debug # I'm using Canvas for my work ac_add_options --enable-canvas ac_add_options --disable-installer
- I added the line ac_add_options --disable-installer because nsis is not installed on my computer and I do not wish to create an installer.
- At this point, we basically have all we need setup to pull the Trunk:
C:\proj\mozilla> make -f client.mk checkout
- If successful, you should see a much of files and folders inside the mozilla Directory. By all means, build it!
C:\proj\mozilla> make -f client.mk build
- There you have it. If everything goes right, you should have a working build of Firefox 3 on your computer located in C:\proj\mozilla\firefox-objdir\dist\bin. Woot!Problems:
Problems Encountered & Solutions
The first problem I had was with the school intranet system. The administrators have the school have this place locked up tighter then Fort Knox. Therefore, I was required to do a little bit of tunneling in order to get my signal out of the school. Tunneling is achieved by using Putty and one of our UNIX servers such as Matrix. By doing this, I created a tunnel form my machine through Matrix and into the internet, bypassing all the firewalls and bandwidth prioritizing technologies the administrator’s setup.
The second problem I encountered was with the newer version of make. I started to build Firefox and about an hour into the build make died and gave me an error. I inquired in #developers and they immediately told me that I was using the wrong version of make. I downgraded make to version 3.80 and everything was fine and dandy.
Lastly, during the initial build process, I read an error that make could not find nsis, the installer code that bundles the executable. I decided to immediately ditch the process and add the line ac_add_options --disable-installer to the .mozconfig file.
Resources Used
David Humphrey's site on how to build Firefox
Official Mozilla Instructions on building Firefox
Conclusion
Woohoo, I did it. The build instructions that Dave provides on his website work great but with a minor modification in order to bypass Seneca’s firewall. Other then that, it’s pretty easy but it takes a long, long time. Also, make sure to use make 3.80 and not anything else because it breaks the build. You don’t want to sit there for 2 hours compiling and having it break right before it finishes.