2005-08-24 02:53:38 +00:00
|
|
|
using System;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace AMXXRelease
|
|
|
|
{
|
|
|
|
//Build process for any Linux
|
|
|
|
public class LinuxBuilder : ABuilder
|
|
|
|
{
|
|
|
|
private string m_AmxxPc;
|
|
|
|
|
|
|
|
public override void OnBuild()
|
|
|
|
{
|
|
|
|
m_AmxxPc = PropSlashes(m_Cfg.GetSourceTree() + "/plugins/amxxpc");
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void CompressDir(string target, string dir)
|
|
|
|
{
|
|
|
|
ProcessStartInfo info = new ProcessStartInfo();
|
|
|
|
|
|
|
|
info.FileName = m_Cfg.CompressPath();
|
2005-08-25 08:02:48 +00:00
|
|
|
info.WorkingDirectory = dir;
|
2005-08-25 08:20:11 +00:00
|
|
|
|
|
|
|
string [] files = Directory.GetFiles(dir);
|
|
|
|
string file_list = "";
|
|
|
|
for (int i=0; i<files.Length; i++)
|
|
|
|
file_list += GetFileName(files[i]) + " ";
|
|
|
|
files = Directory.GetDirectories(dir);
|
|
|
|
for (int i=0; i<files.Length; i++)
|
|
|
|
file_list += GetFileName(files[i]) + " ";
|
|
|
|
|
2005-09-18 03:26:26 +00:00
|
|
|
ProcessStartInfo chmod = new ProcessStartInfo();
|
|
|
|
chmod.FileName = "/bin/chmod";
|
|
|
|
chmod.WorkingDirectory = dir;
|
|
|
|
chmod.Arguments = "-R 755 " + file_list;
|
|
|
|
chmod.UseShellExecute = false;
|
|
|
|
Process c = Process.Start(chmod);
|
|
|
|
c.WaitForExit();
|
2007-08-03 17:26:57 +00:00
|
|
|
c.Close();
|
2005-09-18 03:26:26 +00:00
|
|
|
|
2005-09-22 05:12:23 +00:00
|
|
|
|
2013-02-13 07:14:37 +00:00
|
|
|
info.Arguments = "zcvf \"" + target + "-linux.tar.gz\" " + file_list;
|
2005-08-24 02:53:38 +00:00
|
|
|
info.UseShellExecute = false;
|
|
|
|
|
|
|
|
Process p = Process.Start(info);
|
|
|
|
p.WaitForExit();
|
2007-08-03 17:26:57 +00:00
|
|
|
p.Close();
|
2005-08-24 02:53:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void AmxxPc(string inpath, string args)
|
|
|
|
{
|
|
|
|
ProcessStartInfo info = new ProcessStartInfo();
|
|
|
|
|
|
|
|
info.WorkingDirectory = PropSlashes(m_Cfg.GetSourceTree() + "\\plugins");
|
|
|
|
info.FileName = (string)m_AmxxPc.Clone();
|
|
|
|
info.Arguments = inpath + ".sma";
|
|
|
|
if (args != null)
|
|
|
|
info.Arguments += " " + args;
|
|
|
|
info.UseShellExecute = false;
|
|
|
|
|
|
|
|
Process p = Process.Start(info);
|
|
|
|
p.WaitForExit();
|
2007-08-03 17:26:57 +00:00
|
|
|
p.Close();
|
2005-08-24 02:53:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override string GetLibExt()
|
|
|
|
{
|
2007-08-03 16:48:04 +00:00
|
|
|
return "_i386.so";
|
2005-08-24 02:53:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public override string BuildModule(Module module)
|
|
|
|
{
|
|
|
|
ProcessStartInfo info = new ProcessStartInfo();
|
|
|
|
|
|
|
|
string dir = m_Cfg.GetSourceTree() + "\\" + module.sourcedir;
|
|
|
|
string file = dir;
|
|
|
|
file += "\\" + "Release" + "\\" + module.projname + GetLibExt();
|
|
|
|
file = PropSlashes(file);
|
|
|
|
|
|
|
|
if (File.Exists(file))
|
|
|
|
File.Delete(file);
|
|
|
|
|
|
|
|
Console.WriteLine(PropSlashes(dir));
|
|
|
|
info.WorkingDirectory = PropSlashes(dir);
|
|
|
|
info.FileName = m_Cfg.DevenvPath();
|
|
|
|
info.Arguments = "clean";
|
|
|
|
info.UseShellExecute = false;
|
|
|
|
|
|
|
|
Process p = Process.Start(info);
|
|
|
|
p.WaitForExit();
|
2007-08-03 17:29:59 +00:00
|
|
|
p.Close();
|
2005-08-24 02:53:38 +00:00
|
|
|
|
|
|
|
info.WorkingDirectory = PropSlashes(dir);
|
|
|
|
info.FileName = m_Cfg.DevenvPath();
|
2007-03-13 00:29:10 +00:00
|
|
|
info.Arguments = m_Cfg.MakeOpts();
|
2005-08-24 02:53:38 +00:00
|
|
|
info.UseShellExecute = false;
|
|
|
|
|
|
|
|
p = Process.Start(info);
|
|
|
|
p.WaitForExit();
|
2007-08-03 17:26:57 +00:00
|
|
|
p.Close();
|
2005-08-24 02:53:38 +00:00
|
|
|
|
|
|
|
if (!File.Exists(file))
|
2005-08-24 18:13:40 +00:00
|
|
|
{
|
|
|
|
Console.WriteLine("Output file failed: " + file);
|
2005-08-24 02:53:38 +00:00
|
|
|
return null;
|
2005-08-24 18:13:40 +00:00
|
|
|
}
|
2005-08-24 02:53:38 +00:00
|
|
|
|
|
|
|
//Now we need to see if the DL handle is valid!
|
|
|
|
string dlsym_dir = m_Cfg.GetSourceTree() + "\\plugins";
|
|
|
|
string dlsym = dlsym_dir + "\\dlsym";
|
|
|
|
dlsym = PropSlashes(dlsym);
|
|
|
|
dlsym_dir = PropSlashes(dlsym_dir);
|
|
|
|
info.WorkingDirectory = dlsym_dir;
|
|
|
|
info.FileName = dlsym;
|
|
|
|
info.Arguments = file;
|
|
|
|
info.UseShellExecute = false;
|
2007-08-03 17:29:59 +00:00
|
|
|
info.RedirectStandardOutput = true;
|
2005-08-24 02:53:38 +00:00
|
|
|
|
|
|
|
p = Process.Start(info);
|
2007-08-03 17:31:42 +00:00
|
|
|
string output = p.StandardOutput.ReadToEnd();
|
2005-08-24 02:53:38 +00:00
|
|
|
p.WaitForExit();
|
2007-08-03 17:26:57 +00:00
|
|
|
p.Close();
|
2005-08-24 02:53:38 +00:00
|
|
|
|
|
|
|
if (output.IndexOf("Handle:") == -1)
|
|
|
|
return null;
|
|
|
|
|
|
|
|
return file;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|