From b63b94bc816cd2edc8181cc4d6f31576b8f2b7e2 Mon Sep 17 00:00:00 2001
From: Scott Ehlert <ds@alliedmods.net>
Date: Sun, 1 May 2011 00:17:11 -0500
Subject: [PATCH] Updated buildbot scripts to support clang builders.

---
 AMBuildScript               |  2 ++
 tools/buildbot/bootstrap.pl | 17 +++++++++++------
 tools/buildbot/package.pl   |  8 +++++++-
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/AMBuildScript b/AMBuildScript
index 7e94e4d9..74260bab 100644
--- a/AMBuildScript
+++ b/AMBuildScript
@@ -155,6 +155,8 @@ class SM:
 			#Platform-specifics
 			if AMBuild.target['platform'] == 'linux':
 				self.compiler.AddToListVar('CDEFINES', '_LINUX')
+				if self.vendor == 'clang':
+					self.compiler.AddToListVar('POSTLINKFLAGS', '-lgcc_eh')
 			elif AMBuild.target['platform'] == 'darwin':
 				self.compiler.AddToListVar('CFLAGS', ['-isysroot',
 				                                      '/Developer/SDKs/MacOSX10.5.sdk'])
diff --git a/tools/buildbot/bootstrap.pl b/tools/buildbot/bootstrap.pl
index 76ad13d8..f86b9e82 100755
--- a/tools/buildbot/bootstrap.pl
+++ b/tools/buildbot/bootstrap.pl
@@ -43,14 +43,19 @@ if ($reconf) {
 	rmtree('OUTPUT');
 	mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
 	chdir('OUTPUT');
-	my ($result);
+	my ($result, $argn);
+	$argn = $#ARGV + 1;
 	print "Attempting to reconfigure...\n";
-	if ($^O eq "linux") {
-		$result = `CC=gcc-4.1 CXX=gcc-4.1 python3.1 ../build/configure.py --enable-optimize`;
-	} elsif ($^O eq "darwin") {
-		$result = `CC=gcc-4.2 CXX=gcc-4.2 python3.1 ../build/configure.py --enable-optimize`;
+	if ($argn > 0 && $^O !~ /MSWin/) {
+		$result = `CC=$ARGV[0] CXX=$ARGV[0] python3.1 ../build/configure.py --enable-optimize`;
 	} else {
-		$result = `C:\\Python31\\Python.exe ..\\build\\configure.py --enable-optimize`;
+		if ($^O eq "linux") {
+			$result = `CC=gcc-4.1 CXX=gcc-4.1 python3.1 ../build/configure.py --enable-optimize`;
+		} elsif ($^O eq "darwin") {
+			$result = `CC=gcc-4.2 CXX=gcc-4.2 python3.1 ../build/configure.py --enable-optimize`;
+		} else {
+			$result = `C:\\Python31\\Python.exe ..\\build\\configure.py --enable-optimize`;
+		}
 	}
 	print "$result\n";
 	if ($? != 0) {
diff --git a/tools/buildbot/package.pl b/tools/buildbot/package.pl
index 8a07ff82..28b36420 100755
--- a/tools/buildbot/package.pl
+++ b/tools/buildbot/package.pl
@@ -5,9 +5,10 @@ use Cwd;
 use File::Basename;
 use Net::FTP;
 
-my ($ftp_file, $ftp_host, $ftp_user, $ftp_pass, $ftp_path);
+my ($ftp_file, $ftp_host, $ftp_user, $ftp_pass, $ftp_path, $tag);
 
 $ftp_file = shift;
+$tag = shift;
 
 open(FTP, $ftp_file) or die "Unable to read FTP config file $ftp_file: $!\n";
 $ftp_host = <FTP>;
@@ -49,6 +50,11 @@ else
     $version .= '-' . $^O;
 }
 
+if (defined $tag)
+{
+	$version .= '-' . $tag;
+}
+
 my ($filename);
 $filename = 'sourcemod-' . $version;
 if ($^O eq "linux")