%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) %define _use_internal_dependency_generator 0 %define __find_requires /usr/lib/rpm/ocaml-find-requires.sh %define __find_provides /usr/lib/rpm/ocaml-find-provides.sh # From previous experience it seemed that all of the following # were necessary to prevent stripping of bytecode executables %define __os_install_post /usr/lib/rpm/brp-compress %{nil} %define _enable_debug_package 0 %define debug_package %{nil} Name: ocaml-mlgmpidl Version: 1.1 Release: 7%{?dist} Summary: OCaml interface to GMP and MPFR libraries Group: Development/Libraries License: LGPLv2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ExcludeArch: sparc64 s390 s390x URL: http://www.inrialpes.fr/pop-art/people/bjeannet/mlxxxidl-forge/mlgmpidl/index.html Source0: http://gforge.inria.fr/frs/download.php/20228/mlgmpidl-%{version}.tgz Source1: mlgmpidl_test.ml Source2: mlgmpidl_test_result Source3: mlgmpidl-META Patch0: mlgmpidl-1.1-Makefile.patch # Remove GMP_RND_MAX and mpfr_random, both no longer in GMP/MPFR. Patch1: mlgmpidl-1.1-remove-random.patch BuildRequires: ocaml >= 3.07, ocaml-ocamldoc, ocaml-camlidl-devel, gmp-devel, mpfr-devel, prelink # BuildRequires for documentation build BuildRequires: texlive-latex, texlive-texmf, ghostscript %description MLGMPIDL is an OCaml interface to the GMP and MPFR rational and real number math libraries. Although there is another such interface, this one is different in that it provides a more imperative (rather than functional) interface to conserve memory and that this one uses CAMLIDL to take care of the C/OCaml interface in a convenient and modular way. %package devel Summary: Development files for %{name} Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel The %{name}-devel package contains libraries and signature files for developing applications that use %{name}. %package doc Summary: Documentation files for %{name} Group: Documentation %description doc The %{name}-doc package contains documentation for using %{name}. %prep %setup -q -n mlgmpidl cp %{SOURCE1} %{SOURCE2} . cp %{SOURCE3} ./META # Patch makefile to take custom locations for libraries and installing %patch0 %patch1 -p1 %build mv Makefile.config.model Makefile.config %define ocaml_lib_dir %{_libdir}/ocaml %define my_ocaml_lib_dir %{ocaml_lib_dir}/mlgmpidl make PREFIX=%{_prefix} GMP_LIBDIR=%{_libdir} MPFR_LIBDIR=%{_libdir} \ CAML_LIBDIR=%{ocaml_lib_dir} CAMLIDL_LIBDIR=%{ocaml_lib_dir} \ MLGMPIDL_LIBDIR=%{_libdir} all gmptop make mlgmpidl.dvi make html dvipdf mlgmpidl.dvi # Put the C library location in the META file sed -e 's|LIBDIR|%{_libdir}|' META > META.tmp && mv META.tmp META %check ocamlc -ccopt -L. -custom -dllib %{_libdir}/libgmp.so gmp.cma bigarray.cma mlgmpidl_test.ml ./a.out > mlgmpidl_test_myresult diff mlgmpidl_test_myresult mlgmpidl_test_result %install rm -rf %{buildroot} make INSTALL_INCLUDEDIR=%{buildroot}/%{_includedir} \ INSTALL_OCAML_LIBDIR=%{buildroot}/%{my_ocaml_lib_dir} \ INSTALL_BINDIR=%{buildroot}/%{_bindir} install cp META %{buildroot}/%{my_ocaml_lib_dir} # Install Documentation %define doc_dir %{_docdir}/%{name} mkdir -p %{buildroot}%{doc_dir} cp -p *.pdf %{buildroot}%{doc_dir} cp -pr html %{buildroot}%{doc_dir} # Make sure that prelink does not foul up our bytecode executables by # stripping them with a cron job. This is done in install to ensure # that exactly the files that are eventually installed are in the # list, not all of the files in the bin directory of the build %define prelinkfilename %{name}-prelink.conf cd %{buildroot}%{_bindir} for f in *; do file $f | grep "not stripped" | sed -e 's/:.*//' -e 's!^!-b %{_bindir}/!' >> %{prelinkfilename} done %define prelinkconfdir %{_sysconfdir}/prelink.conf.d mkdir -p %{buildroot}%{prelinkconfdir} mv %{prelinkfilename} %{buildroot}%{prelinkconfdir} %clean rm -rf %{buildroot} %files %defattr(-,root,root,-) %{my_ocaml_lib_dir} %if %opt %exclude %{my_ocaml_lib_dir}/*.cmx* %endif %exclude %{my_ocaml_lib_dir}/*.idl %exclude %{my_ocaml_lib_dir}/*.mli %exclude %{my_ocaml_lib_dir}/*.a %{_bindir}/gmptop %doc COPYING README %config %{prelinkconfdir}/%{prelinkfilename} %files devel %defattr(-,root,root,-) %{_includedir}/* %if %opt %{my_ocaml_lib_dir}/*.cmx* %endif %{my_ocaml_lib_dir}/*.idl %{my_ocaml_lib_dir}/*.mli %{my_ocaml_lib_dir}/*.a %files doc %defattr(-,root,root,-) %{_docdir}/%{name} %changelog * Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild * Mon Jan 10 2011 Richard W.M. Jones <rjones@redhat.com> - 1.1-6 - Rebuild for OCaml 3.12 (http://fedoraproject.org/wiki/Features/OCaml3.12). - Remove GMP_RND_MAX and mpfr_random, both no longer in GMP/MPFR. * Wed Dec 30 2009 Richard W.M. Jones <rjones@redhat.com> - 1.1-4 - Rebuild for OCaml 3.11.2. * Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild * Sat May 23 2009 Richard W.M. Jones <rjones@redhat.com> - 1.1-2 - Rebuild for OCaml 3.11.1 * Thu Apr 16 2009 S390x secondary arch maintainer <fedora-s390x@lists.fedoraproject.org> - ExcludeArch sparc64, s390, s390x as we don't have OCaml on those archs (added sparc64 per request from the sparc maintainer) * Thu Apr 02 2009 Alan Dunn <amdunn@gmail.com> 1.1-1 - New upstream version incorporates functional interface to Mpfr. * Sat Mar 28 2009 Alan Dunn <amdunn@gmail.com> 1.0-1 - Initial Fedora RPM version.