Assignment 1 (bhearsum)
Build Prerequisites
The first step in building Firefox on Windows is getting a compiler. For someone who works on Linux most of the time this seemed like an easy step. A compiler's a compiler, right? Apparantly not! After reading the build documentation I found out that depending on which branch is being built a different compiler is needed. The latest version of Microsoft's cl compiler will only build the HEAD branch (Firefox 3.0). Visual Studio 2003 compilers will build all branches of the Mozilla tree. Microsoft does not make the free editions of these available anymore, luckily Seneca students have access to the full versions through ACS. I chose to build HEAD.
The Mozilla build system requires a unix-like environment to function correctly; this is a big reason why compiling Firefox on Windows can be such a headache. In order to get this functionality I had to install Cygwin. It provides a unix-style shell and all the standard unix tools. GNU make and CVS were also installed via Cygwin. I had to modify the default cygwin.bat file to point it to the Visual Studio libraries, include files, and executables as well as the moztools. Now I only have a few more things to install before building!
There are certain libraries and binaries that are required for building on the Mozilla tree that Cygwin does not provide. These are distributed in a package called moztools, which I got from the Mozilla Developer Center. To compile and link Windows applications I had to install the Microsoft Platform SDK. The installer for Mozilla applications uses the Nullsoft Install System. This isn't required to build but I wanted to create an installer so I could easily distribute my build.
Configuration
Now that all of this is installed I can start building! Well....almost. The Mozilla build system does not use the traditional './configure; make; make install' method of compilation and installation. I imagine this is because of the complexity of the project. In any case, configure and compile-time options are set in a special file called .mozconfig. Configure options are preceeded by 'ac_add_options' and compile-time ones by 'mk_add_options'. Here is the .mozconfig file I used:
mk_add_options MOZ_OBJ_DIR="/cygdrive/c/mozilla/obj-ff3" mk_add_options MOZ_CO_PROJECT="browser" ac_add_options --enable-application=browser ac_add_options --enable-optimize ac_add_options --enable-static --disable-shared
MOZ_OBJ_DIR tells the compiler where to put the object files. This is useful when building multiple projects from the same tree. MOZ_CO_PROJECT tells the build system what files you will need when checking out from CVS. In this case I am only building the browser. --enable-application is similar to MOZ_CO_PROJECT, but it tells autotools what you will be building so that it can generate the proper Makefiles. --enable-optimize will enable the default optimizations. This can benefit performance and start-up time but makes debugging extremely difficult. The last two options tell the linker to use static linking instead of shared libraries. Because I want to generate an installer it is required that I use static linking.