1
0
mirror of https://github.com/moparisthebest/curl synced 2025-03-11 07:39:50 -04:00

Added lots of new command line options, made confsuffix get set based on

targetos only and not build os. Commented away the line that enables perl
warnings.
This commit is contained in:
Daniel Stenberg 2005-03-15 07:35:36 +00:00
parent 1f68fa19c7
commit 562d2de303

View File

@ -6,7 +6,7 @@
# | (__| |_| | _ <| |___ # | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____| # \___|\___/|_| \_\_____|
# #
# Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. # Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
# #
# This software is licensed as described in the file COPYING, which # This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms # you should have received as part of this distribution. The terms
@ -34,25 +34,35 @@
# curl site, at http://curl.haxx.se/auto/ # curl site, at http://curl.haxx.se/auto/
# USAGE: # USAGE:
# testcurl.pl [--target=your_os] [curl-daily-name] > output # testcurl.pl [options] [curl-daily-name] > output
# Updated: # Options:
# v1.7 22-Jun-04 - added --target option for other platform targets. #
# v1.2 8-Mar-04 - rewritten in perl # --configure=[options] Configure options
# v1.1 6-Nov-03 - to take an optional parameter, the name of a daily-build # --crosscompile This is a crosscompile
# directory. If present, build from that directory, otherwise # --desc=[desc] Description of your test system
# perform a normal CVS build. # --email=[email] Set email address to report as
# --mktarball=[command] Command to run after completed test
# --name=[name] Set name to report as
# --nocvsup Don't update from CVS even though it is a CVS tree
# --setup=[file name] File name to read setup from (deprecated)
# --target=[your os] Specify your target environment.
#
# if [curl-daily-name] is omitted, a 'curl' CVS directory is assumed.
#
use strict; use strict;
use Cwd; use Cwd;
# Turn on warnings (equivalent to -w, which can't be used with /usr/bin/env) # Turn on warnings (equivalent to -w, which can't be used with /usr/bin/env)
BEGIN { $^W = 1; } #BEGIN { $^W = 1; }
use vars qw($version $fixed $infixed $CURLDIR $CVS $pwd $build $buildlog use vars qw($version $fixed $infixed $CURLDIR $CVS $pwd $build $buildlog
$buildlogname $gnulikebuild $targetos $confsuffix $binext $libext); $buildlogname $configurebuild $targetos $confsuffix $binext
use vars qw($name $email $desc $confopts $setupfile $mktarball); $libext);
use vars qw($name $email $desc $confopts $setupfile $mktarball $nocvsup
$crosscompile);
# version of this script # version of this script
$version='$Revision$'; $version='$Revision$';
@ -62,44 +72,75 @@ $fixed=0;
# or if we got a specific target option or setup file option. # or if we got a specific target option or setup file option.
$CURLDIR="curl"; $CURLDIR="curl";
$CVS=1; $CVS=1;
$targetos = '';
$setupfile = 'setup'; $setupfile = 'setup';
$mktarball = '';
while ($ARGV[0]) { while ($ARGV[0]) {
if ($ARGV[0] =~ /--target=/) { if ($ARGV[0] =~ /--target=/) {
$targetos = (split(/=/, shift @ARGV))[1]; $targetos = (split(/=/, shift @ARGV))[1];
} elsif ($ARGV[0] =~ /--setup=/) { }
elsif ($ARGV[0] =~ /--setup=/) {
$setupfile = (split(/=/, shift @ARGV))[1]; $setupfile = (split(/=/, shift @ARGV))[1];
} elsif ($ARGV[0] =~ /--mktarball=/) { }
elsif ($ARGV[0] =~ /--mktarball=/) {
$mktarball = (split(/=/, shift @ARGV))[1]; $mktarball = (split(/=/, shift @ARGV))[1];
} else { }
elsif ($ARGV[0] =~ /--name=/) {
$name = (split(/=/, shift @ARGV))[1];
}
elsif ($ARGV[0] =~ /--email=/) {
$email = (split(/=/, shift @ARGV))[1];
}
elsif ($ARGV[0] =~ /--desc=/) {
$desc = (split(/=/, shift @ARGV))[1];
}
elsif ($ARGV[0] =~ /--configure=/) {
$confopts = (split(/=/, shift @ARGV))[1];
}
elsif ($ARGV[0] =~ /--nocvsup/) {
$nocvsup=1;
shift @ARGV;
}
elsif ($ARGV[0] =~ /--crosscompile/) {
$crosscompile=1;
shift @ARGV;
}
else {
$CURLDIR=shift @ARGV; $CURLDIR=shift @ARGV;
$CVS=0; $CVS=0;
} }
} }
# Do the platform-specific stuff here # Do the platform-specific stuff here
$gnulikebuild = 1; $configurebuild = 1;
$confsuffix = ''; $confsuffix = '';
$binext = ''; $binext = '';
$libext = '.la'; # .la since both libcurl and libcares are made with libtool $libext = '.la'; # .la since both libcurl and libcares are made with libtool
if ($^O eq 'MSWin32' || $targetos ne '') { if ($^O eq 'MSWin32' || $targetos) {
$gnulikebuild = 0; if (!$targetos) {
if ($targetos eq '') {
# If no target defined on Win32 lets assume vc # If no target defined on Win32 lets assume vc
$targetos = 'vc'; $targetos = 'vc';
} }
if ($targetos =~ /vc/ || $targetos =~ /mingw32/ || $targetos =~ /borland/) { if ($targetos =~ /vc/ || $targetos =~ /mingw32/ || $targetos =~ /borland/) {
$confsuffix = '-win32';
$binext = '.exe'; $binext = '.exe';
$libext = '.lib' if ($targetos =~ /vc/ || $targetos =~ /borland/); $libext = '.lib' if ($targetos =~ /vc/ || $targetos =~ /borland/);
$libext = '.a' if ($targetos =~ /mingw32/); $libext = '.a' if ($targetos =~ /mingw32/);
} elsif ($targetos =~ /netware/) { }
elsif ($targetos =~ /netware/) {
$binext = '.nlm'; $binext = '.nlm';
$libext = '.lib'; $libext = '.lib';
} }
} }
if ($^O eq 'MSWin32') {
# Set these things only when building ON Windows, not when simply building
# FOR Windows since we might be cross-compiling on another system. Non-
# Windows builds still default to configure-style builds with no confsuffix.
$configurebuild = 0;
$confsuffix = '-win32';
}
$ENV{LANG}="C"; $ENV{LANG}="C";
sub rmtree($) { sub rmtree($) {
@ -192,22 +233,22 @@ if (!$confopts) {
print "examples: --with-ssl --enable-debug --enable-ipv6 --with-krb4\n"; print "examples: --with-ssl --enable-debug --enable-ipv6 --with-krb4\n";
$confopts = <>; $confopts = <>;
chomp $confopts; chomp $confopts;
$fixed=4;
} }
} }
if ($fixed < 4) { if ($fixed < 4) {
open(F, ">$setupfile") or die; $fixed=4;
print F "name='$name'\n"; open(F, ">$setupfile") or die;
print F "email='$email'\n"; print F "name='$name'\n";
print F "desc='$desc'\n"; print F "email='$email'\n";
print F "confopts='$confopts'\n"; print F "desc='$desc'\n";
print F "fixed='$fixed'\n"; print F "confopts='$confopts'\n";
close(F); print F "fixed='$fixed'\n";
close(F);
} }
logit "STARTING HERE"; # first line logged logit "STARTING HERE"; # first line logged, for scripts to trigger on
logit "NAME = $name"; logit "NAME = $name";
logit "EMAIL = $email"; logit "EMAIL = $email";
logit "DESC = $desc"; logit "DESC = $desc";
@ -216,7 +257,7 @@ logit "CFLAGS = ".$ENV{CFLAGS};
logit "LDFLAGS = ".$ENV{LDFLAGS}; logit "LDFLAGS = ".$ENV{LDFLAGS};
logit "CC = ".$ENV{CC}; logit "CC = ".$ENV{CC};
logit "target = ".$targetos; logit "target = ".$targetos;
logit "version = $version"; logit "version = $version"; # script version
logit "date = ".(scalar gmtime)." UTC"; logit "date = ".(scalar gmtime)." UTC";
# Make $pwd to become the path without newline. We'll use that in order to cut # Make $pwd to become the path without newline. We'll use that in order to cut
@ -271,7 +312,13 @@ if ($CVS) {
sub cvsup() { sub cvsup() {
# update quietly to the latest CVS # update quietly to the latest CVS
logit "run cvs up"; logit "run cvs up";
system("cvs -Q up -dP 2>&1"); if($nocvsup) {
logit "Skipping CVS update (--nocvsup)";
return 1;
}
else {
system("cvs -Q up -dP 2>&1");
}
$cvsstat=$?; $cvsstat=$?;
@ -299,7 +346,7 @@ if ($CVS) {
unlink "configure"; unlink "configure";
unlink "autom4te.cache"; unlink "autom4te.cache";
if ($gnulikebuild) { if ($configurebuild) {
# generate the build files # generate the build files
logit "invoke buildconf, but filter off the silly aclocal warnings"; logit "invoke buildconf, but filter off the silly aclocal warnings";
open(F, "./buildconf 2>&1 |") or die; open(F, "./buildconf 2>&1 |") or die;
@ -314,7 +361,8 @@ if ($CVS) {
if (grepfile("^buildconf: OK", $buildlog)) { if (grepfile("^buildconf: OK", $buildlog)) {
logit "buildconf was successful"; logit "buildconf was successful";
} else { }
else {
mydie "buildconf was NOT successful"; mydie "buildconf was NOT successful";
} }
@ -333,12 +381,13 @@ if ($CVS) {
chdir ".."; chdir "..";
} }
} else { }
logit "buildconf was successful (dummy message)"; else {
logit "buildconf was successful (dummy message)";
} }
} }
if ($gnulikebuild) { if ($configurebuild) {
if (-f "configure") { if (-f "configure") {
logit "configure created"; logit "configure created";
} else { } else {
@ -351,7 +400,7 @@ if ($gnulikebuild) {
# change to build dir # change to build dir
chdir "$pwd/$build"; chdir "$pwd/$build";
if ($gnulikebuild) { if ($configurebuild) {
# run configure script # run configure script
print `../$CURLDIR/configure $confopts 2>&1`; print `../$CURLDIR/configure $confopts 2>&1`;
@ -364,7 +413,8 @@ if ($gnulikebuild) {
if (($^O eq 'MSWin32') && ($targetos !~ /netware/)) { if (($^O eq 'MSWin32') && ($targetos !~ /netware/)) {
system("xcopy /s /q ..\\$CURLDIR ."); system("xcopy /s /q ..\\$CURLDIR .");
system("buildconf.bat"); system("buildconf.bat");
} elsif (($^O eq 'linux') || ($targetos =~ /netware/)) { }
elsif (($^O eq 'linux') || ($targetos =~ /netware/)) {
system("cp -afr ../$CURLDIR/* ."); system("cp -afr ../$CURLDIR/* .");
system("cp -af ../$CURLDIR/Makefile.dist Makefile"); system("cp -af ../$CURLDIR/Makefile.dist Makefile");
system("make -i -C lib -f Makefile.$targetos prebuild"); system("make -i -C lib -f Makefile.$targetos prebuild");
@ -414,21 +464,24 @@ if (grepfile("define USE_ARES", "lib/config$confsuffix.h")) {
} }
logit "run make"; logit "run make";
if ($gnulikebuild) { if ($configurebuild) {
open(F, "make -i 2>&1 |") or die; open(F, "make -i 2>&1 |") or die;
while (<F>) { while (<F>) {
s/$pwd//g; s/$pwd//g;
print; print;
} }
close(F); close(F);
} else { }
else {
if ($^O eq 'MSWin32') { if ($^O eq 'MSWin32') {
if ($targetos =~ /vc/) { if ($targetos =~ /vc/) {
open(F, "nmake -i $targetos|") or die; open(F, "nmake -i $targetos|") or die;
} else { }
else {
open(F, "make -i $targetos |") or die; open(F, "make -i $targetos |") or die;
} }
} else { }
else {
open(F, "make -i $targetos 2>&1 |") or die; open(F, "make -i $targetos 2>&1 |") or die;
} }
while (<F>) { while (<F>) {
@ -440,26 +493,29 @@ if ($gnulikebuild) {
if (-f "lib/libcurl$libext") { if (-f "lib/libcurl$libext") {
logit "lib/libcurl was created fine (libcurl$libext)"; logit "lib/libcurl was created fine (libcurl$libext)";
} else { }
else {
logit "lib/libcurl was not created (libcurl$libext)"; logit "lib/libcurl was not created (libcurl$libext)";
} }
if (-f "src/curl$binext") { if (-f "src/curl$binext") {
logit "src/curl was created fine (curl$binext)"; logit "src/curl was created fine (curl$binext)";
} else { }
else {
mydie "src/curl was not created (curl$binext)"; mydie "src/curl was not created (curl$binext)";
} }
if ($targetos ne '' && $targetos =~ /netware/) { if ($targetos =~ /netware/) {
if (-f '../../curlver') { if (-f '../../curlver') {
system('../../curlver'); system('../../curlver');
} }
} else { }
elsif(!$crosscompile) {
logit "display curl$binext --version output"; logit "display curl$binext --version output";
system("./src/curl$binext --version"); system("./src/curl$binext --version");
} }
if ($gnulikebuild) { if ($configurebuild && !$crosscompile) {
logit "run make test-full"; logit "run make test-full";
open(F, "make test-full 2>&1 |") or die; open(F, "make test-full 2>&1 |") or die;
open(LOG, ">$buildlog") or die; open(LOG, ">$buildlog") or die;
@ -483,7 +539,11 @@ if ($gnulikebuild) {
logit "the tests were successful!"; logit "the tests were successful!";
} }
} else { } else {
print "TESTDONE: 1 tests out of 0 (dummy message)\n"; # dummy message to feign success # dummy message to feign success
if($crosscompile) {
logit "cross-compiling, can't run tests";
}
print "TESTDONE: 1 tests out of 0 (dummy message)\n";
} }
# create a tarball if we got that option. # create a tarball if we got that option.