Imported support for new build system.
This commit is contained in:
+46
-71
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# vim: set ts=2 sw=2 tw=99 noet:
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
@@ -9,88 +10,62 @@ chdir($path);
|
||||
|
||||
require 'helpers.pm';
|
||||
|
||||
chdir(Build::PathFormat('../builder'));
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
Build::Command('make clean');
|
||||
Build::Command('make');
|
||||
}
|
||||
else
|
||||
{
|
||||
Build::Command('"' . $ENV{'VC9BUILDER'} . '" /rebuild builder.csproj Release');
|
||||
Build::Command('move ' . Build::PathFormat('bin/Release/builder.exe') . ' .');
|
||||
}
|
||||
|
||||
die "Unable to build builder tool!\n" unless -e 'builder.exe';
|
||||
|
||||
#Go back to main source dir.
|
||||
chdir(Build::PathFormat('../..'));
|
||||
#Go back above build dir
|
||||
chdir(Build::PathFormat('../../..'));
|
||||
|
||||
#Get the source path.
|
||||
our ($root) = getcwd();
|
||||
|
||||
my $reconf = 0;
|
||||
|
||||
#Create output folder if it doesn't exist.
|
||||
if (!(-d 'OUTPUT')) {
|
||||
mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
|
||||
mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
|
||||
$reconf = 1;
|
||||
} else {
|
||||
if (-f 'OUTPUT/sentinel') {
|
||||
my @s = stat('OUTPUT/sentinel');
|
||||
my $mtime = $s[9];
|
||||
my @files = ('build/pushbuild.txt', 'build/AMBuildScript', 'build/product.version');
|
||||
my ($i);
|
||||
for ($i = 0; $i <= $#files; $i++) {
|
||||
if (IsNewer($files[$i], $mtime)) {
|
||||
$reconf = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$reconf = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#Write the configuration file.
|
||||
open(CONF, '>build.cfg') or die("Failed to write build.cfg: $!\n");
|
||||
print CONF "OutputBase = " . Build::PathFormat($root . '/OUTPUT') . "\n";
|
||||
print CONF "SourceBase = $root\n";
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
print CONF "BuilderPath = /usr/bin/make\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print CONF "BuilderPath = " . $ENV{'VC9BUILDER'} . "\n";
|
||||
print CONF "PDBLog = $root\\OUTPUT\\pdblog.txt\n";
|
||||
}
|
||||
close(CONF);
|
||||
|
||||
#Do the annoying revision bumping.
|
||||
#Linux needs some help here.
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
Build::Command("flip -u modules.versions");
|
||||
Build::Command("flip -u tools/versionchanger.pl");
|
||||
Build::Command("chmod +x tools/versionchanger.pl");
|
||||
}
|
||||
my ($build_type);
|
||||
$build_type = Build::GetBuildType(Build::PathFormat('tools/buildbot/build_type'));
|
||||
if ($build_type == "dev")
|
||||
{
|
||||
Build::Command(Build::PathFormat('tools/versionchanger.pl') . ' --buildstring="-dev"');
|
||||
if ($reconf) {
|
||||
chdir('OUTPUT');
|
||||
my ($result);
|
||||
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`;
|
||||
} else {
|
||||
$result = `C:\\Python31\\Python.exe ..\\build\\configure.py --enable-optimize`;
|
||||
}
|
||||
print "$result\n";
|
||||
if ($? != 0) {
|
||||
die('Could not configure!');
|
||||
}
|
||||
open(FILE, '>sentinel');
|
||||
print FILE "this is nothing.\n";
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
#Bootstrap extensions that have complex dependencies
|
||||
sub IsNewer
|
||||
{
|
||||
my ($file, $time) = (@_);
|
||||
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
BuildLibCurl_Linux();
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildLibCurl_Win32();
|
||||
my @s = stat($file);
|
||||
my $mtime = $s[9];
|
||||
return $mtime > $time;
|
||||
}
|
||||
|
||||
sub BuildLibCurl_Win32
|
||||
{
|
||||
chdir("extensions\\curl\\curl-src\\lib");
|
||||
Build::Command('"' . $ENV{'VC9BUILDER'} . '" /rebuild build_libcurl.vcproj "LIB Release"');
|
||||
die "Unable to find libcurl.lib!\n" unless (-f "LIB-Release\\libcurl.lib");
|
||||
chdir("..\\..\\..\\..");
|
||||
}
|
||||
exit(0);
|
||||
|
||||
|
||||
sub BuildLibCurl_Linux
|
||||
{
|
||||
chdir("extensions/curl/curl-src");
|
||||
Build::Command("mkdir -p Release");
|
||||
Build::Command("chmod +x configure");
|
||||
chdir("Release");
|
||||
Build::Command("../configure --enable-static --disable-shared --disable-ldap --without-ssl --without-zlib");
|
||||
Build::Command("make");
|
||||
die "Unable to find libcurl.a!\n" unless (-f "lib/.libs/libcurl.a");
|
||||
chdir("../../../..");
|
||||
}
|
||||
|
||||
@@ -27,12 +27,13 @@ chdir($path);
|
||||
require 'helpers.pm';
|
||||
|
||||
#Switch to the output folder.
|
||||
chdir(Build::PathFormat('../../OUTPUT/base'));
|
||||
chdir(Build::PathFormat('../../../OUTPUT/package'));
|
||||
|
||||
my ($version);
|
||||
|
||||
$version = Build::ProductVersion(Build::PathFormat('../../product.version'));
|
||||
$version .= '-hg' . Build::HgRevNum('../..');
|
||||
$version = Build::ProductVersion(Build::PathFormat('../../build/product.version'));
|
||||
$version =~ s/-dev//g;
|
||||
$version .= '-hg' . Build::HgRevNum('../../build');
|
||||
|
||||
my ($filename);
|
||||
$filename = 'sourcemod-' . $version;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# vim: set ts=2 sw=2 tw=99 noet:
|
||||
|
||||
use File::Basename;
|
||||
|
||||
@@ -7,33 +8,20 @@ chdir($path);
|
||||
|
||||
require 'helpers.pm';
|
||||
|
||||
chdir('..');
|
||||
chdir('..');
|
||||
chdir('../../../OUTPUT');
|
||||
|
||||
my ($cmd, $output);
|
||||
|
||||
$cmd = Build::PathFormat('tools/builder/builder.exe') . ' build.cfg'; # 2>&1';
|
||||
|
||||
if ($^O eq "linux")
|
||||
{
|
||||
$cmd = 'mono ' . $cmd;
|
||||
if ($^O eq "linux") {
|
||||
system("python3.1 build.py 2>&1");
|
||||
} else {
|
||||
system("C:\\Python31\\python.exe build.py 2>&1");
|
||||
}
|
||||
|
||||
system($cmd);
|
||||
|
||||
if ($? == -1)
|
||||
if ($? != 0)
|
||||
{
|
||||
die "Build failed: $!\n";
|
||||
}
|
||||
elsif ($^O eq "linux" and $? & 127)
|
||||
{
|
||||
die "Build died :(\n";
|
||||
}
|
||||
elsif ($? >> 8 != 0)
|
||||
{
|
||||
die "Build failed with exit code: " . ($? >> 8) . "\n";
|
||||
die "Build failed: $!\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(0);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ chdir('..');
|
||||
|
||||
our $SSH = 'ssh -i ../../smpvkey';
|
||||
|
||||
open(PDBLOG, 'OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n";
|
||||
open(PDBLOG, '../OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n";
|
||||
|
||||
#Sync us up with the main symbol store
|
||||
rsync('[email protected]:~/public_html/symbols/', '..\\..\\symstore');
|
||||
@@ -20,16 +20,17 @@ rsync('[email protected]:~/public_html/symbols/', '..\\..\\symstore');
|
||||
#Get version info
|
||||
my ($version);
|
||||
$version = Build::ProductVersion(Build::PathFormat('product.version'));
|
||||
$version =~ s/-dev//g;
|
||||
$version .= '-hg' . Build::HgRevNum('.');
|
||||
|
||||
my ($build_type);
|
||||
$build_type = Build::GetBuildType(Build::PathFormat('tools/buildbot/build_type'));
|
||||
|
||||
if ($build_type == "dev")
|
||||
if ($build_type eq "dev")
|
||||
{
|
||||
$build_type = "buildbot";
|
||||
}
|
||||
elsif ($build_type == "rel")
|
||||
elsif ($build_type eq "rel")
|
||||
{
|
||||
$build_type = "release";
|
||||
}
|
||||
@@ -40,7 +41,7 @@ while (<PDBLOG>)
|
||||
$line = $_;
|
||||
$line =~ s/\.pdb/\*/;
|
||||
chomp $line;
|
||||
Build::Command("symstore add /r /f \"$line\" /s ..\\..\\symstore /t \"SourceMod\" /v \"$version\" /c \"$build_type\"");
|
||||
Build::Command("symstore add /r /f \"..\\OUTPUT\\$line\" /s ..\\..\\symstore /t \"SourceMod\" /v \"$version\" /c \"$build_type\"");
|
||||
}
|
||||
|
||||
close(PDBLOG);
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public abstract class ABuilder
|
||||
{
|
||||
public Config cfg;
|
||||
|
||||
public ABuilder()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract bool BuildLibrary(Package pkg, Library lib);
|
||||
|
||||
public abstract string GetPawnCompilerName();
|
||||
|
||||
public bool CompilePlugin(Package pkg, Plugin pl)
|
||||
{
|
||||
string local_dir = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting", cfg.pkg_path, pkg.GetBaseFolder());
|
||||
|
||||
string filepath = null;
|
||||
if (pl.Folder != null)
|
||||
{
|
||||
filepath = Config.PathFormat("{0}/{1}", pl.Folder, pl.Source);
|
||||
}
|
||||
else
|
||||
{
|
||||
filepath = pl.Source;
|
||||
}
|
||||
|
||||
ProcessStartInfo info = new ProcessStartInfo();
|
||||
info.WorkingDirectory = local_dir;
|
||||
info.FileName = Config.PathFormat("{0}/{1}", local_dir, GetPawnCompilerName());
|
||||
info.Arguments = filepath + ".sp";
|
||||
info.UseShellExecute = false;
|
||||
info.RedirectStandardOutput = true;
|
||||
info.RedirectStandardError = true;
|
||||
|
||||
Process p = Process.Start(info);
|
||||
string output = p.StandardOutput.ReadToEnd() + "\n";
|
||||
output += p.StandardError.ReadToEnd();
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
|
||||
Console.WriteLine(output);
|
||||
|
||||
string binary = Config.PathFormat("{0}/{1}/addons/sourcemod/scripting/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source);
|
||||
if (!File.Exists(binary))
|
||||
{
|
||||
Console.WriteLine("Could not find binary: " + binary);
|
||||
return false;
|
||||
}
|
||||
|
||||
string new_loc;
|
||||
if (pl.disabled)
|
||||
{
|
||||
new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/disabled/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_loc = Config.PathFormat("{0}/{1}/addons/sourcemod/plugins/{2}.smx", cfg.pkg_path, pkg.GetBaseFolder(), pl.Source);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (File.Exists(new_loc))
|
||||
{
|
||||
File.Delete(new_loc);
|
||||
}
|
||||
File.Move(binary, new_loc);
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CopyFile(Package pkg, string source, string dest)
|
||||
{
|
||||
string from = Config.PathFormat("{0}/{1}",
|
||||
cfg.source_path,
|
||||
source);
|
||||
string to = Config.PathFormat("{0}/{1}/{2}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder(),
|
||||
dest);
|
||||
|
||||
File.Copy(from, to, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** dest can be null to mean root base folder */
|
||||
public void CopyFolder(Package pkg, string source, string dest, string [] omits)
|
||||
{
|
||||
string from_base = Config.PathFormat("{0}/{1}", cfg.source_path, source);
|
||||
string to_base = null;
|
||||
|
||||
if (dest == null)
|
||||
{
|
||||
to_base = Config.PathFormat("{0}/{1}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder());
|
||||
}
|
||||
else
|
||||
{
|
||||
to_base = Config.PathFormat("{0}/{1}/{2}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder(),
|
||||
dest);
|
||||
}
|
||||
|
||||
string [] files = Directory.GetFiles(from_base);
|
||||
string file;
|
||||
|
||||
for (int i=0; i<files.Length; i++)
|
||||
{
|
||||
file = Path.GetFileName(files[i]);
|
||||
|
||||
if (omits != null)
|
||||
{
|
||||
bool skip = false;
|
||||
for (int j=0; j<omits.Length; j++)
|
||||
{
|
||||
if (file.CompareTo(omits[j]) == 0)
|
||||
{
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (skip)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dest = Config.PathFormat("{0}/{1}", to_base, file);
|
||||
File.Copy(files[i], dest, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void BuildPackage(Package pkg)
|
||||
{
|
||||
string path = Config.PathFormat("{0}/{1}", cfg.pkg_path, pkg.GetBaseFolder());
|
||||
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
|
||||
/* Create all dirs */
|
||||
string [] paths = pkg.GetFolders();
|
||||
for (int i=0; i<paths.GetLength(0); i++)
|
||||
{
|
||||
path = Config.PathFormat("{0}/{1}/{2}", cfg.pkg_path, pkg.GetBaseFolder(), paths[i]);
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
}
|
||||
|
||||
/* Do primitive copies */
|
||||
pkg.OnCopyFolders(this);
|
||||
pkg.OnCopyFiles(this);
|
||||
|
||||
/* Do libraries */
|
||||
Library [] libs = pkg.GetLibraries();
|
||||
for (int i=0; i<libs.Length; i++)
|
||||
{
|
||||
if (libs[i].build_mode == BuildMode.BuildMode_Episode1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((libs[i].platform & cfg.Platform) != cfg.Platform)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!BuildLibrary(pkg, libs[i]))
|
||||
{
|
||||
throw new System.Exception("Failed to compile library: " + libs[i].binary_name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Do plugins */
|
||||
Plugin [] plugins = pkg.GetPlugins();
|
||||
if (plugins != null)
|
||||
{
|
||||
for (int i=0; i<plugins.Length; i++)
|
||||
{
|
||||
if (!CompilePlugin(pkg, plugins[i]))
|
||||
{
|
||||
throw new System.Exception("Failed to compile plugin: " + plugins[i].Source);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
@@ -1,111 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
[Flags]
|
||||
public enum BasePlatform
|
||||
{
|
||||
Platform_Windows,
|
||||
Platform_Linux
|
||||
};
|
||||
|
||||
public class Config
|
||||
{
|
||||
public string source_path;
|
||||
public string pkg_path;
|
||||
public string builder_path;
|
||||
public string build_options;
|
||||
public string pdb_log_file;
|
||||
public builder.BasePlatform Platform;
|
||||
|
||||
public Config()
|
||||
{
|
||||
if ((int)System.Environment.OSVersion.Platform == 128)
|
||||
{
|
||||
Platform = BasePlatform.Platform_Linux;
|
||||
}
|
||||
else
|
||||
{
|
||||
Platform = BasePlatform.Platform_Windows;
|
||||
}
|
||||
}
|
||||
|
||||
public static string PathFormat(string format, params string [] args)
|
||||
{
|
||||
string temp = string.Format(format, args);
|
||||
return temp.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
public bool ReadFromFile(string file)
|
||||
{
|
||||
bool read = true;
|
||||
StreamReader sr = null;
|
||||
try
|
||||
{
|
||||
sr = new StreamReader(file);
|
||||
|
||||
string line;
|
||||
string delim = "\t \n\r\v";
|
||||
string split = "=";
|
||||
|
||||
while ( (line = sr.ReadLine()) != null )
|
||||
{
|
||||
line = line.Trim(delim.ToCharArray());
|
||||
if (line.Length < 1 || line[0] == ';')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string [] s = line.Split(split.ToCharArray());
|
||||
string key, val = "";
|
||||
if (s.GetLength(0) >= 1)
|
||||
{
|
||||
key = s[0];
|
||||
if (s.GetLength(0) >= 2)
|
||||
{
|
||||
for (int i=1; i<s.GetLength(0); i++)
|
||||
{
|
||||
val += s[i];
|
||||
}
|
||||
}
|
||||
key = key.Trim(delim.ToCharArray());
|
||||
val = val.Trim(delim.ToCharArray());
|
||||
if (key.CompareTo("SourceBase") == 0)
|
||||
{
|
||||
source_path = val;
|
||||
}
|
||||
else if (key.CompareTo("OutputBase") == 0)
|
||||
{
|
||||
pkg_path = val;
|
||||
}
|
||||
else if (key.CompareTo("BuilderPath") == 0)
|
||||
{
|
||||
builder_path = val;
|
||||
}
|
||||
else if (key.CompareTo("BuildOptions") == 0)
|
||||
{
|
||||
build_options = val;
|
||||
}
|
||||
else if (key.CompareTo("PDBLog") == 0)
|
||||
{
|
||||
pdb_log_file = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Console.WriteLine("Unable to read {0:s}: {1:s}", file, e.Message);
|
||||
read = false;
|
||||
}
|
||||
|
||||
if (sr != null)
|
||||
{
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
return read;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public class LinuxBuilder : ABuilder
|
||||
{
|
||||
public LinuxBuilder(Config _cfg)
|
||||
{
|
||||
cfg = _cfg;
|
||||
}
|
||||
|
||||
public override string GetPawnCompilerName()
|
||||
{
|
||||
return "spcomp";
|
||||
}
|
||||
|
||||
public override bool BuildLibrary(Package pkg, Library lib)
|
||||
{
|
||||
ProcessStartInfo info = new ProcessStartInfo();
|
||||
|
||||
string path = Config.PathFormat("{0}/{1}",
|
||||
cfg.source_path,
|
||||
lib.source_path);
|
||||
|
||||
/* PlatformExt ignored for us */
|
||||
string binName = lib.binary_name;
|
||||
|
||||
if (!lib.is_executable)
|
||||
{
|
||||
if (lib.has_platform_ext)
|
||||
{
|
||||
binName += "_i486.so";
|
||||
}
|
||||
else
|
||||
{
|
||||
binName += ".so";
|
||||
}
|
||||
}
|
||||
|
||||
string output_folder = (lib.release_mode == ReleaseMode.ReleaseMode_Release) ? "Release" : "Debug";
|
||||
|
||||
if (lib.build_mode == BuildMode.BuildMode_Episode2)
|
||||
{
|
||||
output_folder += ".orangebox";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2Valve)
|
||||
{
|
||||
output_folder += ".orangeboxvalve";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2Valve)
|
||||
{
|
||||
output_folder += ".orangeboxvalve";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
|
||||
{
|
||||
output_folder += ".original";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
|
||||
{
|
||||
output_folder += ".left4dead";
|
||||
}
|
||||
|
||||
string binpath = Config.PathFormat("{0}/{1}/{2}",
|
||||
path,
|
||||
output_folder,
|
||||
binName);
|
||||
|
||||
if (File.Exists(binpath))
|
||||
{
|
||||
File.Delete(binpath);
|
||||
}
|
||||
|
||||
string makefile_args = "CPP=gcc-4.1 ";
|
||||
|
||||
if (lib.build_mode == BuildMode.BuildMode_Episode1)
|
||||
{
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2)
|
||||
{
|
||||
makefile_args += "ENGINE=\"orangebox\" ";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2Valve)
|
||||
{
|
||||
makefile_args += "ENGINE=\"orangeboxvalve\" ";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2Valve)
|
||||
{
|
||||
makefile_args += "ENGINE=\"orangeboxvalve\" ";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
|
||||
{
|
||||
makefile_args += "ENGINE=\"original\"";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
|
||||
{
|
||||
makefile_args += "ENGINE=\"left4dead\"";
|
||||
}
|
||||
|
||||
/* Clean the project first */
|
||||
info.WorkingDirectory = path;
|
||||
info.FileName = cfg.builder_path;
|
||||
info.Arguments = makefile_args + " clean";
|
||||
info.UseShellExecute = false;
|
||||
|
||||
Process p = Process.Start(info);
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
|
||||
/* Now build it */
|
||||
info.WorkingDirectory = path;
|
||||
info.FileName = cfg.builder_path;
|
||||
info.Arguments = makefile_args;
|
||||
info.UseShellExecute = false;
|
||||
|
||||
if (cfg.build_options != null)
|
||||
{
|
||||
info.Arguments += " " + cfg.build_options;
|
||||
}
|
||||
|
||||
p = Process.Start(info);
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
|
||||
if (!File.Exists(binpath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
path = Config.PathFormat("{0}/{1}/{2}/{3}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder(),
|
||||
lib.package_path,
|
||||
binName);
|
||||
File.Copy(binpath, path, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.GetLength(0) < 1)
|
||||
{
|
||||
System.Console.WriteLine("Usage: <config file>");
|
||||
return;
|
||||
}
|
||||
|
||||
Config cfg = new Config();
|
||||
if (!cfg.ReadFromFile(args[0]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* :TODO: Add path validation */
|
||||
|
||||
ABuilder bld = null;
|
||||
|
||||
if (cfg.Platform == BasePlatform.Platform_Linux)
|
||||
{
|
||||
bld = new LinuxBuilder(cfg);
|
||||
}
|
||||
else if (cfg.Platform == BasePlatform.Platform_Windows)
|
||||
{
|
||||
bld = new Win32Builder(cfg);
|
||||
/* Do not delete this file anymore. We don't support rebuilds, and thus the file
|
||||
* is guaranteed to be wiped by buildbot.
|
||||
*/
|
||||
/*if (cfg.pdb_log_file != null && File.Exists(cfg.pdb_log_file))
|
||||
{
|
||||
File.Delete(cfg.pdb_log_file);
|
||||
}*/
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
bld.BuildPackage(new PkgCore());
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Console.WriteLine("Build failed, exception: " + e.Message);
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
CS = mcs
|
||||
NAME = builder
|
||||
BINARY = $(NAME).exe
|
||||
|
||||
OBJECTS = ABuilder.cs AssemblyInfo.cs Config.cs LinuxBuilder.cs Win32Builder.cs \
|
||||
Package.cs PkgCore.cs Main.cs
|
||||
|
||||
default: all
|
||||
|
||||
all: $(OBJECTS)
|
||||
$(CS) $(OBJECTS) -out:$(BINARY)
|
||||
|
||||
clean:
|
||||
rm -rf $(BINARY)
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public enum ReleaseMode : int
|
||||
{
|
||||
ReleaseMode_Release,
|
||||
ReleaseMode_Debug,
|
||||
};
|
||||
|
||||
public enum BuildMode : int
|
||||
{
|
||||
BuildMode_Simple,
|
||||
BuildMode_OldMetamod,
|
||||
BuildMode_DarkMessiah,
|
||||
BuildMode_Episode1,
|
||||
BuildMode_Episode2,
|
||||
BuildMode_Episode2Valve,
|
||||
BuildMode_Left4Dead
|
||||
};
|
||||
|
||||
public class Library
|
||||
{
|
||||
public Library()
|
||||
{
|
||||
has_platform_ext = false;
|
||||
is_executable = false;
|
||||
release_mode = ReleaseMode.ReleaseMode_Release;
|
||||
build_mode = BuildMode.BuildMode_Simple;
|
||||
platform = BasePlatform.Platform_Linux | BasePlatform.Platform_Windows;
|
||||
}
|
||||
public string binary_name; /* Name of binary */
|
||||
public string source_path; /* Local path to library build scripts */
|
||||
public ReleaseMode release_mode; /* Release mode */
|
||||
public BuildMode build_mode; /* Build mode */
|
||||
public string package_path; /* Final relative path */
|
||||
public bool has_platform_ext; /* Add extra platform extension? */
|
||||
public string vcproj_name; /* Project file, NULL for standard */
|
||||
public bool is_executable; /* If this is an EXE instead of a DLL */
|
||||
public BasePlatform platform; /* Platforms for which the binary should be built */
|
||||
};
|
||||
|
||||
public class Plugin
|
||||
{
|
||||
public Plugin(string file)
|
||||
{
|
||||
Source = file;
|
||||
disabled = false;
|
||||
}
|
||||
public Plugin (string file, string folder)
|
||||
{
|
||||
Source = file;
|
||||
Folder = folder;
|
||||
disabled = false;
|
||||
}
|
||||
public Plugin (string file, bool is_disabled)
|
||||
{
|
||||
Source = file;
|
||||
disabled = is_disabled;
|
||||
}
|
||||
public string Folder; /* Source folder relative to scripting (null for default) */
|
||||
public string Source; /* Source file name */
|
||||
public bool disabled; /* Is the plugin disabled? */
|
||||
};
|
||||
|
||||
public abstract class Package
|
||||
{
|
||||
/**
|
||||
* Must return the root compression point.
|
||||
*/
|
||||
public abstract void GetCompressBases(ref string path, ref string folder);
|
||||
|
||||
/**
|
||||
* Must return the base package output folder.
|
||||
*/
|
||||
public abstract string GetBaseFolder();
|
||||
|
||||
/**
|
||||
* Must return the list of folders to create.
|
||||
*/
|
||||
public abstract string [] GetFolders();
|
||||
|
||||
/**
|
||||
* Called when file to file copies must be performed
|
||||
*/
|
||||
public abstract void OnCopyFiles(ABuilder builder);
|
||||
|
||||
/**
|
||||
* Called when dir to dir copies must be performed
|
||||
*/
|
||||
public abstract void OnCopyFolders(ABuilder builder);
|
||||
|
||||
/**
|
||||
* Called to build libraries
|
||||
*/
|
||||
public abstract Library [] GetLibraries();
|
||||
|
||||
/**
|
||||
* Called to get package name
|
||||
*/
|
||||
public abstract string GetPackageName();
|
||||
|
||||
/**
|
||||
* Called to get a plugin list
|
||||
*/
|
||||
public abstract Plugin [] GetPlugins();
|
||||
}
|
||||
}
|
||||
@@ -1,440 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public class PkgCore : Package
|
||||
{
|
||||
private ArrayList libraries;
|
||||
private ArrayList plugins;
|
||||
private ArrayList folders;
|
||||
|
||||
public PkgCore()
|
||||
{
|
||||
}
|
||||
|
||||
public override string GetBaseFolder()
|
||||
{
|
||||
return "base";
|
||||
}
|
||||
|
||||
public override void GetCompressBases(ref string path, ref string folder)
|
||||
{
|
||||
path = "base";
|
||||
folder = "addons";
|
||||
}
|
||||
|
||||
public override string GetPackageName()
|
||||
{
|
||||
return "sourcemod-core";
|
||||
}
|
||||
|
||||
/**
|
||||
* Must return the list of folders to create.
|
||||
*/
|
||||
public override string [] GetFolders()
|
||||
{
|
||||
if (folders != null)
|
||||
{
|
||||
return (string [])folders.ToArray(typeof(string));
|
||||
}
|
||||
|
||||
folders = new ArrayList();
|
||||
|
||||
folders.Add("addons/sourcemod/bin");
|
||||
folders.Add("addons/sourcemod/plugins/disabled");
|
||||
folders.Add("addons/sourcemod/gamedata");
|
||||
folders.Add("addons/sourcemod/gamedata/core.games");
|
||||
folders.Add("addons/sourcemod/gamedata/sdktools.games");
|
||||
folders.Add("addons/sourcemod/configs/geoip");
|
||||
folders.Add("addons/sourcemod/translations");
|
||||
folders.Add("addons/sourcemod/logs");
|
||||
folders.Add("addons/sourcemod/extensions");
|
||||
folders.Add("addons/sourcemod/data");
|
||||
folders.Add("addons/sourcemod/scripting/include");
|
||||
folders.Add("addons/sourcemod/scripting/admin-flatfile");
|
||||
folders.Add("addons/sourcemod/scripting/adminmenu");
|
||||
folders.Add("addons/sourcemod/scripting/testsuite");
|
||||
folders.Add("cfg/sourcemod");
|
||||
folders.Add("addons/sourcemod/configs/sql-init-scripts");
|
||||
folders.Add("addons/sourcemod/configs/sql-init-scripts/mysql");
|
||||
folders.Add("addons/sourcemod/configs/sql-init-scripts/sqlite");
|
||||
folders.Add("addons/sourcemod/scripting/basecommands");
|
||||
folders.Add("addons/sourcemod/scripting/basecomm");
|
||||
folders.Add("addons/sourcemod/scripting/funvotes");
|
||||
folders.Add("addons/sourcemod/scripting/basevotes");
|
||||
folders.Add("addons/sourcemod/scripting/basebans");
|
||||
folders.Add("addons/sourcemod/scripting/funcommands");
|
||||
folders.Add("addons/sourcemod/extensions/auto.1.ep1");
|
||||
folders.Add("addons/sourcemod/extensions/auto.2.darkm");
|
||||
//folders.Add("addons/sourcemod/extensions/auto.2.ep1");
|
||||
folders.Add("addons/sourcemod/extensions/auto.2.ep2");
|
||||
folders.Add("addons/sourcemod/extensions/auto.2.ep2valve");
|
||||
folders.Add("addons/sourcemod/extensions/auto.2.l4d");
|
||||
folders.Add("addons/sourcemod/scripting/playercommands");
|
||||
folders.Add("addons/metamod");
|
||||
|
||||
return (string [])folders.ToArray(typeof(string));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when file to file copies must be performed
|
||||
*/
|
||||
public override void OnCopyFiles(ABuilder builder)
|
||||
{
|
||||
builder.CopyFile(this, "sourcepawn/batchtool/compile.exe", "addons/sourcemod/scripting/compile.exe");
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when dir to dir copies must be performed
|
||||
*/
|
||||
public override void OnCopyFolders(ABuilder builder)
|
||||
{
|
||||
builder.CopyFolder(this, "configs", "addons/sourcemod/configs", null);
|
||||
builder.CopyFolder(this, "configs/geoip", "addons/sourcemod/configs/geoip", null);
|
||||
builder.CopyFolder(this, "configs/cfg", "cfg/sourcemod", null);
|
||||
builder.CopyFolder(this, "configs/metamod", "addons/metamod", null);
|
||||
builder.CopyFolder(this,
|
||||
"configs/sql-init-scripts",
|
||||
"addons/sourcemod/configs/sql-init-scripts",
|
||||
null);
|
||||
builder.CopyFolder(this,
|
||||
"configs/sql-init-scripts/mysql",
|
||||
"addons/sourcemod/configs/sql-init-scripts/mysql",
|
||||
null);
|
||||
builder.CopyFolder(this,
|
||||
"configs/sql-init-scripts/sqlite",
|
||||
"addons/sourcemod/configs/sql-init-scripts/sqlite",
|
||||
null);
|
||||
|
||||
string [] plugin_omits = new string[1];
|
||||
plugin_omits[0] = "spcomp.exe";
|
||||
|
||||
string [] include_omits = new string[1];
|
||||
include_omits[0] = "version.tpl";
|
||||
|
||||
builder.CopyFolder(this, "gamedata", "addons/sourcemod/gamedata", null);
|
||||
builder.CopyFolder(this, "gamedata/sdktools.games", "addons/sourcemod/gamedata/sdktools.games", null);
|
||||
builder.CopyFolder(this, "gamedata/core.games", "addons/sourcemod/gamedata/core.games", null);
|
||||
builder.CopyFolder(this, "plugins", "addons/sourcemod/scripting", plugin_omits);
|
||||
builder.CopyFolder(this, "plugins/include", "addons/sourcemod/scripting/include", include_omits);
|
||||
builder.CopyFolder(this, "translations", "addons/sourcemod/translations", null);
|
||||
builder.CopyFolder(this, "public/licenses", "addons/sourcemod", null);
|
||||
builder.CopyFolder(this, "plugins/admin-flatfile", "addons/sourcemod/scripting/admin-flatfile", null);
|
||||
builder.CopyFolder(this, "plugins/adminmenu", "addons/sourcemod/scripting/adminmenu", null);
|
||||
builder.CopyFolder(this, "plugins/testsuite", "addons/sourcemod/scripting/testsuite", null);
|
||||
builder.CopyFolder(this, "plugins/basecommands", "addons/sourcemod/scripting/basecommands", null);
|
||||
builder.CopyFolder(this, "plugins/basecomm", "addons/sourcemod/scripting/basecomm", null);
|
||||
builder.CopyFolder(this, "plugins/funvotes", "addons/sourcemod/scripting/funvotes", null);
|
||||
builder.CopyFolder(this, "plugins/basevotes", "addons/sourcemod/scripting/basevotes", null);
|
||||
builder.CopyFolder(this, "plugins/basebans", "addons/sourcemod/scripting/basebans", null);
|
||||
builder.CopyFolder(this, "plugins/funcommands", "addons/sourcemod/scripting/funcommands", null);
|
||||
builder.CopyFolder(this, "plugins/playercommands", "addons/sourcemod/scripting/playercommands", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to build libraries
|
||||
*/
|
||||
public override Library [] GetLibraries()
|
||||
{
|
||||
if (libraries != null)
|
||||
{
|
||||
return (Library [])libraries.ToArray(typeof(Library));
|
||||
}
|
||||
|
||||
libraries = new ArrayList();
|
||||
|
||||
Library lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "loader";
|
||||
lib.binary_name = "sourcemod_mm";
|
||||
lib.vcproj_name = "loader";
|
||||
lib.build_mode = BuildMode.BuildMode_Simple;
|
||||
lib.has_platform_ext = true;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core/logic";
|
||||
lib.binary_name = "sourcemod.logic";
|
||||
lib.vcproj_name = "logic";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core";
|
||||
lib.binary_name = "sourcemod.1.ep1";
|
||||
lib.vcproj_name = "sourcemod_mm";
|
||||
lib.build_mode = BuildMode.BuildMode_OldMetamod;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core";
|
||||
lib.binary_name = "sourcemod.2.darkm";
|
||||
lib.vcproj_name = "sourcemod_mm";
|
||||
lib.build_mode = BuildMode.BuildMode_DarkMessiah;
|
||||
lib.platform = BasePlatform.Platform_Windows;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core";
|
||||
lib.binary_name = "sourcemod.2.ep2";
|
||||
lib.vcproj_name = "sourcemod_mm";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core";
|
||||
lib.binary_name = "sourcemod.2.ep2valve";
|
||||
lib.vcproj_name = "sourcemod_mm";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core";
|
||||
lib.binary_name = "sourcemod.2.ep2valve";
|
||||
lib.vcproj_name = "sourcemod_mm";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "core";
|
||||
lib.binary_name = "sourcemod.2.l4d";
|
||||
lib.vcproj_name = "sourcemod_mm";
|
||||
lib.build_mode = BuildMode.BuildMode_Left4Dead;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/bin";
|
||||
lib.source_path = "sourcepawn/jit";
|
||||
lib.binary_name = "sourcepawn.jit.x86";
|
||||
lib.vcproj_name = "jit-x86";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/scripting";
|
||||
lib.source_path = "sourcepawn/compiler";
|
||||
lib.binary_name = "spcomp";
|
||||
lib.is_executable = true;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/geoip";
|
||||
lib.binary_name = "geoip.ext";
|
||||
lib.vcproj_name = "geoip";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.1.ep1";
|
||||
lib.source_path = "extensions/bintools";
|
||||
lib.binary_name = "bintools.ext";
|
||||
lib.vcproj_name = "bintools";
|
||||
lib.build_mode = BuildMode.BuildMode_OldMetamod;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.darkm";
|
||||
lib.source_path = "extensions/bintools";
|
||||
lib.binary_name = "bintools.ext";
|
||||
lib.vcproj_name = "bintools";
|
||||
lib.build_mode = BuildMode.BuildMode_DarkMessiah;
|
||||
lib.platform = BasePlatform.Platform_Windows;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep2";
|
||||
lib.source_path = "extensions/bintools";
|
||||
lib.binary_name = "bintools.ext";
|
||||
lib.vcproj_name = "bintools";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep2valve";
|
||||
lib.source_path = "extensions/bintools";
|
||||
lib.binary_name = "bintools.ext";
|
||||
lib.vcproj_name = "bintools";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep2valve";
|
||||
lib.source_path = "extensions/bintools";
|
||||
lib.binary_name = "bintools.ext";
|
||||
lib.vcproj_name = "bintools";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.l4d";
|
||||
lib.source_path = "extensions/bintools";
|
||||
lib.binary_name = "bintools.ext";
|
||||
lib.vcproj_name = "bintools";
|
||||
lib.build_mode = BuildMode.BuildMode_Left4Dead;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/mysql";
|
||||
lib.binary_name = "dbi.mysql.ext";
|
||||
lib.vcproj_name = "sm_mysql";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.1.ep1";
|
||||
lib.source_path = "extensions/sdktools";
|
||||
lib.binary_name = "sdktools.ext";
|
||||
lib.vcproj_name = "sdktools";
|
||||
lib.build_mode = BuildMode.BuildMode_OldMetamod;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.darkm";
|
||||
lib.source_path = "extensions/sdktools";
|
||||
lib.binary_name = "sdktools.ext";
|
||||
lib.vcproj_name = "sdktools";
|
||||
lib.build_mode = BuildMode.BuildMode_DarkMessiah;
|
||||
lib.platform = BasePlatform.Platform_Windows;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep2";
|
||||
lib.source_path = "extensions/sdktools";
|
||||
lib.binary_name = "sdktools.ext";
|
||||
lib.vcproj_name = "sdktools";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep2valve";
|
||||
lib.source_path = "extensions/sdktools";
|
||||
lib.binary_name = "sdktools.ext";
|
||||
lib.vcproj_name = "sdktools";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep2valve";
|
||||
lib.source_path = "extensions/sdktools";
|
||||
lib.binary_name = "sdktools.ext";
|
||||
lib.vcproj_name = "sdktools";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.l4d";
|
||||
lib.source_path = "extensions/sdktools";
|
||||
lib.binary_name = "sdktools.ext";
|
||||
lib.vcproj_name = "sdktools";
|
||||
lib.build_mode = BuildMode.BuildMode_Left4Dead;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/sqlite";
|
||||
lib.binary_name = "dbi.sqlite.ext";
|
||||
lib.vcproj_name = "sm_sqlite";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.1.ep1";
|
||||
lib.source_path = "extensions/cstrike";
|
||||
lib.binary_name = "game.cstrike.ext";
|
||||
lib.vcproj_name = "cstrike";
|
||||
lib.build_mode = BuildMode.BuildMode_OldMetamod;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/topmenus";
|
||||
lib.binary_name = "topmenus.ext";
|
||||
lib.vcproj_name = "topmenus";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions/auto.2.ep2valve";
|
||||
lib.source_path = "extensions/tf2";
|
||||
lib.binary_name = "game.tf2.ext";
|
||||
lib.vcproj_name = "tf2";
|
||||
lib.build_mode = BuildMode.BuildMode_Episode2Valve;
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/regex";
|
||||
lib.binary_name = "regex.ext";
|
||||
lib.vcproj_name = "regex";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/clientprefs";
|
||||
lib.binary_name = "clientprefs.ext";
|
||||
lib.vcproj_name = "clientprefs";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/curl";
|
||||
lib.binary_name = "webternet.ext";
|
||||
lib.vcproj_name = "curl";
|
||||
libraries.Add(lib);
|
||||
|
||||
lib = new Library();
|
||||
lib.package_path = "addons/sourcemod/extensions";
|
||||
lib.source_path = "extensions/updater";
|
||||
lib.binary_name = "updater.ext";
|
||||
lib.vcproj_name = "updater";
|
||||
libraries.Add(lib);
|
||||
|
||||
return (Library [])libraries.ToArray(typeof(Library));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to build plugins
|
||||
*/
|
||||
public override Plugin [] GetPlugins()
|
||||
{
|
||||
if (plugins != null)
|
||||
{
|
||||
return (Plugin [])plugins.ToArray(typeof(Plugin));
|
||||
}
|
||||
|
||||
plugins = new ArrayList();
|
||||
|
||||
plugins.Add(new Plugin("admin-flatfile", "admin-flatfile"));
|
||||
plugins.Add(new Plugin("adminhelp"));
|
||||
plugins.Add(new Plugin("antiflood"));
|
||||
plugins.Add(new Plugin("basecommands"));
|
||||
plugins.Add(new Plugin("reservedslots"));
|
||||
plugins.Add(new Plugin("basetriggers"));
|
||||
plugins.Add(new Plugin("nextmap"));
|
||||
plugins.Add(new Plugin("basechat"));
|
||||
plugins.Add(new Plugin("funcommands"));
|
||||
plugins.Add(new Plugin("basevotes"));
|
||||
plugins.Add(new Plugin("funvotes"));
|
||||
plugins.Add(new Plugin("admin-sql-prefetch", true));
|
||||
plugins.Add(new Plugin("admin-sql-threaded", true));
|
||||
plugins.Add(new Plugin("sql-admin-manager", true));
|
||||
plugins.Add(new Plugin("basebans"));
|
||||
plugins.Add(new Plugin("mapchooser", true));
|
||||
plugins.Add(new Plugin("basecomm"));
|
||||
plugins.Add(new Plugin("randomcycle", true));
|
||||
plugins.Add(new Plugin("rockthevote", true));
|
||||
plugins.Add(new Plugin("adminmenu"));
|
||||
plugins.Add(new Plugin("playercommands"));
|
||||
plugins.Add(new Plugin("clientprefs"));
|
||||
plugins.Add(new Plugin("nominations", true));
|
||||
plugins.Add(new Plugin("sounds"));
|
||||
|
||||
return (Plugin [])plugins.ToArray(typeof(Plugin));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace builder
|
||||
{
|
||||
public class Win32Builder : ABuilder
|
||||
{
|
||||
public Win32Builder(Config _cfg)
|
||||
{
|
||||
cfg = _cfg;
|
||||
}
|
||||
|
||||
public override string GetPawnCompilerName()
|
||||
{
|
||||
return "spcomp.exe";
|
||||
}
|
||||
|
||||
public override bool BuildLibrary(Package pkg, Library lib)
|
||||
{
|
||||
ProcessStartInfo info = new ProcessStartInfo();
|
||||
|
||||
string path = Config.PathFormat("{0}/{1}/msvc9",
|
||||
cfg.source_path,
|
||||
lib.source_path);
|
||||
|
||||
/* PlatformExt ignored for us */
|
||||
string binName = lib.binary_name + (lib.is_executable ? ".exe" : ".dll");
|
||||
|
||||
string config_name = "Unknown";
|
||||
|
||||
if (lib.release_mode == ReleaseMode.ReleaseMode_Release)
|
||||
{
|
||||
config_name = "Release";
|
||||
}
|
||||
else if (lib.release_mode == ReleaseMode.ReleaseMode_Debug)
|
||||
{
|
||||
config_name = "Debug";
|
||||
}
|
||||
|
||||
if (lib.build_mode == BuildMode.BuildMode_DarkMessiah)
|
||||
{
|
||||
config_name = config_name + " - Dark Messiah";
|
||||
}
|
||||
if (lib.build_mode == BuildMode.BuildMode_Episode1)
|
||||
{
|
||||
config_name = config_name + " - Episode 1";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2)
|
||||
{
|
||||
config_name = config_name + " - Orange Box";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2Valve)
|
||||
{
|
||||
config_name = config_name + " - Orange Box Valve";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Episode2Valve)
|
||||
{
|
||||
config_name = config_name + " - Orange Box Valve";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
|
||||
{
|
||||
config_name = config_name + " - Old Metamod";
|
||||
}
|
||||
else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
|
||||
{
|
||||
config_name = config_name + " - Left 4 Dead";
|
||||
}
|
||||
|
||||
string binpath = Config.PathFormat("{0}/{1}/{2}",
|
||||
path,
|
||||
config_name,
|
||||
binName);
|
||||
|
||||
if (File.Exists(binpath))
|
||||
{
|
||||
File.Delete(binpath);
|
||||
}
|
||||
|
||||
string project_file = null;
|
||||
if (lib.vcproj_name != null)
|
||||
{
|
||||
project_file = lib.vcproj_name + ".vcproj";
|
||||
}
|
||||
else
|
||||
{
|
||||
project_file = lib.binary_name + ".vcproj";
|
||||
}
|
||||
|
||||
info.WorkingDirectory = path;
|
||||
info.FileName = cfg.builder_path;
|
||||
info.UseShellExecute = false;
|
||||
info.RedirectStandardOutput = true;
|
||||
info.RedirectStandardError = true;
|
||||
|
||||
if (cfg.build_options != null)
|
||||
{
|
||||
info.Arguments = cfg.build_options + " ";
|
||||
}
|
||||
|
||||
info.Arguments += "/rebuild \"" + project_file + "\" \"" + config_name + "\"";
|
||||
|
||||
Process p = Process.Start(info);
|
||||
Console.WriteLine(p.StandardOutput.ReadToEnd());
|
||||
p.WaitForExit();
|
||||
p.Close();
|
||||
|
||||
if (!File.Exists(binpath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
path = Config.PathFormat("{0}/{1}/{2}/{3}",
|
||||
cfg.pkg_path,
|
||||
pkg.GetBaseFolder(),
|
||||
lib.package_path,
|
||||
binName);
|
||||
File.Copy(binpath, path, true);
|
||||
|
||||
/* On Windows we optionally log the PDB path */
|
||||
if (!lib.is_executable && cfg.pdb_log_file != null)
|
||||
{
|
||||
FileStream fs = File.Open(cfg.pdb_log_file, FileMode.Append, FileAccess.Write);
|
||||
StreamWriter sw = new StreamWriter(fs);
|
||||
sw.WriteLine(binpath.Replace(".dll", ".pdb"));
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
OutputBase = /home/dvander/bin
|
||||
SourceBase = /home/dvander/sourcemod/trunk
|
||||
BuilderPath = /usr/bin/make
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
OutputBase = c:\real\done
|
||||
SourceBase = r:\sourcemod\trunk
|
||||
BuilderPath = C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com
|
||||
@@ -1,121 +0,0 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>builder</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>builder</RootNamespace>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>0.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>none</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.XML">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ABuilder.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Config.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LinuxBuilder.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Package.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PkgCore.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Win32Builder.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,19 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "builder", "builder.csproj", "{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BFC4EB78-4C3E-4C81-8EAD-5A1A2F126512}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,140 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
our %arguments =
|
||||
(
|
||||
'config' => 'modules.versions',
|
||||
'major' => '1',
|
||||
'minor' => '0',
|
||||
'revision' => '0',
|
||||
'build' => undef,
|
||||
'path' => '',
|
||||
'buildstring' => '',
|
||||
);
|
||||
|
||||
my $arg;
|
||||
foreach $arg (@ARGV)
|
||||
{
|
||||
$arg =~ s/--//;
|
||||
@arg = split(/=/, $arg);
|
||||
$arguments{$arg[0]} = $arg[1];
|
||||
}
|
||||
|
||||
#Set up path info
|
||||
if ($arguments{'path'} ne "")
|
||||
{
|
||||
if (!(-d $arguments{'path'}))
|
||||
{
|
||||
die "Unable to find path: " . $arguments{'path'} ."\n";
|
||||
}
|
||||
chdir($arguments{'path'});
|
||||
}
|
||||
|
||||
if (!open(CONFIG, $arguments{'config'}))
|
||||
{
|
||||
die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
|
||||
}
|
||||
|
||||
our %modules;
|
||||
my $cur_module = undef;
|
||||
my $line;
|
||||
while (<CONFIG>)
|
||||
{
|
||||
chomp;
|
||||
$line = $_;
|
||||
if ($line =~ /^\[([^\]]+)\]$/)
|
||||
{
|
||||
$cur_module = $1;
|
||||
next;
|
||||
}
|
||||
if (!$cur_module)
|
||||
{
|
||||
next;
|
||||
}
|
||||
if ($line =~ /^([^=]+) = (.+)$/)
|
||||
{
|
||||
$modules{$cur_module}{$1} = $2;
|
||||
}
|
||||
}
|
||||
|
||||
close(CONFIG);
|
||||
|
||||
#Copy global configuration options...
|
||||
if (exists($modules{'PRODUCT'}))
|
||||
{
|
||||
if (exists($modules{'PRODUCT'}{'major'}))
|
||||
{
|
||||
$arguments{'major'} = $modules{'PRODUCT'}{'major'};
|
||||
}
|
||||
if (exists($modules{'PRODUCT'}{'minor'}))
|
||||
{
|
||||
$arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
|
||||
}
|
||||
if (exists($modules{'PRODUCT'}{'revision'}))
|
||||
{
|
||||
$arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
|
||||
}
|
||||
}
|
||||
|
||||
#Get the global SVN revision if we have none
|
||||
my $rev;
|
||||
if ($arguments{'build'} == undef)
|
||||
{
|
||||
my ($text);
|
||||
$text = `hg identif -n -i`;
|
||||
chomp $text;
|
||||
$text =~ s/\+//g;
|
||||
my ($id,$num) = split(/ /, $text);
|
||||
$rev = "$num:$id";
|
||||
}
|
||||
else
|
||||
{
|
||||
$rev = int($arguments{'build'});
|
||||
}
|
||||
|
||||
my $major = $arguments{'major'};
|
||||
my $minor = $arguments{'minor'};
|
||||
my $revision = $arguments{'revision'};
|
||||
my $buildstr = $arguments{'buildstring'};
|
||||
|
||||
#Go through everything now
|
||||
my $mod_i;
|
||||
while ( ($cur_module, $mod_i) = each(%modules) )
|
||||
{
|
||||
#Skip the magic one
|
||||
if ($cur_module eq "PRODUCT")
|
||||
{
|
||||
next;
|
||||
}
|
||||
#Prepare path
|
||||
my %mod = %{$mod_i};
|
||||
my $infile = $mod{'in'};
|
||||
my $outfile = $mod{'out'};
|
||||
if ($mod{'folder'})
|
||||
{
|
||||
if (!(-d $mod{'folder'}))
|
||||
{
|
||||
die "Folder " . $mod{'folder'} . " not found.\n";
|
||||
}
|
||||
$infile = $mod{'folder'} . '/' . $infile;
|
||||
$outfile = $mod{'folder'} . '/' . $outfile;
|
||||
}
|
||||
if (!(-f $infile))
|
||||
{
|
||||
die "File $infile is not a file.\n";
|
||||
}
|
||||
#Start rewriting
|
||||
open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
|
||||
open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
|
||||
while (<INFILE>)
|
||||
{
|
||||
s/\$PMAJOR\$/$major/g;
|
||||
s/\$PMINOR\$/$minor/g;
|
||||
s/\$PREVISION\$/$revision/g;
|
||||
s/\$BUILD_ID\$/$rev/g;
|
||||
s/\$BUILD_STRING\$/$buildstr/g;
|
||||
print OUTFILE $_;
|
||||
}
|
||||
close(OUTFILE);
|
||||
close(INFILE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user