From 90ddd9d56ff5eb9ed1306d98ee9a9b4ceb300641 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 18 Nov 2008 03:22:50 -0600 Subject: [PATCH] Added build script. --- support/README.txt | 7 +++ support/buildbot/startbuild.pl | 106 +++++++++++++++++++++++++++++++++ support/metaplugins.ini | 14 +++++ 3 files changed, 127 insertions(+) create mode 100644 support/README.txt create mode 100755 support/buildbot/startbuild.pl create mode 100644 support/metaplugins.ini diff --git a/support/README.txt b/support/README.txt new file mode 100644 index 0000000..a54ccb5 --- /dev/null +++ b/support/README.txt @@ -0,0 +1,7 @@ +Visit: + + http://wiki.alliedmods.net/Category:Metamod:Source_Documentation + + for more information. + + diff --git a/support/buildbot/startbuild.pl b/support/buildbot/startbuild.pl new file mode 100755 index 0000000..5c500e9 --- /dev/null +++ b/support/buildbot/startbuild.pl @@ -0,0 +1,106 @@ +#!/usr/bin/perl + +use File::Basename; + +our (@LIBRARIES); +my ($myself, $path) = fileparse($0); +chdir($path); + +require 'helpers.pm'; + +#Get to top of source tree +chdir('..'); +chdir('..'); + +Build('loader', '', 'server', 'full'); +Build('core-legacy', '', 'metamod.1.ep1', ''); +Build('core', 'OrangeBox', 'metamod.2.ep2', ''); +Build('core', 'Left4Dead', 'metamod.2.l4d', ''); + +#Structure our output folder +mkdir('OUTPUT'); +mkdir(Build::PathFormat('OUTPUT/addons')); +mkdir(Build::PathFormat('OUTPUT/addons/metamod')); +mkdir(Build::PathFormat('OUTPUT/addons/metamod/bin')); + +my ($i); +for ($i = 0; $i <= $#LIBRARIES; $i++) +{ + my $library = $LIBRARIES[$i]; + Copy($library, Build::PathFormat('OUTPUT/addons/metamod/bin')); +} +Copy(Build::PathFormat('support/metaplugins.ini'), + Build::PathFormat('OUTPUT/addons/metamod')); +Copy(Build::PathFormat('support/README.txt'), + Build::PathFormat('OUTPUT/addons/metamod')); + +sub Copy +{ + my ($a, $b) = (@_); + + die "Could not copy $a to $b!\n" if (!Build::Copy($a, $b)); +} + +sub Build +{ + my ($srcdir, $objdir, $binary, $suffix) = (@_); + + if ($^O eq "linux") + { + if ($suffix eq 'full') + { + $binary .= '_i486.so'; + } + else + { + $binary .= '.so'; + } + BuildLinux($srcdir, $objdir, $binary); + } +} + +sub BuildLinux +{ + my ($srcdir, $build, $binary) = (@_); + my ($dir, $file, $param); + + $dir = getcwd(); + chdir($srcdir); + + $param = ""; + $file = "Release"; + if ($build eq "OrangeBox") + { + $param = "ENGINE=orangebox"; + $file .= '.orangebox'; + } + elsif ($build eq "Left4Dead") + { + $param = "ENGINE=left4dead"; + $file .= '.left4dead'; + } + $file .= '/' . $binary; + + print "Cleaning $srcdir...\n"; + system("make $param clean"); + CheckFailure(); + + print "Building $srcdir for $binary...\n"; + print "$param\n"; + system("make $param"); + CheckFailure(); + + die "Output library not found: $file\n" if (!-f $file); + + chdir($dir); + + push(@LIBRARIES, $srcdir . '/' . $file); +} + +sub CheckFailure +{ + die "Build failed: $!\n" if $? == -1; + die "Build died :(\n" if $^O eq "linux" and $? & 127; + die "Build failed with exit code: " . ($? >> 8) . "\n" if ($? >> 8 != 0); +} + diff --git a/support/metaplugins.ini b/support/metaplugins.ini new file mode 100644 index 0000000..22fc04d --- /dev/null +++ b/support/metaplugins.ini @@ -0,0 +1,14 @@ +;If your plugin came with a .vdf file, you do not need to use this file. +; +;List one plugin per line. Each line should contain the path to the plugin's binary. +;Any line starting with a ';' character is a comment line, and is ignored. +; +;You do not need to include the _i486.so or .dll part of the file name. Example: +; addons/sourcemod/bin/sourcemod_mm +;You may also put an alias in front of the file, for example: +; sm addons/sourcemod/bin/sourcemod_mm +;Will allow you to use "meta load sm" from the console. +; +;********* LIST PLUGINS BELOW *********** + +