2005-04-28 James Willcox <james@ximian.com>
authorJames Willcox <jwilcox@mono-cvs.ximian.com>
Thu, 28 Apr 2005 20:21:01 +0000 (20:21 -0000)
committerJames Willcox <jwilcox@mono-cvs.ximian.com>
Thu, 28 Apr 2005 20:21:01 +0000 (20:21 -0000)
        * mkbundle.cs: Add --config-dir option
        * template.c: same

svn path=/trunk/mcs/; revision=43744

mcs/tools/mkbundle/ChangeLog
mcs/tools/mkbundle/mkbundle.cs
mcs/tools/mkbundle/template.c

index 015bffafa5077b74b24ffa76dcf27bc58975cdea..dba26fbb66aadc07566c99b63cbb251a302da2f3 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-28 James Willcox <james@ximian.com>
+
+       * mkbundle.cs: Add --config-dir option
+       * template.c: same
+
 2005-04-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * mkbundle.cs: GetReferencedAssemblies () will not report CodeBase, so
index 8960d129c5fd1ff20df5cc9111ab7e885e0b1e74..acc1ca8b41ba49bbfb960814ce328f6876f316da 100644 (file)
@@ -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")]
index 2f0bca5e39ca8d94939b8f11cde76c44d4a5b588..c3432e95c0c2c6c41eec988176c8031fb8a80a17 100644 (file)
@@ -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 @@ 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);