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 # While we still ship bytecode, this requires a /usr/bin/ocamlrun from
49 # the _identical_ native package. We don't have that at the moment,
50 # which is why this is commented out.
51 #Requires: ocaml-runtime = %{version}
53 # The built program will try to run the cross-compiler and flexdll, so
54 # these must be runtime requires.
56 Requires: mingw32-binutils
57 Requires: mingw32-flexdll
59 # i686-pc-mingw32-ocamlmklib tries to run ocamlopt which is probably a
60 # bug, but requires this (XXX).
65 Objective Caml is a high-level, strongly-typed, functional and
66 object-oriented programming language from the ML family of languages.
68 This package is an OCaml cross-compiler which runs natively on Fedora
69 and produces Windows native executables.
73 %setup -q -n ocaml-%{version}
85 # Don't run out of memory.
88 # Build native ocamlrun and ocamlc which contain the filename-win32-dirsep
93 -libdir %{_libdir}/ocaml \
94 -mandir %{_mandir}/man1
97 # Now move the working ocamlrun, ocamlc into the boot/ directory,
98 # overwriting the binary versions which ship with the compiler with
99 # ones that contain the above filename-win32-dirsep patch.
102 # Now replace the compiler configuration (config/{s.h,m.h,Makefile})
103 # with ones as they would be on a 32 bit Windows system.
106 # config/m.h can just be copied from config/m-nt.h which ships.
110 # config/s.h can just be copied from config/s-nt.h which ships.
114 # config/Makefile is a custom one which we supply.
117 -e 's,@prefix@,%{_prefix},g' \
118 -e 's,@bindir@,%{_bindir},g' \
119 -e 's,@libdir@,%{_libdir},g' \
120 -e 's,@target@,%{_mingw32_target},g' \
121 -e 's,@otherlibraries@,%{otherlibraries},g' \
122 < %{SOURCE1000} > Makefile
126 # We're going to build in otherlibs/win32unix and otherlibs/win32graph
127 # directories, but since they would normally only be built under
128 # Windows, they only have the Makefile.nt files. Just symlink
129 # Makefile -> Makefile.nt for these cases.
130 for d in otherlibs/win32unix otherlibs/win32graph; do
131 ln -s Makefile.nt $d/Makefile
134 # Now clean the temporary files from the previous build. This
135 # will also cause asmcomp/arch.ml (etc) to be linked to the 32 bit
136 # i386 versions, essentially causing ocamlopt to use the Win/i386 code
140 # Just rebuild some small bits that we need for the following
141 # 'make opt' to work. Note that 'make all' fails here.
142 make -C byterun libcamlrun.a
145 make -C tools ocamlmklib
152 rm -rf $RPM_BUILD_ROOT
154 mkdir -p $RPM_BUILD_ROOT%{_bindir}
155 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
156 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/threads
157 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/stublibs
159 # This is the equivalent of 'make install installopt', but
160 # we only want to install the parts which are really necessary
161 # for the cross-compiler. eg. We don't need any of the native
162 # tools like ocamllex or ocamldoc.
163 %define makevars BINDIR=$RPM_BUILD_ROOT%{_bindir} LIBDIR=$RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
164 make %{makevars} -C byterun install
165 make %{makevars} -C stdlib install
166 for i in %{otherlibraries}; do
167 make %{makevars} -C otherlibs/$i install
169 make %{makevars} -C tools install
170 make %{makevars} installopt
172 install -m 0755 ocamlc $RPM_BUILD_ROOT%{_bindir}
175 $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/Makefile.config
177 # For bytecode binaries, change the bang-path to point to the locally
178 # installed ocamlrun.
179 pushd $RPM_BUILD_ROOT%{_bindir}
180 for f in ocamlc ocamlcp ocamldep ocamlmklib ocamlopt ocamlprof; do
182 echo '#!%{_bindir}/%{_mingw32_target}-ocamlrun' > $f
183 tail -n +2 $f.old >> $f
189 # Rename all the binaries to target-binary.
190 pushd $RPM_BUILD_ROOT%{_bindir}
191 for f in ocamlc ocamlcp ocamldep ocamlmklib ocamlmktop ocamlopt ocamlprof ocamlrun; do
192 mv $f %{_mingw32_target}-$f
198 rm -rf $RPM_BUILD_ROOT
202 %defattr(-,root,root)
203 %{_bindir}/%{_mingw32_target}-ocamlc
204 %{_bindir}/%{_mingw32_target}-ocamlcp
205 %{_bindir}/%{_mingw32_target}-ocamldep
206 %{_bindir}/%{_mingw32_target}-ocamlmklib
207 %{_bindir}/%{_mingw32_target}-ocamlmktop
208 %{_bindir}/%{_mingw32_target}-ocamlprof
209 %{_bindir}/%{_mingw32_target}-ocamlopt
210 %{_bindir}/%{_mingw32_target}-ocamlrun
211 %{_libdir}/%{_mingw32_target}-ocaml/
215 * Sun Nov 16 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-8
218 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-7
219 - Further requirements.
221 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-6
222 - Install tools, particularly ocamlmklib.
224 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-5
225 - +Requires mingw32-flexdll and the cross-compiler.
227 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-4
228 - Initial RPM release.