apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject svn commit: r421786 - /apr/apr/trunk/build/jlibtool.c
Date Fri, 14 Jul 2006 03:02:09 GMT
Author: jerenkrantz
Date: Thu Jul 13 20:02:09 2006
New Revision: 421786

URL: http://svn.apache.org/viewvc?rev=421786&view=rev
Log:
Allow jlibtool to compile and link on mingw.

The notable bits here are:
- mingw doesn't have fork() or waitpid()
- mkdir() doesn't take the umask parameter
- The MSVCRT runtime is 'safe' and reparses anything that isn't separated with
  a double-quote; so add quotes around our escaped statement to run.

Modified:
    apr/apr/trunk/build/jlibtool.c

Modified: apr/apr/trunk/build/jlibtool.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/jlibtool.c?rev=421786&r1=421785&r2=421786&view=diff
==============================================================================
--- apr/apr/trunk/build/jlibtool.c (original)
+++ apr/apr/trunk/build/jlibtool.c Thu Jul 13 20:02:09 2006
@@ -19,7 +19,9 @@
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if !defined(__MINGW32__)
 #include <sys/wait.h>
+#endif
 #include <unistd.h>
 #include <dirent.h>
 #include <errno.h>
@@ -145,6 +147,21 @@
 #  define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
 #endif
 
+#if defined(__MINGW32__)
+#  define SHELL_CMD "sh"
+#  define DYNAMIC_LIB_EXT "dll"
+#  define MODULE_LIB_EXT  "dll"
+#  define STATIC_LIB_EXT "a"
+#  define OBJECT_EXT     "o"
+#  define LIBRARIAN      "ar"
+#  define LIBRARIAN_OPTS "cr"
+#  define RANLIB "ranlib"
+#  define LINKER_FLAG_PREFIX "-Wl,"
+#  define SHARED_OPTS "-shared"
+#  define MODULE_OPTS "-shared"
+#  define MKDIR_NO_UMASK
+#endif
+
 #ifndef SHELL_CMD
 #error Unsupported platform: Please add defines for SHELL_CMD etc. for your platform.
 #endif
@@ -375,10 +392,14 @@
     unsigned char *d;
     const unsigned char *s;
 
-    cmd = (char *)malloc(2 * strlen(str) + 1);
+    cmd = (char *)malloc(2 * strlen(str) + 3);
     d = (unsigned char *)cmd;
     s = (const unsigned char *)str;
 
+#ifdef __MINGW32__
+    *d++ = '\"';
+#endif
+
     for (; *s; ++s) {
         if (*s == '"') {
             *d++ = '\\';
@@ -390,6 +411,10 @@
         *d++ = *s;
     }
 
+#ifdef __MINGW32__
+    *d++ = '\"';
+#endif
+
     *d = '\0';
     return cmd;
 }
@@ -409,8 +434,8 @@
     if (cmd->options.dry_run) {
         return 0;
     }
-#ifdef __EMX__
-    return spawnvp(P_WAIT, file, argv);
+#if defined(__EMX__) || defined(__MINGW32__)
+    return spawnvp(P_WAIT, argv[0], argv);
 #else
     {
         pid_t pid;
@@ -1380,7 +1405,11 @@
     strcpy(tmpdir, lib);
     strcat(tmpdir, ".exploded");
 
+#ifdef MKDIR_NO_UMASK
+    mkdir(tmpdir);
+#else
     mkdir(tmpdir, 0);
+#endif
     push_count_chars(cmd_data->tmp_dirs, strdup(tmpdir));
     getcwd(savewd, sizeof(savewd));
 
@@ -1721,7 +1750,11 @@
             old_umask = umask(0);
             umask(old_umask);
 
+#ifdef MKDIR_NO_UMASK
+            mkdir(".libs");
+#else
             mkdir(".libs", ~old_umask);
+#endif
         }
 
         if (cmd_data->output == otStaticLibraryOnly ||



Mime
View raw message