1.1 --- a/support/buildbot/startbuild.pl Wed May 12 22:56:31 2010 -0700
1.2 +++ b/support/buildbot/startbuild.pl Fri May 14 00:34:36 2010 -0500
1.3 @@ -1,183 +1,27 @@
1.4 #!/usr/bin/perl
1.5 +# vim: set ts=2 sw=2 tw=99 noet:
1.6
1.7 use File::Basename;
1.8
1.9 -our (@LIBRARIES);
1.10 my ($myself, $path) = fileparse($0);
1.11 chdir($path);
1.12
1.13 require 'helpers.pm';
1.14
1.15 -#Get to top of source tree
1.16 -chdir('..');
1.17 -chdir('..');
1.18 -
1.19 -# Folder .vcproj Engine Binary Suffix type Platform
1.20 -Build('loader', 'mm_loader', '', 'server', 'full', 'both');
1.21 -Build('loader', 'mm_loader', 'Left4Dead2', 'server', '', 'linux');
1.22 -Build('core-legacy', 'mm_core-legacy', '', 'metamod.1.ep1', '', 'both');
1.23 -Build('core', 'mm_core', 'OrangeBox', 'metamod.2.ep2', '', 'both');
1.24 -Build('core', 'mm_core', 'OrangeBoxValve', 'metamod.2.ep2v', '', 'both');
1.25 -Build('core', 'mm_core', 'Left4Dead', 'metamod.2.l4d', '', 'both');
1.26 -Build('core', 'mm_core', 'Left4Dead2', 'metamod.2.l4d2', '', 'both');
1.27 -Build('core', 'mm_core', 'DarkMessiah', 'metamod.2.darkm', '', 'windows');
1.28 -
1.29 -#Structure our output folder
1.30 -mkdir('OUTPUT');
1.31 -mkdir(Build::PathFormat('OUTPUT/addons'));
1.32 -mkdir(Build::PathFormat('OUTPUT/addons/metamod'));
1.33 -mkdir(Build::PathFormat('OUTPUT/addons/metamod/bin'));
1.34 -
1.35 -my ($i);
1.36 -for ($i = 0; $i <= $#LIBRARIES; $i++)
1.37 -{
1.38 - my $library = $LIBRARIES[$i];
1.39 - Copy($library, Build::PathFormat('OUTPUT/addons/metamod/bin'));
1.40 -}
1.41 -Copy(Build::PathFormat('support/metaplugins.ini'),
1.42 - Build::PathFormat('OUTPUT/addons/metamod'));
1.43 -Copy(Build::PathFormat('support/README.txt'),
1.44 - Build::PathFormat('OUTPUT/addons/metamod'));
1.45 -
1.46 -sub Copy
1.47 -{
1.48 - my ($a, $b) = (@_);
1.49 +chdir('../../../OUTPUT');
1.50
1.51 - die "Could not copy $a to $b!\n" if (!Build::Copy($a, $b));
1.52 -}
1.53 -
1.54 -sub Build
1.55 -{
1.56 - my ($srcdir, $vcproj, $objdir, $binary, $suffix, $platform) = (@_);
1.57 -
1.58 - if ($^O eq "linux")
1.59 - {
1.60 - if ($platform eq "windows")
1.61 - {
1.62 - return;
1.63 - }
1.64 -
1.65 - if ($suffix eq 'full')
1.66 - {
1.67 - $binary .= '_i486.so';
1.68 - }
1.69 - else
1.70 - {
1.71 - $binary .= '.so';
1.72 - }
1.73 -
1.74 - BuildLinux($srcdir, $objdir, $binary);
1.75 - }
1.76 - else
1.77 - {
1.78 - if ($platform eq "linux")
1.79 - {
1.80 - return;
1.81 - }
1.82 -
1.83 - $binary .= '.dll';
1.84 - BuildWindows($srcdir, $vcproj, $objdir, $binary);
1.85 - }
1.86 +if ($^O eq "linux" || $^O eq "darwin") {
1.87 + system("python3.1 build.py 2>&1");
1.88 +} else {
1.89 + system("C:\\Python31\\python.exe build.py 2>&1");
1.90 }
1.91
1.92 -sub BuildWindows
1.93 +if ($? != 0)
1.94 {
1.95 - my ($srcdir, $vcproj, $build, $binary) = (@_);
1.96 - my ($dir, $file, $param, $vcbuilder, $cmd);
1.97 -
1.98 - $dir = getcwd();
1.99 - chdir("$srcdir\\msvc9");
1.100 -
1.101 - $param = "Release";
1.102 - if ($build eq "OrangeBox")
1.103 - {
1.104 - $param = "Release - Orange Box";
1.105 - }
1.106 - if ($build eq "OrangeBoxValve")
1.107 - {
1.108 - $param = "Release - Orange Box Valve";
1.109 - }
1.110 - elsif ($build eq "Left4Dead")
1.111 - {
1.112 - $param = "Release - Left 4 Dead";
1.113 - }
1.114 - elsif ($build eq "Left4Dead2")
1.115 - {
1.116 - $param = "Release - Left 4 Dead 2";
1.117 - }
1.118 - elsif ($build eq "DarkMessiah")
1.119 - {
1.120 - $param = "Release - Dark Messiah";
1.121 - }
1.122 -
1.123 - print "Clean building $srcdir...\n";
1.124 - $vcbuilder = $ENV{'VC9BUILDER'};
1.125 - $cmd = "\"$vcbuilder\" /rebuild \"$vcproj.vcproj\" \"$param\"";
1.126 - print "$cmd\n";
1.127 - system($cmd);
1.128 - CheckFailure();
1.129 -
1.130 - $file = "$param\\$binary";
1.131 -
1.132 - die "Output library not found: $file\n" if (!-f $file);
1.133 -
1.134 - chdir($dir);
1.135 -
1.136 - push(@LIBRARIES, "$srcdir\\msvc9\\$file");
1.137 + die "Build failed: $!\n";
1.138 +}
1.139 +else
1.140 +{
1.141 + exit(0);
1.142 }
1.143
1.144 -sub BuildLinux
1.145 -{
1.146 - my ($srcdir, $build, $binary) = (@_);
1.147 - my ($dir, $file, $param);
1.148 -
1.149 - $dir = getcwd();
1.150 - chdir($srcdir);
1.151 -
1.152 - $param = "";
1.153 - $file = "Release";
1.154 - if ($build eq "OrangeBox")
1.155 - {
1.156 - $param = "ENGINE=orangebox";
1.157 - $file .= '.orangebox';
1.158 - }
1.159 - if ($build eq "OrangeBoxValve")
1.160 - {
1.161 - $param = "ENGINE=orangeboxvalve";
1.162 - $file .= '.orangeboxvalve';
1.163 - }
1.164 - elsif ($build eq "Left4Dead")
1.165 - {
1.166 - $param = "ENGINE=left4dead";
1.167 - $file .= '.left4dead';
1.168 - }
1.169 - elsif ($build eq "Left4Dead2")
1.170 - {
1.171 - $param = "ENGINE=left4dead2";
1.172 - $file .= '.left4dead2';
1.173 - }
1.174 - $file .= '/' . $binary;
1.175 -
1.176 - print "Cleaning $srcdir...\n";
1.177 - system("make $param clean");
1.178 - CheckFailure();
1.179 -
1.180 - print "Building $srcdir for $binary...\n";
1.181 - print "$param\n";
1.182 - system("make $param");
1.183 - CheckFailure();
1.184 -
1.185 - die "Output library not found: $file\n" if (!-f $file);
1.186 -
1.187 - chdir($dir);
1.188 -
1.189 - push(@LIBRARIES, $srcdir . '/' . $file);
1.190 -}
1.191 -
1.192 -sub CheckFailure
1.193 -{
1.194 - die "Build failed: $!\n" if $? == -1;
1.195 - die "Build died :(\n" if $^O eq "linux" and $? & 127;
1.196 - die "Build failed with exit code: " . ($? >> 8) . "\n" if ($? >> 8 != 0);
1.197 -}
1.198 -