Mercurial > mxe-octave
annotate src/ocaml-core.mk @ 4200:5cee475eceb0
temporary fixes for of-odepkg package
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 31 Aug 2016 15:02:02 -0400 |
parents | 13be64f9f16d |
children |
rev | line source |
---|---|
2836 | 1 # This file is part of mingw-cross-env. |
2 # See doc/index.html for further information. | |
3 | |
4 # zlib | |
5 PKG := ocaml-core | |
6 $(PKG)_IGNORE := | |
3480
13be64f9f16d
move version info from index.html to src/*.mk files
John W. Eaton <jwe@octave.org>
parents:
3048
diff
changeset
|
7 $(PKG)_VERSION := 4.00.0 |
2836 | 8 $(PKG)_CHECKSUM := $(ocaml-native_CHECKSUM) |
9 $(PKG)_SUBDIR := $(ocaml-native_SUBDIR) | |
10 $(PKG)_FILE := $(ocaml-native_FILE) | |
11 $(PKG)_URL := $(ocaml-native_URL) | |
3048
5ef49fb3299d
treat gcc and binutils as build tools
John W. Eaton <jwe@octave.org>
parents:
3031
diff
changeset
|
12 $(PKG)_DEPS := bfd ocaml-flexdll ocaml-native |
2836 | 13 |
14 define $(PKG)_UPDATE | |
15 $(call ocaml-native_UPDATE) | |
16 endef | |
17 | |
18 | |
19 OTHER_LIBS := win32unix str num dynlink bigarray systhreads win32graph | |
20 | |
21 define $(PKG)_BUILD | |
22 # Build native ocamlrun and ocamlc which contain the | |
23 # filename-win32-dirsep patch. | |
24 # | |
25 # Note that we must build a 32 bit compiler, even on 64 bit build | |
26 # architectures, because this compiler will try to do strength | |
27 # reduction optimizations using its internal int type, and that must | |
28 # match Windows' int type. (That's what -cc and -host are for). | |
29 cd '$(1)' && ./configure \ | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
30 -prefix '$(HOST_PREFIX)' \ |
3014
b6c7244a2f66
Use HOST_BINDIR, HOST_LIBDIR, and HOST_INCDIR instead of MXE_BINDIR, MXE_LIBDIR, and MXE_INCDIR. Attempt to use these variables consistently instead of using $(HOST_PREFIX)/bin, $(HOST_PREFIX)/lib, and $(HOST_PREFIX)/include
John W. Eaton <jwe@octave.org>
parents:
3012
diff
changeset
|
31 -bindir '$(HOST_BINDIR)' \ |
b6c7244a2f66
Use HOST_BINDIR, HOST_LIBDIR, and HOST_INCDIR instead of MXE_BINDIR, MXE_LIBDIR, and MXE_INCDIR. Attempt to use these variables consistently instead of using $(HOST_PREFIX)/bin, $(HOST_PREFIX)/lib, and $(HOST_PREFIX)/include
John W. Eaton <jwe@octave.org>
parents:
3012
diff
changeset
|
32 -libdir '$(HOST_LIBDIR)/ocaml' \ |
2836 | 33 -no-tk \ |
34 -cc "gcc -m32" \ | |
35 -no-shared-libs \ | |
36 -host '$(TARGET)' \ | |
37 -x11lib /usr/lib \ | |
38 -verbose | |
39 $(MAKE) -C '$(1)' core | |
40 # Now move the working ocamlrun, ocamlc into the boot/ directory, | |
41 # overwriting the binary versions which ship with the compiler with | |
42 # ones that contain the filename-win32-dirsep patch. | |
43 $(MAKE) -C '$(1)' coreboot | |
44 # second time, otherwise Segfault in some cases (depending on the runing system?) | |
45 $(MAKE) -C '$(1)' coreboot | |
46 $(MAKE) -C '$(1)' all | |
47 # install ocamldoc and camlp4 (non cross versions) | |
48 $(MAKE) -C '$(1)/ocamldoc' install | |
3014
b6c7244a2f66
Use HOST_BINDIR, HOST_LIBDIR, and HOST_INCDIR instead of MXE_BINDIR, MXE_LIBDIR, and MXE_INCDIR. Attempt to use these variables consistently instead of using $(HOST_PREFIX)/bin, $(HOST_PREFIX)/lib, and $(HOST_PREFIX)/include
John W. Eaton <jwe@octave.org>
parents:
3012
diff
changeset
|
49 cd '$(1)' && BINDIR=$(HOST_BINDIR) \ |
b6c7244a2f66
Use HOST_BINDIR, HOST_LIBDIR, and HOST_INCDIR instead of MXE_BINDIR, MXE_LIBDIR, and MXE_INCDIR. Attempt to use these variables consistently instead of using $(HOST_PREFIX)/bin, $(HOST_PREFIX)/lib, and $(HOST_PREFIX)/include
John W. Eaton <jwe@octave.org>
parents:
3012
diff
changeset
|
50 LIBDIR=$(HOST_LIBDIR)/ocaml \ |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
51 PREFIX=$(HOST_PREFIX) \ |
2836 | 52 ./build/partial-install.sh |
53 | |
54 ####### patch mingw include | |
55 # Now patch utils/clflags.ml to hardcode mingw-specific include. | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
56 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" \ |
2836 | 57 $(1)/hardcode_mingw_include.patch |
58 cd '$(1)' && patch -p2 < hardcode_mingw_include.patch | |
59 | |
60 ####### prepare cross build | |
61 # Replace the compiler configuration (config/{s.h,m.h,Makefile}) | |
62 # with ones as they would be on a 32 bit Windows system. | |
63 cp -f '$(1)/config/m-nt.h' '$(1)/config/m.h' | |
64 cp -f $(1)/config/s-nt.h $(1)/config/s.h | |
65 # config/Makefile is a custom one which we supply. | |
66 rm -f $(1)/config/Makefile | |
67 $(SED) \ | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
68 -e "s,@prefix@,$(HOST_PREFIX),g" \ |
2836 | 69 -e "s,@toolpref@,$(TARGET),g" \ |
70 -e "s,@otherlibraries@,$(OTHER_LIBS),g" \ | |
71 < $(1)/Makefile-mingw.in > $(1)/config/Makefile | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
72 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" $(1)/otherlibs/Makefile.shared |
2836 | 73 # We're going to build in otherlibs/win32unix and otherlibs/win32graph |
74 # directories, but since they would normally only be built under | |
75 # Windows, they only have the Makefile.nt files. Just symlink | |
76 # Makefile -> Makefile.nt for these cases. | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
77 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" $(1)/otherlibs/win32unix/Makefile.nt |
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
78 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" $(1)/otherlibs/win32graph/Makefile.nt |
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
79 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" $(1)/otherlibs/systhreads/Makefile.nt |
2836 | 80 for d in $(1)/otherlibs/win32unix \ |
81 $(1)/otherlibs/win32graph \ | |
82 $(1)/otherlibs/bigarray \ | |
83 $(1)/otherlibs/systhreads; do \ | |
3006
dabfd7db980c
use cp for ln on mingw native builds
John W. Eaton <jwe@octave.org>
parents:
2836
diff
changeset
|
84 $(LN_SF) Makefile.nt $$d/Makefile; \ |
2836 | 85 done |
86 # Now clean the temporary files from the previous build. This | |
87 # will also cause asmcomp/arch.ml (etc) to be linked to the 32 bit | |
88 # i386 versions, essentially causing ocamlopt to use the Win/i386 code | |
89 # generator. | |
90 $(MAKE) -C '$(1)' partialclean | |
91 # We need to remove any .o object for make sure they are | |
92 # recompiled later.. | |
93 cd $(1) && rm byterun/*.o | |
94 | |
95 ####### build mingw ocaml | |
96 # Just rebuild some small bits that we need for the following | |
97 # 'make opt' to work. Note that 'make all' fails here. | |
98 $(MAKE) -C '$(1)/byterun' libcamlrun.a | |
99 $(MAKE) -C '$(1)' ocaml ocamlc | |
100 $(MAKE) -C '$(1)/stdlib' | |
101 $(MAKE) -C '$(1)/tools' ocamlmklib | |
102 # Build ocamlopt | |
103 $(MAKE) -C '$(1)' opt | |
104 # Now build otherlibs for ocamlopt | |
105 cd '$(1)' && \ | |
106 for i in $(OTHER_LIBS); do \ | |
107 $(MAKE) -C otherlibs/$$i clean; \ | |
108 $(MAKE) -C otherlibs/$$i all; \ | |
109 $(MAKE) -C otherlibs/$$i allopt; \ | |
110 done | |
111 | |
112 ####### installation | |
113 $(MAKE) -C '$(1)' install | |
114 $(MAKE) -C '$(1)' installopt | |
115 # Rename all the binaries to target-binary | |
116 for f in ocamlc ocamlcp ocamlrun ocamldep ocamlmklib ocamlmktop ocamlopt ocamlprof camlp4prof camlp4boot camlp4 camlp4oof camlp4of camlp4o camlp4rf camlp4r camlp4orf ocamldoc ; do \ | |
3031
951da75fd09c
improve handling of cross tool prefix
John W. Eaton <jwe@octave.org>
parents:
3014
diff
changeset
|
117 cp -f $(HOST_BINDIR)/$$f $(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)$$f; \ |
2836 | 118 done |
119 | |
120 # test ocamlopt | |
121 cp '$(2).ml' '$(1)/test.ml' | |
3031
951da75fd09c
improve handling of cross tool prefix
John W. Eaton <jwe@octave.org>
parents:
3014
diff
changeset
|
122 cd '$(1)' && '$(MXE_TOOL_PREFIX)ocamlopt' test.ml |
2836 | 123 # test ocamlbuild |
124 mkdir '$(1)/tmp' && cp '$(2).ml' '$(1)/tmp/test.ml' | |
3031
951da75fd09c
improve handling of cross tool prefix
John W. Eaton <jwe@octave.org>
parents:
3014
diff
changeset
|
125 cd '$(1)/tmp' && $(MXE_TOOL_PREFIX)ocamlbuild test.native |
2836 | 126 # test |
127 cp '$(2).ml' '$(1)/test.ml' | |
3031
951da75fd09c
improve handling of cross tool prefix
John W. Eaton <jwe@octave.org>
parents:
3014
diff
changeset
|
128 cd '$(1)' && '$(MXE_TOOL_PREFIX)ocamlopt' test.ml |
2836 | 129 endef |