Author: jwilcox
Date: 2005-04-08 01:46:41 -0400 (Fri, 08 Apr 2005)
New Revision: 42674

Modified:
   trunk/mcs/tools/mkbundle/ChangeLog
   trunk/mcs/tools/mkbundle/mkbundle.cs
Log:
2004-04-08  James Willcox  <[EMAIL PROTECTED]>
                                                                                
                                
        * mkbundle.cs: add a --static flag for statically linking to
        * libmono



Modified: trunk/mcs/tools/mkbundle/ChangeLog
===================================================================
--- trunk/mcs/tools/mkbundle/ChangeLog  2005-04-08 04:51:53 UTC (rev 42673)
+++ trunk/mcs/tools/mkbundle/ChangeLog  2005-04-08 05:46:41 UTC (rev 42674)
@@ -1,4 +1,7 @@
+2004-04-08  James Willcox  <[EMAIL PROTECTED]>
 
+       * mkbundle.cs: add a --static flag for statically linking to libmono
+
 Wed Mar 16 18:11:47 CET 2005 Paolo Molaro <[EMAIL PROTECTED]>
 
        * template.c, mkbundle.cs: automatically bundle config files if found.

Modified: trunk/mcs/tools/mkbundle/mkbundle.cs
===================================================================
--- trunk/mcs/tools/mkbundle/mkbundle.cs        2005-04-08 04:51:53 UTC (rev 
42673)
+++ trunk/mcs/tools/mkbundle/mkbundle.cs        2005-04-08 05:46:41 UTC (rev 
42674)
@@ -23,6 +23,7 @@
        static bool autodeps = false;
        static bool keeptemp = false;
        static bool compile_only = false;
+       static bool static_link = false;
        
        static int Main (string [] args)
        {
@@ -75,7 +76,9 @@
                        case "--keeptemp":
                                keeptemp = true;
                                break;
-                               
+                       case "--static":
+                               static_link = true;
+                               break;
                        default:
                                sources.Add (args [i]);
                                break;
@@ -208,9 +211,19 @@
 
                        if (compile_only)
                                return;
-                       
-                       cmd = String.Format ("cc -o {2} -Wall {0} `pkg-config 
--cflags --libs mono` {1}",
-                                            temp_c, temp_o, output);
+
+                       if (static_link)
+                               cmd = String.Format ("cc -o {2} -Wall 
`pkg-config --cflags mono` {0} " +
+                                                    "`pkg-config --libs-only-L 
mono` -Wl,-Bstatic " +
+                                                    "`pkg-config --libs-only-l 
mono | sed -e \"s/\\-lm //\" | " +
+                                                    "sed -e \"s/\\-ldl //\" | 
sed -e \"s/\\-lpthread //\"` " +
+                                                    "-Wl,-Bdynamic -ldl -lm 
-lrt {1}",
+                                                    temp_c, temp_o, output);
+                       else
+                               cmd = String.Format ("cc -o {2} -Wall {0} 
`pkg-config --cflags --libs mono` {1}",
+                                                    temp_c, temp_o, output);
+
+                            
                        Console.WriteLine (cmd);
                        ret = system (cmd);
                        if (ret != 0){
@@ -328,7 +341,8 @@
                                   "    -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");
+                                  "    --keeptemp  Keeps the temporary 
files\n" +
+                                  "    --static    Statically link to mono 
libs\n");
        }
 
        [DllImport ("libc")]

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

Reply via email to