build firefox on Windows
Authors
Yi Shen
Introduction
In order to build firefox on windows, my first step was search “how to build firefox on Windows” on Google. Then I followed the instructions on David Humphrey's website.
Software Installed
Install the compiler - Visual Studio.NET 2005
Install Cygwin with all packages required for building Mozilla:
ash coreutils cvs diffutils findutils gawk grep libiconv make 3.80 patchutils perl sed unzip zip
Create a directory c:\proj
Download and Extract Moztools to C:\proj\moztools
Steps to Complete the build
Setup environment variables and paths by creating a setup file: c:\proj\buildsetup.bat Copy and paste the given code(from David's website) to c:\proj\buildsetup.bat
@echo off rem --- CVS Setup SET CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/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
Run Cygwin and move into c:\proj directory
Problem1 – I have no idea how to move my current directory to c:\proj in Cygwin
$ cd ../.. $ cd cygdrive/ $ cd c $ cd proj
Setup environment and paths
$ cmd Buildsetup.bat c:\proj> buildsetup.bat
Log into the mozilla CVS by anonymous
Problem2 – failed: connection refused (only at school’s computer)
After handled problem2 run Cygwin again and login CVS by anonymous
C:\proj> cvs login CVS password: anonymous
Checkout the build script:
C:\proj> cvs co mozilla/browser/config mozilla/client.mk Cvs checkout: Updating mozilla/browser/config U mozilla/client.mk
This create some files in C:\proj\mozilla
Move into mozilla directory and create a file .mozconfig
c:\proj\mozilla> touch .mozconfig
open .mozconfig, copy and paste the given code(from David's website).
# 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
now we can get the full source from cvs:
c:\proj\mozilla> make -f client.mk checkout
This will take a little while, then we will see a bunch of files create in c:\proj\mozilla
Now we can build it:
C:\proj\mozilla> make -f client.mk build
After more than half an hour of building, you will find firefox3.0a1 in C:\proj\mozilla\firefox-objdir\dist\bin
Problems
Problem1 - I have no idea how to move my current directory to c:\proj in Cygwin. Mark helped me move the current directory to c:\proj and create the .mozconfig by touch command.
Problem2 - I wasn’t able to log into cvs at school computer. Mark told me to use Putty to tunnel out the school firewall through matix
host Name(or IP address): matix.senecac.on.ca Source Port: 2401 Destination: cvs-mirror.mozilla.org:2401
Login matix
Then Change cvs-mirror.mozilla.org in c:\proj\buildsetup.bat to localhost
Resources
David humphrey’s website
Mark Paruzel
Conclusions
By the instruction on David’s website and mark’s help I build firefox on my first try. But I wasn’t understand clearly about the steps of building it and why it worked that way, at least I didn’t figure out the problem by myself. So I format my hard drive and redo everything by memory and it worked again. All the steps are not too hard to follow, but the building took too long time. Now I am familiar with building firefox on windows.