Author: jwilcox
Date: 2005-04-28 16:21:01 -0400 (Thu, 28 Apr 2005)
New Revision: 43744

Modified:
   trunk/mcs/tools/mkbundle/ChangeLog
   trunk/mcs/tools/mkbundle/mkbundle.cs
   trunk/mcs/tools/mkbundle/template.c
Log:
2005-04-28 James Willcox <[EMAIL PROTECTED]>

        * mkbundle.cs: Add --config-dir option
        * template.c: same



Modified: trunk/mcs/tools/mkbundle/ChangeLog
===================================================================
--- trunk/mcs/tools/mkbundle/ChangeLog  2005-04-28 19:49:34 UTC (rev 43743)
+++ trunk/mcs/tools/mkbundle/ChangeLog  2005-04-28 20:21:01 UTC (rev 43744)
@@ -1,3 +1,8 @@
+2005-04-28 James Willcox <[EMAIL PROTECTED]>
+
+       * mkbundle.cs: Add --config-dir option
+       * template.c: same
+
 2005-04-25 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * mkbundle.cs: GetReferencedAssemblies () will not report CodeBase, so

Modified: trunk/mcs/tools/mkbundle/mkbundle.cs
===================================================================
--- trunk/mcs/tools/mkbundle/mkbundle.cs        2005-04-28 19:49:34 UTC (rev 
43743)
+++ trunk/mcs/tools/mkbundle/mkbundle.cs        2005-04-28 20:21:01 UTC (rev 
43744)
@@ -25,6 +25,7 @@
        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 @@
                                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 @@
                                                ts.Write ("\t.byte {0}\n", 
buffer [i]);
                                        }
                                }
-                               // null terminator 
+                               // null terminator
                                ts.Write ("\t.byte 0\n");
                                ts.WriteLine ();
                        }
@@ -238,6 +248,11 @@
                        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 @@
        {
                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")]

Modified: trunk/mcs/tools/mkbundle/template.c
===================================================================
--- trunk/mcs/tools/mkbundle/template.c 2005-04-28 19:49:34 UTC (rev 43743)
+++ trunk/mcs/tools/mkbundle/template.c 2005-04-28 20:21:01 UTC (rev 43744)
@@ -1,5 +1,6 @@
 int mono_main (int argc, char* argv[]);
 
+#include <stdlib.h>
 #include <malloc.h>
 
 int main (int argc, char* argv[])
@@ -12,6 +13,9 @@
        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);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to