diff -r b2862e8a8ae0 -r 4d7366431a6c tools/buildbot/bootstrap.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/buildbot/bootstrap.pl Wed Jul 25 23:24:42 2012 -0700 @@ -0,0 +1,106 @@ +#!/usr/bin/perl +# vim: set ts=2 sw=2 tw=99 noet: + +use strict; +use Cwd; +use File::Basename; +use File::Path; + +my ($myself, $path) = fileparse($0); +chdir($path); + +require 'helpers.pm'; + +#Go back above build dir +chdir(Build::PathFormat('../../..')); + +#Get the source path. +our ($root) = getcwd(); + +my $reconf = 0; + +#Create output folder if it doesn't exist. +if (!(-d 'OUTPUT')) { + $reconf = 1; +} else { + if (-f 'OUTPUT/sentinel') { + my @s = stat('OUTPUT/sentinel'); + my $mtime = $s[9]; + my @files = ('build/pushbuild.txt', 'build/AMBuildScript', 'build/product.version'); + my ($i); + for ($i = 0; $i <= $#files; $i++) { + if (IsNewer($files[$i], $mtime)) { + $reconf = 1; + last; + } + } + } else { + $reconf = 1; + } +} + +if ($reconf) { + rmtree('OUTPUT'); + mkdir('OUTPUT') or die("Failed to create output folder: $!\n"); + chdir('OUTPUT'); + + print "Attempting to reconfigure...\n"; + + my ($os, $bits, $mode); + $os = $ARGV[0]; + $bits = $ARGV[1]; + $mode = $ARGV[2]; + + my ($prefix, $python); + if ($^O eq "darwin") { + $prefix = 'CC="ccache clang" CXX="ccache clang++" '; + $python = 'python3'; + } elsif ($^O eq "linux") { + $prefix = 'CC="ccache gcc-4.4" CXX="ccache g++-4.4" '; + $python = 'python3'; + } elsif ($^O =~ /MSWin/) { + $prefix = ''; + $python = "C:\\Python31\\Python.exe"; + } + + my ($cmdstring); + $cmdstring = $prefix . + $python . ' ' . + Build::PathFormat('../build/configure.py') . ' '; + + if ($mode eq 'release') { + $cmdstring .= '--enable-optimize '; + } else { + $cmdstring .= '--enable-debug '; + } + + if ($bits eq '32') { + $cmdstring .= '--arch=x86 '; + } else { + $cmdstring .= '--arch-x64 '; + } + + my ($result); + $result = `$cmdstring`; + + print "$result\n"; + if ($? != 0) { + die("Could not configure: $!\n"); + } + open(FILE, '>sentinel'); + print FILE "this is nothing.\n"; + close(FILE); +} + +sub IsNewer +{ + my ($file, $time) = (@_); + + my @s = stat($file); + my $mtime = $s[9]; + return $mtime > $time; +} + +exit(0); + +