Changes

Jump to: navigation, search

Building Firefox 1.5

6,804 bytes added, 12:25, 14 October 2006
no edit summary
= Assignment 1 - Building the The Fox - 1.8.0 Branch =
Written By [[user:RealMarkP|Mark Paruzel]].<br/>''THIS IS UNDER CONSTRUCTION!!''
== Introduction ==
I have built [[Assignment_1_(mcparuze)|Firefox before]] for a previous assignment I did and it was dead simple. Building Firefox 3.0 is as easy as riding a bike; building Firefox 1.5 is like attempting to start a fire, 30 feet under water. Its It’s painful. So, hopefully these instructions will make it a bit easier then the instructions available on the MDC.
== Required Software ==
=== Cygwin ===
* Cygwin is avilable available for download [ftp://ftp.osuosl.org/pub/cygwin/setup.exe Here]. Install it with the following tools:
** ash -- UNIX-like command line interpreter shell (Base category)
** coreutils -- GNU core utilities (includes fileutils, sh-utils, and textutils) (Base category)
** diffutils -- file comparison utility (Base category)
** findutils (Base category)
** gawk -- pattern matching language (Base and Interpretors Interpreters categories)
** grep -- text search tool (Base category)
** make -- dependency analyzer for software builds (Devel category)
=== Make 3.80 ===
* Unfortunately, Cygwin no longer is bundled with make 3.80, rather its bundled with 3.81-1 which breaks duing during the Firefox build.
* To get the version of make that works (3.80), you have to download it [http://cygwin.paracoda.com/release/make/make-3.80-1.tar.bz2 here]. Once you have download it, you can just grab the Make executable file (make.exe) from /usr/bin/ directory and drop it into Cywgin/bin (this will overwrite the existing Make executable).
* While your doing this, make sure Cygwin is not running. If it is, you will need to restart Cygwin.
* There are two tool packages that are required to build Firefox using VS 7.1. These two tools are called [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/moztools-static.zip Moztools] and [http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip Wintools].
* Download these two zip files and extrat thier extract their contents into your C:\proj\ directory.
<pre>
$> pwd
/cygdrive/c/proj
$> ls -al
drwx------+ 6 RealMarkP None 0 Oct 12 15:13 .
drwxrwxr-x+ 10 Administrators SYSTEM 0 Oct 13 11:23 ..
-rwx------+ 1 RealMarkP None 843 Oct 12 15:08 buildsetup.bat
drwx------+ 5 RealMarkP None 0 Jan 23 2001 buildtools
drwx------+ 5 RealMarkP None 0 Jan 24 2006 moztools
</pre>
* At this point were technically done with this section, installing these two tools will be handled in a later section.
=== Setting Up The Environment ===
* At this point, the The Cygwin Environment is basically set upand the two tool packages are extracted. You now have the tools required to automate the build process as well as the compiler to do the grunt work.
* Before you can start to build, you need to set up a bunch of environment variables so that the make files know where to look for dependencies. I created a build batch file that set up the environment for me:
<pre>
BuildSetup@echo off rem --- CVS SetupSET CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsrootSET CVS_RSH=ssh rem --- Setup the paths to the moztools build librariessetset MOZ_TOOLS=C:\proj\moztoolsset GLIB_PREFIX=c:\proj\vc71set LIBIDL_PREFIX=c:\proj\vc71 rem --- Scrub these variables firstSET INCLUDE=SET LIB=SET PATH=C:\;C:\windows\system32;C:\windows\system32\wbem rem --- Prepend cygwinSET PATH=C:\cygwin\bin;%PATH% rem --- Setup VC8 compiler environment varsCALL "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat goes here" x86 rem --- Add glib/libidl to build environmentSET PATH=%PATH%;%GLIB_PREFIX%;%GLIB_PREFIX%\binSET INCLUDE=%GLIB_PREFIX%\include;%INCLUDE%SET LIB=%GLIB_PREFIX%\lib;%LIB% rem --- moztools comes last after glib/libIDLSET PATH=%GLIB_PREFIX%;%GLIB_PREFIX%\bin;%PATH%;%MOZ_TOOLS%\binSET MOZCONFIG=C:\proj\mozilla\mozconfig
</pre>
* It should be noted that there are several lines that point to C:\proj\VC71, this is alright because we will install those in the enxt section.
=== Glib And LibIDL For VC 7.1 ===
* Unfortunately, Moztools cones with an out dated version of Glib and LibIDL, therefore we have to supply our own. The following versions of [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc71/vc71-glib-1.2.10-bin.zip Glib] and [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc71/vc71-libIDL-0.6.8-bin.zip libIDL] are for Visual Studio 7.1.* Grab these two files and extract them into the proj directory. If done correctly they should be a directory called VC71in your C:\proj directory.<pre>$> pwd/cygdrive/c/proj$> ls -aldrwx------+ 6 RealMarkP None 0 Oct 12 15:13 .drwxrwxr-x+ 10 Administrators SYSTEM 0 Oct 13 11:23 ..-rwx------+ 1 RealMarkP None 843 Oct 12 15:08 buildsetup.batdrwx------+ 5 RealMarkP None 0 Jan 23 2001 buildtoolsdrwx------+ 5 RealMarkP None 0 Jan 24 2006 moztoolsdrwx------+ 6 RealMarkP None 0 Apr 5 2004 vc71</pre>* At this point, you are ready to set up the environment variables so that the build process knows where to look. === Environment Variables === * The first thing that needs to be done is to jump into the DOS command prompt.<pre>$> cmd.exeC:\proj></pre>* Note: All the Unix commands work perfectly in this state because the DOS command prompt inherited all the environment settings of the Cygwin shell.* Firstly, we need to run the buildsetup batch file we created earlier in order to set up any environment variables we need.<pre>C:\proj>buildsetup.batSetting environment for using Microsoft Visual Studio .NET 2003 tools.(If you have another version of Visual Studio or Visual C++ installed and wishto use its tools from the command line, run vcvars32.bat for that version.) C:\proj></pre>* In order to test and see if this worked, you can display all the variables that were changed and see if they contain the necessary paths for the build to work.<pre>C:\proj>echo %PATH%c:\proj\vc71;c:\proj\vc71\bin;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\BIN;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\bin\prerelease;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\bin;C:\Program Files\Microsoft VisualStudio .NET 2003\SDK\v1.1\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\cygwin\bin;C:\;C:\windows\system32;C:\windows\system32\wbem;;c:\proj\vc71;c:\proj\vc71\bin;C:\proj\moztools\bin</pre>* What you should be looking for is if the C:\proj\vc71 is in the path as well as C:\proj\moztools. These two paths are crucial to the build.<pre>C:\proj>echo %GLIB_PREFIX%c:\proj\vc71 C:\proj>echo %LIBIDL_PREFIX%c:\proj\vc71 C:\proj>echo %MOZ_TOOLS%C:\proj\moztools C:\proj>echo %MOZCONFIG%C:\proj\mozilla\mozconfig C:\proj></pre>* Secondly, in order to install Wintools into the Moztools, we need to navigate into that directory and install using the batch file provided.<pre>C:\proj>cd buildtoolsC:\proj\buildtools>cd windowsC:\proj\buildtools\windows>install.bat MOZ_TOOLS is set to C:\proj\moztools copying exes and dlls to C:\proj\moztools\bincopying include files to C:\proj\moztools\includecopying include files to C:\proj\moztools\include\libIDLcopying lib files to C:\proj\moztools\lib done copying make sure that MOZ_TOOLS\bin is on your path C:\proj\buildtools\windows>cd ../..C:\proj></pre>* This copies over any windows related tools that we need for the build.* The environment is now set up to receive and compile the Mozilla source tree.
=== Pulling From CVS ===
 
* Now the easy part begins. In order to pull from the CVS repository, you have to specify the right type of branch to pull, this is done by the following command.
<pre>
C:\proj>cvs -d :pserver:anonymous:anonymous@cvs-mirror.mozilla.org:/cvsroot co -r MOZILLA_1_8_0_BRANCH mozilla/client.mk
</pre>
* We are going to pull the 1.8.0 branch because that’s the branch that corresponds with the Firefox 1.5 build.
* This creates a Mozilla directory with a file called client.mk inside it. This file is a make file script that defines what to pull and how.
* To pull the source from the CVS, just use this command.
<pre>
C:\proj>cd mozilla
C:\proj\mozilla>make -f client.mk checkout
</pre>
* Once its done, we need to make a file called mozconfig that will specify the parts of the system that will be built. Put the following code inside this file using notepad or similar text processor. This file does not have an extension and is plainly called mozconfig.
<pre>
mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/hopefullyWorked.firefox.optimized
ac_add_options --enable-application=browser
ac_add_options --disable-optimize
ac_add_options --enable-debug
ac_add_options --enable-svg
ac_add_options --enable-canvas
ac_add_options --disable-installer
</pre>
* Next, all we have to do is Build!!
=== Building ===
 
* Its time to build this beast!
<pre>
C:\proj\mozilla>make -f client.mk build
</pre>
 
* Wait...
* ....Wait some more...
* ...........Keep waiting............
* Somewhere within about 2 hours, the code will finish compiling and you should have Firefox.exe sitting inside your C:\proj\mozilla\hopefullyWorked.firefox.optimized\dist\bin directory.
* Were done!!!
== Problems Encountered & Solutions ==
=== xpidl.exe Crashes ===
* This is because your Path enironment veariable points to the wrong version of Glib and LibIDL. check your path and make sure that it points to C:\proj\vc71 and C:\proj\Vc71\bin. These two Path entries should be at the begining of your Path variable.
== Resources Used ==
1
edit

Navigation menu