1 %define __strip %{_mingw32_strip}
2 %define __objdump %{_mingw32_objdump}
3 %define _use_internal_dependency_generator 0
4 %define __find_requires %{_mingw32_findrequires}
5 %define __find_provides %{_mingw32_findprovides}
7 %define debug_package %{nil}
9 %define otherlibraries win32unix str num dynlink bigarray systhreads win32graph
14 Summary: Objective Caml MinGW cross-compiler and programming environment
16 License: QPL and (LGPLv2+ with exceptions)
17 Group: Development/Libraries
19 URL: http://caml.inria.fr/
20 Source0: http://caml.inria.fr/pub/distrib/ocaml-3.11/ocaml-%{version}.tar.bz2
22 # This is installed as config/Makefile when we cross-compile.
23 Source1000: Makefile-fedora-mingw.in
25 # XXX We should apply any Fedora native patches here.
27 # For patch description, see the top of each patch file.
28 # Start numbering at 1000 since these are MinGW-specific patches.
29 Patch1000: mingw32-ocaml-3.11.0+beta1-combined-Makefile.patch
30 Patch1001: mingw32-ocaml-3.11.0+beta1-disable-cmxs.patch
31 Patch1002: mingw32-ocaml-3.11.0+beta1-filename-win32-dirsep.patch
32 Patch1003: mingw32-ocaml-3.11.0+beta1-i386-profiling.patch
33 Patch1004: mingw32-ocaml-3.11.0+beta1-no-stdlib-dir.patch
34 Patch1005: mingw32-ocaml-3.11.0+beta1-win32-fixes.patch
35 Patch1006: mingw32-ocaml-3.11.0+beta1-win32unix-path.patch
37 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
41 BuildRequires: mingw32-filesystem >= 30
42 BuildRequires: mingw32-gcc
43 BuildRequires: mingw32-binutils
44 BuildRequires: mingw32-flexdll
46 # While we still ship bytecode, this requires a /usr/bin/ocamlrun from
47 # the _identical_ native package. We don't have that at the moment,
48 # which is why this is commented out.
49 #Requires: ocaml-runtime = %{version}
51 # The built program will try to run the cross-compiler and flexdll, so
52 # these must be runtime requires.
54 Requires: mingw32-binutils
55 Requires: mingw32-flexdll
59 Objective Caml is a high-level, strongly-typed, functional and
60 object-oriented programming language from the ML family of languages.
62 This package is an OCaml cross-compiler which runs natively on Fedora
63 and produces Windows native executables.
67 %setup -q -n ocaml-%{version}
79 # Don't run out of memory.
82 # Build native ocamlrun and ocamlc which contain the filename-win32-dirsep
87 -libdir %{_libdir}/ocaml \
88 -mandir %{_mandir}/man1
91 # Now move the working ocamlrun, ocamlc into the boot/ directory,
92 # overwriting the binary versions which ship with the compiler with
93 # ones that contain the above filename-win32-dirsep patch.
96 # Now replace the compiler configuration (config/{s.h,m.h,Makefile})
97 # with ones as they would be on a 32 bit Windows system.
100 # config/m.h can just be copied from config/m-nt.h which ships.
104 # config/s.h can just be copied from config/s-nt.h which ships.
108 # config/Makefile is a custom one which we supply.
111 -e 's,@prefix@,%{_prefix},g' \
112 -e 's,@bindir@,%{_bindir},g' \
113 -e 's,@libdir@,%{_libdir},g' \
114 -e 's,@target@,%{_mingw32_target},g' \
115 -e 's,@otherlibraries@,%{otherlibraries},g' \
116 < %{SOURCE1000} > Makefile
120 # We're going to build in otherlibs/win32unix and otherlibs/win32graph
121 # directories, but since they would normally only be built under
122 # Windows, they only have the Makefile.nt files. Just symlink
123 # Makefile -> Makefile.nt for these cases.
124 for d in otherlibs/win32unix otherlibs/win32graph; do
125 ln -s Makefile.nt $d/Makefile
128 # Now clean the temporary files from the previous build. This
129 # will also cause asmcomp/arch.ml (etc) to be linked to the 32 bit
130 # i386 versions, essentially causing ocamlopt to use the Win/i386 code
134 # Just rebuild some small bits that we need for the following
135 # 'make opt' to work. Note that 'make all' fails here.
136 make -C byterun libcamlrun.a
139 make -C tools ocamlmklib
146 rm -rf $RPM_BUILD_ROOT
148 mkdir -p $RPM_BUILD_ROOT%{_bindir}
149 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
150 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/threads
151 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/stublibs
153 # This is the equivalent of 'make install installopt', but
154 # we only want to install the parts which are really necessary
155 # for the cross-compiler. eg. We don't need any of the native
156 # tools like ocamllex or ocamldoc.
157 %define makevars BINDIR=$RPM_BUILD_ROOT%{_bindir} LIBDIR=$RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
158 make %{makevars} -C byterun install
159 make %{makevars} -C stdlib install
160 for i in %{otherlibraries}; do
161 make %{makevars} -C otherlibs/$i install
163 make %{makevars} -C tools install
164 make %{makevars} installopt
167 $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/Makefile.config
169 # For bytecode binaries, change the bang-path to point to the locally
170 # installed ocamlrun.
171 pushd $RPM_BUILD_ROOT%{_bindir}
172 for f in ocamlcp ocamldep ocamlmklib ocamlopt ocamlprof; do
174 echo '#!%{_bindir}/%{_mingw32_target}-ocamlrun' > $f
175 tail -n +2 $f.old >> $f
181 # Rename all the binaries to target-binary.
182 pushd $RPM_BUILD_ROOT%{_bindir}
183 for f in ocamlcp ocamldep ocamlmklib ocamlmktop ocamlopt ocamlprof ocamlrun; do
184 mv $f %{_mingw32_target}-$f
190 rm -rf $RPM_BUILD_ROOT
194 %defattr(-,root,root)
195 %{_bindir}/%{_mingw32_target}-ocamlcp
196 %{_bindir}/%{_mingw32_target}-ocamldep
197 %{_bindir}/%{_mingw32_target}-ocamlmklib
198 %{_bindir}/%{_mingw32_target}-ocamlmktop
199 %{_bindir}/%{_mingw32_target}-ocamlprof
200 %{_bindir}/%{_mingw32_target}-ocamlopt
201 %{_bindir}/%{_mingw32_target}-ocamlrun
202 %{_libdir}/%{_mingw32_target}-ocaml/
206 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-6
207 - Install tools, particularly ocamlmklib.
209 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-5
210 - +Requires mingw32-flexdll and the cross-compiler.
212 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-4
213 - Initial RPM release.