// Do the file reading and compression in parallel
Action<string> body = delegate (string url) {
- string fname = new Uri (url).LocalPath;
+ string fname = LocateFile (new Uri (url).LocalPath);
Stream stream = File.OpenRead (fname);
long real_size = stream.Length;
// The non-parallel part
byte [] buffer = new byte [8192];
foreach (var url in files) {
- string fname = new Uri (url).LocalPath;
+ string fname = LocateFile (new Uri (url).LocalPath);
string aname = Path.GetFileName (fname);
string encoded = aname.Replace ("-", "_").Replace (".", "_");
tc.Close ();
+ string assembler = GetEnv("AS", "as");
+ string as_cmd = String.Format("{0} -o {1} {2} ", assembler, temp_o, temp_s);
+ Execute(as_cmd);
+
if (compile_only)
return;
Console.WriteLine("Compiling:");
if (style == "windows")
{
- string assembler = GetEnv("AS", "as");
- string as_cmd = String.Format("{0} -o {1} {2} ", assembler, temp_o, temp_s);
- Execute(as_cmd);
Func<string, string> quote = (pp) => { return "\"" + pp + "\""; };
foreach (string include in includes)
compilerArgs.Add(String.Format ("/I {0}", quote (include)));
- if (static_link) {
- compilerArgs.Add("/MT");
- monoFile = monoPath + @"\lib\mono-2.0.lib";
- }
- else {
- compilerArgs.Add("/MD");
- monoFile = monoPath + @"\lib\mono-2.0.dll";
- }
+ if (static_link)
+ monoFile = LocateFile (monoPath + @"\lib\monosgen-2.0.lib");
+ else
+ monoFile = LocateFile (monoPath + @"\lib\monosgen-2.0.dll");
+ compilerArgs.Add("/MD");
compilerArgs.Add(temp_c);
compilerArgs.Add(temp_o);
compilerArgs.Add("/link");
+ if (nomain)
+ compilerArgs.Add("/NOENTRY");
+ compilerArgs.Add("/DLL");
+
foreach (string lib in libs)
compilerArgs.Add(String.Format ("/LIBPATH:{0}", quote(lib)));
compilerArgs.Add (quote(monoFile));
}
else
{
- string assembler = GetEnv("AS", "as");
- string cmd = String.Format("{0} -o {1} {2} ", assembler, temp_o, temp_s);
- Execute(cmd);
-
string zlib = (compress ? "-lz" : "");
string debugging = "-g";
string cc = GetEnv("CC", "cc");
+ string cmd = null;
if (style == "linux")
debugging = "-ggdb";
}
assemblies.Add (a.CodeBase);
- } catch (Exception e) {
+ } catch (Exception) {
if (skip_scan) {
Console.WriteLine ("File will not be scanned: {0}", name);
assemblies.Add (new Uri (new FileInfo (name).FullName).ToString ());
if (!QueueAssembly (files, a.CodeBase))
return false;
}
- } catch (Exception e) {
+ } catch (Exception) {
if (!skip_scan)
throw;
}
static void Execute (string cmdLine)
{
if (IsUnix) {
- Console.WriteLine (cmdLine);
+ Console.WriteLine ("[execute cmd]: " + cmdLine);
int ret = system (cmdLine);
if (ret != 0)
{
Error(String.Format("[Fail] {0}", ret));
}
+ return;
}
// on Windows, we have to pipe the output of a
}
return val;
}
+
+ static string LocateFile(string default_path)
+ {
+ var override_path = Path.Combine(Directory.GetCurrentDirectory(), Path.GetFileName(default_path));
+ if (File.Exists(override_path))
+ return override_path;
+ else if (File.Exists(default_path))
+ return default_path;
+ else
+ throw new FileNotFoundException(default_path);
+ }
}