2836
|
1 This file is part of MXE. |
|
2 See index.html for further information. |
|
3 |
|
4 Contains ad hoc patches for cross building. |
|
5 |
|
6 From 002715e4bdd4f2aacb6ce8b1b89bae734b6c36fc Mon Sep 17 00:00:00 2001 |
|
7 From: MXE |
|
8 Date: Wed, 13 Jun 2012 22:27:54 +0200 |
|
9 Subject: [PATCH] various patches to build an ocaml cross compiler |
|
10 |
|
11 |
|
12 diff --git a/Makefile b/Makefile |
|
13 index e53fd0d..0decd00 100644 |
|
14 --- a/Makefile |
|
15 +++ b/Makefile |
|
16 @@ -289,16 +289,17 @@ install: |
|
17 for i in $(OTHERLIBRARIES); do \ |
|
18 (cd otherlibs/$$i; $(MAKE) install) || exit $$?; \ |
|
19 done |
|
20 - cd ocamldoc; $(MAKE) install |
|
21 + # cd ocamldoc; $(MAKE) install |
|
22 if test -f ocamlopt; then $(MAKE) installopt; else :; fi |
|
23 if test -f debugger/ocamldebug; then (cd debugger; $(MAKE) install); \ |
|
24 else :; fi |
|
25 cp config/Makefile $(LIBDIR)/Makefile.config |
|
26 - BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) PREFIX=$(PREFIX) \ |
|
27 - ./build/partial-install.sh |
|
28 + #BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) PREFIX=$(PREFIX) \ |
|
29 + # ./build/partial-install.sh |
|
30 |
|
31 # Installation of the native-code compiler |
|
32 installopt: |
|
33 + if test -d $(COMPLIBDIR); then : ; else $(MKDIR) $(COMPLIBDIR); fi |
|
34 cd asmrun; $(MAKE) install |
|
35 cp ocamlopt $(BINDIR)/ocamlopt$(EXE) |
|
36 cd stdlib; $(MAKE) installopt |
|
37 @@ -737,7 +738,7 @@ ocamlbuild.native: ocamlopt ocamlbuild-mixed-boot |
|
38 ocamlbuildlib.native: ocamlopt ocamlbuild-mixed-boot |
|
39 ./build/ocamlbuildlib-native-only.sh |
|
40 |
|
41 -ocamlbuild-mixed-boot: ocamlc |
|
42 +ocamlbuild-mixed-boot: ocamlc otherlibraries |
|
43 ./build/mixed-boot.sh |
|
44 touch ocamlbuild-mixed-boot |
|
45 |
|
46 diff --git a/Makefile-mingw.in b/Makefile-mingw.in |
|
47 new file mode 100644 |
|
48 index 0000000..c3dddf6 |
|
49 --- /dev/null |
|
50 +++ b/Makefile-mingw.in |
|
51 @@ -0,0 +1,160 @@ |
|
52 +######### General configuration |
|
53 + |
|
54 +PREFIX=@prefix@ |
|
55 + |
|
56 +### Remove this to disable compiling camlp4 |
|
57 +#CAMLP4=camlp4 |
|
58 + |
|
59 +### Where to install the binaries |
|
60 +BINDIR=$(PREFIX)/bin |
|
61 + |
|
62 +### Where to install the standard library |
|
63 +LIBDIR=$(PREFIX)/lib/ocaml |
|
64 + |
|
65 +### Where to install the stub DLLs |
|
66 +STUBLIBDIR=$(LIBDIR)/stublibs |
|
67 + |
|
68 +### Where to install the info files |
|
69 +DISTRIB=$(PREFIX) |
|
70 + |
|
71 +### Where to install the man pages |
|
72 +MANDIR=$(PREFIX)/man |
|
73 + |
|
74 +########## Toolchain and OS dependencies |
|
75 + |
|
76 +TOOLCHAIN=cc |
|
77 + |
|
78 +### Toolchain prefix |
|
79 +TOOLPREF=@toolpref@- |
|
80 + |
|
81 +CCOMPTYPE=cc |
|
82 +O=o |
|
83 +A=a |
|
84 +S=s |
|
85 +SO=dll |
|
86 +EXE= |
|
87 +EXT_DLL=.dll |
|
88 +EXT_OBJ=.$(O) |
|
89 +EXT_LIB=.$(A) |
|
90 +EXT_ASM=.$(S) |
|
91 +MANEXT=1 |
|
92 +SHARPBANGSCRIPTS=true |
|
93 +PTHREAD_LINK= |
|
94 +X11_INCLUDES= |
|
95 +X11_LINK= |
|
96 +DBM_INCLUDES= |
|
97 +DBM_LINK= |
|
98 +BYTECCRPATH= |
|
99 +SUPPORTS_SHARED_LIBRARIES=true |
|
100 +SHAREDCCCOMPOPTS= |
|
101 +MKSHAREDLIBRPATH= |
|
102 +NATIVECCPROFOPTS=-pg |
|
103 +NATIVECCRPATH= |
|
104 +ASM=$(TOOLPREF)as |
|
105 +ASPP=$(TOOLPREF)gcc -c |
|
106 +ASPPPROFFLAGS=-DPROFILING |
|
107 +PROFILING=prof |
|
108 +DYNLINKOPTS=-ldl |
|
109 +DEBUGGER=ocamldebugger |
|
110 +CC_PROFILE=-pg |
|
111 +SYSTHREAD_SUPPORT=true |
|
112 +EXTRALIBS= |
|
113 +NATDYNLINK=true |
|
114 +NATDYNLINKOPTS= |
|
115 +CMXS=cmxs |
|
116 +RUNTIMED=noruntimed |
|
117 +ASM_CFI_SUPPORTED=false |
|
118 + |
|
119 +########## Configuration for the bytecode compiler |
|
120 + |
|
121 +### Which C compiler to use for the bytecode interpreter. |
|
122 +BYTECC=$(TOOLPREF)gcc |
|
123 + |
|
124 +### Additional compile-time options for $(BYTECC). (For static linking.) |
|
125 +BYTECCCOMPOPTS=-O -mms-bitfields -Wall -Wno-unused |
|
126 + |
|
127 +### Additional link-time options for $(BYTECC). (For static linking.) |
|
128 +BYTECCLINKOPTS=-L$(PREFIX)/lib |
|
129 + |
|
130 +### Additional compile-time options for $(BYTECC). (For building a DLL.) |
|
131 +DLLCCCOMPOPTS= |
|
132 + |
|
133 +### Libraries needed |
|
134 +BYTECCLIBS= |
|
135 +NATIVECCLIBS= |
|
136 + |
|
137 +### How to invoke the C preprocessor |
|
138 + |
|
139 +### Flexlink |
|
140 +FLEXLINK=$(TOOLPREF)flexlink -chain mingw |
|
141 +FLEXDIR=$(shell $(FLEXLINK) -where) |
|
142 +IFLEXDIR=-I"$(FLEXDIR)" |
|
143 +MKDLL=$(FLEXLINK) |
|
144 +MKEXE=$(FLEXLINK) -exe |
|
145 +MKMAINDLL=$(FLEXLINK) -maindll |
|
146 + |
|
147 +### How to build a static library |
|
148 +MKLIB=$(TOOLPREF)ar rcs $(1) $(2) |
|
149 +#ml let mklib out files opts = Printf.sprintf ("%sar rcs %s %s %s") toolpref out opts files;; |
|
150 + |
|
151 +### Canonicalize the name of a system library |
|
152 +SYSLIB=-l$(1) |
|
153 +#ml let syslib x = "-l"^x;; |
|
154 + |
|
155 +### The ranlib command |
|
156 +RANLIB=$(TOOLPREF)ranlib |
|
157 +RANLIBCMD=$(TOOLPREF)ranlib |
|
158 + |
|
159 +### The ar command |
|
160 +ARCMD=$(TOOLPREF)ar |
|
161 + |
|
162 +############# Configuration for the native-code compiler |
|
163 + |
|
164 +### Name of architecture for the native-code compiler |
|
165 +ARCH=i386 |
|
166 + |
|
167 +### Name of architecture model for the native-code compiler. |
|
168 +MODEL=default |
|
169 + |
|
170 +### Name of operating system family for the native-code compiler. |
|
171 +SYSTEM=mingw |
|
172 + |
|
173 +### Which C compiler to use for the native-code compiler. |
|
174 +NATIVECC=$(BYTECC) |
|
175 + |
|
176 +### Additional compile-time options for $(NATIVECC). |
|
177 +NATIVECCCOMPOPTS=-O -mms-bitfields -Wall -Wno-unused |
|
178 + |
|
179 +### Additional link-time options for $(NATIVECC) |
|
180 +NATIVECCLINKOPTS=-L$(PREFIX)/lib |
|
181 + |
|
182 +### Build partially-linked object file |
|
183 +PACKLD=$(TOOLPREF)ld -r $(NATIVECCLINKOPTS) -o #there must be a space after this '-o' |
|
184 + |
|
185 +############# Configuration for the contributed libraries |
|
186 + |
|
187 +OTHERLIBRARIES=@otherlibraries@ |
|
188 + |
|
189 +### Name of the target architecture for the "num" library |
|
190 +BNG_ARCH=i386 |
|
191 +BNG_ASM_LEVEL=1 |
|
192 + |
|
193 +### Configuration for LablTk |
|
194 +# Set TK_ROOT to the directory where you installed TCL/TK 8.5 |
|
195 +# There must be no spaces or special characters in $(TK_ROOT) |
|
196 +TK_DEFS= |
|
197 +TK_LINK= |
|
198 + |
|
199 +############# Aliases for common commands |
|
200 + |
|
201 +# MAKEREC=$(MAKE) -f Makefile.nt |
|
202 +# MAKECMD=$(MAKE) |
|
203 + |
|
204 +# Build compiler for cross-compilation. |
|
205 +BUILD_MKEXE=gcc |
|
206 +BUILD_RANLIB=ranlib |
|
207 +BUILD_MKDLL=gcc -shared |
|
208 +BUILD_CC=gcc |
|
209 +BUILD_CCLIBS=-lm |
|
210 +BUILD_CFLAGS= |
|
211 + |
|
212 diff --git a/asmrun/Makefile b/asmrun/Makefile |
|
213 index d4f0c56..a535666 100644 |
|
214 --- a/asmrun/Makefile |
|
215 +++ b/asmrun/Makefile |
|
216 @@ -26,7 +26,7 @@ COBJS=startup.o main.o fail.o roots.o globroots.o signals.o signals_asm.o \ |
|
217 misc.o freelist.o major_gc.o minor_gc.o memory.o alloc.o compare.o ints.o \ |
|
218 floats.o str.o array.o io.o extern.o intern.o hash.o sys.o parsing.o \ |
|
219 gc_ctrl.o terminfo.o md5.o obj.o lexing.o printexc.o callback.o weak.o \ |
|
220 - compact.o finalise.o custom.o unix.o backtrace.o natdynlink.o debugger.o \ |
|
221 + compact.o finalise.o custom.o unix.o win32.o backtrace.o natdynlink.o debugger.o \ |
|
222 meta.o dynlink.o |
|
223 |
|
224 ASMOBJS=$(ARCH).o |
|
225 @@ -153,6 +153,8 @@ globroots.c: ../byterun/globroots.c |
|
226 ln -s ../byterun/globroots.c globroots.c |
|
227 unix.c: ../byterun/unix.c |
|
228 ln -s ../byterun/unix.c unix.c |
|
229 +win32.c: ../byterun/win32.c |
|
230 + ln -s ../byterun/win32.c win32.c |
|
231 dynlink.c: ../byterun/dynlink.c |
|
232 ln -s ../byterun/dynlink.c dynlink.c |
|
233 signals.c: ../byterun/signals.c |
|
234 @@ -163,7 +165,7 @@ debugger.c: ../byterun/debugger.c |
|
235 LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \ |
|
236 compare.c ints.c floats.c str.c io.c extern.c intern.c hash.c sys.c \ |
|
237 parsing.c gc_ctrl.c terminfo.c md5.c obj.c lexing.c printexc.c callback.c \ |
|
238 - weak.c compact.c finalise.c meta.c custom.c main.c globroots.c unix.c \ |
|
239 + weak.c compact.c finalise.c meta.c custom.c main.c globroots.c unix.c win32.c \ |
|
240 dynlink.c signals.c debugger.c |
|
241 |
|
242 clean:: |
|
243 diff --git a/asmrun/i386.S b/asmrun/i386.S |
|
244 index e8e00a4..800247e 100644 |
|
245 --- a/asmrun/i386.S |
|
246 +++ b/asmrun/i386.S |
|
247 @@ -76,6 +76,9 @@ |
|
248 popl %edx; popl %ecx; popl %eax; popl %ebp |
|
249 #define PROFILE_C \ |
|
250 pushl %ebp; movl %esp, %ebp; call Lmcount$stub; popl %ebp |
|
251 +#elif defined(SYS_mingw) |
|
252 +#define PROFILE_CAML |
|
253 +#define PROFILE_C |
|
254 #endif |
|
255 #else |
|
256 #define PROFILE_CAML |
|
257 diff --git a/byterun/Makefile.common b/byterun/Makefile.common |
|
258 index b519f75..2274562 100755 |
|
259 --- a/byterun/Makefile.common |
|
260 +++ b/byterun/Makefile.common |
|
261 @@ -24,7 +24,7 @@ COMMONOBJS=\ |
|
262 compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \ |
|
263 hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \ |
|
264 lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \ |
|
265 - dynlink.o |
|
266 + dynlink.o win32.o |
|
267 |
|
268 PRIMS=\ |
|
269 alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \ |
|
270 diff --git a/byterun/dynlink.c b/byterun/dynlink.c |
|
271 index 5cb2ed7..b6605fa 100644 |
|
272 --- a/byterun/dynlink.c |
|
273 +++ b/byterun/dynlink.c |
|
274 @@ -80,7 +80,12 @@ static char * parse_ld_conf(void) |
|
275 |
|
276 stdlib = getenv("OCAMLLIB"); |
|
277 if (stdlib == NULL) stdlib = getenv("CAMLLIB"); |
|
278 - if (stdlib == NULL) stdlib = OCAML_STDLIB_DIR; |
|
279 + if (stdlib == NULL) |
|
280 +#ifdef OCAML_STDLIB_DIR |
|
281 + stdlib = OCAML_STDLIB_DIR; |
|
282 +#else |
|
283 + stdlib = "."; |
|
284 +#endif |
|
285 ldconfname = caml_stat_alloc(strlen(stdlib) + 2 + sizeof(LD_CONF_NAME)); |
|
286 strcpy(ldconfname, stdlib); |
|
287 strcat(ldconfname, "/" LD_CONF_NAME); |
|
288 diff --git a/byterun/unix.c b/byterun/unix.c |
|
289 index 7d24ef4..3619e67 100644 |
|
290 --- a/byterun/unix.c |
|
291 +++ b/byterun/unix.c |
|
292 @@ -15,6 +15,8 @@ |
|
293 |
|
294 /* Unix-specific stuff */ |
|
295 |
|
296 +#ifndef WIN32 |
|
297 + |
|
298 #define _GNU_SOURCE |
|
299 /* Helps finding RTLD_DEFAULT in glibc */ |
|
300 |
|
301 @@ -323,3 +325,5 @@ int caml_executable_name(char * name, int name_len) |
|
302 } |
|
303 |
|
304 #endif |
|
305 + |
|
306 +#endif /* !WIN32 */ |
|
307 diff --git a/byterun/win32.c b/byterun/win32.c |
|
308 index f8ba9c9..82afc1c 100644 |
|
309 --- a/byterun/win32.c |
|
310 +++ b/byterun/win32.c |
|
311 @@ -13,6 +13,8 @@ |
|
312 |
|
313 /* $Id: win32.c 12686 2012-07-10 11:34:39Z scherer $ */ |
|
314 |
|
315 +#ifdef WIN32 |
|
316 + |
|
317 /* Win32-specific stuff */ |
|
318 |
|
319 #include <windows.h> |
|
320 @@ -35,6 +37,26 @@ |
|
321 |
|
322 #include "flexdll.h" |
|
323 |
|
324 +/* XXX including <io.h> gets ../byterun/io.h for some reason. |
|
325 + * Including the real io.h using the full path fails because of |
|
326 + * some strange bug in the system header file itself. Give up and |
|
327 + * just define _finddata_t explicitly here. |
|
328 + */ |
|
329 +#ifndef _FSIZE_T_DEFINED |
|
330 +typedef unsigned long _fsize_t; |
|
331 +#define _FSIZE_T_DEFINED |
|
332 + |
|
333 +struct _finddata_t |
|
334 +{ |
|
335 + unsigned attrib; |
|
336 + time_t time_create; |
|
337 + time_t time_access; |
|
338 + time_t time_write; |
|
339 + _fsize_t size; |
|
340 + char name[FILENAME_MAX]; |
|
341 +}; |
|
342 +#endif |
|
343 + |
|
344 #ifndef S_ISREG |
|
345 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) |
|
346 #endif |
|
347 @@ -93,7 +115,7 @@ CAMLexport char * caml_search_exe_in_path(char * name) |
|
348 pathlen = strlen(name) + 1; |
|
349 if (pathlen < 256) pathlen = 256; |
|
350 while (1) { |
|
351 - fullname = stat_alloc(pathlen); |
|
352 + fullname = caml_stat_alloc(pathlen); |
|
353 retcode = SearchPath(NULL, /* use system search path */ |
|
354 name, |
|
355 ".exe", /* add .exe extension if needed */ |
|
356 @@ -107,7 +129,7 @@ CAMLexport char * caml_search_exe_in_path(char * name) |
|
357 break; |
|
358 } |
|
359 if (retcode < pathlen) break; |
|
360 - stat_free(fullname); |
|
361 + caml_stat_free(fullname); |
|
362 pathlen = retcode + 1; |
|
363 } |
|
364 return fullname; |
|
365 @@ -479,3 +501,5 @@ int caml_win32_random_seed (intnat data[16]) |
|
366 data[2] = GetCurrentProcessId(); |
|
367 return 3; |
|
368 } |
|
369 + |
|
370 +#endif /* WIN32 */ |
|
371 diff --git a/hardcode_mingw_include.patch b/hardcode_mingw_include.patch |
|
372 new file mode 100644 |
|
373 index 0000000..571747d |
|
374 --- /dev/null |
|
375 +++ b/hardcode_mingw_include.patch |
|
376 @@ -0,0 +1,24 @@ |
|
377 +Index: build-tree/ocaml-3.11.1/utils/clflags.ml |
|
378 +=================================================================== |
|
379 +--- build-tree.orig/ocaml-3.12.1/utils/clflags.ml 2010-01-07 04:00:11.000000000 +0100 |
|
380 ++++ build-tree/ocaml-3.12.1/utils/clflags.ml 2010-01-07 04:00:24.000000000 +0100 |
|
381 +@@ -20,7 +20,7 @@ |
|
382 + |
|
383 + let compile_only = ref false (* -c *) |
|
384 + and output_name = ref (None : string option) (* -o *) |
|
385 +-and include_dirs = ref ([] : string list)(* -I *) |
|
386 ++and include_dirs = ref (["@libdir@"] : string list)(* -I *) |
|
387 + and no_std_include = ref false (* -nostdlib *) |
|
388 + and print_types = ref false (* -i *) |
|
389 + and make_archive = ref false (* -a *) |
|
390 +--- build-tree.orig/ocaml-3.12.1/tools/ocamlmklib.mlp 2010-02-22 20:15:57.000000000 -0600 |
|
391 ++++ build-tree/ocaml-3.12.1/tools/ocamlmklib.mlp 2010-02-22 20:16:20.000000000 -0600 |
|
392 +@@ -29,7 +29,7 @@ |
|
393 + and failsafe = ref false (* whether to fall back on static build only *) |
|
394 + and c_libs = ref [] (* libs to pass to mksharedlib and ocamlc -cclib *) |
|
395 + and c_opts = ref [] (* options to pass to mksharedlib and ocamlc -ccopt *) |
|
396 +-and ld_opts = ref [] (* options to pass only to the linker *) |
|
397 ++and ld_opts = ref ["-I @libdir@"] (* options to pass only to the linker *) |
|
398 + and ocamlc = ref (compiler_path "ocamlc") |
|
399 + and ocamlopt = ref (compiler_path "ocamlopt") |
|
400 + and output = ref "a" (* Output name for Caml part of library *) |
|
401 diff --git a/myocamlbuild.ml b/myocamlbuild.ml |
|
402 index c687242..ccdd937 100644 |
|
403 --- a/myocamlbuild.ml |
|
404 +++ b/myocamlbuild.ml |
|
405 @@ -107,9 +107,11 @@ let if_mixed_dir dir = |
|
406 if mixed then ".."/dir else dir;; |
|
407 |
|
408 let unix_dir = |
|
409 - match Sys.os_type with |
|
410 - | "Win32" -> if_mixed_dir "otherlibs/win32unix" |
|
411 - | _ -> if_mixed_dir "otherlibs/unix";; |
|
412 + if_mixed_dir ( |
|
413 + let win32path = "otherlibs/win32unix" in |
|
414 + if Sys.file_exists (win32path / "unix.cma") then win32path |
|
415 + else "otherlibs/unix" |
|
416 + );; |
|
417 |
|
418 let threads_dir = if_mixed_dir "otherlibs/threads";; |
|
419 let systhreads_dir = if_mixed_dir "otherlibs/systhreads";; |
|
420 diff --git a/ocamldoc/Makefile b/ocamldoc/Makefile |
|
421 index 74c82d3..61036c8 100644 |
|
422 --- a/ocamldoc/Makefile |
|
423 +++ b/ocamldoc/Makefile |
|
424 @@ -69,6 +69,7 @@ INCLUDES_DEP=-I $(OCAMLSRCDIR)/parsing \ |
|
425 INCLUDES_NODEP= -I $(OCAMLSRCDIR)/stdlib \ |
|
426 -I $(OCAMLSRCDIR)/otherlibs/str \ |
|
427 -I $(OCAMLSRCDIR)/otherlibs/dynlink \ |
|
428 + -I $(OCAMLSRCDIR)/otherlibs/win32unix \ |
|
429 -I $(OCAMLSRCDIR)/otherlibs/unix \ |
|
430 -I $(OCAMLSRCDIR)/otherlibs/num \ |
|
431 -I $(OCAMLSRCDIR)/otherlibs/graph |
|
432 diff --git a/otherlibs/Makefile.shared b/otherlibs/Makefile.shared |
|
433 index 2c084a0..0e13022 100644 |
|
434 --- a/otherlibs/Makefile.shared |
|
435 +++ b/otherlibs/Makefile.shared |
|
436 @@ -33,7 +33,7 @@ MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib |
|
437 #EXTRACFLAGS= |
|
438 #EXTRACAMLFLAGS= |
|
439 #LINKOPTS= |
|
440 -#LDOPTS= |
|
441 +LDOPTS=-L$(LIBDIR) |
|
442 #HEADERS= |
|
443 |
|
444 CMIFILES ?= $(CAMLOBJS:.cmo=.cmi) |
|
445 @@ -42,7 +42,8 @@ CLIBNAME ?= $(LIBNAME) |
|
446 |
|
447 all: lib$(CLIBNAME).$(A) $(LIBNAME).cma $(CMIFILES) |
|
448 |
|
449 -allopt: lib$(CLIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).$(CMXS) $(CMIFILES) |
|
450 +allopt: lib$(CLIBNAME).$(A) $(LIBNAME).cmxa $(CMIFILES) |
|
451 +# $(LIBNAME).$(CMXS) |
|
452 |
|
453 $(LIBNAME).cma: $(CAMLOBJS) |
|
454 $(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlc '$(CAMLC)' -linkall $(CAMLOBJS) $(LINKOPTS) |
|
455 @@ -50,8 +51,8 @@ $(LIBNAME).cma: $(CAMLOBJS) |
|
456 $(LIBNAME).cmxa: $(CAMLOBJS_NAT) |
|
457 $(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlopt '$(CAMLOPT)' -linkall $(CAMLOBJS_NAT) $(LINKOPTS) |
|
458 |
|
459 -$(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A) |
|
460 - $(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa |
|
461 +#$(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A) |
|
462 +# $(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa |
|
463 |
|
464 lib$(CLIBNAME).$(A): $(COBJS) |
|
465 $(MKLIB) -oc $(CLIBNAME) $(COBJS) $(LDOPTS) |
|
466 diff --git a/otherlibs/bigarray/Makefile b/otherlibs/bigarray/Makefile |
|
467 index d442edb..dc34d6d 100644 |
|
468 --- a/otherlibs/bigarray/Makefile |
|
469 +++ b/otherlibs/bigarray/Makefile |
|
470 @@ -14,8 +14,8 @@ |
|
471 # $Id: Makefile 11156 2011-07-27 14:17:02Z doligez $ |
|
472 |
|
473 LIBNAME=bigarray |
|
474 -EXTRACFLAGS=-I../unix -DIN_OCAML_BIGARRAY -DCAML_NAME_SPACE |
|
475 -EXTRACAMLFLAGS=-I ../unix |
|
476 +EXTRACFLAGS=-I../win32unix -I../unix -DIN_OCAML_BIGARRAY -DCAML_NAME_SPACE |
|
477 +EXTRACAMLFLAGS=-I ../win32unix -I ../unix |
|
478 COBJS=bigarray_stubs.$(O) mmap_unix.$(O) |
|
479 CAMLOBJS=bigarray.cmo |
|
480 HEADERS=bigarray.h |
|
481 diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile |
|
482 index 502498f..7ed53df 100644 |
|
483 --- a/otherlibs/systhreads/Makefile |
|
484 +++ b/otherlibs/systhreads/Makefile |
|
485 @@ -15,13 +15,13 @@ |
|
486 |
|
487 include ../../config/Makefile |
|
488 |
|
489 -CAMLC=../../ocamlcomp.sh -I ../unix |
|
490 -CAMLOPT=../../ocamlcompopt.sh -I ../unix |
|
491 +CAMLC=../../ocamlcomp.sh -I ../win32unix -I ../unix |
|
492 +CAMLOPT=../../ocamlcompopt.sh -I ../win32unix -I ../unix |
|
493 MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib |
|
494 COMPFLAGS=-warn-error A -g |
|
495 |
|
496 -BYTECODE_C_OBJS=st_stubs_b.o |
|
497 -NATIVECODE_C_OBJS=st_stubs_n.o |
|
498 +BYTECODE_C_OBJS=st_stubs_b.o win32_b.o |
|
499 +NATIVECODE_C_OBJS=st_stubs_n.o win32_n.o |
|
500 |
|
501 THREAD_OBJS= thread.cmo mutex.cmo condition.cmo event.cmo threadUnix.cmo |
|
502 |
|
503 @@ -37,6 +37,10 @@ st_stubs_b.o: st_stubs.c st_posix.h |
|
504 -c st_stubs.c |
|
505 mv st_stubs.o st_stubs_b.o |
|
506 |
|
507 +win32_b.$(O): st_stubs.c st_win32.h |
|
508 + $(BYTECC) -I ../../byterun $(BYTECCCOMPOPTS) $(CFLAGS) -c st_stubs.c |
|
509 + mv st_stubs.$(O) win32_b.$(O) |
|
510 + |
|
511 # Dynamic linking with -lpthread is risky on many platforms, so |
|
512 # do not create a shared object for libthreadsnat. |
|
513 libthreadsnat.a: $(NATIVECODE_C_OBJS) |
|
514 @@ -46,9 +50,13 @@ st_stubs_n.o: st_stubs.c st_posix.h |
|
515 $(NATIVECC) -O -I../../asmrun -I../../byterun $(NATIVECCCOMPOPTS) $(SHAREDCCCOMPOPTS) -DNATIVE_CODE -DTARGET_$(ARCH) -DSYS_$(SYSTEM) -c st_stubs.c |
|
516 mv st_stubs.o st_stubs_n.o |
|
517 |
|
518 +win32_n.$(O): st_stubs.c st_win32.h |
|
519 + $(NATIVECC) -DNATIVE_CODE -O -I../../asmrun -I../../byterun $(NATIVECCCOMPOPTS) -c st_stubs.c |
|
520 + mv st_stubs.$(O) win32_n.$(O) |
|
521 + |
|
522 threads.cma: $(THREAD_OBJS) |
|
523 $(MKLIB) -ocamlc '$(CAMLC)' -o threads $(THREAD_OBJS) \ |
|
524 - -cclib -lunix $(PTHREAD_LINK) |
|
525 + -cclib -lunix $(PTHREAD_LINK) -lcamlrun |
|
526 |
|
527 # See remark above: force static linking of libthreadsnat.a |
|
528 threads.cmxa: $(THREAD_OBJS:.cmo=.cmx) |
|
529 diff --git a/otherlibs/systhreads/Makefile.nt b/otherlibs/systhreads/Makefile.nt |
|
530 index dc118b7..4b53d6e 100644 |
|
531 --- a/otherlibs/systhreads/Makefile.nt |
|
532 +++ b/otherlibs/systhreads/Makefile.nt |
|
533 @@ -21,6 +21,7 @@ CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib -I ../win32unix |
|
534 COMPFLAGS=-warn-error A -g |
|
535 MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib |
|
536 CFLAGS=-I../../byterun $(EXTRACFLAGS) |
|
537 +LDOPTS=-L@libdir@ |
|
538 |
|
539 CAMLOBJS=thread.cmo mutex.cmo condition.cmo event.cmo threadUnix.cmo |
|
540 CMIFILES=$(CAMLOBJS:.cmo=.cmi) |
|
541 @@ -34,7 +35,7 @@ all: lib$(LIBNAME).$(A) $(LIBNAME).cma $(CMIFILES) |
|
542 allopt: lib$(LIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).cmxs $(CMIFILES) |
|
543 |
|
544 $(LIBNAME).cma: $(CAMLOBJS) |
|
545 - $(MKLIB) -o $(LIBNAME) -ocamlc "..\\..\\boot\\ocamlrun ..\\..\\ocamlc" -linkall $(CAMLOBJS) $(LINKOPTS) |
|
546 + $(MKLIB) -o $(LIBNAME) -ocamlc "../../boot/ocamlrun ../../ocamlc" -linkall $(CAMLOBJS) $(LINKOPTS) |
|
547 |
|
548 lib$(LIBNAME).$(A): $(COBJS) |
|
549 $(MKLIB) -o $(LIBNAME) $(COBJS) $(LDOPTS) |
|
550 @@ -46,7 +47,7 @@ st_stubs_b.$(O): st_stubs.c st_win32.h |
|
551 |
|
552 |
|
553 $(LIBNAME).cmxa: $(CAMLOBJS:.cmo=.cmx) |
|
554 - $(MKLIB) -o $(LIBNAME)nat -ocamlopt "..\\..\\boot\\ocamlrun ..\\..\\ocamlopt" -linkall $(CAMLOBJS:.cmo=.cmx) $(LINKOPTS) |
|
555 + $(MKLIB) -o $(LIBNAME)nat -ocamlopt "../../boot/ocamlrun ../../ocamlopt" -linkall $(CAMLOBJS:.cmo=.cmx) $(LINKOPTS) |
|
556 mv $(LIBNAME)nat.cmxa $(LIBNAME).cmxa |
|
557 mv $(LIBNAME)nat.$(A) $(LIBNAME).$(A) |
|
558 |
|
559 @@ -71,6 +72,7 @@ clean: partialclean |
|
560 install: |
|
561 cp dllthreads.dll $(STUBLIBDIR)/dllthreads.dll |
|
562 cp libthreads.$(A) $(LIBDIR)/libthreads.$(A) |
|
563 + cd $(LIBDIR); $(RANLIB) libthreads.$(A) |
|
564 mkdir -p $(LIBDIR)/threads |
|
565 cp $(CMIFILES) threads.cma $(LIBDIR)/threads |
|
566 rm -f $(LIBDIR)/threads/stdlib.cma |
|
567 @@ -78,6 +80,7 @@ install: |
|
568 |
|
569 installopt: |
|
570 cp libthreadsnat.$(A) $(LIBDIR)/libthreadsnat.$(A) |
|
571 + cd $(LIBDIR); $(RANLIB) libthreadsnat.$(A) |
|
572 cp $(THREAD_OBJS:.cmo=.cmx) threads.cmxa threads.$(A) $(LIBDIR)/threads |
|
573 cp threads.cmxs $(LIBDIR)/threads |
|
574 |
|
575 diff --git a/otherlibs/systhreads/st_win32.h b/otherlibs/systhreads/st_win32.h |
|
576 index da602b7..7e1dcb9 100644 |
|
577 --- a/otherlibs/systhreads/st_win32.h |
|
578 +++ b/otherlibs/systhreads/st_win32.h |
|
579 @@ -17,7 +17,7 @@ |
|
580 |
|
581 #define _WIN32_WINNT 0x0400 |
|
582 #include <windows.h> |
|
583 -#include <WinError.h> |
|
584 +#include <winerror.h> |
|
585 #include <stdio.h> |
|
586 #include <signal.h> |
|
587 |
|
588 diff --git a/otherlibs/win32graph/Makefile.nt b/otherlibs/win32graph/Makefile.nt |
|
589 index 62c4678..e7c6d6b 100644 |
|
590 --- a/otherlibs/win32graph/Makefile.nt |
|
591 +++ b/otherlibs/win32graph/Makefile.nt |
|
592 @@ -18,10 +18,11 @@ COBJS=open.$(O) draw.$(O) events.$(O) dib.$(O) |
|
593 CAMLOBJS=graphics.cmo |
|
594 WIN32LIBS=$(call SYSLIB,kernel32) $(call SYSLIB,gdi32) $(call SYSLIB,user32) |
|
595 LINKOPTS=-cclib "\"$(WIN32LIBS)\"" |
|
596 -LDOPTS=-ldopt "$(WIN32LIBS)" |
|
597 |
|
598 include ../Makefile.nt |
|
599 |
|
600 +LDOPTS=-L@libdir@ -ldopt "$(WIN32LIBS)" |
|
601 + |
|
602 graphics.ml: ../graph/graphics.ml |
|
603 cp ../graph/graphics.ml graphics.ml |
|
604 graphics.mli: ../graph/graphics.mli |
|
605 diff --git a/otherlibs/win32unix/Makefile.nt b/otherlibs/win32unix/Makefile.nt |
|
606 index 76a1c19..c401bbb 100644 |
|
607 --- a/otherlibs/win32unix/Makefile.nt |
|
608 +++ b/otherlibs/win32unix/Makefile.nt |
|
609 @@ -40,7 +40,6 @@ LIBNAME=unix |
|
610 COBJS=$(ALL_FILES:.c=.$(O)) |
|
611 CAMLOBJS=unix.cmo unixLabels.cmo |
|
612 LINKOPTS=-cclib $(WSOCKLIB) |
|
613 -LDOPTS=-ldopt $(WSOCKLIB) |
|
614 EXTRACAMLFLAGS=-nolabels |
|
615 EXTRACFLAGS=-I../unix |
|
616 HEADERS=unixsupport.h socketaddr.h |
|
617 @@ -48,6 +47,8 @@ HEADERS=unixsupport.h socketaddr.h |
|
618 |
|
619 include ../Makefile.nt |
|
620 |
|
621 +LDOPTS=-L@libdir@ -ldopt $(WSOCKLIB) |
|
622 + |
|
623 clean:: |
|
624 rm -f $(UNIX_FILES) $(UNIX_CAML_FILES) |
|
625 |
|
626 diff --git a/utils/config.mlp b/utils/config.mlp |
|
627 index cdf67d4..b905059 100644 |
|
628 --- a/utils/config.mlp |
|
629 +++ b/utils/config.mlp |
|
630 @@ -86,11 +86,7 @@ let ext_asm = "%%EXT_ASM%%" |
|
631 let ext_lib = "%%EXT_LIB%%" |
|
632 let ext_dll = "%%EXT_DLL%%" |
|
633 |
|
634 -let default_executable_name = |
|
635 - match Sys.os_type with |
|
636 - "Unix" -> "a.out" |
|
637 - | "Win32" | "Cygwin" -> "camlprog.exe" |
|
638 - | _ -> "camlprog" |
|
639 +let default_executable_name = "camlprog.exe" |
|
640 |
|
641 let systhread_supported = %%SYSTHREAD_SUPPORT%%;; |
|
642 |
|
643 @@ -118,7 +114,7 @@ let print_config oc = |
|
644 p "ext_asm" ext_asm; |
|
645 p "ext_lib" ext_lib; |
|
646 p "ext_dll" ext_dll; |
|
647 - p "os_type" Sys.os_type; |
|
648 + p "os_type" "Win32"; |
|
649 p "default_executable_name" default_executable_name; |
|
650 p_bool "systhread_supported" systhread_supported; |
|
651 flush oc; |
|
652 -- |
|
653 1.7.9.5 |
|
654 |