# Building Mozilla on Microsoft Windows 32-bit platforms

## Daniel Nunes, `leaf@netscape.com`

v 1.0, June 1998

How to build Mozilla on a Microsoft Windows 32-bit System.

## 1. Introduction

## 2. Building Mozilla

- 2.1 Get the Code
- 2.2 Requirements
- 2.3 Set up the Build Environment
- 2.4 Build the Lizard

## 3. Common Problems

## 1. Introduction

What this document is: A guide to building the Mozilla application.
This includes:

1. A listing of the development tools you will need to build Mozilla.
2. A list of environment variables you will need to set before building.

If you're looking for documentation on developing features or fixing bugs, the Mozilla Technical Documents or Library are probably what you're looking for.

## 2. Building Mozilla

Each of the following subsections describes, or gives references to descriptions of, the steps necessary to build Mozilla.

## 2.1 Get the Code

There are two principal ways of getting the code, ftp and CVS. CVS will provide the most current code for building, but is slower than ftp. Ftp drops are generally produced once per month, and are known to compile.

## 2.2 Requirements

The following need to be installed:

- Microsoft Visual C++ version 4.2 or later
- GNU Tools for Microsoft Windows, located:
  - Cygnus
  - GNU home page
  - MIT
  Specifically, you'll need:
  `cp.exe
  rm.exe
  uname.exe
  `
  Netscape has internally modified version of gmake, shmsdos and win32gnu that we use to get around some problems we were having keeping in sync with the Unix version of gmake. This version of gmake can be found in the Windows Build Tools package, which can be ftp'd from the Mozilla Download page. The three files you will need are:
  `gmake.exe
  shmsdos.exe
  uname.exe
  `

Hardware/OS

- Pentium 133 MHz or better
- 64 MB RAM, 128 MB recommended
- 250 MB NTFS or 500 MB FAT disk space
- NT 4.0 is preferred; NT 3.51 will also work.

## 2.3 Setup the Build Environment

The following environment variables need to be set:

`set MOZ_BITS=32
set MOZ_DEBUG=1 (set this only if you want to build a debug build)
set MOZ_MEDIUM=1
set MOZ_NT=351 (if running NT3.51)
set MOZ_OUT=(optional: specifies location of resultant executable)
set MOZ_SRC=(top of your tree, for example: set MOZ_SRC=d:\mozilla_source if this is the directory where you checked or unzipped the source into)
set MOZ_TOOLS=(the parent directory of the GNU tools 'bin' directory. The build looks for MOZ_TOOLS\bin\gmake.exe, so make sure that the gmake.exe from the Windows Build Tools package resides there.)
set NSPR20=1
set _MSC_VER=1100 (if you are running VC++ 5.0) or 1200 (if you are running VC++ 6.0)
`

## 2.4 Run the build

Change to the directory you copied the source into (for example, `cd d:\mozilla_source`). If this directory was empty before you installed the source, there should be two directories here: `README` and `mozilla`. `

    cd mozilla\config
    nmake /f makefile.win
    cd ..
    nmake /f client.mak

`

## 3. Common Sticking Points

- nmake has a 'fatal error', listing one of the GNU commands and a hexadecimal return code.
  This will happen as a result of not having the GNU tools and Windows Build tools in your path. Add the directories with the appropriate binaries to your path.
- It fails with the message "'.\WIN32' unexpected":
  You didn't properly set the environment variables -- you must not include a space at the end of the set statements (be careful if you are cut'n'pasting).
- It fails to build, with directory-related errors:
  The full path to the source must not include any spaces. Additionally, the source must be extracted with an intact directory structure by a utility that understands long filenames. If in doubt, grab Info-Zip at ftp://ftp.cdrom.com/pub/infozip
- It fails immediately with the message "Cannot find specified directory":
  You didn't properly set the environment variable MOZ_TOOLS; this needs to be set to the path up to, but not including, the final \bin directory in the path to the gnu tools. So, the path to the tool executables is '%MOZ_TOOLS%\bin\'.
- I'm not running a 32-bit windows system, how do i build?
  Currently, the build process depends on a 32-bit operating system. Windows NT 4.0 is the recommended windows operating system.