X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=ocaml%2Fmingw32-ocaml.spec;h=e2e93d7180dc6cc844c3123a96db852938461f7c;hb=f5fb0d87bb47b6a323131a45dea1e19c8718ce71;hp=f83678629a6165659a338785d428ddfef95c693b;hpb=4e01565ca0f958c38409170b6435e8bb31f667a3;p=fedora-mingw.git diff --git a/ocaml/mingw32-ocaml.spec b/ocaml/mingw32-ocaml.spec index f836786..e2e93d7 100644 --- a/ocaml/mingw32-ocaml.spec +++ b/ocaml/mingw32-ocaml.spec @@ -1,22 +1,25 @@ +# Built-in strip corrupts binaries, so use the mingw32 strip instead: %define __strip %{_mingw32_strip} %define __objdump %{_mingw32_objdump} -%define _use_internal_dependency_generator 0 -%define __find_requires %{_mingw32_findrequires} -%define __find_provides %{_mingw32_findprovides} + +%define debug_package %{nil} + +%define otherlibraries win32unix str num dynlink bigarray systhreads win32graph Name: mingw32-ocaml -Version: 3.11.0+beta1 -Release: 1%{?dist} +Version: 3.11.0 +Release: 0.16.beta1%{?dist} Summary: Objective Caml MinGW cross-compiler and programming environment License: QPL and (LGPLv2+ with exceptions) Group: Development/Libraries URL: http://caml.inria.fr/ -Source0: http://caml.inria.fr/pub/distrib/ocaml-3.11/ocaml-%{version}.tar.bz2 +Source0: http://caml.inria.fr/pub/distrib/ocaml-3.11/ocaml-%{version}+beta1.tar.bz2 # This is installed as config/Makefile when we cross-compile. Source1000: Makefile-fedora-mingw.in +Source1001: README.Fedora # XXX We should apply any Fedora native patches here. @@ -32,6 +35,10 @@ Patch1006: mingw32-ocaml-3.11.0+beta1-win32unix-path.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # Is it noarch? (XXX) +# Answer: yes and no. In theory it should be, but because we install +# Windows binaries in %{_libdir}, the path is different if built on +# 32 and 64 bit platforms. We should probably install the binaries +# in /usr/share. BuildArch: noarch BuildRequires: mingw32-filesystem >= 30 @@ -39,6 +46,32 @@ BuildRequires: mingw32-gcc BuildRequires: mingw32-binutils BuildRequires: mingw32-flexdll +# These are required so we can use gcc -m32 and link to 32 bit X11: +BuildRequires: /lib/libgcc_s.so.1 +BuildRequires: /usr/lib/crt1.o +BuildRequires: /usr/lib/libX11.so + +# We need the native Fedora OCaml package (of the precise matching +# version) for several reasons: +# (a) We need /usr/bin/ocamlrun (the bytecode interpreter) in order +# to run our bytecodes such as i686-pc-mingw32-ocamlopt. Eventually +# shipping native versions of the cross-compiler binaries should +# resolve this. +# (b) We need camlp4 preprocessor, and because of the way this works +# it has to be the camlp4 from the identical version. +Requires: ocaml-runtime = %{version} +Requires: ocaml-camlp4-devel = %{version} + +# The built program will try to run the cross-compiler and flexdll, so +# these must be runtime requires. +Requires: mingw32-gcc +Requires: mingw32-binutils +Requires: mingw32-flexdll + +# i686-pc-mingw32-ocamlmklib tries to run ocamlopt which is probably a +# bug, but requires this (XXX). +Requires: ocaml + %description Objective Caml is a high-level, strongly-typed, functional and @@ -49,7 +82,7 @@ and produces Windows native executables. %prep -%setup -q -n ocaml-%{version} +%setup -q -n ocaml-%{version}+beta1 %patch1000 -p1 %patch1001 -p1 @@ -61,13 +94,22 @@ and produces Windows native executables. %build -# Build native ocamlrun and ocamlc which contain the filename-win32-dirsep -# patch. +# Don't run out of memory. +ulimit -s unlimited + +# Build native ocamlrun and ocamlc which contain the +# filename-win32-dirsep patch. +# +# Note that we must build a 32 bit compiler, even on 64 bit build +# architectures, because this compiler will try to do strength +# reduction optimizations using its internal int type, and that must +# match Windows' int type. (That's what -cc and -host are for). ./configure \ -no-tk \ -bindir %{_bindir} \ -libdir %{_libdir}/ocaml \ - -mandir %{_mandir}/man1 + -mandir %{_mandir}/man1 \ + -cc "gcc -m32" -host i386-pc-linux -x11lib /usr/lib -verbose make world # Now move the working ocamlrun, ocamlc into the boot/ directory, @@ -93,6 +135,8 @@ sed \ -e 's,@prefix@,%{_prefix},g' \ -e 's,@bindir@,%{_bindir},g' \ -e 's,@libdir@,%{_libdir},g' \ + -e 's,@target@,%{_mingw32_target},g' \ + -e 's,@otherlibraries@,%{otherlibraries},g' \ < %{SOURCE1000} > Makefile popd @@ -121,23 +165,44 @@ make -C tools ocamlmklib # Build ocamlopt make opt +cp %{SOURCE1001} . + %install rm -rf $RPM_BUILD_ROOT -# Only want to install ocamlopt and libraries. mkdir -p $RPM_BUILD_ROOT%{_bindir} -mkdir -p $RPM_BUILD_ROOT%{_libdir}/i686-pc-mingw32-ocaml -mkdir -p $RPM_BUILD_ROOT%{_libdir}/i686-pc-mingw32-ocaml/threads +mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml +mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/threads +mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/stublibs + +# This is the equivalent of 'make install installopt', but +# we only want to install the parts which are really necessary +# for the cross-compiler. eg. We don't need any of the native +# tools like ocamllex or ocamldoc. +%define makevars BINDIR=$RPM_BUILD_ROOT%{_bindir} LIBDIR=$RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml +make %{makevars} -C byterun install +make %{makevars} -C stdlib install +for i in %{otherlibraries}; do + make %{makevars} -C otherlibs/$i install +done +make %{makevars} -C tools install +make %{makevars} installopt -make installopt \ - BINDIR=$RPM_BUILD_ROOT%{_bindir} \ - LIBDIR=$RPM_BUILD_ROOT%{_libdir}/i686-pc-mingw32-ocaml +install -m 0755 ocamlc $RPM_BUILD_ROOT%{_bindir} + +cp config/Makefile \ + $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/Makefile.config + +# Rename all the binaries to target-binary. +pushd $RPM_BUILD_ROOT%{_bindir} +for f in ocamlc ocamlcp ocamldep ocamlmklib ocamlmktop ocamlopt ocamlprof; do + mv $f %{_mingw32_target}-$f +done +popd -# ocamlopt is a cross-compiler, so rename the binary. -# XXX This should probably use %{_mingw32_target} macro. -mv $RPM_BUILD_ROOT%{_bindir}/ocamlopt \ - $RPM_BUILD_ROOT%{_bindir}/i686-pc-mingw32-ocamlopt +# Don't install ocamlrun, use native one. +rm $RPM_BUILD_ROOT%{_bindir}/ocamlrun %clean @@ -146,10 +211,54 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%{_bindir}/i686-pc-mingw32-ocamlopt -%{_libdir}/i686-pc-mingw32-ocaml/ +%doc README.Fedora +%{_bindir}/%{_mingw32_target}-ocamlc +%{_bindir}/%{_mingw32_target}-ocamlcp +%{_bindir}/%{_mingw32_target}-ocamldep +%{_bindir}/%{_mingw32_target}-ocamlmklib +%{_bindir}/%{_mingw32_target}-ocamlmktop +%{_bindir}/%{_mingw32_target}-ocamlprof +%{_bindir}/%{_mingw32_target}-ocamlopt +%{_libdir}/%{_mingw32_target}-ocaml/ %changelog -* Sat Nov 15 2008 Richard W.M. Jones - 3.11.0+beta1-1 +* Fri Feb 20 2009 Richard W.M. Jones - 3.11.0-0.16.beta1 +- Rebuild for mingw32-gcc 4.4 + +* Sun Nov 23 2008 Richard W.M. Jones - 3.11.0-0.15.beta1 +- Use the proper package naming convention, since '+' etc shouldn't be + in the name, as per Fedora packaging guidelines. Note that this won't + upgrade smoothly, but we don't care because these packages aren't + officially released yet. You'll just have to uninstall the old + package and install the new one. +- Don't ship our own ocamlrun, use the native one instead. +- Require camlp4 utilities. + +* Mon Nov 17 2008 Richard W.M. Jones - 3.11.0+beta1-14 +- Added README.Fedora. + +* Sun Nov 16 2008 Richard W.M. Jones - 3.11.0+beta1-13 +- Build the native compiler as 32 bits even on a 64 bit build + architecture (because the target, Windows, is 32 bit). The + compiler does strength reduction and other optimizations + internally so we must ensure it uses the same int type. +- Requires libX11-devel.i386 and libgcc.i386. +- Allow the normal dependency generators to run because this + is a native package. +- Use mingw32 strip to avoid corrupting binaries. + +* Sun Nov 16 2008 Richard W.M. Jones - 3.11.0+beta1-8 +- Install ocamlc. + +* Sat Nov 15 2008 Richard W.M. Jones - 3.11.0+beta1-7 +- Further requirements. + +* Sat Nov 15 2008 Richard W.M. Jones - 3.11.0+beta1-6 +- Install tools, particularly ocamlmklib. + +* Sat Nov 15 2008 Richard W.M. Jones - 3.11.0+beta1-5 +- +Requires mingw32-flexdll and the cross-compiler. + +* Sat Nov 15 2008 Richard W.M. Jones - 3.11.0+beta1-4 - Initial RPM release.