aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Prebuild/src/Core/Targets/AutotoolsTarget.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Prebuild/src/Core/Targets/AutotoolsTarget.cs')
-rw-r--r--Prebuild/src/Core/Targets/AutotoolsTarget.cs112
1 files changed, 67 insertions, 45 deletions
diff --git a/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
index 5dcbb38..f102038 100644
--- a/Prebuild/src/Core/Targets/AutotoolsTarget.cs
+++ b/Prebuild/src/Core/Targets/AutotoolsTarget.cs
@@ -65,9 +65,18 @@ POSSIBILITY OF SUCH DAMAGE.
65 */ 65 */
66 66
67#endregion 67#endregion
68
69#region CVS Information
70/*
71 * $Source$
72 * $Author: jendave $
73 * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $
74 * $Revision: 136 $
75 */
76#endregion
77
68using System; 78using System;
69using System.Collections; 79using System.Collections;
70using System.Collections.Generic;
71using System.Collections.Specialized; 80using System.Collections.Specialized;
72using System.IO; 81using System.IO;
73using System.Reflection; 82using System.Reflection;
@@ -173,7 +182,8 @@ namespace Prebuild.Core.Targets
173 Hashtable assemblyPathToPackage = new Hashtable(); 182 Hashtable assemblyPathToPackage = new Hashtable();
174 Hashtable assemblyFullNameToPath = new Hashtable(); 183 Hashtable assemblyFullNameToPath = new Hashtable();
175 Hashtable packagesHash = new Hashtable(); 184 Hashtable packagesHash = new Hashtable();
176 readonly List<SystemPackage> packages = new List<SystemPackage>(); 185 ArrayList packages = new ArrayList();
186 ClrVersion currentVersion;
177 187
178 #endregion 188 #endregion
179 189
@@ -193,6 +203,22 @@ namespace Prebuild.Core.Targets
193 di.Create(); 203 di.Create();
194 } 204 }
195 205
206 private void mkStubFiles(string dirName, ArrayList fileNames)
207 {
208 for (int i = 0; i < fileNames.Count; i++)
209 {
210 string tmpFile = dirName + "/" + (string)fileNames[i];
211
212 FileStream tmpFileStream =
213 new FileStream(tmpFile, FileMode.Create);
214
215 StreamWriter sw = new StreamWriter(tmpFileStream);
216 sw.WriteLine("These are not the files you are looking for.");
217 sw.Flush();
218 tmpFileStream.Close();
219 }
220 }
221
196 private void chkMkDir(string dirName) 222 private void chkMkDir(string dirName)
197 { 223 {
198 System.IO.DirectoryInfo di = 224 System.IO.DirectoryInfo di =
@@ -247,11 +273,11 @@ namespace Prebuild.Core.Targets
247 } 273 }
248 } 274 }
249 275
250 private List<string> GetAssembliesWithLibInfo(string line, string file) 276 private ArrayList GetAssembliesWithLibInfo(string line, string file)
251 { 277 {
252 List<string> references = new List<string>(); 278 ArrayList references = new ArrayList();
253 List<string> libdirs = new List<string>(); 279 ArrayList libdirs = new ArrayList();
254 List<string> retval = new List<string>(); 280 ArrayList retval = new ArrayList();
255 foreach (string piece in line.Split(' ')) 281 foreach (string piece in line.Split(' '))
256 { 282 {
257 if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) 283 if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
@@ -278,9 +304,9 @@ namespace Prebuild.Core.Targets
278 return retval; 304 return retval;
279 } 305 }
280 306
281 private List<string> GetAssembliesWithoutLibInfo(string line, string file) 307 private ArrayList GetAssembliesWithoutLibInfo(string line, string file)
282 { 308 {
283 List<string> references = new List<string>(); 309 ArrayList references = new ArrayList();
284 foreach (string reference in line.Split(' ')) 310 foreach (string reference in line.Split(' '))
285 { 311 {
286 if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) 312 if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
@@ -330,7 +356,7 @@ namespace Prebuild.Core.Targets
330 if (packagesHash.Contains(pname)) 356 if (packagesHash.Contains(pname))
331 return; 357 return;
332 358
333 List<string> fullassemblies = null; 359 ArrayList fullassemblies = null;
334 string version = ""; 360 string version = "";
335 string desc = ""; 361 string desc = "";
336 362
@@ -378,7 +404,7 @@ namespace Prebuild.Core.Targets
378 package.Initialize(pname, 404 package.Initialize(pname,
379 version, 405 version,
380 desc, 406 desc,
381 fullassemblies.ToArray(), 407 (string[])fullassemblies.ToArray(typeof(string)),
382 ClrVersion.Default, 408 ClrVersion.Default,
383 false); 409 false);
384 packages.Add(package); 410 packages.Add(package);
@@ -388,7 +414,7 @@ namespace Prebuild.Core.Targets
388 void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) 414 void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
389 { 415 {
390 SystemPackage package = new SystemPackage(); 416 SystemPackage package = new SystemPackage();
391 List<string> list = new List<string>(); 417 ArrayList list = new ArrayList();
392 418
393 string dir = Path.Combine(prefix, version); 419 string dir = Path.Combine(prefix, version);
394 if (!Directory.Exists(dir)) 420 if (!Directory.Exists(dir))
@@ -405,7 +431,7 @@ namespace Prebuild.Core.Targets
405 package.Initialize("mono", 431 package.Initialize("mono",
406 version, 432 version,
407 "The Mono runtime", 433 "The Mono runtime",
408 list.ToArray(), 434 (string[])list.ToArray(typeof(string)),
409 ver, 435 ver,
410 false); 436 false);
411 packages.Add(package); 437 packages.Add(package);
@@ -418,10 +444,12 @@ namespace Prebuild.Core.Targets
418 if (Environment.Version.Major == 1) 444 if (Environment.Version.Major == 1)
419 { 445 {
420 versionDir = "1.0"; 446 versionDir = "1.0";
447 currentVersion = ClrVersion.Net_1_1;
421 } 448 }
422 else 449 else
423 { 450 {
424 versionDir = "2.0"; 451 versionDir = "2.0";
452 currentVersion = ClrVersion.Net_2_0;
425 } 453 }
426 454
427 //Pull up assemblies from the installed mono system. 455 //Pull up assemblies from the installed mono system.
@@ -455,9 +483,9 @@ namespace Prebuild.Core.Targets
455 } 483 }
456 } 484 }
457 search_dirs += Path.PathSeparator + libpath; 485 search_dirs += Path.PathSeparator + libpath;
458 if (!string.IsNullOrEmpty(search_dirs)) 486 if (search_dirs != null && search_dirs.Length > 0)
459 { 487 {
460 List<string> scanDirs = new List<string>(); 488 ArrayList scanDirs = new ArrayList();
461 foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) 489 foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
462 { 490 {
463 if (!scanDirs.Contains(potentialDir)) 491 if (!scanDirs.Contains(potentialDir))
@@ -735,22 +763,20 @@ namespace Prebuild.Core.Targets
735 bool hasAssemblyConfig = false; 763 bool hasAssemblyConfig = false;
736 chkMkDir(projectDir); 764 chkMkDir(projectDir);
737 765
738 List<string> 766 ArrayList
739 compiledFiles = new List<string>(), 767 compiledFiles = new ArrayList(),
740 contentFiles = new List<string>(), 768 contentFiles = new ArrayList(),
741 embeddedFiles = new List<string>(), 769 embeddedFiles = new ArrayList(),
742
743 binaryLibs = new List<string>(),
744 pkgLibs = new List<string>(),
745 systemLibs = new List<string>(),
746 runtimeLibs = new List<string>(),
747 770
748 extraDistFiles = new List<string>(), 771 binaryLibs = new ArrayList(),
749 localCopyTargets = new List<string>(); 772 pkgLibs = new ArrayList(),
773 systemLibs = new ArrayList(),
774 runtimeLibs = new ArrayList(),
750 775
751 // If there exists a .config file for this assembly, copy 776 extraDistFiles = new ArrayList(),
752 // it to the project folder 777 localCopyTargets = new ArrayList();
753 778
779 // If there exists a .config file for this assembly, copy it to the project folder
754 // TODO: Support copying .config.osx files 780 // TODO: Support copying .config.osx files
755 // TODO: support processing the .config file for native library deps 781 // TODO: support processing the .config file for native library deps
756 string projectAssemblyName = project.Name; 782 string projectAssemblyName = project.Name;
@@ -813,15 +839,11 @@ namespace Prebuild.Core.Targets
813 foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) 839 foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
814 Console.WriteLine("Error! '{0}'", error.ErrorText); 840 Console.WriteLine("Error! '{0}'", error.ErrorText);
815 841
816 try { 842 string projectFullName = cr.CompiledAssembly.FullName;
817 string projectFullName = cr.CompiledAssembly.FullName; 843 Regex verRegex = new Regex("Version=([\\d\\.]+)");
818 Regex verRegex = new Regex("Version=([\\d\\.]+)"); 844 Match verMatch = verRegex.Match(projectFullName);
819 Match verMatch = verRegex.Match(projectFullName); 845 if (verMatch.Success)
820 if (verMatch.Success)
821 projectVersion = verMatch.Groups[1].Value; 846 projectVersion = verMatch.Groups[1].Value;
822 }catch{
823 Console.WriteLine("Couldn't compile AssemblyInfo.cs");
824 }
825 847
826 // Clean up the temp file 848 // Clean up the temp file
827 try 849 try
@@ -831,7 +853,7 @@ namespace Prebuild.Core.Targets
831 } 853 }
832 catch 854 catch
833 { 855 {
834 Console.WriteLine("Error! '{0}'", e.ToString()); 856 //Console.WriteLine("Error! '{0}'", e.ToString());
835 } 857 }
836 858
837 } 859 }
@@ -991,46 +1013,46 @@ namespace Prebuild.Core.Targets
991 } 1013 }
992 } 1014 }
993 1015
994 const string lineSep = " \\\n\t"; 1016 string lineSep = " \\\n\t";
995 string compiledFilesString = string.Empty; 1017 string compiledFilesString = string.Empty;
996 if (compiledFiles.Count > 0) 1018 if (compiledFiles.Count > 0)
997 compiledFilesString = 1019 compiledFilesString =
998 lineSep + string.Join(lineSep, compiledFiles.ToArray()); 1020 lineSep + string.Join(lineSep, (string[])compiledFiles.ToArray(typeof(string)));
999 1021
1000 string embeddedFilesString = ""; 1022 string embeddedFilesString = "";
1001 if (embeddedFiles.Count > 0) 1023 if (embeddedFiles.Count > 0)
1002 embeddedFilesString = 1024 embeddedFilesString =
1003 lineSep + string.Join(lineSep, embeddedFiles.ToArray()); 1025 lineSep + string.Join(lineSep, (string[])embeddedFiles.ToArray(typeof(string)));
1004 1026
1005 string contentFilesString = ""; 1027 string contentFilesString = "";
1006 if (contentFiles.Count > 0) 1028 if (contentFiles.Count > 0)
1007 contentFilesString = 1029 contentFilesString =
1008 lineSep + string.Join(lineSep, contentFiles.ToArray()); 1030 lineSep + string.Join(lineSep, (string[])contentFiles.ToArray(typeof(string)));
1009 1031
1010 string extraDistFilesString = ""; 1032 string extraDistFilesString = "";
1011 if (extraDistFiles.Count > 0) 1033 if (extraDistFiles.Count > 0)
1012 extraDistFilesString = 1034 extraDistFilesString =
1013 lineSep + string.Join(lineSep, extraDistFiles.ToArray()); 1035 lineSep + string.Join(lineSep, (string[])extraDistFiles.ToArray(typeof(string)));
1014 1036
1015 string pkgLibsString = ""; 1037 string pkgLibsString = "";
1016 if (pkgLibs.Count > 0) 1038 if (pkgLibs.Count > 0)
1017 pkgLibsString = 1039 pkgLibsString =
1018 lineSep + string.Join(lineSep, pkgLibs.ToArray()); 1040 lineSep + string.Join(lineSep, (string[])pkgLibs.ToArray(typeof(string)));
1019 1041
1020 string binaryLibsString = ""; 1042 string binaryLibsString = "";
1021 if (binaryLibs.Count > 0) 1043 if (binaryLibs.Count > 0)
1022 binaryLibsString = 1044 binaryLibsString =
1023 lineSep + string.Join(lineSep, binaryLibs.ToArray()); 1045 lineSep + string.Join(lineSep, (string[])binaryLibs.ToArray(typeof(string)));
1024 1046
1025 string systemLibsString = ""; 1047 string systemLibsString = "";
1026 if (systemLibs.Count > 0) 1048 if (systemLibs.Count > 0)
1027 systemLibsString = 1049 systemLibsString =
1028 lineSep + string.Join(lineSep, systemLibs.ToArray()); 1050 lineSep + string.Join(lineSep, (string[])systemLibs.ToArray(typeof(string)));
1029 1051
1030 string localCopyTargetsString = ""; 1052 string localCopyTargetsString = "";
1031 if (localCopyTargets.Count > 0) 1053 if (localCopyTargets.Count > 0)
1032 localCopyTargetsString = 1054 localCopyTargetsString =
1033 string.Join("\n", localCopyTargets.ToArray()); 1055 string.Join("\n", (string[])localCopyTargets.ToArray(typeof(string)));
1034 1056
1035 string monoPath = ""; 1057 string monoPath = "";
1036 foreach (string runtimeLib in runtimeLibs) 1058 foreach (string runtimeLib in runtimeLibs)