1.1 --- a/tools/buildbot/bootstrap.pl Sun Aug 30 00:03:58 2009 -0700
1.2 +++ b/tools/buildbot/bootstrap.pl Sun Aug 30 00:21:42 2009 -0700
1.3 @@ -1,4 +1,5 @@
1.4 #!/usr/bin/perl
1.5 +# vim: set ts=2 sw=2 tw=99 noet:
1.6
1.7 use strict;
1.8 use Cwd;
1.9 @@ -9,88 +10,62 @@
1.10
1.11 require 'helpers.pm';
1.12
1.13 -chdir(Build::PathFormat('../builder'));
1.14 -if ($^O eq "linux")
1.15 -{
1.16 - Build::Command('make clean');
1.17 - Build::Command('make');
1.18 -}
1.19 -else
1.20 -{
1.21 - Build::Command('"' . $ENV{'VC9BUILDER'} . '" /rebuild builder.csproj Release');
1.22 - Build::Command('move ' . Build::PathFormat('bin/Release/builder.exe') . ' .');
1.23 -}
1.24 -
1.25 -die "Unable to build builder tool!\n" unless -e 'builder.exe';
1.26 -
1.27 -#Go back to main source dir.
1.28 -chdir(Build::PathFormat('../..'));
1.29 +#Go back above build dir
1.30 +chdir(Build::PathFormat('../../..'));
1.31
1.32 #Get the source path.
1.33 our ($root) = getcwd();
1.34
1.35 +my $reconf = 0;
1.36 +
1.37 #Create output folder if it doesn't exist.
1.38 if (!(-d 'OUTPUT')) {
1.39 - mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
1.40 + mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
1.41 + $reconf = 1;
1.42 +} else {
1.43 + if (-f 'OUTPUT/sentinel') {
1.44 + my @s = stat('OUTPUT/sentinel');
1.45 + my $mtime = $s[9];
1.46 + my @files = ('build/pushbuild.txt', 'build/AMBuildScript', 'build/product.version');
1.47 + my ($i);
1.48 + for ($i = 0; $i <= $#files; $i++) {
1.49 + if (IsNewer($files[$i], $mtime)) {
1.50 + $reconf = 1;
1.51 + last;
1.52 + }
1.53 + }
1.54 + } else {
1.55 + $reconf = 1;
1.56 + }
1.57 }
1.58
1.59 -#Write the configuration file.
1.60 -open(CONF, '>build.cfg') or die("Failed to write build.cfg: $!\n");
1.61 -print CONF "OutputBase = " . Build::PathFormat($root . '/OUTPUT') . "\n";
1.62 -print CONF "SourceBase = $root\n";
1.63 -if ($^O eq "linux")
1.64 -{
1.65 - print CONF "BuilderPath = /usr/bin/make\n";
1.66 -}
1.67 -else
1.68 -{
1.69 - print CONF "BuilderPath = " . $ENV{'VC9BUILDER'} . "\n";
1.70 - print CONF "PDBLog = $root\\OUTPUT\\pdblog.txt\n";
1.71 -}
1.72 -close(CONF);
1.73 -
1.74 -#Do the annoying revision bumping.
1.75 -#Linux needs some help here.
1.76 -if ($^O eq "linux")
1.77 -{
1.78 - Build::Command("flip -u modules.versions");
1.79 - Build::Command("flip -u tools/versionchanger.pl");
1.80 - Build::Command("chmod +x tools/versionchanger.pl");
1.81 -}
1.82 -my ($build_type);
1.83 -$build_type = Build::GetBuildType(Build::PathFormat('tools/buildbot/build_type'));
1.84 -if ($build_type == "dev")
1.85 -{
1.86 - Build::Command(Build::PathFormat('tools/versionchanger.pl') . ' --buildstring="-dev"');
1.87 +if ($reconf) {
1.88 + chdir('OUTPUT');
1.89 + my ($result);
1.90 + print "Attempting to reconfigure...\n";
1.91 + if ($^O eq "linux") {
1.92 + $result = `CC=gcc-4.1 CXX=gcc-4.1 python3.1 ../build/configure.py --enable-optimize`;
1.93 + } else {
1.94 + $result = `C:\\Python31\\Python.exe ..\\build\\configure.py --enable-optimize`;
1.95 + }
1.96 + print "$result\n";
1.97 + if ($? != 0) {
1.98 + die('Could not configure!');
1.99 + }
1.100 + open(FILE, '>sentinel');
1.101 + print FILE "this is nothing.\n";
1.102 + close(FILE);
1.103 }
1.104
1.105 -#Bootstrap extensions that have complex dependencies
1.106 -
1.107 -if ($^O eq "linux")
1.108 +sub IsNewer
1.109 {
1.110 - BuildLibCurl_Linux();
1.111 -}
1.112 -else
1.113 -{
1.114 - BuildLibCurl_Win32();
1.115 + my ($file, $time) = (@_);
1.116 +
1.117 + my @s = stat($file);
1.118 + my $mtime = $s[9];
1.119 + return $mtime > $time;
1.120 }
1.121
1.122 -sub BuildLibCurl_Win32
1.123 -{
1.124 - chdir("extensions\\curl\\curl-src\\lib");
1.125 - Build::Command('"' . $ENV{'VC9BUILDER'} . '" /rebuild build_libcurl.vcproj "LIB Release"');
1.126 - die "Unable to find libcurl.lib!\n" unless (-f "LIB-Release\\libcurl.lib");
1.127 - chdir("..\\..\\..\\..");
1.128 -}
1.129 +exit(0);
1.130
1.131 -sub BuildLibCurl_Linux
1.132 -{
1.133 - chdir("extensions/curl/curl-src");
1.134 - Build::Command("mkdir -p Release");
1.135 - Build::Command("chmod +x configure");
1.136 - chdir("Release");
1.137 - Build::Command("../configure --enable-static --disable-shared --disable-ldap --without-ssl --without-zlib");
1.138 - Build::Command("make");
1.139 - die "Unable to find libcurl.a!\n" unless (-f "lib/.libs/libcurl.a");
1.140 - chdir("../../../..");
1.141 -}
1.142 +