3
# The contents of this file are subject to the Netscape Public
4
# License Version 1.1 (the "License"); you may not use this file
5
# except in compliance with the License. You may obtain a copy of
6
# the License at http://www.mozilla.org/NPL/
8
# Software distributed under the License is distributed on an "AS
9
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
# implied. See the License for the specific language governing
11
# rights and limitations under the License.
13
# The Original Code is Mozilla Communicator client code,
14
# released March 31, 1998.
16
# The Initial Developer of the Original Code is Netscape Communications
17
# Corporation. Portions created by Netscape are
18
# Copyright (C) 1999 Netscape Communications Corporation. All
22
# Sean Su <ssu@netscape.com>
26
# To build the mozilla self-extracting installer and its corresponding .xpi files
27
# given a mozilla build on a local system.
30
# 1. perl needs to be installed correctly on the build system because cwd.pm is used.
31
# 2. mozilla\xpinstall\wizard\windows needs to be built.
32
# a. to build it, MFC must be installed with VC
33
# b. set MOZ_MFC=1 in the build environment
34
# c. run nmake -f makefile.win from the above directory
42
$DEPTH = "../../../..";
43
$topsrcdir = GetTopSrcDir();
44
# ensure that Packager.pm is in @INC, since we might not be called from
45
# mozilla/xpinstall/packager
46
push(@INC, "$topsrcdir/../mozilla/xpinstall/packager");
51
$topobjdir = $topsrcdir if !defined($topobjdir);
52
$inStagePath = "$topobjdir/stage" if !defined($inStagePath);
53
$inDistPath = "$topobjdir/dist" if !defined($inDistPath);
54
$inXpiURL = "ftp://not.supplied.invalid" if !defined($inXpiURL);
55
$inRedirIniURL = $inXpiURL if !defined($inRedirIniURL);
56
$cwdBuilder = "$topsrcdir/xpinstall/wizard/windows/builder";
57
$gDistInstallPath = "$inDistPath/inst_gre";
58
$gPackagerPath = "$topsrcdir/xpinstall/packager";
60
if(defined($ENV{DEBUG_INSTALLER_BUILD}))
62
print " build_gre.pl\n";
63
print " topobjdir : $topobjdir\n";
64
print " inDistPath : $inDistPath\n";
65
print " inStagePath: $inStagePath\n";
68
chdir("$gPackagerPath/win_gre");
69
if(system("perl makeall.pl -objDir \"$topobjdir\" -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL"))
71
die "\n Error: perl makeall.pl -objDir \"$topobjdir\" -stagePath \"$inStagePath\" -distPath \"$inDistPath\" -aurl $inXpiURL -rurl $inRedirIniURL\n";
76
# Copy the .xpi files to the same directory as setup.exe.
77
# This is so that setup.exe can find the .xpi files
78
# in the same directory and use them.
79
StageUtils::CopyFiles("$gDistInstallPath/xpi", "$gDistInstallPath");
84
print "* A self-extracting installer has been built and delivered:\n";
86
print "* $gDistInstallPath/gre-win32-install.exe\n";
95
die "usage: $0 [options]
97
options available are:
101
-objDir <path> - the build directory (defaults to a srcdir build)
103
-stagePath <path> - Full path to where the mozilla stage dir is at.
104
Default path, if one is not set, is:
107
-distPath <path> - Full path to where the mozilla dist dir is at.
108
Default path, if one is not set, is:
111
-aurl <url> - ftp or http url for where the archives (.xpi, exe, .zip, etx...) are.
112
ie: ftp://my.ftp.com/mysoftware/version1.0/xpi
114
-rurl <url> - ftp or http url for where the redirect.ini file is located at.
115
ie: ftp://my.ftp.com/mysoftware/version1.0
117
This url can be the same as the archive url.
118
If -rurl is not supplied, it will be assumed that the redirect.ini
121
-DEPTH location of the top of the Mozilla build tree
130
for($counter = 0; $counter <= $#myArgv; $counter++)
132
if($myArgv[$counter] =~ /^[-,\/]h$/i)
136
elsif($myArgv[$counter] =~ /^[-,\/]objDir$/i)
138
if($#myArgv >= ($counter + 1))
141
$topobjdir = $myArgv[$counter];
142
$topobjdir =~ s/\\/\//g;
145
elsif($myArgv[$counter] =~ /^[-,\/]stagePath$/i)
147
if($#myArgv >= ($counter + 1))
150
$inStagePath = $myArgv[$counter];
151
$inStagePath =~ s/\\/\//g;
154
elsif($myArgv[$counter] =~ /^[-,\/]distPath$/i)
156
if($#myArgv >= ($counter + 1))
159
$inDistPath = $myArgv[$counter];
160
$inDistPath =~ s/\\/\//g;
163
elsif($myArgv[$counter] =~ /^[-,\/]aurl$/i)
165
if($#myArgv >= ($counter + 1))
168
$inXpiURL = $myArgv[$counter];
169
$inRedirIniURL = $inXpiURL;
172
elsif($myArgv[$counter] =~ /^[-,\/]rurl$/i)
174
if($#myArgv >= ($counter + 1))
177
$inRedirIniURL = $myArgv[$counter];
180
elsif($myArgv[$counter] =~ /^[-,\/]depth$/i)
182
if($#myArgv >= ($counter + 1))
185
$DEPTH = $myArgv[$counter];
189
PrintUsage() if (!defined($topsrcdir));
190
$tmpdir = get_system_cwd();
191
chdir("$topsrcdir") || die "$topsrcdir: Directory does not exist!\n";
192
$topsrcdir = get_system_cwd();
193
chdir("$tmpdir") || die "$tmpdir: Cannot find our way back home\n";
194
if (defined($DEPTH)) {
195
chdir("$DEPTH") || die "$DEPTH: Directory does not exist!\n";
196
$DEPTH = get_system_cwd();
197
chdir("$tmpdir") || die "$tmpdir: Cannot find our way back home again\n";
202
my $a = Cwd::getcwd()||`pwd`;
212
my($distWinPathName);
219
# determine if build was built via gmake
220
$distWinPathName = "dist";
222
$fileMozilla = "$depthPath/$distWinPathName/bin/mozilla.exe";
223
# verify the existance of file
224
if(!(-e "$fileMozilla"))
226
print "file not found: $fileMozilla\n";
230
($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat $fileMozilla;
231
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($mtime);
234
# localtime() returns year 2000 as 100, we mod 100 to get at the last 2 digits
236
$yy = "20" . sprintf("%.2d", $yy);
239
$monAdjusted = $mon + 1;
240
$mm = sprintf("%.2d", $monAdjusted);
242
# calculate month day
243
$dd = sprintf("%.2d", $mday);
246
$hh = sprintf("%.2d", $hour);
248
$fileMozillaVer = "$yy$mm$dd$hh";
249
print "y2k compliant version string for $fileMozilla: $fileMozillaVer\n";
250
return($fileMozillaVer);
255
my($rootDir) = dirname($0) . "/$DEPTH";
256
my($savedCwdDir) = cwd();