1 #%define __strip %{_mingw32_strip}
2 #%define __objdump %{_mingw32_objdump}
5 %define _use_internal_dependency_generator 0
6 %define __find_requires %{_mingw32_findrequires}
7 %define __find_provides %{_mingw32_findprovides}
9 %define debug_package %{nil}
11 %define otherlibraries win32unix str num dynlink bigarray systhreads win32graph
16 Summary: Objective Caml MinGW cross-compiler and programming environment
18 License: QPL and (LGPLv2+ with exceptions)
19 Group: Development/Libraries
21 URL: http://caml.inria.fr/
22 Source0: http://caml.inria.fr/pub/distrib/ocaml-3.11/ocaml-%{version}.tar.bz2
24 # This is installed as config/Makefile when we cross-compile.
25 Source1000: Makefile-fedora-mingw.in
27 # XXX We should apply any Fedora native patches here.
29 # For patch description, see the top of each patch file.
30 # Start numbering at 1000 since these are MinGW-specific patches.
31 Patch1000: mingw32-ocaml-3.11.0+beta1-combined-Makefile.patch
32 Patch1001: mingw32-ocaml-3.11.0+beta1-disable-cmxs.patch
33 Patch1002: mingw32-ocaml-3.11.0+beta1-filename-win32-dirsep.patch
34 Patch1003: mingw32-ocaml-3.11.0+beta1-i386-profiling.patch
35 Patch1004: mingw32-ocaml-3.11.0+beta1-no-stdlib-dir.patch
36 Patch1005: mingw32-ocaml-3.11.0+beta1-win32-fixes.patch
37 Patch1006: mingw32-ocaml-3.11.0+beta1-win32unix-path.patch
39 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
43 BuildRequires: mingw32-filesystem >= 30
44 BuildRequires: mingw32-gcc
45 BuildRequires: mingw32-binutils
46 BuildRequires: mingw32-flexdll
48 BuildRequires: /usr/lib/libX11.so
50 # While we still ship bytecode, this requires a /usr/bin/ocamlrun from
51 # the _identical_ native package. We don't have that at the moment,
52 # which is why this is commented out.
53 #Requires: ocaml-runtime = %{version}
55 # The built program will try to run the cross-compiler and flexdll, so
56 # these must be runtime requires.
58 Requires: mingw32-binutils
59 Requires: mingw32-flexdll
61 # i686-pc-mingw32-ocamlmklib tries to run ocamlopt which is probably a
62 # bug, but requires this (XXX).
67 Objective Caml is a high-level, strongly-typed, functional and
68 object-oriented programming language from the ML family of languages.
70 This package is an OCaml cross-compiler which runs natively on Fedora
71 and produces Windows native executables.
75 %setup -q -n ocaml-%{version}
87 # Don't run out of memory.
90 # Build native ocamlrun and ocamlc which contain the
91 # filename-win32-dirsep patch.
93 # Note that we must build a 32 bit compiler, even on 64 bit build
94 # architectures, because this compiler will try to do strength
95 # reduction optimizations using its internal int type, and that must
96 # match Windows' int type. (That's what -cc and -host are for).
100 -libdir %{_libdir}/ocaml \
101 -mandir %{_mandir}/man1 \
102 -cc "gcc -m32" -host i386-pc-linux -x11lib /usr/lib
105 # Now move the working ocamlrun, ocamlc into the boot/ directory,
106 # overwriting the binary versions which ship with the compiler with
107 # ones that contain the above filename-win32-dirsep patch.
110 # Now replace the compiler configuration (config/{s.h,m.h,Makefile})
111 # with ones as they would be on a 32 bit Windows system.
114 # config/m.h can just be copied from config/m-nt.h which ships.
118 # config/s.h can just be copied from config/s-nt.h which ships.
122 # config/Makefile is a custom one which we supply.
125 -e 's,@prefix@,%{_prefix},g' \
126 -e 's,@bindir@,%{_bindir},g' \
127 -e 's,@libdir@,%{_libdir},g' \
128 -e 's,@target@,%{_mingw32_target},g' \
129 -e 's,@otherlibraries@,%{otherlibraries},g' \
130 < %{SOURCE1000} > Makefile
134 # We're going to build in otherlibs/win32unix and otherlibs/win32graph
135 # directories, but since they would normally only be built under
136 # Windows, they only have the Makefile.nt files. Just symlink
137 # Makefile -> Makefile.nt for these cases.
138 for d in otherlibs/win32unix otherlibs/win32graph; do
139 ln -s Makefile.nt $d/Makefile
142 # Now clean the temporary files from the previous build. This
143 # will also cause asmcomp/arch.ml (etc) to be linked to the 32 bit
144 # i386 versions, essentially causing ocamlopt to use the Win/i386 code
148 # Just rebuild some small bits that we need for the following
149 # 'make opt' to work. Note that 'make all' fails here.
150 make -C byterun libcamlrun.a
153 make -C tools ocamlmklib
160 rm -rf $RPM_BUILD_ROOT
162 mkdir -p $RPM_BUILD_ROOT%{_bindir}
163 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
164 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/threads
165 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/stublibs
167 # This is the equivalent of 'make install installopt', but
168 # we only want to install the parts which are really necessary
169 # for the cross-compiler. eg. We don't need any of the native
170 # tools like ocamllex or ocamldoc.
171 %define makevars BINDIR=$RPM_BUILD_ROOT%{_bindir} LIBDIR=$RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
172 make %{makevars} -C byterun install
173 make %{makevars} -C stdlib install
174 for i in %{otherlibraries}; do
175 make %{makevars} -C otherlibs/$i install
177 make %{makevars} -C tools install
178 make %{makevars} installopt
180 install -m 0755 ocamlc $RPM_BUILD_ROOT%{_bindir}
183 $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/Makefile.config
185 # For bytecode binaries, change the bang-path to point to the locally
186 # installed ocamlrun.
187 pushd $RPM_BUILD_ROOT%{_bindir}
188 for f in ocamlc ocamlcp ocamldep ocamlmklib ocamlopt ocamlprof; do
190 echo '#!%{_bindir}/%{_mingw32_target}-ocamlrun' > $f
191 tail -n +2 $f.old >> $f
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 ocamlrun; do
200 mv $f %{_mingw32_target}-$f
206 rm -rf $RPM_BUILD_ROOT
210 %defattr(-,root,root)
211 %{_bindir}/%{_mingw32_target}-ocamlc
212 %{_bindir}/%{_mingw32_target}-ocamlcp
213 %{_bindir}/%{_mingw32_target}-ocamldep
214 %{_bindir}/%{_mingw32_target}-ocamlmklib
215 %{_bindir}/%{_mingw32_target}-ocamlmktop
216 %{_bindir}/%{_mingw32_target}-ocamlprof
217 %{_bindir}/%{_mingw32_target}-ocamlopt
218 %{_bindir}/%{_mingw32_target}-ocamlrun
219 %{_libdir}/%{_mingw32_target}-ocaml/
223 * Sun Nov 16 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-9
224 - Build the native compiler as 32 bits even on a 64 bit build
225 architecture (because the target, Windows, is 32 bit). The
226 compiler does strength reduction and other optimizations
227 internally so we must ensure it uses the same int type.
229 * Sun Nov 16 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-8
232 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-7
233 - Further requirements.
235 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-6
236 - Install tools, particularly ocamlmklib.
238 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-5
239 - +Requires mingw32-flexdll and the cross-compiler.
241 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-4
242 - Initial RPM release.