Minefield For Dummies

This entry is a detailed step by step instruction on how to use a metal detector and a hammer to cross a minefield.. just kidding.

Up until today I was really lost on how exactly to build Minefield, which is the developer’s unofficial build dealy of Firefox. I would have to agree with Peter Evanoff and say that this must’ve been the most confusing setup experience for any course I’ve done so far at Seneca. Thanks Chris for all the help. This entry is going to be an educational one, for those that take this subject later maybe or if my brain reformats. The steps to compile Minefield for dummies like me (oh and you must be a linux dummy cause this is for Windows):

The first thing to do is get the development tools needed to compile this monster. These can be found at the Mozilla Development Center, get the Windows MozillaBuild here. It’s a 35mb download and installs to c:\mozilla-build by default. On command prompt I execute start-msvc8.bat , if I use Visual Studio 2005 on my machine (I think). Use start-msvc71.bat if you use VS 2003 as Cathy said. This will bring up a sort of bash shell window that accepts unix commands. We’ll be working in this window from now on.

Edit: I missed this before, while trying to compile Firefox at home. So I’ll include the requirements here. Not only do you need the mozilla development tools and Visual Studio, in order to compile Firefox in Windows we need to download and install the Windows Platform SDK.

Now create and navigate to the directory where you want the source code to go. I’m going to stick with c:/temp/ for simplicity. The directory path must not contain any special characters or spaces. Before we get the source code we need the makefile client.mk. The filecontains the instructions to “checkout” the source from Tinderbox and the instructions to compile it all. To get it run the command:

$ cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk

Concurrent Versions System (CVS) will create a mozilla folder containing client.mk and some other random stuff.. Next we need to create a .mozconfig file to describe how we want to build the source. I cheated last class by not confiuring the .mozconfig to do a debug build, which is ideal for developing, oops. Yes I cheated. Anyway, Windows won’t allow us to create a file without a filename. It thinks the “mozconfig” after the “.” is the file extension! So on the bash window I did:

$ touch .mozconfig

You knew that already! :) Now to copy and paste the mozconfig options into this file. Wait a minute, where do I get these options?! Detailed intructions on how to do this can be found here or use the user-unfriendly generator that doesn’t explain what to put in those textfields. In this case I’m using the following setup in my mozconfig:

mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir
mk_add_options MOZ_MAKE_FLAGS=-j4
ac_add_options –enable-application=browser
ac_add_options –enable-debug
ac_add_options –disable-optimize

Note that there’s two dashes before “enable” and “disable” for the last 3 lines. I’m a cheater, so I switched windows and opened the .mozconfig file with textpad. You can use VI on the bash window :). We enable debug so that the source will be compiled to several small .dlls . Only then can we save some time by rebuilding smaller components instead of the whole source from the root. Disable optimize ’cause we would only need that for a final release, plus it would make the compile process longer. Where it says “-j4″, change the 4 so its one or more than the number of cores on your machine. This will ultimately affect the compile time required.

Next is to grab the source from the interweb, but before that lets check out Tinderbox: firefox. Tinderbox is a 24/7 web tool that builds and tests the state of the application. The grid shows the status of the source on each platform, where green is good and red is bad. If alot of red appears then it may be a bad time to checkout the source code. In worst case, tinderbox will show platforms on fire with an actual burning gif on the background! If all is good we can get the source now using this command:

$ make -f client.mk checkout

This will download the source files we need to compile into the mozilla directory. Finally I.. I mean we, can compile this thing! Run:

$ make -f client.mk build

All should go well if Tinderbox overall showed that the source is in good shape. Let’s test run Minefield now that we compiled with no errors! Go to the object directory as described in the .mozconfig. In this case we can find the executable at c:\temp\mozilla\objdir\dist\bin\firefox.exe . Let’s run it from the bash command prompt using:

$ firefox -no-remote - profilemanager

If you create a profile, say “development”, then next time we run this build we can enter:

$ firefox -no-remote -P development

Edit: I finally got Minefield to compile on my home machine, Windows XP. When I started it up though, the application was popping out with error messages. Dave on irc chat told me that this was normal on XP. The way to get around this is to do: export XPCOM_DEBUG_BREAK=warn before trying to run Minefield again. During the time when I was trying to build I learned quite a few things.. maybe I’ll blog again about those, a part 2 for my build experience!

I tried to find a definition of Minefield but it looks like its no where to be found. It seems that people on random forums believe that Minefield is Firefox 3.0 leaked. Minefield if I can remember clearly from Chris Tyler, is what they call firefox before its released as not to get the two confused and because the name Firefox is copyrighted or something? Hey welcome to the world of open source!

Anyhow, this clears up alot for me, and hopefully for anyone else that bothered to read! After this little yet big first step, I’m feeling a a bit better about jumping into a project I don’t know anything about (other than the goal written in text >_<). If I could suggest, the mozilla development site should really have an explanation such as this. A how to build at first glance sort of thing. Well that’s just my little bit of rant -and highly valued experience! I’m going to go through this process a few times, see how to build just one component of the mozilla source, and I’ll be ready for the next step! Starting with left foot up.. uuuup.. C’MON!!..

2 Responses

  1. [...] I’ve learned for others who had trouble building on their home computer too. I updated my previous post which explains everything I know to compile successfully on Windows [...]

    Peter » Blog Archive » Bug 340976 - January 26th, 2008 at 7:17 am
  2. [...] I decided to finally build Firefox. Using Peter’s walkthrough made the process super easy as he laid it out step by [...]

    Firestorm ZERO’s OSD Blog » Crossing the Minefield - January 28th, 2008 at 7:39 pm

Leave a Reply