1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-08 23:46:20 +01:00
HLMetaModOfficial/support/buildbot/bootstrap.pl

97 lines
2.0 KiB
Perl
Raw Normal View History

#!/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);
use FindBin;
use lib $FindBin::Bin;
require 'helpers.pm';
#Go back to tree root.
my ($result);
chdir(Build::PathFormat('../..'));
$result = `git submodule update --init --recursive`;
print "$result\n";
#Go back above build dir
chdir(Build::PathFormat('..'));
#Get the source path.
our ($root) = getcwd();
my $reconf = 0;
2020-08-19 22:34:12 +02:00
my $trigger_file = 'support/buildbot/trigger_full_rebuild';
if (-f $trigger_file) {
my $trigger_mtime = (stat $trigger_file)[9];
if (-f 'OUTPUT/.ambuild2/graph') {
my $graph_mtime = (stat 'OUTPUT/.ambuild2/graph')[9];
if ($trigger_mtime > $graph_mtime) {
print "Trigger time $trigger_mtime > $graph_mtime, cleaning objdir...\n";
rmtree('OUTPUT');
}
}
}
2013-11-18 19:22:06 +01:00
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;
2014-05-27 07:41:20 +02:00
print "Attempting to reconfigure...\n";
2014-05-27 07:41:20 +02:00
my @conf_argv = (
'--enable-optimize',
'--breakpad-dump',
2014-05-27 07:41:20 +02:00
'--no-color',
'--symbol-files'
);
if ($^O =~ /darwin/) {
push(@conf_argv, '--hl2sdk-root=/Volumes/hgshare');
} elsif ($^O =~ /linux/) {
push(@conf_argv, '--hl2sdk-root=/hgshare');
} elsif ($^O =~ /MSWin/) {
push(@conf_argv, '--hl2sdk-root=H:\\');
}
2020-08-21 08:27:53 +02:00
push(@conf_argv, '--targets=x86,x86_64');
2020-08-19 22:34:12 +02:00
push(@conf_argv, '--sdks=all');
2014-05-27 07:41:20 +02:00
my $conf_args = join(' ', @conf_argv);
if ($argn > 0 && $^O !~ /MSWin/) {
2021-07-12 07:24:38 +02:00
$result = `CC=$ARGV[0] CXX=$ARGV[0] python3 ../build/configure.py $conf_args`;
} else {
if ($^O =~ /MSWin/) {
2020-08-19 22:34:12 +02:00
$result = `C:\\Python38\\Python.exe ..\\build\\configure.py $conf_args`;
} else {
2021-07-12 07:24:38 +02:00
$result = `CC=clang CXX=clang python3 ../build/configure.py $conf_args`;
}
}
print "$result\n";
if ($? != 0) {
die("Could not configure: $!\n");
}
sub IsNewer
{
my ($file, $time) = (@_);
my @s = stat($file);
my $mtime = $s[9];
return $mtime > $time;
}
exit(0);