Changed for new build system, and to inlcude long comment about how this whole thing works.

This commit is contained in:
sfraser 1998-05-28 18:57:55 +00:00
parent d3febdb901
commit 30f7a5bc2f
2 changed files with 89 additions and 28 deletions

View File

@ -15,21 +15,83 @@
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifdef DEBUG
#include "Comm_DebugConfig.h"
#else
#include "Comm_Config.h"
#endif
/*
This project is rather, um, creative in the way it works. Here's why.
There are two goals here (which should probably be separated out):
1. Make a shared library which exports a bunch of symbols which are
IDs of error strings:
MacXPStrings.c is preprocessed and compiled in the normal way
for a C file, and ends up simple assigning numerical values to
lots of exported ints, e.g. "int MK_BAD_CONNECT = (-205)". These
ints are exported by name from the shared library.
The dummy function MacintoshForever() is there because there
is apparently a CFM bug that causes a crash loading shared
libraries with no exported code symbols.
2. Make a file called "Mozilla resources" which contains a bunch
of 'STR ' resources containing the strings defined in allxpstr.h,
and some other resources.
This is achieved by the .xps file which, if you look at the
File Mapping prefs, is processed by ToolFrontEnd. The
ToolFrontEnd prefs panel specifies that the following command:
Execute "{{SourceFile}}_Make"
is send to ToolServer, so xpstring.xps_Make will get executed.
xpstring.xps_Make preprocesses this file (xpstrings.xps) with the
MWCPPC tool, outputting the result to a .r file Temp_XPStrings.r:
MWCPPC -nodefaults -i- -e2 -D _XP_Core_ {IncludeFiles} "{{SourceFile}}" ¶
> "{{ResourceDir}}Temp_XPStrings.r"
Temp_XPStrings.r is then Perlized by resdef.pl to create xpstring.r:
perl resdef.pl Temp_XPStrings.r
xpstring.r is then Rez'd to create Mozilla Resources:
Rez -t 'NSPL' -c MOZZ -i "{RIncludes}" ¶
-o "{{TargetDir}}Essential Files:Mozilla Resources" ¶
xpstring.r
We then Rez MacSTR.r, which itself includes all the other .r files here:
Rez -append -i "{RIncludes}" -i "{{mozilla}}cmd:macfe:include:" ¶
-o "{{TargetDir}}Essential Files:Mozilla Resources" ¶
MacSTR.r
That's basically it. Phew!
Some things to be careful of:
MacXPStrings.c is preprocessed by the IDE, so in prefix file
specified in the prefs is included.
When this file is preprocessed by MWCPPC, the prefix file is
ignored so we include "MacCommonPrefix.h" ourselves.
*/
#define RESOURCE_STR
#define OTUNIXERRORS 1 // needed to pickup errors in OT.h
#include "OpenTransport.h"
/* allxpstr.h have to be in the last one */
/* Manually include the prefix file, so that MWCPPC picks it up */
#include "MacConfigInclude.h"
/* the prefix file should have already defined OTUNIXERRORS at this stage */
#include "OpenTransport.h"
/* allxpstr.h have to be in the last one */
#include "allxpstr.h" /* The real stuff is here... */
#ifdef rez
/*
** These are included here to force CodeWarrior to rebuild if they change. The
** include should not actually happen during the build phase, only when the #include

View File

@ -21,12 +21,19 @@
Evaluate % = ("{{SourceFile}}" =~ /(Å:)¨0Å/)
Directory "{{¨0}}"
Set ns "::::" # project folder relative
Set -e ResourceDir "{{ns}}cmd:macfe:restext:"
Set TargetDir "{{ns}}cmd:macfe:projects:client:"
Set RIncludes "{{ns}}lib:mac:MW:Headers:Rez_Headers:"
Set mozilla "::::" # project folder relative
Set -e ResourceDir "{{mozilla}}cmd:macfe:restext:"
Set TargetDir "{{mozilla}}dist:client_debug:"
MWCPPC -nodefaults -i- -e2 -D _XP_Core_ -D XP_MAC {IncludeFiles} "{{SourceFile}}" ¶
if {DEBUG}
Set TargetDir "{{mozilla}}dist:client_debug:"
else
Set TargetDir "{{mozilla}}dist:client:"
end if
# Set RIncludes "{{mozilla}}lib:mac:MW:Headers:Rez_Headers:"
MWCPPC -nodefaults -i- -e2 -D _XP_Core_ {IncludeFiles} "{{SourceFile}}" ¶
> "{{ResourceDir}}Temp_XPStrings.r"
if {status} != 0
@ -39,23 +46,15 @@ End
Directory "{{ResourceDir}}" # set to the correct folder
perl resdef.pl Temp_XPStrings.r
delete Temp_XPStrings.r
Rez -t 'NSPL' -c MOSS -i "{RIncludes}" ¶
-o "{{TargetDir}}Essential Files:Netscape Resources" ¶
Rez -t 'NSPL' -c MOZZ -i "{RIncludes}" ¶
-o "{{TargetDir}}Essential Files:Mozilla Resources" ¶
xpstring.r
delete xpstring.r
Rez -append -i "{RIncludes}" -i "{{ns}}cmd:macfe:include:" ¶
-o "{{TargetDir}}Essential Files:Netscape Resources" ¶
Rez -append -i "{RIncludes}" -i "{{mozilla}}cmd:macfe:include:" ¶
-o "{{TargetDir}}Essential Files:Mozilla Resources" ¶
MacSTR.r
Rez -append -i "{RIncludes}" -i "{{ns}}cmd:macfe:include:" ¶
-o "{{TargetDir}}Essential Files:Netscape Resources" ¶
Rez -append -i "{RIncludes}" -i "{{mozilla}}cmd:macfe:include:" ¶
-o "{{TargetDir}}Essential Files:Mozilla Resources" ¶
exception_str.r
# Duplicate the Desktop icon scripts
Set SourceDir "{{ns}}cmd:macfe:desktop:"
Set DestDir "{{TargetDir}}Essential Files:"
Duplicate -y "{{SourceDir}}Messenger script" "{{DestDir}}Messenger Inbox shortcut"
Duplicate -y "{{SourceDir}}Navigator script" "{{DestDir}}Navigator shortcut"
Quit # get rid of ToolServer