Revert "add package ocaml-core"

This reverts commit f7e8a7a5f6.
This commit is contained in:
Mark Brand 2012-09-18 23:43:52 +02:00
parent 3ff298f43d
commit e06403840e
4 changed files with 0 additions and 773 deletions

View File

@ -1648,11 +1648,6 @@ USE_OSGPLUGIN(<plugin2>)
<td id="ocaml-flexdll-version">0.30</td>
<td id="ocaml-flexdll-website"><a href="http://alain.frisch.fr/">flexdll</a></td>
</tr>
<tr>
<td id="ocaml-core-package">ocaml</td>
<td id="ocaml-core-version">3.12.1</td>
<td id="ocaml-core-website"><a href="http://caml.inria.fr/">ocaml</a></td>
</tr>
<tr>
<td id="ogg-package">ogg</td>
<td id="ogg-version">1.3.0</td>

View File

@ -1,613 +0,0 @@
This file is part of MXE.
See index.html for further information.
Contains ad hoc patches for cross building.
From 0a4f59615e611ce517dc02226ca185370ae646a6 Mon Sep 17 00:00:00 2001
From: MXE
Date: Wed, 13 Jun 2012 22:27:54 +0200
Subject: [PATCH] various patches to build an ocaml cross compiler
diff --git a/Makefile-mingw.in b/Makefile-mingw.in
new file mode 100644
index 0000000..a303487
--- /dev/null
+++ b/Makefile-mingw.in
@@ -0,0 +1,82 @@
+PREFIX=@prefix@
+BINDIR=@bindir@
+LIBDIR=@libdir@
+TARGET2=@target2@
+LIBDIR2=@libdir2@
+STUBLIBDIR=$(LIBDIR)/stublibs
+MANDIR=$(PREFIX)/man
+MANEXT=1
+RANLIB=$(TARGET2)ranlib
+RANLIBCMD=$(TARGET2)ranlib
+SHARPBANGSCRIPTS=true
+BNG_ARCH=i386
+BNG_ASM_LEVEL=1
+PTHREAD_LINK=
+X11_INCLUDES=
+X11_LINK=
+DBM_INCLUDES=
+DBM_LINK=
+TK_DEFS=
+TK_LINK=
+BYTECC=$(TARGET2)gcc
+BYTECCCOMPOPTS=-O -mms-bitfields -Wall -Wno-unused
+BYTECCLINKOPTS=-L$(LIBDIR2)
+BYTECCLIBS=
+BYTECCRPATH=
+EXE=
+SUPPORTS_SHARED_LIBRARIES=true
+SHAREDCCCOMPOPTS=
+MKSHAREDLIBRPATH=
+NATDYNLINK=true
+NATDYNLINKOPTS=
+SYSLIB=-l$(1)
+#ml let syslib x = "-l"^x;;
+
+### How to build a static library
+MKLIB=$(TARGET2)ar rcs $(1) $(2)
+#ml let mklib out files opts = Printf.sprintf ("%sar rcs %s %s %s") target2 out opts files;;
+ARCH=i386
+MODEL=default
+SYSTEM=mingw
+NATIVECC=$(TARGET2)gcc
+NATIVECCCOMPOPTS=-O -mms-bitfields -Wall -Wno-unused
+NATIVECCPROFOPTS=-pg
+NATIVECCLINKOPTS=-L$(LIBDIR2)
+NATIVECCRPATH=
+NATIVECCLIBS=
+ASM=$(TARGET2)as
+ASPP=$(TARGET2)gcc -c
+ASPPPROFFLAGS=-DPROFILING
+PROFILING=prof
+DYNLINKOPTS=-ldl
+OTHERLIBRARIES=@otherlibraries@
+DEBUGGER=ocamldebugger
+CC_PROFILE=-pg
+SYSTHREAD_SUPPORT=true
+PARTIALLD=$(TARGET2)ld -r
+PACKLD=$(PARTIALLD) $(NATIVECCLINKOPTS) -o
+DLLCCCOMPOPTS=
+IFLEXDIR=-I@flexdir@
+O=o
+A=a
+SO=dll
+EXT_OBJ=.o
+EXT_ASM=.s
+EXT_LIB=.a
+EXT_DLL=.dll
+EXTRALIBS=
+CCOMPTYPE=cc
+TOOLCHAIN=cc
+CMXS=cmxs
+FLEXLINK=$(TARGET2)flexlink -chain mingw
+MKEXE=$(FLEXLINK) -exe
+MKDLL=$(FLEXLINK)
+MKMAINDLL=$(FLEXLINK) -maindll
+
+# Build compiler for cross-compilation.
+BUILD_MKEXE=gcc
+BUILD_RANLIB=ranlib
+BUILD_MKDLL=gcc -shared
+BUILD_CC=gcc
+BUILD_CCLIBS=-lm
+BUILD_CFLAGS=
diff --git a/asmrun/Makefile b/asmrun/Makefile
index efffa33..5b1a8a5 100644
--- a/asmrun/Makefile
+++ b/asmrun/Makefile
@@ -26,7 +26,7 @@ COBJS=startup.o main.o fail.o roots.o globroots.o signals.o signals_asm.o \
misc.o freelist.o major_gc.o minor_gc.o memory.o alloc.o compare.o ints.o \
floats.o str.o array.o io.o extern.o intern.o hash.o sys.o parsing.o \
gc_ctrl.o terminfo.o md5.o obj.o lexing.o printexc.o callback.o weak.o \
- compact.o finalise.o custom.o unix.o backtrace.o natdynlink.o debugger.o
+ compact.o finalise.o custom.o unix.o win32.o backtrace.o natdynlink.o debugger.o
ASMOBJS=$(ARCH).o
@@ -138,6 +138,8 @@ globroots.c: ../byterun/globroots.c
ln -s ../byterun/globroots.c globroots.c
unix.c: ../byterun/unix.c
ln -s ../byterun/unix.c unix.c
+win32.c: ../byterun/win32.c
+ ln -s ../byterun/win32.c win32.c
dynlink.c: ../byterun/dynlink.c
ln -s ../byterun/dynlink.c dynlink.c
signals.c: ../byterun/signals.c
@@ -148,7 +150,7 @@ debugger.c: ../byterun/debugger.c
LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \
compare.c ints.c floats.c str.c io.c extern.c intern.c hash.c sys.c \
parsing.c gc_ctrl.c terminfo.c md5.c obj.c lexing.c printexc.c callback.c \
- weak.c compact.c finalise.c meta.c custom.c main.c globroots.c unix.c \
+ weak.c compact.c finalise.c meta.c custom.c main.c globroots.c unix.c win32.c \
dynlink.c signals.c debugger.c
clean::
diff --git a/asmrun/i386.S b/asmrun/i386.S
index 95198e0..25edd28 100644
--- a/asmrun/i386.S
+++ b/asmrun/i386.S
@@ -64,6 +64,9 @@
popl %edx; popl %ecx; popl %eax; popl %ebp
#define PROFILE_C \
pushl %ebp; movl %esp, %ebp; call Lmcount$stub; popl %ebp
+#elif defined(SYS_mingw)
+#define PROFILE_CAML
+#define PROFILE_C
#endif
#else
#define PROFILE_CAML
diff --git a/byterun/Makefile.common b/byterun/Makefile.common
index d554d29..047d817 100755
--- a/byterun/Makefile.common
+++ b/byterun/Makefile.common
@@ -24,7 +24,7 @@ COMMONOBJS=\
compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \
hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \
lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \
- dynlink.o
+ dynlink.o win32.o
PRIMS=\
alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
diff --git a/byterun/dynlink.c b/byterun/dynlink.c
index 9f46597..2aaa07b 100644
--- a/byterun/dynlink.c
+++ b/byterun/dynlink.c
@@ -80,7 +80,12 @@ static char * parse_ld_conf(void)
stdlib = getenv("OCAMLLIB");
if (stdlib == NULL) stdlib = getenv("CAMLLIB");
- if (stdlib == NULL) stdlib = OCAML_STDLIB_DIR;
+ if (stdlib == NULL)
+#ifdef OCAML_STDLIB_DIR
+ stdlib = OCAML_STDLIB_DIR;
+#else
+ stdlib = ".";
+#endif
ldconfname = caml_stat_alloc(strlen(stdlib) + 2 + sizeof(LD_CONF_NAME));
strcpy(ldconfname, stdlib);
strcat(ldconfname, "/" LD_CONF_NAME);
diff --git a/byterun/unix.c b/byterun/unix.c
index 20fd172..e86f1c8 100644
--- a/byterun/unix.c
+++ b/byterun/unix.c
@@ -15,6 +15,8 @@
/* Unix-specific stuff */
+#ifndef WIN32
+
#define _GNU_SOURCE
/* Helps finding RTLD_DEFAULT in glibc */
@@ -323,3 +325,5 @@ int caml_executable_name(char * name, int name_len)
}
#endif
+
+#endif /* !WIN32 */
diff --git a/byterun/win32.c b/byterun/win32.c
index 29991c0..e7767a4 100644
--- a/byterun/win32.c
+++ b/byterun/win32.c
@@ -13,6 +13,8 @@
/* $Id: win32.c 9547 2010-01-22 12:48:24Z doligez $ */
+#ifdef WIN32
+
/* Win32-specific stuff */
#include <windows.h>
@@ -35,6 +37,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 +115,7 @@ CAMLexport char * caml_search_exe_in_path(char * name)
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 +129,7 @@ CAMLexport char * caml_search_exe_in_path(char * name)
break;
}
if (retcode < pathlen) break;
- stat_free(fullname);
+ caml_stat_free(fullname);
pathlen = retcode + 1;
}
return fullname;
@@ -543,3 +565,5 @@ intnat caml_win32_random_seed (void)
seed ^= GetCurrentProcessId();
return seed;
}
+
+#endif /* WIN32 */
diff --git a/hardcode_mingw_include.patch b/hardcode_mingw_include.patch
new file mode 100644
index 0000000..571747d
--- /dev/null
+++ b/hardcode_mingw_include.patch
@@ -0,0 +1,24 @@
+Index: build-tree/ocaml-3.11.1/utils/clflags.ml
+===================================================================
+--- build-tree.orig/ocaml-3.12.1/utils/clflags.ml 2010-01-07 04:00:11.000000000 +0100
++++ build-tree/ocaml-3.12.1/utils/clflags.ml 2010-01-07 04:00:24.000000000 +0100
+@@ -20,7 +20,7 @@
+
+ let compile_only = ref false (* -c *)
+ and output_name = ref (None : string option) (* -o *)
+-and include_dirs = ref ([] : string list)(* -I *)
++and include_dirs = ref (["@libdir@"] : string list)(* -I *)
+ and no_std_include = ref false (* -nostdlib *)
+ and print_types = ref false (* -i *)
+ and make_archive = ref false (* -a *)
+--- build-tree.orig/ocaml-3.12.1/tools/ocamlmklib.mlp 2010-02-22 20:15:57.000000000 -0600
++++ build-tree/ocaml-3.12.1/tools/ocamlmklib.mlp 2010-02-22 20:16:20.000000000 -0600
+@@ -29,7 +29,7 @@
+ and failsafe = ref false (* whether to fall back on static build only *)
+ and c_libs = ref [] (* libs to pass to mksharedlib and ocamlc -cclib *)
+ and c_opts = ref [] (* options to pass to mksharedlib and ocamlc -ccopt *)
+-and ld_opts = ref [] (* options to pass only to the linker *)
++and ld_opts = ref ["-I @libdir@"] (* options to pass only to the linker *)
+ and ocamlc = ref (compiler_path "ocamlc")
+ and ocamlopt = ref (compiler_path "ocamlopt")
+ and output = ref "a" (* Output name for Caml part of library *)
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index d50274d..ecdad32 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -107,9 +107,11 @@ let if_mixed_dir dir =
if mixed then ".."/dir else dir;;
let unix_dir =
- match Sys.os_type with
- | "Win32" -> if_mixed_dir "otherlibs/win32unix"
- | _ -> if_mixed_dir "otherlibs/unix";;
+ if_mixed_dir (
+ let win32path = "otherlibs/win32unix" in
+ if Sys.file_exists (win32path / "unix.cma") then win32path
+ else "otherlibs/unix"
+ );;
let threads_dir = if_mixed_dir "otherlibs/threads";;
let systhreads_dir = if_mixed_dir "otherlibs/systhreads";;
diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile
index 8f6e87c..30b4489 100644
--- a/ocamldoc/Makefile
+++ b/ocamldoc/Makefile
@@ -62,6 +62,7 @@ INCLUDES_DEP=-I $(OCAMLSRCDIR)/parsing \
INCLUDES_NODEP= -I $(OCAMLSRCDIR)/stdlib \
-I $(OCAMLSRCDIR)/otherlibs/str \
-I $(OCAMLSRCDIR)/otherlibs/dynlink \
+ -I $(OCAMLSRCDIR)/otherlibs/win32unix \
-I $(OCAMLSRCDIR)/otherlibs/unix \
-I $(OCAMLSRCDIR)/otherlibs/num \
-I $(OCAMLSRCDIR)/otherlibs/graph
diff --git a/otherlibs/Makefile.shared b/otherlibs/Makefile.shared
index b235cc3..97217d5 100644
--- a/otherlibs/Makefile.shared
+++ b/otherlibs/Makefile.shared
@@ -42,7 +42,8 @@ CLIBNAME ?= $(LIBNAME)
all: lib$(CLIBNAME).$(A) $(LIBNAME).cma $(CMIFILES)
-allopt: lib$(CLIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).$(CMXS) $(CMIFILES)
+allopt: lib$(CLIBNAME).$(A) $(LIBNAME).cmxa $(CMIFILES)
+# $(LIBNAME).$(CMXS)
$(LIBNAME).cma: $(CAMLOBJS)
$(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlc '$(CAMLC)' -linkall $(CAMLOBJS) $(LINKOPTS)
@@ -50,8 +51,8 @@ $(LIBNAME).cma: $(CAMLOBJS)
$(LIBNAME).cmxa: $(CAMLOBJS_NAT)
$(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlopt '$(CAMLOPT)' -linkall $(CAMLOBJS_NAT) $(LINKOPTS)
-$(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A)
- $(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa
+#$(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A)
+# $(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa
lib$(CLIBNAME).$(A): $(COBJS)
$(MKLIB) -oc $(CLIBNAME) $(COBJS) $(LDOPTS)
diff --git a/otherlibs/bigarray/Makefile b/otherlibs/bigarray/Makefile
index 81f5aef..f5f0747 100644
--- a/otherlibs/bigarray/Makefile
+++ b/otherlibs/bigarray/Makefile
@@ -14,8 +14,8 @@
# $Id: Makefile 8748 2008-01-04 09:52:27Z xleroy $
LIBNAME=bigarray
-EXTRACFLAGS=-I../unix -DIN_OCAML_BIGARRAY -DCAML_NAME_SPACE
-EXTRACAMLFLAGS=-I ../unix
+EXTRACFLAGS=-I../win32unix -I../unix -DIN_OCAML_BIGARRAY -DCAML_NAME_SPACE
+EXTRACAMLFLAGS=-I ../win32unix -I ../unix
COBJS=bigarray_stubs.$(O) mmap_unix.$(O)
CAMLOBJS=bigarray.cmo
HEADERS=bigarray.h
diff --git a/otherlibs/bigarray/Makefile.nt b/otherlibs/bigarray/Makefile.nt
index 94ef9dd..0b72534 100644
--- a/otherlibs/bigarray/Makefile.nt
+++ b/otherlibs/bigarray/Makefile.nt
@@ -19,6 +19,7 @@ EXTRACAMLFLAGS=-I ../win32unix
COBJS=bigarray_stubs.$(O) mmap_win32.$(O)
CAMLOBJS=bigarray.cmo
HEADERS=bigarray.h
+LDOPTS=-L@libdir@
include ../Makefile.nt
diff --git a/otherlibs/num/Makefile b/otherlibs/num/Makefile
index 6feef50..86d331c 100644
--- a/otherlibs/num/Makefile
+++ b/otherlibs/num/Makefile
@@ -21,6 +21,7 @@ CAMLOBJS=int_misc.cmo nat.cmo big_int.cmo arith_flags.cmo \
ratio.cmo num.cmo arith_status.cmo
CMIFILES=big_int.cmi nat.cmi num.cmi ratio.cmi arith_status.cmi
COBJS=bng.$(O) nat_stubs.$(O)
+LDOPTS=-L@libdir@
include ../Makefile
diff --git a/otherlibs/str/Makefile b/otherlibs/str/Makefile
index b59fe80..38c6798 100644
--- a/otherlibs/str/Makefile
+++ b/otherlibs/str/Makefile
@@ -20,6 +20,7 @@ LIBNAME=str
COBJS=strstubs.$(O)
CLIBNAME=camlstr
CAMLOBJS=str.cmo
+LDOPTS=-L@libdir@
include ../Makefile
diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile
index 5ee2775..bcd3186 100644
--- a/otherlibs/systhreads/Makefile
+++ b/otherlibs/systhreads/Makefile
@@ -15,13 +15,13 @@
include ../../config/Makefile
-CAMLC=../../ocamlcomp.sh -I ../unix
-CAMLOPT=../../ocamlcompopt.sh -I ../unix
+CAMLC=../../ocamlcomp.sh -I ../win32unix -I ../unix
+CAMLOPT=../../ocamlcompopt.sh -I ../win32unix -I ../unix
MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
COMPFLAGS=-warn-error A -g
-BYTECODE_C_OBJS=st_stubs_b.o
-NATIVECODE_C_OBJS=st_stubs_n.o
+BYTECODE_C_OBJS=st_stubs_b.o win32_b.o
+NATIVECODE_C_OBJS=st_stubs_n.o win32_n.o
THREAD_OBJS= thread.cmo mutex.cmo condition.cmo event.cmo threadUnix.cmo
@@ -37,6 +37,10 @@ st_stubs_b.o: st_stubs.c st_posix.h
-c st_stubs.c
mv st_stubs.o st_stubs_b.o
+win32_b.$(O): st_stubs.c st_win32.h
+ $(BYTECC) -I ../../byterun $(BYTECCCOMPOPTS) $(CFLAGS) -c st_stubs.c
+ mv st_stubs.$(O) win32_b.$(O)
+
# Dynamic linking with -lpthread is risky on many platforms, so
# do not create a shared object for libthreadsnat.
libthreadsnat.a: $(NATIVECODE_C_OBJS)
@@ -46,9 +50,13 @@ st_stubs_n.o: st_stubs.c st_posix.h
$(NATIVECC) -O -I../../asmrun -I../../byterun $(NATIVECCCOMPOPTS) $(SHAREDCCCOMPOPTS) -DNATIVE_CODE -DTARGET_$(ARCH) -DSYS_$(SYSTEM) -c st_stubs.c
mv st_stubs.o st_stubs_n.o
+win32_n.$(O): st_stubs.c st_win32.h
+ $(NATIVECC) -DNATIVE_CODE -O -I../../asmrun -I../../byterun $(NATIVECCCOMPOPTS) -c st_stubs.c
+ mv st_stubs.$(O) win32_n.$(O)
+
threads.cma: $(THREAD_OBJS)
$(MKLIB) -ocamlc '$(CAMLC)' -o threads $(THREAD_OBJS) \
- -cclib -lunix $(PTHREAD_LINK)
+ -cclib -lunix $(PTHREAD_LINK) -lcamlrun
# See remark above: force static linking of libthreadsnat.a
threads.cmxa: $(THREAD_OBJS:.cmo=.cmx)
diff --git a/otherlibs/systhreads/Makefile.nt b/otherlibs/systhreads/Makefile.nt
index a7d6aaa..1766b6e 100644
--- a/otherlibs/systhreads/Makefile.nt
+++ b/otherlibs/systhreads/Makefile.nt
@@ -21,6 +21,7 @@ CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib -I ../win32unix
COMPFLAGS=-warn-error A -g
MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
CFLAGS=-I../../byterun $(EXTRACFLAGS)
+LDOPTS=-L@libdir@
CAMLOBJS=thread.cmo mutex.cmo condition.cmo event.cmo threadUnix.cmo
CMIFILES=$(CAMLOBJS:.cmo=.cmi)
@@ -34,7 +35,7 @@ all: lib$(LIBNAME).$(A) $(LIBNAME).cma $(CMIFILES)
allopt: lib$(LIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).cmxs $(CMIFILES)
$(LIBNAME).cma: $(CAMLOBJS)
- $(MKLIB) -o $(LIBNAME) -ocamlc "..\\..\\boot\\ocamlrun ..\\..\\ocamlc" -linkall $(CAMLOBJS) $(LINKOPTS)
+ $(MKLIB) -o $(LIBNAME) -ocamlc "../../boot/ocamlrun ../../ocamlc" -linkall $(CAMLOBJS) $(LINKOPTS)
lib$(LIBNAME).$(A): $(COBJS)
$(MKLIB) -o $(LIBNAME) $(COBJS) $(LDOPTS)
@@ -46,7 +47,7 @@ st_stubs_b.$(O): st_stubs.c st_win32.h
$(LIBNAME).cmxa: $(CAMLOBJS:.cmo=.cmx)
- $(MKLIB) -o $(LIBNAME)nat -ocamlopt "..\\..\\boot\\ocamlrun ..\\..\\ocamlopt" -linkall $(CAMLOBJS:.cmo=.cmx) $(LINKOPTS)
+ $(MKLIB) -o $(LIBNAME)nat -ocamlopt "../../boot/ocamlrun ../../ocamlopt" -linkall $(CAMLOBJS:.cmo=.cmx) $(LINKOPTS)
mv $(LIBNAME)nat.cmxa $(LIBNAME).cmxa
mv $(LIBNAME)nat.$(A) $(LIBNAME).$(A)
@@ -71,6 +72,7 @@ clean: partialclean
install:
cp dllthreads.dll $(STUBLIBDIR)/dllthreads.dll
cp libthreads.$(A) $(LIBDIR)/libthreads.$(A)
+ cd $(LIBDIR); $(RANLIB) libthreads.$(A)
mkdir -p $(LIBDIR)/threads
cp $(CMIFILES) threads.cma $(LIBDIR)/threads
rm -f $(LIBDIR)/threads/stdlib.cma
@@ -78,6 +80,7 @@ install:
installopt:
cp libthreadsnat.$(A) $(LIBDIR)/libthreadsnat.$(A)
+ cd $(LIBDIR); $(RANLIB) libthreadsnat.$(A)
cp $(THREAD_OBJS:.cmo=.cmx) threads.cmxa threads.$(A) $(LIBDIR)/threads
cp threads.cmxs $(LIBDIR)/threads
diff --git a/otherlibs/systhreads/st_win32.h b/otherlibs/systhreads/st_win32.h
index e3e37c8..a55c4b4 100644
--- a/otherlibs/systhreads/st_win32.h
+++ b/otherlibs/systhreads/st_win32.h
@@ -16,7 +16,7 @@
/* Win32 implementation of the "st" interface */
#include <windows.h>
-#include <WinError.h>
+#include <winerror.h>
#include <stdio.h>
#include <signal.h>
diff --git a/otherlibs/win32graph/Makefile.nt b/otherlibs/win32graph/Makefile.nt
index 92f244d..0201484 100644
--- a/otherlibs/win32graph/Makefile.nt
+++ b/otherlibs/win32graph/Makefile.nt
@@ -18,7 +18,7 @@ COBJS=open.$(O) draw.$(O) events.$(O) dib.$(O)
CAMLOBJS=graphics.cmo
WIN32LIBS=$(call SYSLIB,kernel32) $(call SYSLIB,gdi32) $(call SYSLIB,user32)
LINKOPTS=-cclib "\"$(WIN32LIBS)\""
-LDOPTS=-ldopt "$(WIN32LIBS)"
+LDOPTS=-L@libdir@ -ldopt "$(WIN32LIBS)"
include ../Makefile.nt
diff --git a/otherlibs/win32unix/Makefile.nt b/otherlibs/win32unix/Makefile.nt
index 5fa26cf..f048cee 100644
--- a/otherlibs/win32unix/Makefile.nt
+++ b/otherlibs/win32unix/Makefile.nt
@@ -40,7 +40,7 @@ LIBNAME=unix
COBJS=$(ALL_FILES:.c=.$(O))
CAMLOBJS=unix.cmo unixLabels.cmo
LINKOPTS=-cclib $(WSOCKLIB)
-LDOPTS=-ldopt $(WSOCKLIB)
+LDOPTS=-L@libdir@ -ldopt $(WSOCKLIB)
EXTRACAMLFLAGS=-nolabels
EXTRACFLAGS=-I../unix
HEADERS=unixsupport.h socketaddr.h
diff --git a/otherlibs/win32unix/nonblock.c b/otherlibs/win32unix/nonblock.c
index ab5f2aa..0383940 100755
--- a/otherlibs/win32unix/nonblock.c
+++ b/otherlibs/win32unix/nonblock.c
@@ -26,7 +26,7 @@ CAMLprim value unix_set_nonblock(socket)
win32_maperr(WSAGetLastError());
uerror("unix_set_nonblock", Nothing);
}
- Flags_fd_val(socket) = Flags_fd_val(socket) | FLAGS_FD_IS_BLOCKING;
+ Flags_fd_val(socket) = Flags_fd_val(socket) & ~FLAGS_FD_IS_BLOCKING;
return Val_unit;
}
@@ -39,6 +39,6 @@ CAMLprim value unix_clear_nonblock(socket)
win32_maperr(WSAGetLastError());
uerror("unix_clear_nonblock", Nothing);
}
- Flags_fd_val(socket) = Flags_fd_val(socket) & ~FLAGS_FD_IS_BLOCKING;
+ Flags_fd_val(socket) = Flags_fd_val(socket) | FLAGS_FD_IS_BLOCKING;
return Val_unit;
}
diff --git a/otherlibs/win32unix/select.c b/otherlibs/win32unix/select.c
index 1c2b4dd..da31000 100644
--- a/otherlibs/win32unix/select.c
+++ b/otherlibs/win32unix/select.c
@@ -556,7 +556,7 @@ void socket_poll (HANDLE hStop, void *_data)
if (iterQuery->uFlagsFd & FLAGS_FD_IS_BLOCKING)
{
DEBUG_PRINT("Restore a blocking socket");
- iMode = 1;
+ iMode = 0;
check_error(lpSelectData,
WSAEventSelect((SOCKET)(iterQuery->hFileDescr), aEvents[i], 0) != 0 ||
ioctlsocket((SOCKET)(iterQuery->hFileDescr), FIONBIO, &iMode) != 0);
diff --git a/otherlibs/win32unix/unixsupport.c b/otherlibs/win32unix/unixsupport.c
index 5f8077d..c83b1d4 100644
--- a/otherlibs/win32unix/unixsupport.c
+++ b/otherlibs/win32unix/unixsupport.c
@@ -53,7 +53,7 @@ value win_alloc_handle(HANDLE h)
Handle_val(res) = h;
Descr_kind_val(res) = KIND_HANDLE;
CRT_fd_val(res) = NO_CRT_FD;
- Flags_fd_val(res) = 0;
+ Flags_fd_val(res) = FLAGS_FD_IS_BLOCKING;
return res;
}
@@ -63,7 +63,7 @@ value win_alloc_socket(SOCKET s)
Socket_val(res) = s;
Descr_kind_val(res) = KIND_SOCKET;
CRT_fd_val(res) = NO_CRT_FD;
- Flags_fd_val(res) = 0;
+ Flags_fd_val(res) = FLAGS_FD_IS_BLOCKING;
return res;
}
diff --git a/utils/config.mlp b/utils/config.mlp
index 9694868..373fb7a 100644
--- a/utils/config.mlp
+++ b/utils/config.mlp
@@ -83,11 +83,7 @@ let ext_asm = "%%EXT_ASM%%"
let ext_lib = "%%EXT_LIB%%"
let ext_dll = "%%EXT_DLL%%"
-let default_executable_name =
- match Sys.os_type with
- "Unix" -> "a.out"
- | "Win32" | "Cygwin" -> "camlprog.exe"
- | _ -> "camlprog"
+let default_executable_name = "camlprog.exe"
let systhread_supported = %%SYSTHREAD_SUPPORT%%;;
@@ -114,7 +110,7 @@ let print_config oc =
p "ext_asm" ext_asm;
p "ext_lib" ext_lib;
p "ext_dll" ext_dll;
- p "os_type" Sys.os_type;
+ p "os_type" "Win32";
p "default_executable_name" default_executable_name;
p_bool "systhread_supported" systhread_supported;
flush oc;
--
1.7.9.5

View File

@ -1,4 +0,0 @@
open Printf
open Format
let _ =
ignore (1+2)

View File

@ -1,151 +0,0 @@
# This file is part of mingw-cross-env.
# See doc/index.html for further information.
# zlib
PKG := ocaml-core
$(PKG)_IGNORE :=
$(PKG)_CHECKSUM := 05125da055d39dd6fe8fe5c0155b2e9f55c10dfd
$(PKG)_SUBDIR := ocaml-$($(PKG)_VERSION)
$(PKG)_FILE := ocaml-$($(PKG)_VERSION).tar.gz
$(PKG)_URL := http://caml.inria.fr/pub/distrib/ocaml-3.12/$($(PKG)_FILE)
$(PKG)_DEPS := gcc ocaml-flexdll
define $(PKG)_UPDATE
wget -q -O- 'http://caml.inria.fr/pub/distrib/ocaml-3.12' | \
$(SED) -n 's,.*ocaml-\([0-9][^>]*\)\.tar.*,\1,ip' | \
tail -1
endef
OTHER_LIBS := win32unix str num dynlink bigarray systhreads win32graph
define $(PKG)_BUILD
# Build native ocamlrun and ocamlc which contain the
# filename-win32-dirsep patch.
#
# Note that we must build a 32 bit compiler, even on 64 bit build
# architectures, because this compiler will try to do strength
# reduction optimizations using its internal int type, and that must
# match Windows' int type. (That's what -cc and -host are for).
cd '$(1)' && ./configure \
-prefix '$(PREFIX)/$(TARGET)' \
-bindir '$(PREFIX)/$(TARGET)/bin' \
-libdir '$(PREFIX)/$(TARGET)/lib/ocaml' \
-no-tk \
-cc "gcc -m32" \
-no-shared-libs \
-host '$(TARGET)' \
-x11lib /usr/lib \
-verbose
$(MAKE) -C '$(1)' world
# Now move the working ocamlrun, ocamlc into the boot/ directory,
# overwriting the binary versions which ship with the compiler with
# ones that contain the filename-win32-dirsep patch.
$(MAKE) -C '$(1)' coreboot
####### patch mingw include
# Now patch utils/clflags.ml to hardcode mingw-specific include.
$(SED) -i "s,@libdir@,$(PREFIX)/$(TARGET)/lib,g" \
$(1)/hardcode_mingw_include.patch
cd '$(1)' && patch -p2 < hardcode_mingw_include.patch
####### prepare cross build
# Replace the compiler configuration (config/{s.h,m.h,Makefile})
# with ones as they would be on a 32 bit Windows system.
cp -f '$(1)/config/m-nt.h' '$(1)/config/m.h'
cp -f $(1)/config/s-nt.h $(1)/config/s.h
# config/Makefile is a custom one which we supply.
rm -f $(1)/config/Makefile
$(SED) \
-e "s,@target2@,$(TARGET)-,g" \
-e "s,@prefix@,$(PREFIX)/$(TARGET),g" \
-e "s,@bindir@,$(PREFIX)/$(TARGET)/bin,g" \
-e "s,@libdir2@,$(PREFIX)/$(TARGET)/lib,g" \
-e "s,@libdir@,$(PREFIX)/$(TARGET)/lib/ocaml,g" \
-e "s,@otherlibraries@,$(OTHER_LIBS),g" \
-e "s,@flexdir@,$(PREFIX)/$(TARGET)/include,g" \
< $(1)/Makefile-mingw.in > $(1)/config/Makefile
$(SED) -i "s,@libdir@,$(PREFIX)/$(TARGET)/lib,g" $(1)/otherlibs/str/Makefile
$(SED) -i "s,@libdir@,$(PREFIX)/$(TARGET)/lib,g" $(1)/otherlibs/num/Makefile
# We're going to build in otherlibs/win32unix and otherlibs/win32graph
# directories, but since they would normally only be built under
# Windows, they only have the Makefile.nt files. Just symlink
# Makefile -> Makefile.nt for these cases.
$(SED) -i "s,@libdir@,$(PREFIX)/$(TARGET)/lib,g" $(1)/otherlibs/win32unix/Makefile.nt
$(SED) -i "s,@libdir@,$(PREFIX)/$(TARGET)/lib,g" $(1)/otherlibs/win32graph/Makefile.nt
$(SED) -i "s,@libdir@,$(PREFIX)/$(TARGET)/lib,g" $(1)/otherlibs/bigarray/Makefile.nt
$(SED) -i "s,@libdir@,$(PREFIX)/$(TARGET)/lib,g" $(1)/otherlibs/systhreads/Makefile.nt
for d in $(1)/otherlibs/win32unix \
$(1)/otherlibs/win32graph \
$(1)/otherlibs/bigarray \
$(1)/otherlibs/systhreads; do \
ln -sf Makefile.nt $$d/Makefile; \
done
# Now clean the temporary files from the previous build. This
# will also cause asmcomp/arch.ml (etc) to be linked to the 32 bit
# i386 versions, essentially causing ocamlopt to use the Win/i386 code
# generator.
$(MAKE) -C '$(1)' partialclean
# We need to remove any .o object for make sure they are
# recompiled later..
cd $(1) && rm byterun/*.o
####### build mingw ocaml
# Just rebuild some small bits that we need for the following
# 'make opt' to work. Note that 'make all' fails here.
$(MAKE) -C '$(1)/byterun' libcamlrun.a
$(MAKE) -C '$(1)' ocaml ocamlc
$(MAKE) -C '$(1)/stdlib'
$(MAKE) -C '$(1)/tools' ocamlmklib
# Build ocamlopt
$(MAKE) -C '$(1)' opt
# Now build otherlibs for ocamlopt
cd '$(1)' && \
for i in $(OTHER_LIBS); do \
$(MAKE) -C otherlibs/$$i clean; \
$(MAKE) -C otherlibs/$$i all; \
$(MAKE) -C otherlibs/$$i allopt; \
done
####### installation
mkdir -p $(PREFIX)/$(TARGET)/lib/ocaml/threads
mkdir -p $(PREFIX)/$(TARGET)/lib/ocaml/stublibs
$(MAKE) -C '$(1)/byterun' \
BINDIR=$(PREFIX)/$(TARGET)/bin \
LIBDIR=$(PREFIX)/$(TARGET)/lib/ocaml \
install
$(MAKE) -C '$(1)/stdlib' \
BINDIR=$(PREFIX)/$(TARGET)/bin \
LIBDIR=$(PREFIX)/$(TARGET)/lib/ocaml \
install
for i in $(OTHER_LIBS); do \
$(MAKE) -C $(1)/otherlibs/$$i \
BINDIR=$(PREFIX)/$(TARGET)/bin \
LIBDIR=$(PREFIX)/$(TARGET)/lib/ocaml \
install; \
done
$(MAKE) -C '$(1)/tools' \
BINDIR=$(PREFIX)/$(TARGET)/bin \
LIBDIR=$(PREFIX)/$(TARGET)/lib/ocaml \
install
$(MAKE) -C '$(1)' \
BINDIR=$(PREFIX)/$(TARGET)/bin \
LIBDIR=$(PREFIX)/$(TARGET)/lib/ocaml \
installopt
cd $(1) && $(INSTALL) -m 0755 ocamlc $(PREFIX)/$(TARGET)/bin
cd $(1) && cp \
toplevel/topstart.cmo \
typing/outcometree.cmi typing/outcometree.mli \
toplevel/toploop.cmi toplevel/toploop.mli \
toplevel/topdirs.cmi toplevel/topdirs.mli \
toplevel/topmain.cmi toplevel/topmain.mli \
$(PREFIX)/$(TARGET)/lib/ocaml
# Rename all the binaries to target-binary
for f in ocamlc ocamlcp ocamlrun ocamldep ocamlmklib ocamlmktop ocamlopt ocamlprof; do \
cp -f $(PREFIX)/$(TARGET)/bin/$$f $(PREFIX)/bin/$(TARGET)-$$f; \
done
# test
cp '$(2).ml' '$(1)/test.ml'
cd '$(1)' && '$(TARGET)-ocamlopt' test.ml
endef