1999-02-23 06:52:21 +03:00
|
|
|
#!perl
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
require 5.000;
|
|
|
|
|
|
|
|
use Sys::Hostname;
|
|
|
|
use POSIX "sys_wait_h";
|
|
|
|
use Cwd;
|
|
|
|
|
1999-03-20 05:04:21 +03:00
|
|
|
$Version = '$Revision: 1.14 $';
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
sub InitVars {
|
|
|
|
# PLEASE FILL THIS IN WITH YOUR PROPER EMAIL ADDRESS
|
|
|
|
$BuildAdministrator = "$ENV{'USER'}\@$ENV{'HOST'}";
|
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
# Default values of cmdline opts
|
1999-03-03 04:21:42 +03:00
|
|
|
$BuildDepend = 1; # Depend or Clobber
|
|
|
|
$ReportStatus = 1; # Send results to server or not
|
|
|
|
$BuildOnce = 0; # Build once, don't send results to server
|
|
|
|
$BuildClassic = 0; # Build classic source
|
|
|
|
$RunTest = 1; # Run the smoke test on successful build, or not
|
1999-02-14 10:15:44 +03:00
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
# Relative path to binary
|
1999-02-14 10:15:44 +03:00
|
|
|
$BinaryName{'x'} = 'mozilla-export';
|
|
|
|
$BinaryName{'qt'} = 'qtmozilla-export';
|
|
|
|
$BinaryName{'gnome'} = 'gnuzilla-export';
|
|
|
|
$BinaryName{'apprunner'} = '/dist/bin/apprunner';
|
|
|
|
|
|
|
|
# Set these to what makes sense for your system
|
|
|
|
$cpus = 1;
|
1999-03-18 12:19:22 +03:00
|
|
|
$Make = 'gmake'; # Must be GNU make
|
1999-02-23 06:52:21 +03:00
|
|
|
$MakeOverrides = '';
|
1999-02-14 10:15:44 +03:00
|
|
|
$mail = '/bin/mail';
|
1999-03-19 02:50:10 +03:00
|
|
|
$CVS = 'cvs -q -z3';
|
1999-02-14 10:15:44 +03:00
|
|
|
$CVSCO = 'co -P';
|
|
|
|
|
|
|
|
# Set these proper values for your tinderbox server
|
|
|
|
$Tinderbox_server = 'tinderbox-daemon\@cvs-mirror.mozilla.org';
|
|
|
|
|
|
|
|
# These shouldn't really need to be changed
|
|
|
|
$BuildSleep = 10; # Minimum wait period from start of build to start
|
|
|
|
# of next build in minutes
|
|
|
|
$BuildTree = 'MozillaTest'; # until you get the script working.
|
|
|
|
# when it works, change to the tree you're
|
|
|
|
# actually building
|
|
|
|
$BuildTag = '';
|
|
|
|
$BuildName = '';
|
|
|
|
$TopLevel = '.';
|
|
|
|
$Topsrcdir = 'mozilla';
|
|
|
|
$BuildObjName = '';
|
|
|
|
$BuildConfigDir = 'mozilla/config';
|
|
|
|
$ClobberStr = 'realclean';
|
|
|
|
$ConfigureEnvArgs = 'CFLAGS=-pipe CXXFLAGS=-pipe';
|
1999-03-18 11:47:10 +03:00
|
|
|
$ConfigureArgs = '--with-nspr=/builds/tinderbox/SeaMonkey/nspr --cache-file=/dev/null --enable-editor ';
|
1999-02-14 10:15:44 +03:00
|
|
|
$ConfigGuess = './build/autoconf/config.guess';
|
|
|
|
$Logfile = '${BuildDir}.log';
|
1999-03-09 03:15:46 +03:00
|
|
|
$NSPRArgs = 'DIST=/builds/tinderbox/SeaMonkey/nspr MOZILLA_CLIENT=1 NSDISTMODE=copy NO_MDUPDATE=1 ';
|
|
|
|
$Compiler = 'gcc';
|
1999-03-18 11:47:10 +03:00
|
|
|
$ShellOverride = ''; # Only used if the default shell is too stupid
|
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
sub ConditionalArgs {
|
|
|
|
if ( $BuildClassic ) {
|
|
|
|
$FE = 'x';
|
|
|
|
$ConfigureArgs .= " --enable-fe=$FE";
|
|
|
|
$BuildModule = 'Raptor';
|
|
|
|
$BuildTag = ''
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $BuildTag eq '' );
|
1999-02-14 10:15:44 +03:00
|
|
|
$TopLevel = "mozilla-classic";
|
|
|
|
} else {
|
|
|
|
$FE = 'apprunner';
|
|
|
|
$BuildModule = 'SeaMonkeyAll';
|
|
|
|
}
|
1999-03-18 12:19:22 +03:00
|
|
|
$CVSCO .= " -r $BuildTag" if ( $BuildTag ne '' );
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
1999-03-18 11:47:10 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
sub SetupEnv {
|
|
|
|
umask(0);
|
|
|
|
$ENV{"CVSROOT"} = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot';
|
1999-02-23 06:52:21 +03:00
|
|
|
$ENV{"LD_LIBRARY_PATH"} = '/builds/tinderbox/SeaMonkey/nspr/lib:/builds/tinderbox/SeaMonkey/' . $DirName . '/mozilla/' . $ObjDir . '/dist/bin:/usr/lib/png:/usr/local/lib';
|
1999-02-14 10:15:44 +03:00
|
|
|
$ENV{"DISPLAY"} = 'crucible.mcom.com:0.0';
|
1999-03-18 11:47:10 +03:00
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
sub SetupPath {
|
1999-03-09 03:44:04 +03:00
|
|
|
my($Path, $comptmp);
|
|
|
|
$comptmp = '';
|
1999-02-14 10:15:44 +03:00
|
|
|
$Path = $ENV{PATH};
|
|
|
|
print "Path before: $Path\n";
|
|
|
|
|
1999-02-23 06:52:21 +03:00
|
|
|
if ( $OS eq 'AIX' ) {
|
|
|
|
$ENV{'PATH'} = '/builds/local/bin:' . $ENV{'PATH'} . ':/usr/lpp/xlC/bin';
|
|
|
|
$ConfigureArgs .= '--x-includes=/usr/include/X11 --x-libraries=/usr/lib --disable-shared';
|
|
|
|
$ConfigureEnvArgs = 'CC=xlC_r CXX=xlC_r';
|
1999-03-09 03:15:46 +03:00
|
|
|
$Compiler = 'xlC_r';
|
1999-02-24 07:33:17 +03:00
|
|
|
$NSPRArgs .= 'NS_USE_NATIVE=1 USE_PTHREADS=1';
|
1999-02-23 06:52:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( $OS eq 'BSD_OS' ) {
|
|
|
|
$ENV{'PATH'} = '/usr/contrib/bin:/bin:/usr/bin:' . $ENV{'PATH'};
|
|
|
|
$ConfigureArgs .= '--disable-shared';
|
|
|
|
$ConfigureEnvArgs = 'CC=shlicc2 CXX=shlicc2';
|
1999-03-09 03:15:46 +03:00
|
|
|
$Compiler = 'shlicc2';
|
1999-02-23 06:52:21 +03:00
|
|
|
$mail = '/usr/ucb/mail';
|
|
|
|
$MakeOverrides = 'CPP_PROG_LINK=0 CCF=shlicc2'; # because ld dies if it encounters -include
|
1999-02-24 07:33:17 +03:00
|
|
|
$NSPRArgs .= 'NS_USE_GCC=1 NS_USE_NATIVE=';
|
1999-02-23 06:52:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( $OS eq 'FreeBSD' ) {
|
|
|
|
$ENV{'PATH'} = '/bin:/usr/bin:' . $ENV{'PATH'};
|
1999-03-09 03:15:46 +03:00
|
|
|
if ( $ENV{'HOST'} eq 'angelus.mcom.com' ) {
|
|
|
|
$ConfigureEnvArgs = 'CC=egcc CXX=eg++';
|
|
|
|
$Compiler = 'egcc';
|
|
|
|
}
|
1999-02-23 06:52:21 +03:00
|
|
|
$mail = '/usr/bin/mail';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $OS eq 'HP-UX' ) {
|
|
|
|
$ENV{'PATH'} = '/opt/ansic/bin:/opt/aCC/bin:/builds/local/bin:' . $ENV{'PATH'};
|
|
|
|
$ENV{'LPATH'} = '/usr/lib:' . $ENV{'LD_LIBRARY_PATH'} . ':/builds/local/lib';
|
|
|
|
$ENV{'SHLIB_PATH'} = $ENV{'LPATH'};
|
|
|
|
$ConfigureArgs .= '--disable-gtktest --x-includes=/usr/include/X11 --x-libraries=/usr/lib';
|
|
|
|
$ConfigureEnvArgs = 'CC="cc -Ae" CXX="aCC -ext"';
|
1999-03-09 03:15:46 +03:00
|
|
|
$Compiler = 'cc/aCC';
|
1999-02-23 06:52:21 +03:00
|
|
|
# Use USE_PTHREADS=1 instead of CLASSIC_NSPR if you've got DCE installed.
|
1999-02-24 07:33:17 +03:00
|
|
|
$NSPRArgs .= 'NS_USE_NATIVE=1 CLASSIC_NSPR=1';
|
1999-02-23 06:52:21 +03:00
|
|
|
}
|
|
|
|
|
1999-03-20 05:04:21 +03:00
|
|
|
if ( $OS eq 'IRIX' ) {
|
|
|
|
$ENV{'PATH'} = '/opt/bin:' . $ENV{'PATH'};
|
|
|
|
$ENV{'LD_LIBRARY_PATH'} .= ':/opt/lib';
|
|
|
|
$ENV{'LD_LIBRARYN32_PATH'} = $ENV{'LD_LIBRARY_PATH'};
|
|
|
|
$ConfigureEnvArgs = 'CC=cc CXX=CC CFLAGS="-n32 -O" CXXFLAGS="-n32 -O"';
|
|
|
|
$Compiler = 'cc/CC';
|
|
|
|
$NSPRArgs .= 'NS_USE_NATIVE=1 USE_PTHREADS=1';
|
|
|
|
}
|
|
|
|
|
1999-03-09 03:15:46 +03:00
|
|
|
if ( $OS eq 'NetBSD' ) {
|
|
|
|
$ENV{'PATH'} = '/bin:/usr/bin:' . $ENV{'PATH'};
|
1999-03-10 06:30:42 +03:00
|
|
|
$ENV{'LD_LIBRARY_PATH'} .= ':/usr/X11R6/lib';
|
1999-03-09 03:15:46 +03:00
|
|
|
$ConfigureEnvArgs = 'CC=egcc CXX=eg++';
|
|
|
|
$Compiler = 'egcc';
|
|
|
|
$mail = '/usr/bin/mail';
|
|
|
|
}
|
|
|
|
|
1999-02-23 06:52:21 +03:00
|
|
|
if ( $OS eq 'OSF1' ) {
|
|
|
|
$ENV{'PATH'} = '/usr/gnu/bin:' . $ENV{'PATH'};
|
|
|
|
$ENV{'LD_LIBRARY_PATH'} .= ':/usr/gnu/lib';
|
|
|
|
$ConfigureEnvArgs = 'CC="cc -readonly_strings" CXX="cxx"';
|
1999-03-09 03:15:46 +03:00
|
|
|
$Compiler = 'cc/cxx';
|
1999-03-18 11:47:10 +03:00
|
|
|
$MakeOverrides = 'SHELL=/usr/bin/ksh';
|
1999-02-24 07:33:17 +03:00
|
|
|
$NSPRArgs .= 'NS_USE_NATIVE=1 USE_PTHREADS=1';
|
1999-03-18 11:47:10 +03:00
|
|
|
$ShellOverride = '/usr/bin/ksh';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $OS eq 'QNX' ) {
|
|
|
|
$ENV{'PATH'} = '/usr/local/bin:' . $ENV{'PATH'};
|
|
|
|
$ENV{'LD_LIBRARY_PATH'} .= ':/usr/X11/lib';
|
|
|
|
$ConfigureArgs .= '--disable-shared --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib';
|
|
|
|
$ConfigureEnvArgs = 'CC=cc CXX=cc';
|
1999-03-20 05:04:21 +03:00
|
|
|
$Compiler = 'cc';
|
1999-03-18 11:47:10 +03:00
|
|
|
$mail = '/usr/bin/sendmail';
|
1999-02-23 06:52:21 +03:00
|
|
|
}
|
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
if ( $OS eq 'SunOS' ) {
|
1999-02-27 07:55:44 +03:00
|
|
|
if ( $OSVerMajor eq '4' ) {
|
|
|
|
$ENV{'PATH'} = '/usr/gnu/bin:/usr/local/sun4/bin:/usr/bin:' . $ENV{'PATH'};
|
|
|
|
$ENV{'LD_LIBRARY_PATH'} = '/home/motif/usr/lib:' . $ENV{'LD_LIBRARY_PATH'};
|
1999-03-03 04:21:42 +03:00
|
|
|
$ConfigureArgs .= '--x-includes=/home/motif/usr/include/X11 --x-libraries=/home/motif/usr/lib';
|
1999-02-27 07:55:44 +03:00
|
|
|
$ConfigureEnvArgs = 'CC="egcc -DSUNOS4" CXX="eg++ -DSUNOS4"';
|
1999-03-09 03:15:46 +03:00
|
|
|
$Compiler = 'egcc';
|
1999-02-27 07:55:44 +03:00
|
|
|
} else {
|
|
|
|
$ENV{'PATH'} = '/usr/ccs/bin:' . $ENV{'PATH'};
|
|
|
|
$ConfigureArgs .= '--with-pthreads';
|
|
|
|
}
|
1999-02-24 07:33:17 +03:00
|
|
|
if ( $CPU eq 'i86pc' ) {
|
|
|
|
$ENV{'PATH'} = '/opt/gnu/bin:' . $ENV{'PATH'};
|
|
|
|
$ENV{'LD_LIBRARY_PATH'} .= ':/opt/gnu/lib';
|
1999-02-26 02:35:52 +03:00
|
|
|
$ConfigureEnvArgs = 'CC=egcc CXX=eg++';
|
1999-03-09 03:15:46 +03:00
|
|
|
$Compiler = 'egcc';
|
1999-02-24 07:33:17 +03:00
|
|
|
# This may just be an NSPR bug, but if USE_PTHREADS is defined, then
|
|
|
|
# _PR_HAVE_ATOMIC_CAS gets defined (erroneously?) and libnspr21 doesn't work.
|
1999-02-27 07:55:44 +03:00
|
|
|
$NSPRArgs .= 'CLASSIC_NSPR=1 NS_USE_GCC=1 NS_USE_NATIVE=';
|
1999-02-24 07:33:17 +03:00
|
|
|
} else {
|
1999-02-27 07:55:44 +03:00
|
|
|
# This is utterly lame....
|
|
|
|
if ( $ENV{'HOST'} eq 'fugu' ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
$ENV{'PATH'} = '/tools/ns/workshop/bin:/usrlocal/bin:' . $ENV{'PATH'};
|
|
|
|
$ENV{'LD_LIBRARY_PATH'} = '/tools/ns/workshop/lib:/usrlocal/lib:' . $ENV{'LD_LIBRARY_PATH'};
|
1999-02-27 07:55:44 +03:00
|
|
|
$ConfigureEnvArgs = 'CC=cc CXX=CC';
|
1999-03-09 03:44:04 +03:00
|
|
|
$comptmp = `cc -V 2>&1 | head -1`;
|
|
|
|
chop($comptmp);
|
|
|
|
$Compiler = "cc/CC \($comptmp\)";
|
1999-02-27 07:55:44 +03:00
|
|
|
$NSPRArgs .= 'NS_USE_NATIVE=1';
|
|
|
|
} else {
|
|
|
|
$NSPRArgs .= 'NS_USE_GCC=1 NS_USE_NATIVE=';
|
|
|
|
}
|
|
|
|
if ( $OSVerMajor eq '5' ) {
|
1999-03-09 03:15:46 +03:00
|
|
|
$NSPRArgs .= ' USE_PTHREADS=1';
|
1999-02-27 07:55:44 +03:00
|
|
|
}
|
1999-02-24 07:33:17 +03:00
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
$Path = $ENV{PATH};
|
|
|
|
print "Path After: $Path\n";
|
1999-03-18 11:47:10 +03:00
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
# NO USER CONFIGURABLE PIECES BEYOND THIS POINT #
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
sub GetSystemInfo {
|
|
|
|
$OS = `uname -s`;
|
|
|
|
$OSVer = `uname -r`;
|
1999-02-23 06:52:21 +03:00
|
|
|
$CPU = `uname -m`;
|
1999-03-03 04:21:42 +03:00
|
|
|
$BuildName = "";
|
|
|
|
|
|
|
|
my($host) = "";
|
|
|
|
my($myhost) = hostname;
|
1999-02-23 06:52:21 +03:00
|
|
|
|
|
|
|
chop($OS, $OSVer, $CPU);
|
1999-03-03 04:21:42 +03:00
|
|
|
chomp($myhost);
|
|
|
|
|
|
|
|
($host, $junk) = split(/\./, $myhost);
|
1999-02-23 06:52:21 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
if ( $OS eq 'AIX' ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
my($osAltVer) = `uname -v`;
|
|
|
|
chop($osAltVer);
|
|
|
|
$OSVer = $osAltVer . "." . $OSVer;
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
1999-02-23 06:52:21 +03:00
|
|
|
|
|
|
|
if ( $OS eq 'BSD/OS' ) {
|
|
|
|
$OS = 'BSD_OS';
|
|
|
|
}
|
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
if ( $OS eq 'IRIX64' ) {
|
|
|
|
$OS = 'IRIX';
|
|
|
|
}
|
1999-02-23 06:52:21 +03:00
|
|
|
|
1999-03-18 11:47:10 +03:00
|
|
|
if ( $OS eq 'QNX' ) {
|
|
|
|
$OSVer = `uname -v`;
|
|
|
|
chop($OSVer);
|
|
|
|
$OSVer =~ s/^([0-9])([0-9]*)$/$1.$2/;
|
|
|
|
}
|
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
if ( $OS eq 'SCO_SV' ) {
|
|
|
|
$OS = 'SCOOS';
|
|
|
|
$OSVer = '5.0';
|
|
|
|
}
|
1999-02-23 06:52:21 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
if ( "$host" ne "" ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
$BuildName = $host . ' ' . $OS . ' ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
|
|
|
$DirName = $OS . '_' . $OSVer . '_' . ($BuildDepend?'depend':'clobber');
|
1999-02-23 06:52:21 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# Defining ObjDir really ought to be done by first checking out
|
|
|
|
# mozilla/build/autoconf/config.guess, and then using it to do
|
|
|
|
# the definition once.
|
|
|
|
#
|
|
|
|
|
|
|
|
if ( $OS eq 'AIX' ) {
|
|
|
|
# Assumes 4.2.1 for now.
|
|
|
|
$ObjDir = 'obj-powerpc-ibm-aix4.2.1.0';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $OS eq 'BSD_OS' ) {
|
|
|
|
$ObjDir = 'obj-' . $CPU . '-pc-bsdi' . $OSVer;
|
|
|
|
$BuildName = $host . ' BSD/OS ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $OS eq 'FreeBSD' ) {
|
|
|
|
$ObjDir = 'obj-' . $CPU . '-unknown-freebsd' . $OSVer;
|
1999-03-09 03:15:46 +03:00
|
|
|
$ObjDir =~ s/(bsd[0-9]\.[0-9])(-[A-Za-z0-9]*)$/$1/o;
|
1999-02-23 06:52:21 +03:00
|
|
|
$BuildName = $host . ' ' . $OS . '/' . $CPU . ' ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
|
|
|
}
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
if ( $OS eq 'HP-UX' ) {
|
1999-02-23 06:52:21 +03:00
|
|
|
$ObjDir = 'obj-hppa1.1-hp-hpux' . $OSVer;
|
|
|
|
$ObjDir =~ s/hpux[AB]\./hpux/o;
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-03-20 05:04:21 +03:00
|
|
|
if ( $OS eq 'IRIX' ) {
|
|
|
|
$ObjDir = 'obj-mips-sgi-irix' . $OSVer;
|
|
|
|
}
|
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
if ( $OS eq 'Linux' ) {
|
1999-03-18 11:47:10 +03:00
|
|
|
if ( $CPU eq 'alpha' || $CPU eq 'sparc' ) {
|
1999-02-23 06:52:21 +03:00
|
|
|
$ObjDir = 'obj-' . $CPU . '-unknown-linux-gnu';
|
|
|
|
$BuildName = $host . ' ' . $OS . '/' . $CPU . ' ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
1999-02-24 07:33:17 +03:00
|
|
|
} elsif ( $CPU eq 'armv4l' || $CPU eq 'sa110' ) {
|
|
|
|
$ObjDir = 'obj-arm-unknown-linux-gnu';
|
1999-02-26 02:35:52 +03:00
|
|
|
$BuildName = $host . ' ' . $OS . '/arm ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
1999-03-09 03:15:46 +03:00
|
|
|
} elsif ( $CPU eq 'ppc' ) {
|
|
|
|
$ObjDir = 'obj-powerpc-unknown-linux-gnu';
|
|
|
|
$BuildName = $host . ' ' . $OS . '/' . $CPU . ' ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
1999-02-23 06:52:21 +03:00
|
|
|
} else {
|
|
|
|
$ObjDir = 'obj-' . $CPU . '-pc-linux-gnu';
|
1999-02-26 02:35:52 +03:00
|
|
|
$BuildName = $host . ' ' . $OS . '/i386 ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
1999-03-10 06:30:42 +03:00
|
|
|
# What's the right way to test for this?
|
|
|
|
if ( $host eq 'truth' ) {
|
|
|
|
$ObjDir .= 'libc1';
|
|
|
|
}
|
1999-02-23 06:52:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-09 03:15:46 +03:00
|
|
|
if ( $OS eq 'NetBSD' ) {
|
|
|
|
$ObjDir = 'obj-' . $CPU . '-unknown-netbsd' . $OSVer;
|
|
|
|
$BuildName = $host . ' ' . $OS . '/' . $CPU . ' ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
|
|
|
}
|
|
|
|
|
1999-02-23 06:52:21 +03:00
|
|
|
if ( $OS eq 'OSF1' ) {
|
|
|
|
# Assumes 4.0D for now.
|
|
|
|
$ObjDir = 'obj-alpha-dec-osf4.0d';
|
|
|
|
}
|
|
|
|
|
1999-03-18 11:47:10 +03:00
|
|
|
if ( $OS eq 'QNX' ) {
|
|
|
|
$ObjDir = 'obj-i386-pc-qnx4';
|
|
|
|
}
|
|
|
|
|
1999-02-23 06:52:21 +03:00
|
|
|
if ( $OS eq 'SunOS' ) {
|
|
|
|
if ( $CPU eq 'i86pc' ) {
|
1999-02-24 07:33:17 +03:00
|
|
|
$ObjDir = 'obj-i386-pc-solaris' . $OSVer;
|
1999-02-26 02:35:52 +03:00
|
|
|
$BuildName = $host . ' ' . $OS . '/i386 ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
1999-02-23 06:52:21 +03:00
|
|
|
} else {
|
1999-02-27 07:55:44 +03:00
|
|
|
$ObjDir = 'obj-sparc-sun-';
|
|
|
|
$OSVerMajor = substr($OSVer, 0, 1);
|
|
|
|
if ( $OSVerMajor eq '4' ) {
|
|
|
|
$ObjDir .= 'sunos';
|
|
|
|
} else {
|
|
|
|
$ObjDir .= 'solaris';
|
|
|
|
$BuildName = $host . ' ' . $OS . '/sparc ' . $OSVer . ' ' . ($BuildDepend?'Depend':'Clobber');
|
|
|
|
}
|
|
|
|
$ObjDir .= $OSVer;
|
1999-02-23 06:52:21 +03:00
|
|
|
}
|
|
|
|
$ObjDir =~ s/s5\./s2./o;
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $BuildClassic ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
$logfile = "${DirName}-classic.log";
|
|
|
|
} else {
|
|
|
|
$logfile = "${DirName}.log";
|
|
|
|
}
|
1999-03-18 11:47:10 +03:00
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
sub BuildIt {
|
1999-03-18 11:47:10 +03:00
|
|
|
my($fe, @felist, $EarlyExit, $LastTime, $StartTimeStr, $comptmp);
|
1999-03-09 03:44:04 +03:00
|
|
|
$comptmp = '';
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
mkdir("$DirName", 0777);
|
|
|
|
chdir("$DirName") || die "Couldn't enter $DirName";
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
$StartDir = getcwd();
|
|
|
|
$LastTime = 0;
|
|
|
|
$EarlyExit = 0;
|
1999-03-03 04:21:42 +03:00
|
|
|
|
|
|
|
print "Starting dir is : $StartDir\n";
|
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
while ( ! $EarlyExit ) {
|
|
|
|
chdir("$StartDir");
|
|
|
|
if ( time - $LastTime < (60 * $BuildSleep) ) {
|
|
|
|
$SleepTime = (60 * $BuildSleep) - (time - $LastTime);
|
|
|
|
print "\n\nSleeping $SleepTime seconds ...\n";
|
|
|
|
sleep($SleepTime);
|
|
|
|
}
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
$LastTime = time;
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
$StartTime = time - 60 * 10;
|
|
|
|
$StartTimeStr = &CVSTime($StartTime);
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
&StartBuild if ( $ReportStatus );
|
1999-02-14 10:15:44 +03:00
|
|
|
$CurrentDir = getcwd();
|
|
|
|
if ( $CurrentDir ne $StartDir ) {
|
|
|
|
print "startdir: $StartDir, curdir $CurrentDir\n";
|
|
|
|
die "curdir != startdir";
|
|
|
|
}
|
|
|
|
|
|
|
|
$BuildDir = $CurrentDir;
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
unlink( "$logfile" );
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
print "opening $logfile\n";
|
|
|
|
open( LOG, ">$logfile" ) || print "can't open $?\n";
|
1999-02-27 07:55:44 +03:00
|
|
|
print LOG "current dir is -- " . $ENV{'HOST'} . ":$CurrentDir\n";
|
1999-02-14 10:15:44 +03:00
|
|
|
print LOG "Build Administrator is $BuildAdministrator\n";
|
|
|
|
&PrintEnv;
|
1999-03-09 03:15:46 +03:00
|
|
|
if ( $Compiler ne '' ) {
|
|
|
|
print LOG "===============================\n";
|
|
|
|
if ( $Compiler eq 'gcc' || $Compiler eq 'egcc' ) {
|
1999-03-09 03:44:04 +03:00
|
|
|
$comptmp = `$Compiler --version`;
|
|
|
|
chop($comptmp);
|
|
|
|
print LOG "Compiler is -- $Compiler \($comptmp\)\n";
|
1999-03-09 03:15:46 +03:00
|
|
|
} else {
|
|
|
|
print LOG "Compiler is -- $Compiler\n";
|
|
|
|
}
|
|
|
|
print LOG "===============================\n";
|
|
|
|
}
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
$BuildStatus = 0;
|
|
|
|
|
|
|
|
mkdir($TopLevel, 0777);
|
|
|
|
chdir($TopLevel) || die "chdir($TopLevel): $!\n";
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
if ( $BuildClassic ) {
|
|
|
|
print"$CVS $CVSCO $BuildModule\n";
|
|
|
|
print LOG "$CVS $CVSCO $BuildModule\n";
|
|
|
|
open (PULL, "$CVS $CVSCO $BuildModule 2>&1 |") || die "open: $!\n";
|
|
|
|
} else {
|
|
|
|
print "$CVS $CVSCO mozilla/client.mk\n";
|
|
|
|
print LOG "$CVS $CVSCO mozilla/client.mk\n";
|
|
|
|
open (PULL, "$CVS $CVSCO mozilla/client.mk 2>&1 |") || die "open: $!\n";
|
|
|
|
}
|
|
|
|
while (<PULL>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close(PULL);
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
# Do a separate checkout with toplevel makefile
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $BuildClassic == 0 ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
print LOG "$Make -f mozilla/client.mk checkout CVSCO='$CVS $CVSCO'|\n";
|
|
|
|
open (PULLALL, "$Make -f mozilla/client.mk checkout CVSCO='$CVS $CVSCO' |\n");
|
|
|
|
while (<PULLALL>) {
|
|
|
|
print LOG $_;
|
|
|
|
print $_;
|
|
|
|
}
|
|
|
|
close(PULLALL);
|
|
|
|
}
|
|
|
|
|
|
|
|
chdir($Topsrcdir) || die "chdir($Topsrcdir): $!\n";
|
|
|
|
print LOG "Build nspr\n";
|
1999-02-23 06:52:21 +03:00
|
|
|
open (BUILDNSPR, "gmake -C nsprpub $NSPRArgs export 2>&1 | ") || die "Build nspr: $!\n";
|
1999-02-14 10:15:44 +03:00
|
|
|
while(<BUILDNSPR>) {
|
|
|
|
print LOG $_;
|
|
|
|
print $_;
|
|
|
|
}
|
|
|
|
|
|
|
|
print LOG "$ConfigGuess\n";
|
|
|
|
$BuildObjName = "obj-";
|
|
|
|
open (GETOBJ, "$ConfigGuess 2>&1 |") || die "$ConfigGuess: $!\n";
|
|
|
|
while (<GETOBJ>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
chomp($BuildObjName .= $_);
|
|
|
|
}
|
|
|
|
close (GETOBJ);
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
mkdir($BuildObjName, 0777);
|
|
|
|
chdir($BuildObjName) || die "chdir($BuildObjName): $!\n";
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
print LOG "$ConfigureEnvArgs ../configure $ConfigureArgs\n";
|
1999-03-18 11:47:10 +03:00
|
|
|
open (CONFIGURE, "$ConfigureEnvArgs $ShellOverride ../configure $ConfigureArgs 2>&1 |") || die "../configure: $!\n";
|
1999-02-14 10:15:44 +03:00
|
|
|
while (<CONFIGURE>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close(CONFIGURE);
|
|
|
|
|
|
|
|
print "--- config.cache.\n";
|
|
|
|
print LOG "--- config.cache.\n";
|
|
|
|
open (CONFIGURE, "config.cache");
|
|
|
|
while (<CONFIGURE>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close(CONFIGURE);
|
|
|
|
print "--- config.cache.\n";
|
|
|
|
print LOG "--- config.cache.\n";
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
# If we are building depend, rebuild dependencies
|
|
|
|
if ( $BuildDepend ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
print LOG "$Make MAKE='$Make -j $cpus' depend 2>&1 |\n";
|
|
|
|
open ( MAKEDEPEND, "$Make MAKE='$Make -j $cpus' depend 2>&1 |\n");
|
|
|
|
while ( <MAKEDEPEND> ) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close (MAKEDEPEND);
|
|
|
|
system("rm -rf dist");
|
|
|
|
} else {
|
|
|
|
# Building clobber
|
|
|
|
print LOG "$Make MAKE='$Make -j $cpus' $ClobberStr 2>&1 |\n";
|
|
|
|
open( MAKECLOBBER, "$Make MAKE='$Make -j $cpus' $ClobberStr 2>&1 |");
|
|
|
|
while ( <MAKECLOBBER> ) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close( MAKECLOBBER );
|
|
|
|
}
|
|
|
|
|
|
|
|
@felist = split(/,/, $FE);
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
foreach $fe ( @felist ) {
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( &BinaryExists($fe) ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
print LOG "deleting existing binary\n";
|
|
|
|
&DeleteBinary($fe);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $BuildClassic ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
# Build the BE only
|
|
|
|
print LOG "$Make MAKE='$Make -j $cpus' MOZ_FE= 2>&1 |\n";
|
|
|
|
open( BEBUILD, "$Make MAKE='$Make -j $cpus' MOZ_FE= 2>&1 |");
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
while ( <BEBUILD> ) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close( BEBUILD );
|
|
|
|
|
|
|
|
foreach $fe ( @felist ) {
|
|
|
|
# Now build each front end
|
|
|
|
print LOG "$Make MAKE='$Make -j $cpus' -C cmd/${fe}fe 2>&1 |\n";
|
|
|
|
open(FEBUILD, "$Make MAKE='$Make -j $cpus' -C cmd/${fe}fe 2>&1 |\n");
|
|
|
|
while (<FEBUILD>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close(FEBUILD);
|
|
|
|
}
|
|
|
|
} else {
|
1999-02-23 06:52:21 +03:00
|
|
|
print LOG "$Make MAKE='$Make -j $cpus' $MakeOverrides 2>&1 |\n";
|
|
|
|
open(BUILD, "$Make MAKE='$Make -j $cpus' $MakeOverrides 2>&1 |\n");
|
1999-02-14 10:15:44 +03:00
|
|
|
while (<BUILD>) {
|
|
|
|
print $_;
|
|
|
|
print LOG $_;
|
|
|
|
}
|
|
|
|
close(BUILD);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach $fe (@felist) {
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( &BinaryExists($fe) ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
if ( $RunTest ) {
|
|
|
|
print LOG "export binary exists, build successful. Testing...\n";
|
|
|
|
$BuildStatus = &RunSmokeTest($fe);
|
|
|
|
} else {
|
|
|
|
print LOG "export binary exists, build successful. Skipping test.\n";
|
|
|
|
$BuildStatus = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
print LOG "export binary missing, build FAILED\n";
|
|
|
|
$BuildStatus = 666;
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
if ( $BuildStatus == 0 ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
$BuildStatusStr = 'success';
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
|
|
|
elsif ( $BuildStatus == 333 ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
$BuildStatusStr = 'testfailed';
|
|
|
|
} else {
|
|
|
|
$BuildStatusStr = 'busted';
|
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
print LOG "tinderbox: tree: $BuildTree\n";
|
|
|
|
print LOG "tinderbox: builddate: $StartTime\n";
|
|
|
|
print LOG "tinderbox: status: $BuildStatusStr\n";
|
|
|
|
print LOG "tinderbox: build: $BuildName $fe\n";
|
|
|
|
print LOG "tinderbox: errorparser: unix\n";
|
|
|
|
print LOG "tinderbox: buildfamily: unix\n";
|
|
|
|
print LOG "tinderbox: END\n";
|
|
|
|
}
|
|
|
|
close(LOG);
|
|
|
|
chdir("$StartDir");
|
1999-03-03 04:21:42 +03:00
|
|
|
|
|
|
|
# this fun line added on 2/5/98. do not remove. Translated to english,
|
|
|
|
# that's "take any line longer than 1000 characters, and split it into less
|
|
|
|
# than 1000 char lines. If any of the resulting lines is
|
|
|
|
# a dot on a line by itself, replace that with a blank line."
|
|
|
|
# This is to prevent cases where a <cr>.<cr> occurs in the log file. Sendmail
|
|
|
|
# interprets that as the end of the mail, and truncates the log before
|
|
|
|
# it gets to Tinderbox. (terry weismann, chris yeh)
|
|
|
|
#
|
|
|
|
# This was replaced by a perl 'port' of the above, writen by
|
|
|
|
# preed@netscape.com; good things: no need for system() call, and now it's
|
|
|
|
# all in perl, so we don't have to do OS checking like before.
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
open(LOG, "$logfile") || die "Couldn't open logfile: $!\n";
|
|
|
|
open(OUTLOG, ">${logfile}.last") || die "Couldn't open logfile: $!\n";
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
while (<LOG>) {
|
|
|
|
$q = 0;
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
for (;;) {
|
|
|
|
$val = $q * 1000;
|
|
|
|
$Output = substr($_, $val, 1000);
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
last if ( $Output eq undef );
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
$Output =~ s/^\.$//g;
|
|
|
|
$Output =~ s/\n//g;
|
|
|
|
print OUTLOG "$Output\n";
|
|
|
|
$q++;
|
|
|
|
} #EndFor
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
} #EndWhile
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
close(LOG);
|
|
|
|
close(OUTLOG);
|
|
|
|
|
1999-03-03 04:21:42 +03:00
|
|
|
system( "$mail $Tinderbox_server < ${logfile}.last" ) if ( $ReportStatus );
|
1999-02-14 10:15:44 +03:00
|
|
|
unlink("$logfile");
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
# If this is a test run, set early_exit to 0.
|
|
|
|
# This mean one loop of execution
|
|
|
|
$EarlyExit++ if ( $BuildOnce );
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
1999-03-18 11:47:10 +03:00
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
sub CVSTime {
|
|
|
|
my($StartTimeArg) = @_;
|
1999-03-09 03:15:46 +03:00
|
|
|
my($RetTime, $sec, $minute, $hour, $mday, $mon, $year);
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
($sec,$minute,$hour,$mday,$mon,$year) = localtime($StartTimeArg);
|
|
|
|
$mon++; # month is 0 based.
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
sprintf("%02d/%02d/%02d %02d:%02d:00", $mon,$mday,$year,$hour,$minute );
|
|
|
|
}
|
|
|
|
|
|
|
|
sub StartBuild {
|
|
|
|
my($fe, @felist);
|
|
|
|
|
|
|
|
@felist = split(/,/, $FE);
|
|
|
|
|
|
|
|
open( LOG, "|$mail $Tinderbox_server" );
|
|
|
|
foreach $fe ( @felist ) {
|
|
|
|
print LOG "\n";
|
|
|
|
print LOG "tinderbox: tree: $BuildTree\n";
|
|
|
|
print LOG "tinderbox: builddate: $StartTime\n";
|
|
|
|
print LOG "tinderbox: status: building\n";
|
|
|
|
print LOG "tinderbox: build: $BuildName $fe\n";
|
|
|
|
print LOG "tinderbox: errorparser: unix\n";
|
|
|
|
print LOG "tinderbox: buildfamily: unix\n";
|
|
|
|
print LOG "tinderbox: END\n";
|
|
|
|
print LOG "\n";
|
|
|
|
}
|
|
|
|
close( LOG );
|
|
|
|
}
|
|
|
|
|
|
|
|
# check for the existence of the binary
|
|
|
|
sub BinaryExists {
|
|
|
|
my($fe) = @_;
|
|
|
|
my($Binname);
|
1999-03-18 12:19:22 +03:00
|
|
|
$fe = 'x' if ( !defined($fe) );
|
1999-02-14 10:15:44 +03:00
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $BuildClassic ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/'. $BuildObjName . "/cmd/${fe}fe/" . $BinaryName{"$fe"};
|
|
|
|
} else {
|
|
|
|
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . $BinaryName{"$fe"};
|
|
|
|
}
|
|
|
|
print LOG $BinName . "\n";
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( (-e $BinName) && (-x $BinName) && (-s $BinName) ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub DeleteBinary {
|
|
|
|
my($fe) = @_;
|
|
|
|
my($BinName);
|
1999-03-18 12:19:22 +03:00
|
|
|
$fe = 'x' if ( !defined($fe) );
|
1999-02-14 10:15:44 +03:00
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $BuildClassic ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . "/cmd/${fe}fe/" . $BinaryName{"$fe"};
|
|
|
|
} else {
|
|
|
|
$BinName = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . $BinaryName{"$fe"};
|
|
|
|
}
|
|
|
|
print LOG "unlinking $BinName\n";
|
|
|
|
unlink ($BinName) || print LOG "unlinking $BinName failed\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
sub ParseArgs {
|
|
|
|
my($i, $manArg);
|
|
|
|
|
|
|
|
if( @ARGV == 0 ) {
|
|
|
|
&PrintUsage;
|
|
|
|
}
|
|
|
|
$i = 0;
|
|
|
|
$manArg = 0;
|
|
|
|
while( $i < @ARGV ) {
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $ARGV[$i] eq '--classic' ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
$BuildClassic = 1;
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
1999-03-18 12:19:22 +03:00
|
|
|
elsif ( $ARGV[$i] eq '--clobber' ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
$BuildDepend = 0;
|
|
|
|
$manArg++;
|
|
|
|
}
|
1999-03-18 12:19:22 +03:00
|
|
|
elsif ( $ARGV[$i] eq '--depend' ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
$BuildDepend = 1;
|
|
|
|
$manArg++;
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
1999-03-18 12:30:57 +03:00
|
|
|
elsif ( $ARGV[$i] eq '--help' || $ARGV[$i] eq '-h' ) {
|
|
|
|
$PrintUsage;
|
|
|
|
}
|
1999-03-20 05:04:21 +03:00
|
|
|
elsif ( $ARGV[$i] eq '--nocompress' ) {
|
|
|
|
$CVS = 'cvs -q';
|
|
|
|
}
|
1999-03-18 12:19:22 +03:00
|
|
|
elsif ( $ARGV[$i] eq '--noreport' ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
$ReportStatus = 0;
|
|
|
|
}
|
1999-03-18 12:19:22 +03:00
|
|
|
elsif ( $ARGV[$i] eq '--notest' ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
$RunTest = 0;
|
|
|
|
}
|
|
|
|
elsif ( $ARGV[$i] eq '--once' ) {
|
|
|
|
$BuildOnce = 1;
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
|
|
|
elsif ( $ARGV[$i] eq '-tag' ) {
|
|
|
|
$i++;
|
|
|
|
$BuildTag = $ARGV[$i];
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $BuildTag eq '' || $BuildTag eq '-t' ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
&PrintUsage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif ( $ARGV[$i] eq '-t' ) {
|
|
|
|
$i++;
|
|
|
|
$BuildTree = $ARGV[$i];
|
|
|
|
if ( $BuildTree eq '' ) {
|
|
|
|
&PrintUsage;
|
|
|
|
}
|
1999-03-03 04:21:42 +03:00
|
|
|
}
|
1999-03-18 12:19:22 +03:00
|
|
|
elsif ( $ARGV[$i] eq '--version' || $ARGV[$i] eq '-v' ) {
|
|
|
|
die "$0: version" . substr($Version,9,6) . "\n";
|
1999-02-14 10:15:44 +03:00
|
|
|
} else {
|
|
|
|
&PrintUsage;
|
|
|
|
}
|
|
|
|
$i++;
|
1999-03-18 12:19:22 +03:00
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
if ( $BuildTree =~ /^\s+$/i ) {
|
|
|
|
&PrintUsage;
|
|
|
|
}
|
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $BuildDepend eq undef ) {
|
1999-02-14 10:15:44 +03:00
|
|
|
&PrintUsage;
|
|
|
|
}
|
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
&PrintUsage if ( $manArg == 0 );
|
1999-03-18 11:47:10 +03:00
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
sub PrintUsage {
|
1999-03-18 12:30:57 +03:00
|
|
|
die "usage: $0 --depend | --clobber [ -v | --version ] [ --once --classic --noreport --notest -tag TREETAG -t TREENAME ]\n";
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sub PrintEnv {
|
1999-03-18 11:47:10 +03:00
|
|
|
my($key);
|
|
|
|
foreach $key (sort(keys %ENV)) {
|
|
|
|
print LOG $key, '=', $ENV{$key}, "\n";
|
|
|
|
print $key, '=', $ENV{$key}, "\n";
|
1999-02-14 10:15:44 +03:00
|
|
|
}
|
1999-03-18 11:47:10 +03:00
|
|
|
}
|
1999-02-14 10:15:44 +03:00
|
|
|
|
|
|
|
sub RunSmokeTest {
|
|
|
|
my($fe) = @_;
|
|
|
|
my($Binary);
|
1999-03-03 04:21:42 +03:00
|
|
|
my($status) = 0;
|
1999-03-09 03:44:04 +03:00
|
|
|
my($waittime) = 45;
|
1999-03-03 04:21:42 +03:00
|
|
|
my($pid) = fork;
|
1999-03-18 12:19:22 +03:00
|
|
|
$fe = 'x' if ( !defined($fe) );
|
1999-02-14 10:15:44 +03:00
|
|
|
|
1999-02-23 06:52:21 +03:00
|
|
|
$Binary = $BuildDir . '/' . $TopLevel . '/' . $Topsrcdir . '/' . $BuildObjName . $BinaryName{"$fe"};
|
|
|
|
print LOG $Binary . "\n";
|
1999-02-14 10:15:44 +03:00
|
|
|
|
1999-03-18 12:19:22 +03:00
|
|
|
exec $Binary if ( !$pid );
|
1999-03-03 04:21:42 +03:00
|
|
|
|
|
|
|
# parent - wait $waittime seconds then check on child
|
|
|
|
sleep $waittime;
|
|
|
|
$status = waitpid($pid, WNOHANG());
|
1999-03-18 12:19:22 +03:00
|
|
|
if ( $status != 0 ) {
|
1999-03-03 04:21:42 +03:00
|
|
|
print LOG "$Binary has crashed or quit. Turn the tree orange now.\n";
|
|
|
|
return 333;
|
|
|
|
}
|
|
|
|
|
|
|
|
print LOG "Success! $Binary is still running. Killing...\n";
|
|
|
|
# try to kill 3 times, then try a kill -9
|
|
|
|
for ($i=0 ; $i<3 ; $i++) {
|
|
|
|
kill('TERM',$pid,);
|
|
|
|
# give it 3 seconds to actually die
|
|
|
|
sleep 3;
|
|
|
|
$status = waitpid($pid, WNOHANG());
|
1999-03-18 12:19:22 +03:00
|
|
|
last if ( $status != 0 );
|
1999-03-03 04:21:42 +03:00
|
|
|
}
|
|
|
|
return 0;
|
1999-03-18 11:47:10 +03:00
|
|
|
}
|
1999-03-03 04:21:42 +03:00
|
|
|
|
1999-02-14 10:15:44 +03:00
|
|
|
# Main function
|
|
|
|
&InitVars;
|
|
|
|
&ParseArgs;
|
|
|
|
&ConditionalArgs;
|
|
|
|
&GetSystemInfo;
|
|
|
|
&SetupEnv;
|
|
|
|
&SetupPath;
|
|
|
|
&BuildIt;
|
|
|
|
|
|
|
|
1;
|