2008-11-18 09:28:38 +01:00
|
|
|
#!/usr/bin/perl
|
2010-05-14 07:34:36 +02:00
|
|
|
# vim: set ts=2 sw=2 tw=99 noet:
|
2008-11-18 09:28:38 +01:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use Cwd;
|
|
|
|
use File::Basename;
|
2010-05-14 07:34:36 +02:00
|
|
|
use File::Path;
|
2008-11-18 09:28:38 +01:00
|
|
|
|
|
|
|
my ($myself, $path) = fileparse($0);
|
|
|
|
chdir($path);
|
|
|
|
|
|
|
|
require 'helpers.pm';
|
|
|
|
|
2010-05-14 07:34:36 +02:00
|
|
|
#Go back above build dir
|
|
|
|
chdir(Build::PathFormat('../../..'));
|
2008-11-18 09:28:38 +01:00
|
|
|
|
2010-05-14 07:34:36 +02:00
|
|
|
#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');
|
2011-05-01 05:41:54 +02:00
|
|
|
my ($result, $argn);
|
|
|
|
$argn = $#ARGV + 1;
|
2010-05-14 07:34:36 +02:00
|
|
|
print "Attempting to reconfigure...\n";
|
2011-05-01 05:41:54 +02:00
|
|
|
if ($argn > 0 && $^O !~ /MSWin/) {
|
2012-03-21 11:28:25 +01:00
|
|
|
$result = `CC=$ARGV[0] CXX=$ARGV[0] python3 ../build/configure.py --enable-optimize`;
|
2010-05-14 07:34:36 +02:00
|
|
|
} else {
|
2011-05-01 05:41:54 +02:00
|
|
|
if ($^O eq "linux") {
|
2012-03-21 11:28:25 +01:00
|
|
|
$result = `CC=gcc-4.4 CXX=gcc-4.4 python3 ../build/configure.py --enable-optimize`;
|
2011-05-01 05:41:54 +02:00
|
|
|
} elsif ($^O eq "darwin") {
|
2012-03-21 11:28:25 +01:00
|
|
|
$result = `CC=clang CXX=clang python3 ../build/configure.py --enable-optimize`;
|
2011-05-01 05:41:54 +02:00
|
|
|
} else {
|
|
|
|
$result = `C:\\Python31\\Python.exe ..\\build\\configure.py --enable-optimize`;
|
|
|
|
}
|
2010-05-14 07:34:36 +02:00
|
|
|
}
|
|
|
|
print "$result\n";
|
|
|
|
if ($? != 0) {
|
|
|
|
die('Could not configure!');
|
|
|
|
}
|
|
|
|
open(FILE, '>sentinel');
|
|
|
|
print FILE "this is nothing.\n";
|
|
|
|
close(FILE);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub IsNewer
|
2008-11-18 09:28:38 +01:00
|
|
|
{
|
2010-05-14 07:34:36 +02:00
|
|
|
my ($file, $time) = (@_);
|
|
|
|
|
|
|
|
my @s = stat($file);
|
|
|
|
my $mtime = $s[9];
|
|
|
|
return $mtime > $time;
|
2008-11-18 09:28:38 +01:00
|
|
|
}
|
2010-05-14 07:34:36 +02:00
|
|
|
|
|
|
|
exit(0);
|
|
|
|
|
2008-11-18 09:28:38 +01:00
|
|
|
|