The following are the steps I took to build Firefox on Windows XP SP2 using Visual Studio.NET 2005. My first step is to read the build prerequisites for Windows in the Mozilla developer site. Then search “how to build firefox on Windows” on Google. I follow the instructions on David Humphrey's website.
Intel Pentium 4 Processor-M 1.8 MHz 1 GB RAM 60 gig Hard Drive Windows XP sp2
- Install Visual Studio.NET 2005 using the default paths. Download it from ACS.
- Install Cygwin following the instructions in http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites and install the require packages.
ash -- UNIX-like command line interpreter shell (Base category) coreutils -- GNU core utilities (includes fileutils, install, sh-utils, and textutils) (Base category) cvs -- concurrent versions system (Devel category) diffutils -- file comparison utility (Base category) findutils (Base category) gawk -- pattern matching language (Base and Interpretors categories) grep -- text search tool (Base category) libiconv -- character set conversion (Devel category) make 3.80 (not 3.81!) -- dependency analyzer for software builds (Devel category) patchutils -- a small collection of programs that operate on patch files (Devel category) perl -- a scripting language used to control parts of the build (Interpreters category) sed -- a search and replace language (Base category) unzip -- zip file extraction (Archive category) zip -- zip file creation (Archive category)
- Create a directory C:\assignment1
- Download and Extract Moztools to C:\assignment1\moztools
Steps to Build Firefox
- Configure environment variables by create a script called buildsetup.bat in C:\assignment1. (the following code from David's website)
@echo off rem --- CVS Setup SET CVSROOT=:pserver:firstname.lastname@example.org:/cvsroot SET CVS_RSH=ssh rem --- Setup the paths to the moztools build libraries set MOZ_TOOLS=C:\assignment1\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 buildsetup.bat in C:\assignment1.
- Login to the mozilla CVS repository in C:\assignment1, type anonymous as password when prompted.
C:\assignment1> cvs login
- Check out the build script
C:\assignment1> cvs co mozilla/browser/config mozilla/client.mk this will create mozilla directory within C:\assignment1
- create a text file .mozconfig in mozilla (the following 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
• Check out the source code from cvs
c:\assignment1\mozilla> make -f client.mk checkout
• Finally do the build
c:\assignment1\mozilla> make –f client.mk build Once the build is successful, firefox 3.0 will be in c:\assignment1\mozilla\firefox-objdir\dist\bin
My problem was failing to use the right verison of make to build firefox.
make: *** [_xpidlgen/nsIContextMenuListener.h] Error 1 make: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir/embedding/browser/webBrowser' make: *** [export] Error 2 make: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir/embedding/browser' make: *** [export] Error 2 make: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir/embedding' make: *** [export_tier_gecko] Error 2 make: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir' make: *** [tier_gecko] Error 2 make: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir' make: *** [default] Error 2 make: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir' make: *** [build] Error 2
elichak told me the site that has an older verison of cygwin. Download cygwinBasic here and install it to a temp directory. Then copy make from the temp directory and paste it into the Cygwin dirctory.
I was expecting a lot of problems with the Mozilla Firefox build. It turned out to be better then I expected as building on Windows XP professional sp2 proved to be very easy and straight forward as long as you follow the instruction closely and make sure all the version are correct. The problem I encountered allowed me to understand that the slightest version change can break the build.