X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Ftools%2Fmkbundle%2Fmkbundle.cs;h=8680e0bbf8160f8f502a3705956eb7ebc06b88cb;hb=2709ca7625d75e5b3cf8eac8a34b95395bd15c46;hp=5c6e6e895ef0ea61eb001dffbb889469d7788d35;hpb=2099acf5f4a80c46bf4e75e9d67b8db4f2c86bbd;p=mono.git diff --git a/mcs/tools/mkbundle/mkbundle.cs b/mcs/tools/mkbundle/mkbundle.cs index 5c6e6e895ef..8680e0bbf81 100755 --- a/mcs/tools/mkbundle/mkbundle.cs +++ b/mcs/tools/mkbundle/mkbundle.cs @@ -49,6 +49,7 @@ class MakeBundle { static string machine_config_file = null; static string config_dir = null; static string style = "linux"; + static bool bundled_header = false; static string os_message = ""; static bool compress; static bool nomain; @@ -134,7 +135,7 @@ class MakeBundle { return 1; } if (sdk_path != null || runtime != null) - Error ("You can not specify one of --runtime, --sdk or --cross"); + Error ("You can only specify one of --runtime, --sdk or --cross"); custom_mode = false; autodeps = true; cross_target = args [++i]; @@ -212,7 +213,7 @@ class MakeBundle { autodeps = true; sdk_path = args [++i]; if (cross_target != null || runtime != null) - Error ("You can not specify one of --runtime, --sdk or --cross"); + Error ("You can only specify one of --runtime, --sdk or --cross"); break; case "--runtime": if (i+1 == top){ @@ -347,6 +348,9 @@ class MakeBundle { else environment.Add (env.Substring (0, p), env.Substring (p+1)); break; + case "--bundled-header": + bundled_header = true; + break; default: sources.Add (args [i]); break; @@ -620,6 +624,8 @@ class MakeBundle { return false; } maker.Add (code, file); + // add a space after code (="systemconfig:" or "machineconfig:") + Console.WriteLine (code + " " + file); return true; } @@ -655,15 +661,17 @@ class MakeBundle { Console.WriteLine (" Assembly: " + fname); if (File.Exists (fname + ".config")){ maker.Add ("config:" + aname, fname + ".config"); - Console.WriteLine (" Config: " + runtime); + Console.WriteLine (" Config: " + fname + ".config"); } } if (!MaybeAddFile (maker, "systemconfig:", config_file) || !MaybeAddFile (maker, "machineconfig:", machine_config_file)) return false; - if (config_dir != null) + if (config_dir != null){ maker.Add ("config_dir:", config_dir); + Console.WriteLine (" Config_dir: " + config_dir ); + } if (embedded_options != null) maker.AddString ("options:", embedded_options); if (environment.Count > 0){ @@ -700,10 +708,10 @@ class MakeBundle { using (StreamWriter tc = new StreamWriter (File.Create (temp_c))) { string prog = null; -#if XAMARIN_ANDROID - tc.WriteLine ("/* This source code was produced by mkbundle, do not edit */"); - tc.WriteLine ("\n#ifndef NULL\n#define NULL (void *)0\n#endif"); - tc.WriteLine (@" + if (bundled_header) { + tc.WriteLine ("/* This source code was produced by mkbundle, do not edit */"); + tc.WriteLine ("\n#ifndef NULL\n#define NULL (void *)0\n#endif"); + tc.WriteLine (@" typedef struct { const char *name; const unsigned char *data; @@ -712,10 +720,10 @@ typedef struct { void mono_register_bundled_assemblies (const MonoBundledAssembly **assemblies); void mono_register_config_for_assembly (const char* assembly_name, const char* config_xml); "); -#else - tc.WriteLine ("#include "); - tc.WriteLine ("#include \n"); -#endif + } else { + tc.WriteLine ("#include "); + tc.WriteLine ("#include \n"); + } if (compress) { tc.WriteLine ("typedef struct _compressed_data {"); @@ -1106,6 +1114,14 @@ void mono_register_config_for_assembly (const char* assembly_name, cons } if (error != null) { + Console.Error.WriteLine ("Failure to load i18n assemblies, the following directories were searched for the assemblies:"); + foreach (var path in link_paths){ + Console.Error.WriteLine (" Path: " + path); + } + if (custom_mode){ + Console.WriteLine ("In Custom mode, you need to provide the directory to lookup assemblies from using -L"); + } + Error ("Couldn't load one or more of the i18n assemblies: " + error); Environment.Exit (1); } @@ -1114,10 +1130,10 @@ void mono_register_config_for_assembly (const char* assembly_name, cons static readonly Universe universe = new Universe (); static readonly Dictionary loaded_assemblies = new Dictionary (); - static readonly string resourcePathSeparator = (Path.DirectorySeparatorChar == '\\') ? $"\\{Path.DirectorySeparatorChar}" : $"{Path.DirectorySeparatorChar}"; public static string GetAssemblyName (string path) { + string resourcePathSeparator = style == "windows" ? "\\\\" : "/"; string name = Path.GetFileName (path); // A bit of a hack to support satellite assemblies. They all share the same name but @@ -1157,9 +1173,18 @@ void mono_register_config_for_assembly (const char* assembly_name, cons return true; try { Assembly a = universe.LoadFile (path); + if (a == null) { + Error ("Unable to to load assembly `{0}'", path); + return false; + } foreach (AssemblyName an in a.GetReferencedAssemblies ()) { a = LoadAssembly (an.Name); + if (a == null) { + Error ("Unable to load assembly `{0}' referenced by `{1}'", an.Name, path); + return false; + } + if (!QueueAssembly (files, a.CodeBase)) return false; } @@ -1179,7 +1204,12 @@ void mono_register_config_for_assembly (const char* assembly_name, cons Assembly a = null; try { + if (!quiet) + Console.WriteLine ("Attempting to load assembly: {0}", assembly); a = universe.LoadFile (assembly); + if (!quiet) + Console.WriteLine ("Assembly {0} loaded successfully.", assembly); + } catch (FileNotFoundException){ Error ($"Cannot find assembly `{assembly}'"); } catch (IKVM.Reflection.BadImageFormatException f) { @@ -1202,6 +1232,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons string total_log = ""; foreach (string dir in link_paths){ string full_path = Path.Combine (dir, assembly); + if (!quiet) + Console.WriteLine ("Attempting to load assembly from: " + full_path); if (!assembly.EndsWith (".dll") && !assembly.EndsWith (".exe")) full_path += ".dll"; @@ -1238,6 +1270,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons " --skip-scan Skip scanning assemblies that could not be loaded (but still embed them).\n" + " --i18n ENCODING none, all or comma separated list of CJK, MidWest, Other, Rare, West.\n" + " -v Verbose output\n" + + " --bundled-header Do not attempt to include 'mono-config.h'. Define the entry points directly in the generated code\n" + "\n" + "--simple Simple mode does not require a C toolchain and can cross compile\n" + " --cross TARGET Generates a binary for the given TARGET\n"+