1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/support/buildbot/startbuild.pl Tue Nov 18 03:22:50 2008 -0600
1.3 @@ -0,0 +1,106 @@
1.4 +#!/usr/bin/perl
1.5 +
1.6 +use File::Basename;
1.7 +
1.8 +our (@LIBRARIES);
1.9 +my ($myself, $path) = fileparse($0);
1.10 +chdir($path);
1.11 +
1.12 +require 'helpers.pm';
1.13 +
1.14 +#Get to top of source tree
1.15 +chdir('..');
1.16 +chdir('..');
1.17 +
1.18 +Build('loader', '', 'server', 'full');
1.19 +Build('core-legacy', '', 'metamod.1.ep1', '');
1.20 +Build('core', 'OrangeBox', 'metamod.2.ep2', '');
1.21 +Build('core', 'Left4Dead', 'metamod.2.l4d', '');
1.22 +
1.23 +#Structure our output folder
1.24 +mkdir('OUTPUT');
1.25 +mkdir(Build::PathFormat('OUTPUT/addons'));
1.26 +mkdir(Build::PathFormat('OUTPUT/addons/metamod'));
1.27 +mkdir(Build::PathFormat('OUTPUT/addons/metamod/bin'));
1.28 +
1.29 +my ($i);
1.30 +for ($i = 0; $i <= $#LIBRARIES; $i++)
1.31 +{
1.32 + my $library = $LIBRARIES[$i];
1.33 + Copy($library, Build::PathFormat('OUTPUT/addons/metamod/bin'));
1.34 +}
1.35 +Copy(Build::PathFormat('support/metaplugins.ini'),
1.36 + Build::PathFormat('OUTPUT/addons/metamod'));
1.37 +Copy(Build::PathFormat('support/README.txt'),
1.38 + Build::PathFormat('OUTPUT/addons/metamod'));
1.39 +
1.40 +sub Copy
1.41 +{
1.42 + my ($a, $b) = (@_);
1.43 +
1.44 + die "Could not copy $a to $b!\n" if (!Build::Copy($a, $b));
1.45 +}
1.46 +
1.47 +sub Build
1.48 +{
1.49 + my ($srcdir, $objdir, $binary, $suffix) = (@_);
1.50 +
1.51 + if ($^O eq "linux")
1.52 + {
1.53 + if ($suffix eq 'full')
1.54 + {
1.55 + $binary .= '_i486.so';
1.56 + }
1.57 + else
1.58 + {
1.59 + $binary .= '.so';
1.60 + }
1.61 + BuildLinux($srcdir, $objdir, $binary);
1.62 + }
1.63 +}
1.64 +
1.65 +sub BuildLinux
1.66 +{
1.67 + my ($srcdir, $build, $binary) = (@_);
1.68 + my ($dir, $file, $param);
1.69 +
1.70 + $dir = getcwd();
1.71 + chdir($srcdir);
1.72 +
1.73 + $param = "";
1.74 + $file = "Release";
1.75 + if ($build eq "OrangeBox")
1.76 + {
1.77 + $param = "ENGINE=orangebox";
1.78 + $file .= '.orangebox';
1.79 + }
1.80 + elsif ($build eq "Left4Dead")
1.81 + {
1.82 + $param = "ENGINE=left4dead";
1.83 + $file .= '.left4dead';
1.84 + }
1.85 + $file .= '/' . $binary;
1.86 +
1.87 + print "Cleaning $srcdir...\n";
1.88 + system("make $param clean");
1.89 + CheckFailure();
1.90 +
1.91 + print "Building $srcdir for $binary...\n";
1.92 + print "$param\n";
1.93 + system("make $param");
1.94 + CheckFailure();
1.95 +
1.96 + die "Output library not found: $file\n" if (!-f $file);
1.97 +
1.98 + chdir($dir);
1.99 +
1.100 + push(@LIBRARIES, $srcdir . '/' . $file);
1.101 +}
1.102 +
1.103 +sub CheckFailure
1.104 +{
1.105 + die "Build failed: $!\n" if $? == -1;
1.106 + die "Build died :(\n" if $^O eq "linux" and $? & 127;
1.107 + die "Build failed with exit code: " . ($? >> 8) . "\n" if ($? >> 8 != 0);
1.108 +}
1.109 +