1 OCaml sources uses separate Makefile and Makefile.nt in each directory,
2 which is a pain when cross-compiling. Instead of that, it's better to
3 combine all objects into one Makefile, and make sure the source is
4 defended by #ifdef/#ifndef WIN32 ... #endif, around the whole files as
7 Index: build-tree/ocaml-3.12.0/asmrun/Makefile
8 ===================================================================
9 --- build-tree.orig/ocaml-3.12.0/asmrun/Makefile 2010-06-23 19:37:52.000000000 +0200
10 +++ build-tree/ocaml-3.12.0/asmrun/Makefile 2010-06-23 19:39:37.000000000 +0200
12 misc.o freelist.o major_gc.o minor_gc.o memory.o alloc.o compare.o ints.o \
13 floats.o str.o array.o io.o extern.o intern.o hash.o sys.o parsing.o \
14 gc_ctrl.o terminfo.o md5.o obj.o lexing.o printexc.o callback.o weak.o \
15 - compact.o finalise.o custom.o unix.o backtrace.o natdynlink.o debugger.o
16 + compact.o finalise.o custom.o unix.o win32.o backtrace.o natdynlink.o debugger.o
21 ln -s ../byterun/globroots.c globroots.c
22 unix.c: ../byterun/unix.c
23 ln -s ../byterun/unix.c unix.c
24 +win32.c: ../byterun/win32.c
25 + ln -s ../byterun/win32.c win32.c
26 dynlink.c: ../byterun/dynlink.c
27 ln -s ../byterun/dynlink.c dynlink.c
28 signals.c: ../byterun/signals.c
30 LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \
31 compare.c ints.c floats.c str.c io.c extern.c intern.c hash.c sys.c \
32 parsing.c gc_ctrl.c terminfo.c md5.c obj.c lexing.c printexc.c callback.c \
33 - weak.c compact.c finalise.c meta.c custom.c main.c globroots.c unix.c \
34 + weak.c compact.c finalise.c meta.c custom.c main.c globroots.c unix.c win32.c \
35 dynlink.c signals.c debugger.c
38 Index: build-tree/ocaml-3.12.0/byterun/Makefile.common
39 ===================================================================
40 --- build-tree.orig/ocaml-3.12.0/byterun/Makefile.common 2010-06-23 19:37:51.000000000 +0200
41 +++ build-tree/ocaml-3.12.0/byterun/Makefile.common 2010-06-23 19:39:37.000000000 +0200
43 compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \
44 hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \
45 lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \
50 alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
51 Index: build-tree/ocaml-3.12.0/byterun/unix.c
52 ===================================================================
53 --- build-tree.orig/ocaml-3.12.0/byterun/unix.c 2010-06-23 19:37:51.000000000 +0200
54 +++ build-tree/ocaml-3.12.0/byterun/unix.c 2010-06-23 19:39:37.000000000 +0200
57 /* Unix-specific stuff */
62 /* Helps finding RTLD_DEFAULT in glibc */
70 Index: build-tree/ocaml-3.12.0/byterun/win32.c
71 ===================================================================
72 --- build-tree.orig/ocaml-3.12.0/byterun/win32.c 2010-06-23 19:37:52.000000000 +0200
73 +++ build-tree/ocaml-3.12.0/byterun/win32.c 2010-06-23 19:39:37.000000000 +0200
76 /* $Id: win32.c 9547 2010-01-22 12:48:24Z doligez $ */
80 /* Win32-specific stuff */
84 seed ^= GetCurrentProcessId();
89 Index: build-tree/ocaml-3.12.0/otherlibs/systhreads/Makefile
90 ===================================================================
91 --- build-tree.orig/ocaml-3.12.0/otherlibs/systhreads/Makefile 2010-06-23 19:37:52.000000000 +0200
92 +++ build-tree/ocaml-3.12.0/otherlibs/systhreads/Makefile 2010-06-23 19:43:39.000000000 +0200
94 $(NATIVECC) -O -I../../asmrun -I../../byterun $(NATIVECCCOMPOPTS) $(SHAREDCCCOMPOPTS) -DNATIVE_CODE -DTARGET_$(ARCH) -DSYS_$(SYSTEM) -c st_stubs.c
95 mv st_stubs.o st_stubs_n.o
97 threads.cma: $(THREAD_OBJS)
98 $(MKLIB) -ocamlc '$(CAMLC)' -o threads $(THREAD_OBJS) \
99 - -cclib -lunix $(PTHREAD_LINK)
100 + -cclib -lunix $(PTHREAD_LINK) -lcamlrun
102 # See remark above: force static linking of libthreadsnat.a
103 threads.cmxa: $(THREAD_OBJS:.cmo=.cmx)