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 # Build native ocamlrun and ocamlc which contain the filename-win32-dirsep
84 -libdir %{_libdir}/ocaml \
85 -mandir %{_mandir}/man1
88 # Now move the working ocamlrun, ocamlc into the boot/ directory,
89 # overwriting the binary versions which ship with the compiler with
90 # ones that contain the above filename-win32-dirsep patch.
93 # Now replace the compiler configuration (config/{s.h,m.h,Makefile})
94 # with ones as they would be on a 32 bit Windows system.
97 # config/m.h can just be copied from config/m-nt.h which ships.
101 # config/s.h can just be copied from config/s-nt.h which ships.
105 # config/Makefile is a custom one which we supply.
108 -e 's,@prefix@,%{_prefix},g' \
109 -e 's,@bindir@,%{_bindir},g' \
110 -e 's,@libdir@,%{_libdir},g' \
111 -e 's,@target@,%{_mingw32_target},g' \
112 -e 's,@otherlibraries@,%{otherlibraries},g' \
113 < %{SOURCE1000} > Makefile
117 # We're going to build in otherlibs/win32unix and otherlibs/win32graph
118 # directories, but since they would normally only be built under
119 # Windows, they only have the Makefile.nt files. Just symlink
120 # Makefile -> Makefile.nt for these cases.
121 for d in otherlibs/win32unix otherlibs/win32graph; do
122 ln -s Makefile.nt $d/Makefile
125 # Now clean the temporary files from the previous build. This
126 # will also cause asmcomp/arch.ml (etc) to be linked to the 32 bit
127 # i386 versions, essentially causing ocamlopt to use the Win/i386 code
131 # Just rebuild some small bits that we need for the following
132 # 'make opt' to work. Note that 'make all' fails here.
133 make -C byterun libcamlrun.a
136 make -C tools ocamlmklib
143 rm -rf $RPM_BUILD_ROOT
145 mkdir -p $RPM_BUILD_ROOT%{_bindir}
146 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
147 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/threads
148 mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/stublibs
150 # This is the equivalent of 'make install installopt', but
151 # we only want to install the parts which are really necessary
152 # for the cross-compiler. eg. We don't need any of the native
153 # tools like ocamllex or ocamldoc.
154 %define makevars BINDIR=$RPM_BUILD_ROOT%{_bindir} LIBDIR=$RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml
155 make %{makevars} -C byterun install
156 make %{makevars} -C stdlib install
157 for i in %{otherlibraries}; do
158 make %{makevars} -C otherlibs/$i install
160 make %{makevars} -C tools install
161 make %{makevars} installopt
164 $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/Makefile.config
166 # For bytecode binaries, change the bang-path to point to the locally
167 # installed ocamlrun.
168 pushd $RPM_BUILD_ROOT%{_bindir}
169 for f in ocamlcp ocamldep ocamlmklib ocamlopt ocamlprof; do
171 echo '#!%{_bindir}/%{_mingw32_target}-ocamlrun' > $f
172 tail -n +2 $f.old >> $f
178 # Rename all the binaries to target-binary.
179 pushd $RPM_BUILD_ROOT%{_bindir}
180 for f in ocamlcp ocamldep ocamlmklib ocamlmktop ocamlopt ocamlprof ocamlrun; do
181 mv $f %{_mingw32_target}-$f
187 rm -rf $RPM_BUILD_ROOT
191 %defattr(-,root,root)
192 %{_bindir}/%{_mingw32_target}-ocamlcp
193 %{_bindir}/%{_mingw32_target}-ocamldep
194 %{_bindir}/%{_mingw32_target}-ocamlmklib
195 %{_bindir}/%{_mingw32_target}-ocamlmktop
196 %{_bindir}/%{_mingw32_target}-ocamlprof
197 %{_bindir}/%{_mingw32_target}-ocamlopt
198 %{_bindir}/%{_mingw32_target}-ocamlrun
199 %{_libdir}/%{_mingw32_target}-ocaml/
203 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-6
204 - Install tools, particularly ocamlmklib.
206 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-5
207 - +Requires mingw32-flexdll and the cross-compiler.
209 * Sat Nov 15 2008 Richard W.M. Jones <rjones@redhat.com> - 3.11.0+beta1-4
210 - Initial RPM release.