From 96b2cd38daecb7e8ef6e0eaee078d1e230fd4730 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Bundle the correct ocamlrun with the binary. --- ocaml/Makefile-fedora-mingw.in | 2 +- ocaml/mingw32-ocaml.spec | 53 +++++++++++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/ocaml/Makefile-fedora-mingw.in b/ocaml/Makefile-fedora-mingw.in index f056246..ec0690c 100644 --- a/ocaml/Makefile-fedora-mingw.in +++ b/ocaml/Makefile-fedora-mingw.in @@ -1,6 +1,6 @@ PREFIX=@prefix@ BINDIR=@bindir@ -LIBDIR=@libdir@/i686-pc-mingw32-ocaml +LIBDIR=@libdir@/@target@-ocaml STUBLIBDIR=$(LIBDIR)/stublibs MANDIR=$(PREFIX)/man MANEXT=1 diff --git a/ocaml/mingw32-ocaml.spec b/ocaml/mingw32-ocaml.spec index f836786..bf82e7b 100644 --- a/ocaml/mingw32-ocaml.spec +++ b/ocaml/mingw32-ocaml.spec @@ -4,9 +4,11 @@ %define __find_requires %{_mingw32_findrequires} %define __find_provides %{_mingw32_findprovides} +%define debug_package %{nil} + Name: mingw32-ocaml Version: 3.11.0+beta1 -Release: 1%{?dist} +Release: 3%{?dist} Summary: Objective Caml MinGW cross-compiler and programming environment License: QPL and (LGPLv2+ with exceptions) @@ -39,6 +41,11 @@ BuildRequires: mingw32-gcc BuildRequires: mingw32-binutils BuildRequires: mingw32-flexdll +# While we still ship bytecode, this requires a /usr/bin/ocamlrun from +# the _identical_ native package. We don't have that at the moment, +# which is why this is commented out. +#Requires: ocaml-runtime = %{version} + %description Objective Caml is a high-level, strongly-typed, functional and @@ -93,6 +100,7 @@ sed \ -e 's,@prefix@,%{_prefix},g' \ -e 's,@bindir@,%{_bindir},g' \ -e 's,@libdir@,%{_libdir},g' \ + -e 's,@target@,%{_mingw32_target},g' \ < %{SOURCE1000} > Makefile popd @@ -125,19 +133,31 @@ make opt %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 - -make installopt \ - BINDIR=$RPM_BUILD_ROOT%{_bindir} \ - LIBDIR=$RPM_BUILD_ROOT%{_libdir}/i686-pc-mingw32-ocaml - -# 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 +mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml +mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/threads + +# 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 +make %{makevars} installopt + +cp config/Makefile \ + $RPM_BUILD_ROOT%{_libdir}/%{_mingw32_target}-ocaml/Makefile.config + +# Rename the binaries so they don't clash with base OCaml package. +mv $RPM_BUILD_ROOT%{_bindir}/ocamlrun \ + $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-ocamlrun +echo '#!%{_bindir}/%{_mingw32_target}-ocamlrun' \ + > $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-ocamlopt +tail -n +2 $RPM_BUILD_ROOT%{_bindir}/ocamlopt \ + >> $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-ocamlopt +chmod 0755 $RPM_BUILD_ROOT%{_bindir}/%{_mingw32_target}-ocamlopt +rm $RPM_BUILD_ROOT%{_bindir}/ocamlopt %clean @@ -146,10 +166,11 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%{_bindir}/i686-pc-mingw32-ocamlopt -%{_libdir}/i686-pc-mingw32-ocaml/ +%{_bindir}/%{_mingw32_target}-ocamlrun +%{_bindir}/%{_mingw32_target}-ocamlopt +%{_libdir}/%{_mingw32_target}-ocaml/ %changelog -* Sat Nov 15 2008 Richard W.M. Jones - 3.11.0+beta1-1 +* Sat Nov 15 2008 Richard W.M. Jones - 3.11.0+beta1-3 - Initial RPM release. -- 1.8.3.1