gecko-dev/README/mozilla/mac-build.html

401 lines
16 KiB
HTML
Raw Normal View History

<HTML>
<HEAD>
<TITLE>Building Mozilla on the Macintosh PPC platform</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000EE" VLINK="#551A8B"
ALINK="#FF0000">
<HR>
<H1>
Building Mozilla on the Macintosh PPC platform</H1>
<H2>
Daniel Nunes, <TT><A HREF="mailto:leaf@netscape.com">leaf@netscape.com</A></TT>
</H2>
v 1.0, June 1998
<P>
<HR><I>How to build Mozilla on a Macintosh PPC System.</I>
<HR>
<H2>1. <A HREF="#s1">Introduction</A></H2>
<H2>2. <A HREF="#s2">Building Mozilla</A></H2>
<UL>
<LI>
<A HREF="#ss2.1">2.1 Get the Code </A></LI>
<LI>
<A HREF="#ss2.2">2.2 Requirements</A></LI>
<LI>
<A HREF="#ss2.3">2.3 Set up the Build Environment</A></LI>
<LI>
<A HREF="#ss2.4">2.4 Build the Lizard </A></LI>
</UL>
<H2>3. <A HREF="#s3"> Common Problems </A></H2>
<H2>4. <A HREF="#s4"> Credits </A></H2>
<HR>
<H2><A NAME="s1">1. Introduction</A></H2>
<P>
What this document is: A guide to building the Mozilla application.
This includes:
<OL>
<LI> A listing of the development tools you will need to build Mozilla. </LI>
<LI> A list of environment variables you will need to set before building. </LI>
</OL>
<P>
If you're looking for documentation on developing features or fixing bugs,
the Mozilla
<A HREF="http://www.mozilla.org/docs/tplist/tplist.html">Technical Documents
</A> or <A HREF="http://www.mozilla.org/library.html"> Library </A>
are probably what you're looking for.
<P>
<HR>
<H2><A NAME="s2">2. Building Mozilla </A></H2>
<P>
<UL>Each of the following subsections describes, or gives references to
descriptions of, the steps necessary to build Mozilla.
<H2><A NAME="ss2.1">2.1 Get the Code</A></H2>
<P>
<UL>
There are two principal ways of getting the code,
<A HREF="http://www.mozilla.org/download.html"> ftp</A> and
<A HREF="http://www.mozilla.org/cvs.html"> CVS</A>.
CVS will provide the most current code for building, but is
slower than ftp (takes longer to download).
</UL>
<P>
<H2><A NAME="ss2.2">2.2 Requirements</A></H2>
The following need to be installed:
<UL>
<LI>CodeWarrior (CW) 2 - obtainable from
<A HREF="http://www.metrowerks.com">Metrowerks</A>.
See <A HREF="#s3">Common Sticking Points</A> if you have a different
version.
</LI>
<LI>PowerPlant 1.8 - obtainable from the CodeWarrior CD.</LI>
<LI>MSL - the Metrowerks Standard Library, obtainable from the
CodeWarrior CD</LI>
<LI><A HREF="ftp://ftp.boingo.com//dan/WASTE/waste-13.hqx">WASTE
1.3</A></LI>
<LI><A HREF="http://www.bact.wisc.edu/CWASTEEdit/CWASTEEdit.sit.hqx">CWASTE
1.6.2</A></LI>
<LI>
<A HREF="ftp://ftp.scripting.com/userland/menuSharingToolkit4.1.sit.hqx">
Menu Sharing Toolkit</A> (from UserLand)</LI>
<LI>
<A HREF="ftp://ftp.digitalalchemy.com/pub/digitalalchemy/mercutio-SDK.sit.bin">
Mercutio 1.5 SDK</A> (only download the SDK, not the entire package, else
the access paths will be wrong)</LI>
<LI>
<A HREF="ftp://ftp.share.com/pub/internet-configuration/ICProgKit1.4.sit">
Internet Config 1.4 SDK</A></LI>
<LI><A HREF="http://www.mooseyard.com/Jens/Software/">AEGizmos
1.4.2</A></LI>
<LI><A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_tool.bin">
MacPerl 5 MPW Tool</A></LI>
<LI>
<A HREF="ftp://sunsite.cnlab-switch.ch/software/platform/macos/perl/Mac_Perl_520r4_appl.bin">MacPerl 5 Application</A></LI>
<LI>MakeStub - MPW (installed with CodeWarrior Heaven option). If
you choose not to install MPW, it is located on the MacOS Tools CD
in "CW Pro 2 Tools:CodeWarrior MPW:MPW:Tools"</LI>
<LI>RunTSScript - in Mozilla source distribution
(mozilla:build:mac:RunTSScript), needs to be installed by hand</LI>
<LI><A HREF="ftp://dev.apple.com/devworld/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/ToolServer.sit.hqx">ToolServer</A>
- or in the CW distribution (CW Pro 2 Tools:Apple Development
Tools:ToolServer 3.4.1.sit). <B>We recommend pulling it off the
CD</B> because it comes with configuration files for CodeWarrior
which you would have to create manually were you to pull it off
the net.</LI>
<LI>
<A HREF="http://people.netscape.com/sfraser/software/NewAlias_tool.sit.hqx">
New Alias MPW Tool</A> An MPW tool that creates Finder aliases for files.
</LI>
<LI>StreamEdit MPW Tool - MPW (installed with CodeWarrior Heaven option). If
you choose not to install MPW, it is located on the MacOS Tools CD
in "CW Pro 2 Tools:CodeWarrior MPW:MPW:Tools"</LI>
</LI>
<LI>
<A HREF="ftp://dev.apple.com/devworld/Periodicals/develop/develop25/develop_Issue_25_code/ToolFrontEnd.sit.hqx">ToolFrontEnd</A></LI>
<LI>
<A HREF="http://sunsite.cnlab-switch.ch/ftp/software/platform/macos/src/HTML/MPW_C.html">
patch 2.1</A></LI>
</UL>
<P>
Hardware/OS
<UL>
<LI>To build Navigator, you need a fast PPC Mac. The faster the
better. You can't build with a 68K machine because we have too many
resources, and the build process will crash when trying to generate
resources out of our cross-platform strings. See the discussion below
for a way around this.
</LI>
<LI>You will need about 96 MB of physical RAM to "fast link" the app.
You can still fast link if you give your machine 96 MB of virtual
memory, but then the VM hit is large enough to counteract any
improvement. One of our beta testers had a machine with only 64MB of
physical RAM (VM was off) and it ran out of memory trying to link.
Turning VM on got it to link, but build time increased greatly.
</LI>
<LI>Reports from the net indicate that the optimized version
(MozillaPPC) take much less RAM to build than the 96MB we suggest. If
you are running out of memory, try building that instead of the debug
version (the debug symbols require a lot of RAM come link time).
</LI>
<LI>You should be ok with a 400MB disk partition, even when fully
built. This does not include tools like the IDE, just source.
</LI>
<LI>On an HFS+ volume, a full build takes about 110MB. HFS+ is good,
but utilities are sparse.
</LI>
</UL>
<P>
<H2><A NAME="ss2.3">2.3 Setup the Build Environment</A></H2>
<P>
<OL>
<LI>Install CodeWarrior from the CD. While it is large, installing
the "CodeWarrior Heaven" option will guarantee that you have
everything you need. This will give you PowerPlant, MSL, and MPW.
If you choose to install less, proceed at your own risk.</LI>
<LI>In the Finder, increase the memory partition of the IDE to
15MB (you can get by with 12, if need be).</LI>
<LI>Download ToolFrontEnd. After expanding it, in "ToolFrontEnd
Folder:Drop-Ins" there are three items:
<UL>
<LI><I>#include</I></LI>
<LI><I>ToolFrontEnd</I></LI>
<LI><I>ToolFrontEnd Panel</I></LI>
</UL>
<P>Create a folder named "Include Scanners". Place the file
"#include" into the Include Scanners folder. Move the Include
Scanners folder to the CodeWarrior Plugins folder. Create a folder
named "ToolFrontEnd". Place the files "ToolFrontEnd" and
"ToolFrontEnd Panel" into the ToolFrontEnd folder. Place this
folder in the CodeWarrior Plugins folder.</P></LI>
<LI>Open "ToolFrontEnd Panel" with ResEdit. Change the file type
from <B>'Panl'</B> to <B>'PanL'</B>. Save.</LI>
<LI>Uncompress the StuffIt Archive for ToolServer. The goal is to
let ToolServer and MPW share the same Tools directory so you don't
need to have multiple versions of tools. Do the following:
<OL>
<LI>Open ToolServer's Tools folder. There is one file called
"RMetrowerks". </LI>
<LI>Move RMetrowerks to Tools folder of MPW. MPW folder must be
at "Metrowerks:Codewarrior MPW:MPW" if you installed
Codewarrior Heaven. </LI>
<LI>Remove ToolServer's Tools folder.</LI>
<LI>Now create an alias of Tools folder in "CodeWarrior MPW"
and move it to your ToolServer folder. Rename the alias
(probably called "Tools alias") to "Tools"</LI>
<LI><FONT COLOR="#FF0000"><B>IMPORTANT</B></FONT>: Make sure
you only have one instance of ToolServer on your machine. If
the build script finds the wrong one, the correct tools will
not be found and strange things will happen.</LI>
</OL>
</LI>
<LI>After installing the MacPerl MPW Tool distribution (run the
InstallerVISE application), in the "MacPerl &#131;" folder, there
will be an MPW tool named "perl". Install this in MPW's tools
folder.</LI>
<LI>Install the MacPerl Application (run the
InstallerVISE application). You can install this anywhere, but it is
recommended that you install it inside of your CodeWarrior folder for
easy reference. After installation, you will need to set a preference
to enable double-click launch of the perl scripts. This preference is set
by going under the Edit Menu to Preferences. Click on the "Script" button
and hit the radio button "Run Scripts opened from Finder"</LI>
<LI>Install the "patch", "MakeStub", "NewAlias" and "StreamEdit" Tools in the
tools
folder. Note that "MakeStub" and "StreamEdit" are automatically installed by the
"CodeWarrior Heaven" install option.</LI>
<LI>Install RunTSScript (found in the Mozilla source distribution)
in the compilers folder in your build environment
("Metrowerks:Metrowerks Codewarrior:Codewarrior
Plugins:Compilers")</LI>
<LI>Next, after downloading all the 3rd party software components,
drag WASTE, CWASTE, Menu Sharing, Mercutio, Internet Config, and
the AEGizmo folders (just as they are) into the "MacOS Support"
folder in your build environment.</LI>
<LI>Start ToolServer from within CodeWarrior (or use MPW if you
are brave enough). We're about to patch some files. Make sure the
ToolServer menu is in the CodeWarrior menu bar by turning on the
<A HREF="IDEPrefs.gif">preference</A> under the "Extras" panel in
the IDE Preferences (not the project preferences!). The menu bar
should look like this:
<P><IMG SRC="IDEMenuBar.gif" WIDTH=359 HEIGHT=20 X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
<P>Choose "Start ToolServer" from the ToolServer menu (this is the
icon menu between "Window" and "Help" in the menubar above). You
will now see a window with no close box. This is your ToolServer
Worksheet where you will type (or cut &amp; paste) the commands
for the following steps.</P>
<P>In case you have never used MPW/ToolServer before, the
following is <B>very important</B>. Pressing "return" does not
execute commands like you might think. It just inserts a newline
into the worksheet like a normal text editor. <B>To actually get
ToolServer to execute the command, you must press "Enter" (lower
right of numeric keypad).</B> This executes the line that the
cursor is on, and only that line. If you want to execute multiple
lines at once, select them all and hit Enter.</P></LI>
<LI>Set the shell variables {IDE} and {Source} to the correct
paths for your build environment. {IDE} is where your CodeWarrior
IDE is located. {Source} is the folder containing the toplevel
"ns" folder of the Mozilla source. Mine look like this (don't
forget to keep the quotes if your path includes spaces), yours
will almost certainly be different (<FONT COLOR="#FF0000">to
punctuate this, the things you need to change are in red</FONT>).
<PRE>Set IDE "<FONT COLOR="#FF0000">Develop:Source331 Build Environment:CW Pro 2:Metrowerks CodeWarrior:</FONT>"
Set Source "<FONT COLOR="#FF0000">Source:FreeSource:</FONT>"</PRE>
</LI>
<LI>If you are using CWPro2, execute the following lines to patch
LDropFlag to draw correcly over non-white backgrounds.
<PRE>directory "{IDE}MacOS Support:PowerPlant:_In Progress:_Table Classes:"
patch LDropFlag.cp "{Source}mozilla:lib:mac:patches:LDropFlag.patch"
duplicate -y "{Source}mozilla:lib:mac:patches:DropFlag Icons.rsrc" "{IDE}MacOS Support:PowerPlant:PowerPlant Resources:"</PRE></LI>
<LI>Execute the following lines to patch menusharing.c to allow it
to compile with the new Universal Headers. It references an
obsolete header file (GestaltEqu.h).
<PRE>directory "{IDE}MacOS Support:Menu Sharing Toolkit 4.1:"
patch menusharing.c "{Source}mozilla:lib:mac:patches:menusharing.patch"</PRE></LI>
<LI>If you are using CWPro2 straight off the CD, you need to patch
AppleEvents.r to fix a problem with the Universal Headers (the
definition of the 'aedt' resource was omitted). <B>You do not have
to do this if you have applied the netborne patch to Pro2e
</B> because it has been fixed.
<PRE>directory "{IDE}MacOS Support:Headers:Rez Headers:"
patch AppleEvents.r "{Source}mozilla:lib:mac:patches:AppleEvents.r.patch"</PRE></LI>
<LI>You need to patch stat.mac.h to fix a problem in MSL where
lines were omitted.
<PRE>directory "{IDE}Metrowerks Standard Library:MSL C:MSL Mac:Public Includes"
patch stat.mac.h "{Source}mozilla:lib:mac:patches:stat.mac.h.patch"</PRE></LI>
<LI>Congratulations! Now you are ready to build. Once these steps
are done, you don't have to repeat these setups the next
time!</LI>
</OL>
<P>
<H2><A NAME="ss2.4">2.4 Run the build </A></H2>
<UL>
<P>In the folder mozilla:build:mac:, there are several Perl scripts with
names of the form BuildMozillaXXX.pl, where XXX is "Optimized",
"Debug", "Tinderbox", et al. Each script builds the corresponding
version of Mozilla. If you configured the MacPerl application to
execute scripts that are opened from the finder, all you have to do is
double click on the appropriate one; otherwise, launch MacPerl, and
run the appropriate script from the "Run Script..." menu item.</P>
<P>These `configured build' scripts are simple, and you might want to
make your own to force your build to StopForErrors(), or alternatively
DontStopForErrors(), et al. You can set up certain build-script
variables and (soon) compile-time flags. Compare the supplied scripts
to figure out what you might want. Note that CodeWarriorLib, Moz.pm,
and BuildList.pm, are AppleScript libraries and Perl modules meant to
be used by a `configured build'. Use your favorite POD viewer (Shuck
comes with MacPerl) to view the documentation in the Perl scripts.</P>
<P>If there were any errors in any of the projects along the way, the
script will stop at that point and the IDE will tell you the errors.
You can fix them and make sure they current project builds, but to
continue the automation, you have to start from the beginning by
double-clicking the script again. This isn't quite as bad as it
sounds because the previous projects are already built (unless you
changed some major header file). Please note that stopping the script
once it has started is difficult. We are working to address
this issue.</P>
<P>After the build is complete, you can find aliases to the built libraries
and the final Mozilla application. Debug builds are built to
Mozilla:dist:client_debug, while optimized builds are built to Mozilla:dist:client.
</P>
<P>Don't worry too much about the numerous warnings generated during
the build. We try our best to get the XP teams to use real compilers,
but alas, they continue to write warning-laden code. There is also
some generated code (Java is one example) that has a lot of warnings
that we can't help either. If you write any new code, please help us
in our quest to get zero warnings.</P>
</UL>
</UL>
<HR>
<H2><A NAME="s3">3. Common Sticking Points</A></H2>
<UL>
<LI><B>I have CodeWarrior3, how do i build with it?</B>
<UL> Currently, the answer is, "You don't." Eventually, the distribution
will be modified to allow building using CodeWarrior3, but for now
CodeWarrior2 is the only IDE that is supported.
</UL>
</LI>
</UL>
<HR>
<H2><A NAME="s4">4. Credits</A></H2>
<UL>
The majority of this document is taken from the build document included
in the Mozilla source distribution at README:mozilla:macbuild.htm written
by Mike Pinkerton, <A HREF="mailto:pinkerton@netscape.com">
pinkerton@netscape.com</A>.
</BODY>
</HTML>