Beginnings of an OCaml cross-compiler.
[fedora-mingw.git] / ocaml / mingw32-ocaml-3.11.0+beta1-win32-fixes.patch
diff --git a/ocaml/mingw32-ocaml-3.11.0+beta1-win32-fixes.patch b/ocaml/mingw32-ocaml-3.11.0+beta1-win32-fixes.patch
new file mode 100644 (file)
index 0000000..1e19167
--- /dev/null
@@ -0,0 +1,58 @@
+Misc fixes for byterun/win32.c
+
+diff --exclude _build -urN ocaml-3.11.0+beta1.orig/byterun/win32.c ocaml-3.11.0+beta1.mingw/byterun/win32.c
+--- ocaml-3.11.0+beta1.orig/byterun/win32.c    2008-04-22 13:24:10.000000000 +0100
++++ ocaml-3.11.0+beta1.mingw/byterun/win32.c   2008-11-15 15:50:32.000000000 +0000
+@@ -13,7 +13,6 @@
+ #include <windows.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+-#include <io.h>
+ #include <fcntl.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -35,6 +36,26 @@
+ #include "flexdll.h"
++/* XXX including <io.h> gets ../byterun/io.h for some reason.
++ * Including the real io.h using the full path fails because of
++ * some strange bug in the system header file itself.  Give up and
++ * just define _finddata_t explicitly here.
++ */
++#ifndef _FSIZE_T_DEFINED
++typedef unsigned long   _fsize_t;
++#define _FSIZE_T_DEFINED
++
++struct _finddata_t
++{
++  unsigned        attrib;
++  time_t          time_create;
++  time_t          time_access;
++  time_t          time_write;
++  _fsize_t        size;
++  char            name[FILENAME_MAX];
++};
++#endif
++
+ #ifndef S_ISREG
+ #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
+ #endif
+@@ -93,7 +114,7 @@
+   pathlen = strlen(name) + 1;
+   if (pathlen < 256) pathlen = 256;
+   while (1) {
+-    fullname = stat_alloc(pathlen);
++    fullname = caml_stat_alloc(pathlen);
+     retcode = SearchPath(NULL,              /* use system search path */
+                        name,
+                        ".exe",            /* add .exe extension if needed */
+@@ -107,7 +128,7 @@
+       break;
+     }
+     if (retcode < pathlen) break;
+-    stat_free(fullname);
++    caml_stat_free(fullname);
+     pathlen = retcode + 1;
+   }
+   return fullname;