From e4511a06f6cbebf2e4efccd4aebad5875ec71f46 Mon Sep 17 00:00:00 2001 From: James Willcox Date: Thu, 28 Apr 2005 20:21:01 +0000 Subject: [PATCH] 2005-04-28 James Willcox * mkbundle.cs: Add --config-dir option * template.c: same svn path=/trunk/mcs/; revision=43744 --- mcs/tools/mkbundle/ChangeLog | 5 +++++ mcs/tools/mkbundle/mkbundle.cs | 38 ++++++++++++++++++++++++---------- mcs/tools/mkbundle/template.c | 4 ++++ 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/mcs/tools/mkbundle/ChangeLog b/mcs/tools/mkbundle/ChangeLog index 015bffafa50..dba26fbb66a 100644 --- a/mcs/tools/mkbundle/ChangeLog +++ b/mcs/tools/mkbundle/ChangeLog @@ -1,3 +1,8 @@ +2005-04-28 James Willcox + + * mkbundle.cs: Add --config-dir option + * template.c: same + 2005-04-25 Gonzalo Paniagua Javier * mkbundle.cs: GetReferencedAssemblies () will not report CodeBase, so diff --git a/mcs/tools/mkbundle/mkbundle.cs b/mcs/tools/mkbundle/mkbundle.cs index 8960d129c5f..acc1ca8b41b 100644 --- a/mcs/tools/mkbundle/mkbundle.cs +++ b/mcs/tools/mkbundle/mkbundle.cs @@ -25,6 +25,7 @@ class MakeBundle { static bool compile_only = false; static bool static_link = false; static string config_file = null; + static string config_dir = null; static int Main (string [] args) { @@ -81,12 +82,21 @@ class MakeBundle { static_link = true; break; case "--config": - if (i+1 == top){ + if (i+1 == top) { Help (); return 1; } + config_file = args [++i]; break; + case "--config-dir": + if (i+1 == top) { + Help (); + return 1; + } + + config_dir = args [++i]; + break; default: sources.Add (args [i]); break; @@ -209,7 +219,7 @@ class MakeBundle { ts.Write ("\t.byte {0}\n", buffer [i]); } } - // null terminator + // null terminator ts.Write ("\t.byte 0\n"); ts.WriteLine (); } @@ -238,6 +248,11 @@ class MakeBundle { if (config_file != null) tc.WriteLine ("\tmono_config_parse_memory (&system_config);\n"); tc.WriteLine ("}\n"); + + if (config_dir != null) + tc.WriteLine ("static const char *config_dir = \"{0}\";", config_dir); + else + tc.WriteLine ("static const char *config_dir = NULL;"); StreamReader s = new StreamReader (Assembly.GetAssembly (typeof(MakeBundle)).GetManifestResourceStream ("template.c")); tc.Write (s.ReadToEnd ()); @@ -371,15 +386,16 @@ class MakeBundle { { Console.WriteLine ("Usage is: mkbundle [options] assembly1 [assembly2...]\n\n" + "Options:\n" + - " -c Produce stub only, do not compile\n" + - " -o out Specifies output filename\n" + - " -oo obj Specifies output filename for helper object file" + - " -L path Adds `path' to the search path for assemblies\n" + - " --nodeps Turns off automatic dependency embedding (default)\n" + - " --deps Turns on automatic dependency embedding\n" + - " --keeptemp Keeps the temporary files\n" + - " --config F Bundle system config file `F'\n" + - " --static Statically link to mono libs\n"); + " -c Produce stub only, do not compile\n" + + " -o out Specifies output filename\n" + + " -oo obj Specifies output filename for helper object file\n" + + " -L path Adds `path' to the search path for assemblies\n" + + " --nodeps Turns off automatic dependency embedding (default)\n" + + " --deps Turns on automatic dependency embedding\n" + + " --keeptemp Keeps the temporary files\n" + + " --config F Bundle system config file `F'\n" + + " --config-dir D Set MONO_CFG_DIR to `D'\n" + + " --static Statically link to mono libs\n"); } [DllImport ("libc")] diff --git a/mcs/tools/mkbundle/template.c b/mcs/tools/mkbundle/template.c index 2f0bca5e39c..c3432e95c0c 100644 --- a/mcs/tools/mkbundle/template.c +++ b/mcs/tools/mkbundle/template.c @@ -1,5 +1,6 @@ int mono_main (int argc, char* argv[]); +#include #include int main (int argc, char* argv[]) @@ -12,6 +13,9 @@ int main (int argc, char* argv[]) for (i = 1; i < argc; i++) newargs [i+1] = argv [i]; newargs [++i] = NULL; + + if (config_dir != NULL && getenv ("MONO_CFG_DIR") == NULL) + setenv ("MONO_CFG_DIR", config_dir, 1); install_dll_config_files (); mono_register_bundled_assemblies(bundled); -- 2.25.1