Switch bootstrap.pl and startbuild.pl to AMBuild.

Former-commit-id: 462765c926
This commit is contained in:
David Anderson 2014-02-08 21:23:02 -08:00
parent f0f319a418
commit 426771deda
2 changed files with 48 additions and 55 deletions

View File

@ -12,54 +12,44 @@ require 'helpers.pm';
#Go to main source dir
chdir(Build::PathFormat('../..'));
#Do the annoying revision bumping.
#Linux needs some help here.
if ($^O eq "linux" || $^O eq "darwin")
#Get the source path.
our ($root) = getcwd();
my $reconf = 0;
if (!(-f 'OUTPUT/.ambuild2/graph') || !(-f 'OUTPUT/.ambuild2/vars')) {
rmtree('OUTPUT');
mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
chdir('OUTPUT');
my ($result, $argn);
$argn = $#ARGV + 1;
print "Attempting to reconfigure...\n";
my $conf_args = '--enable-optimize --no-color';
if ($argn > 0 && $^O !~ /MSWin/) {
$result = `CC=$ARGV[0] CXX=$ARGV[0] python ../build/configure.py $conf_args`;
} else {
if ($^O =~ /MSWin/) {
$result = `C:\\Python27\\Python.exe ..\\build\\configure.py $conf_args`;
} else {
$result = `CC=clang CXX=clang python ../build/configure.py $conf_args`;
}
}
print "$result\n";
if ($? != 0) {
die("Could not configure: $!\n");
}
}
sub IsNewer
{
Build::Command("flip -u modules.versions");
Build::Command("flip -u support/versionchanger.pl");
Build::Command("chmod +x support/versionchanger.pl");
}
Build::Command(Build::PathFormat('support/versionchanger.pl') . ' --buildstring="-dev"');
#Build::Command(Build::PathFormat('support/versionchanger.pl'));
my ($file, $time) = (@_);
my $DEVENV = "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe";
my @s = stat($file);
my $mtime = $s[9];
return $mtime > $time;
}
#Build the amxmodx builder tool.
chdir('installer/builder');
if ($^O eq "linux" || $^O eq "darwin") {
Build::Command("make");
} else {
Build::Command("\"$DEVENV\" builder.csproj /p:Configuration=Release /t:Rebuild");
}
if (!(-f 'builder.exe')) {
die "Could not find build tool.\n";
}
chdir('../..');
exit(0);
if (-d '../OUTPUT') {
Build::Delete(Cwd::abs_path('../OUTPUT'));
}
Build::Command("mkdir " . Build::PathFormat('../OUTPUT'));
#Output directions on how to build.
open(DIRECTIONS, '>installer/builder/directions.info');
if ($^O eq "linux") {
print DIRECTIONS "compress = /bin/tar\n";
} elsif ($^O eq "darwin") {
print DIRECTIONS "compress = /usr/bin/zip\n";
} else {
print DIRECTIONS "compress = C:\\WINDOWS\\zip.exe\n";
}
print DIRECTIONS "source = " . Cwd::abs_path('.') . "\n";
print DIRECTIONS "makeopts = \n";
print DIRECTIONS "output = " . Cwd::abs_path('../OUTPUT') . "\n";
if ($^O eq "linux" || $^O eq "darwin") {
print DIRECTIONS "devenv = /usr/bin/make\n";
} else {
print DIRECTIONS "devenv = $DEVENV\n";
}
print DIRECTIONS "release = amxmodx-" . Build::ProductVersion('product.version') .
"-hg" . Build::HgRevNum('.') . "\n";
close(DIRECTIONS);

View File

@ -7,19 +7,22 @@ chdir($path);
require 'helpers.pm';
chdir('../../installer/builder');
chdir('../../OUTPUT');
my $output;
if ($^O eq "linux" || $^O eq "darwin") {
$output = `mono builder.exe directions.info`;
} else {
$output = `builder.exe directions.info`;
my $argn = $#ARGV + 1;
if ($argn > 0) {
$ENV{CC} = $ARGV[0];
$ENV{CXX} = $ARGV[0];
}
print $output . "\n";
if (!($output =~ /Build succeeded/)) {
die "Build failed!\n";
} else {
system("ambuild --no-color 2>&1");
if ($? != 0)
{
die "Build failed: $!\n";
}
else
{
exit(0);
}