1 # Built-in strip corrupts binaries, so use the mingw32 strip instead:
2 %define __strip %{_mingw32_strip}
3 %define __objdump %{_mingw32_objdump}
5 %define debug_package %{nil}
7 %define otherlibraries win32unix str num dynlink bigarray systhreads win32graph
11 Release: 0.15.beta1%{?dist}
12 Summary: Objective Caml MinGW cross-compiler and programming environment
14 License: QPL and (LGPLv2+ with exceptions)
15 Group: Development/Libraries
17 URL: http://caml.inria.fr/
18 Source0: http://caml.inria.fr/pub/distrib/ocaml-3.11/ocaml-%{version}+beta1.tar.bz2
20 # This is installed as config/Makefile when we cross-compile.
21 Source1000: Makefile-fedora-mingw.in
22 Source1001: README.Fedora
24 # XXX We should apply any Fedora native patches here.
26 # For patch description, see the top of each patch file.
27 # Start numbering at 1000 since these are MinGW-specific patches.
28 Patch1000: mingw32-ocaml-3.11.0+beta1-combined-Makefile.patch
29 Patch1001: mingw32-ocaml-3.11.0+beta1-disable-cmxs.patch
30 Patch1002: mingw32-ocaml-3.11.0+beta1-filename-win32-dirsep.patch
31 Patch1003: mingw32-ocaml-3.11.0+beta1-i386-profiling.patch
32 Patch1004: mingw32-ocaml-3.11.0+beta1-no-stdlib-dir.patch
33 Patch1005: mingw32-ocaml-3.11.0+beta1-win32-fixes.patch
34 Patch1006: mingw32-ocaml-3.11.0+beta1-win32unix-path.patch
36 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
38 # Answer: yes and no. In theory it should be, but because we install
39 # Windows binaries in %{_libdir}, the path is different if built on
40 # 32 and 64 bit platforms. We should probably install the binaries
44 BuildRequires: mingw32-filesystem >= 30
45 BuildRequires: mingw32-gcc
46 BuildRequires: mingw32-binutils
47 BuildRequires: mingw32-flexdll
49 # These are required so we can use gcc -m32 and link to 32 bit X11:
50 BuildRequires: /lib/libgcc_s.so.1
51 BuildRequires: /usr/lib/crt1.o
52 BuildRequires: /usr/lib/libX11.so
54 # We need the native Fedora OCaml package (of the precise matching
55 # version) for several reasons:
56 # (a) We need /usr/bin/ocamlrun (the bytecode interpreter) in order
57 # to run our bytecodes such as i686-pc-mingw32-ocamlopt. Eventually
58 # shipping native versions of the cross-compiler binaries should
60 # (b) We need camlp4 preprocessor, and because of the way this works
61 # it has to be the camlp4 from the identical version.
62 Requires: ocaml-runtime = %{version}
63 Requires: ocaml-camlp4-devel = %{version}
65 # The built program will try to run the cross-compiler and flexdll, so
66 # these must be runtime requires.
68 Requires: mingw32-binutils
69 Requires: mingw32-flexdll
71 # i686-pc-mingw32-ocamlmklib tries to run ocamlopt which is probably a
72 # bug, but requires this (XXX).
77 Objective Caml is a high-level, strongly-typed, functional and
78 object-oriented programming language from the ML family of languages.
80 This package is an OCaml cross-compiler which runs natively on Fedora
81 and produces Windows native executables.
85 %setup -q -n ocaml-%{version}+beta1
97 # Don't run out of memory.
100 # Build native ocamlrun and ocamlc which contain the
101 # filename-win32-dirsep patch.
103 # Note that we must build a 32 bit compiler, even on 64 bit build
104 # architectures, because this compiler will try to do strength
105 # reduction optimizations using its internal int type, and that must
106 # match Windows' int type. (That's what -cc and -host are for).
110 -libdir %{_libdir}/ocaml \
111 -mandir %{_mandir}/man1 \
112 -cc "gcc -m32" -host i386-pc-linux -x11lib /usr/lib -verbose
115 # Now move the working ocamlrun, ocamlc into the boot/ directory,
116 # overwriting the binary versions which ship with the compiler with
117 # ones that contain the above filename-win32-dirsep patch.
120 # Now replace the compiler configuration (config/{s.h,m.h,Makefile})
121 # with ones as they would be on a 32 bit Windows system.
124 # config/m.h can just be copied from config/m-nt.h which ships.
128 # config/s.h can just be copied from config/s-nt.h which ships.
132 # config/Makefile is a custom one which we supply.
135 -e 's,@prefix@,%{_prefix},g' \
136 -e 's,@bindir@,%{_bindir},g' \
137 -e 's,@libdir@,%{_libdir},g' \
138 -e 's,@target@,%{_mingw32_target},g' \
139 -e 's,@otherlibraries@,%{otherlibraries},g' \
140 < %{SOURCE1000} > Makefile
144 # We're going to build in otherlibs/win32unix and otherlibs/win32graph
145 # directories, but since they would normally only be built under
146 # Windows, they only have the Makefile.nt files. Just symlink
147 # Makefile -> Makefile.nt for these cases.
148 for d in otherlibs/win32unix otherlibs/win32graph; do
149 ln -s Makefile.nt $d/Makefile
152 # Now clean the temporary files from the previous build. This
153 # will also cause asmcomp/arch.ml (etc) to be linked to the 32 bit
154 # i386 versions, essentially causing ocamlopt to use the Win/i386 code
158 # Just rebuild some small bits that we need for the following
159 # 'make opt' to work. Note that 'make all' fails here.
160 make -C byterun libcamlrun.a
163 make -C tools ocamlmklib
172 rm -rf $RPM_BUILD_ROOT
174 mkdir -p $RPM_BUILD_ROOT%{_bindir}
175 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
176 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/threads
177 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/stublibs
179 # This is the equivalent of 'make install installopt', but
180 # we only want to install the parts which are really necessary
181 # for the cross-compiler. eg. We don't need any of the native
182 # tools like ocamllex or ocamldoc.
183 %define makevars BINDIR=$RPM_BUILD_ROOT%{_bindir} LIBDIR=$RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
184 make %{makevars} -C byterun install
185 make %{makevars} -C stdlib install
186 for i in %{otherlibraries}; do
187 make %{makevars} -C otherlibs/$i install
189 make %{makevars} -C tools install
190 make %{makevars} installopt
192 install -m 0755 ocamlc $RPM_BUILD_ROOT%{_bindir}
195 $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/Makefile.config
197 # Rename all the binaries to target-binary.
198 pushd $RPM_BUILD_ROOT%{_bindir}
199 for f in ocamlc ocamlcp ocamldep ocamlmklib ocamlmktop ocamlopt ocamlprof; do
200 mv $f %{_mingw32_target}-$f
204 # Don't install ocamlrun, use native one.
205 rm $RPM_BUILD_ROOT%{_bindir}/ocamlrun
209 rm -rf $RPM_BUILD_ROOT
213 %defattr(-,root,root)
215 %{_bindir}/%{_mingw32_target}-ocamlc
216 %{_bindir}/%{_mingw32_target}-ocamlcp
217 %{_bindir}/%{_mingw32_target}-ocamldep
218 %{_bindir}/%{_mingw32_target}-ocamlmklib
219 %{_bindir}/%{_mingw32_target}-ocamlmktop
220 %{_bindir}/%{_mingw32_target}-ocamlprof
221 %{_bindir}/%{_mingw32_target}-ocamlopt
222 %{_libdir}/%{_mingw32_target}-ocaml/
226 * Sun Nov 23 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0-0.15.beta1
227 - Use the proper package naming convention, since '+' etc shouldn't be
228 in the name, as per Fedora packaging guidelines. Note that this won't
229 upgrade smoothly, but we don't care because these packages aren't
230 officially released yet. You'll just have to uninstall the old
231 package and install the new one.
232 - Don't ship our own ocamlrun, use the native one instead.
233 - Require camlp4 utilities.
235 * Mon Nov 17 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-14
236 - Added README.Fedora.
238 * Sun Nov 16 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-13
239 - Build the native compiler as 32 bits even on a 64 bit build
240 architecture (because the target, Windows, is 32 bit). The
241 compiler does strength reduction and other optimizations
242 internally so we must ensure it uses the same int type.
243 - Requires libX11-devel.i386 and libgcc.i386.
244 - Allow the normal dependency generators to run because this
246 - Use mingw32 strip to avoid corrupting binaries.
248 * Sun Nov 16 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-8
251 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-7
252 - Further requirements.
254 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-6
255 - Install tools, particularly ocamlmklib.
257 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-5
258 - +Requires mingw32-flexdll and the cross-compiler.
260 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-4
261 - Initial RPM release.