Friday, October 9, 2009

Compile Fire Fox on WinXP home with vs2008

I have always been intimidated with compiling a commercial (real world program, not some little school assignment). I get a sense of being overwhelmed and confused with all the "help" web sites that really only seem to aid the people who are already a bit familiar with this stuff. What follows is my attempt to explain in a very basic way how to compile fire fox (mine field) on windows xp home edition.

ASSUMPTIONS
The following is going to be assumed:
-You have windows xp(home)
-you have your windows updated to service pack 2 at the minimum.
-you have visual studio 2008 with it's own update of service pack 1. (this takes a long time to apply that update).
-you have the proper SDK. Down load this one. I made the mistake of thinking "aw sweet, I already have visual studio 2008 patched and working. I gotta have the most recent sdk...right?" boy was I wrong, and that caused me to waste of whole bunch of time later down the road.

Now to get on with compiling:

1)The first step were this started for me was this link from mozilla. On that webpage it had a link to download MozillaBuild. (a package of additional build tools.) Click on the link to the left called MozillaBuild and download that file.

2)Once the download finishes, click on the file MozillaBuildSetup-Latest.exe (run the setup)

3)Let it run and when it asks you for options, just keep the default settings and keep hitting 'next' until your finished. (Do not change paths or start experimenting with other stuff)

4)Once installation of MozillaBuildSetup-Latest.exe is finished, click on your desktops 'Start' button - > click 'Run'. and enter the following command: c:\mozilla-build\start-msvc9.bat then click ok. It should like something like this.


5) The last command you just entered will open a console window that looks like a dos window except it acts like a linux shell. Don't worry you don't need to know about linux, I post what to type ;) The console window looks like the pic below except I changed my font to red because I think it looks cool. What is important is that this window opens up on ur computer containing the same text as the one in the picture below.
for this guide I will call the console window in this picture 'the shell'


6)At this point if you skipped over my ASSUMPTIONS section at the very top, make sure you have that stuff or you will be off this guides path and will probably hit a few bumps on your path to figuring out how to compile fire fox.
In the shell window type the following commands:
hg clone http://hg.mozilla.org/mozilla-central/

then press enter

The command above will take some time to finish because
it's downloading Mozilla files to your computer.
Don't close the window thinking it froze.

7)This is an in-between step but it's important to do
because on Windows XP the above command puts the
mozilla-central folder into the following directory:

C:\Documents and Settings\Alex\mozilla-central
**on ur system ..\Alex\.. will be the user name you are
logged into windows with.**

make sure to move(cut) the mozilla-central folder from
there and paste it to C:\

or else the following commands
in step 8 will not work because they can't find
mozilla-central in the shell.

8)Now continue entering the following commands.

cd mozilla-central

then press enter

echo '. $topsrcdir/browser/config/mozconfig' > mozconfig

then press enter
*enter it exactly like this*

echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-release' >> mozconfig

then press enter

IMPORTANT!!
**If this command does not fully appear b/c the blog
cuts it off, click on this link!! to copy the
full command. It's important to get the full command
with exact spacing and case sensitivity**

moving on, enter the command below:

echo 'mk_add_options MOZ_MAKE_FLAGS="-j4"' >> mozconfig

then press enter

make -f client.mk

then press enter

9) After inputting the above command in the shell
window make -f client.mk", your computer will go
nuts processing a whole wack of files. It
actually looks kinda cool. This step can take
quite a while so be patient and don't close the
window.
The way you can tell it's finished is when the
shell window has a blinking underscore(cursor)
that means it is ready for another command.

Once it finishes doing it's thing, this is were you will
see if there was an error or if you did everything
correct.
If there is an error, the shell window will give some
kind of vague error message.
I'm assuming at this point you have a blinking cursor in
the shell window.
So with the assumption that there is no error,
click 'Start' on the task bar -> then click 'Run' and type
the following comand:

c:\mozilla-central\objdir-ff-release\dist\bin\firefox.exe --no-remote
-profilemanager



When you click ok a new window should pop up
(look at the pic below).
Make a profile and click start minefield:


If all goes well you should see a new browser window
open up and... Ta-Dahhhh!
you got MineField compiled.
Congrats I hope you found it easy and the guide
actually worked.

Optional but sexy step.
10)For those who don't think it's cool to have to
type a run command ex)
c:\mozilla-central\objdir-ff-release\dist\bin\firefox.exe --no-remote -profilemanager

everytime you want to launch minefield, and don't
want to make a lame shortcut, the following will
actually make a cool installer that you can send
to other computers or friends to show off ;)
do the following:

a)open up the shell window again (remember the command?)
c:\mozilla-build\start-msvc9.bat
**in start->run->enter**

and type the follow command in this window:

cd C:\mozilla-central\objdir-ff-release

then press enter

now type the 2nd command:

make package

then press enter (yes this is actually a command)
This command will also take a bit of time so be patient.

b)

Once the 'make package' command is finished you can click on
start on task bar -> run and enter the following:
C:\mozilla-central\objdir-ff-release\dist\install\sea

This is where your new sexy installation file is located then you
just have to double click on it.


firefox-3.7a1pre.en-US.win32.installer.exe
Now go through the set up process.

c) Now there is one minor detail I had to do to make it feel just like
regular fire fox. Because I have fire fox 3.5 installed and now MineField.
If I don't do this step, every time I click on minefield.exe it will
launch firefox.exe (v3.5) thats not cool
Ergo, do the following:
click start -> all programs -> minefield (hover over minefield)
then right click and select properties. Check picture below:



Once you select properties a new window will open.

d)In that new window click on the shortcuts tab
at the top of the window.
It will look like this:
Add the following
to the end of the 'Target' text field:

--no-remote
then click 'Apply' button and 'OK'.
you can even add ur user profile so you don't have
to pick one on every start up. This is done by
adding the following line:

"C:\Program Files\Minefield\firefox.exe" --no-remote -p "Tyrant911"

where Tyrant911 is what ever user name you want to use.

My teacher Dave sent me this link to other useful command line options
that could be added.


That is the end. Hope it works
out for you :)

I want to give thanks to the people who were
patient with me for so many hours on IRC b/c unfortunately
it took me a long time to figure this out, and I broke
their balls individually (ouch!)

Thanks to:

on IRC server irc://moznet F1LT3R , jhford, humph my teacher

Cheers!

No comments:

Post a Comment