%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) %define debug_package %{nil} Name: ocaml-batteries Version: 1.0 Release: 0.1.beta2.20090903%{?dist} Summary: OCaml Batteries Included Group: Development/Libraries License: LGPLv2+ with exceptions URL: http://batteries.forge.ocamlcore.org/ Source0: http://forge.ocamlcore.org/frs/download.php/256/batteries-20090903.tgz Patch0: ocaml-batteries-20090903-libdir.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: ocaml >= 3.11.0 BuildRequires: ocaml-findlib-devel BuildRequires: ocaml-ocamldoc BuildRequires: ocaml-zip-devel BuildRequires: ocaml-bin-prot-devel BuildRequires: ocaml-ocamlnet-devel >= 2.2.9 BuildRequires: ocaml-camomile-devel >= 0.7 BuildRequires: ocaml-sexplib-devel >= 3.7.5 BuildRequires: ocaml-ounit-devel BuildRequires: chrpath # Patch0 patches configure.ac BuildRequires: autoconf %define _use_internal_dependency_generator 0 %define __find_requires /usr/lib/rpm/ocaml-find-requires.sh -i Concurrent -i Enum -i ExtUChar -i ExtUTF8 -i Interfaces -i Netchannels_modtype -i Rope -i Value_printer %define __find_provides /usr/lib/rpm/ocaml-find-provides.sh %description OCaml Batteries Included is a comprehensive core library for OCaml. It aims at a "community-driven effort to standardize on an consistent, documented, and comprehensive development platform for the OCaml programming language." As such it contains many different modules for standard purposes, and also includes (and supercedes) some other OCaml modules such as Extlib. %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}. %prep %setup -q -n batteries-20090903 %patch0 -p1 autoconf %build %configure \ --with-browser="xdg-open %s" \ --with-docroot=%{_docdir}/%{name}-%{version} make all %if %opt make opt %endif make top syntax # Error: # ocamlfind: Package `batteries' not found #%check #make tests %install # These rules work if the library uses 'ocamlfind install' to install itself. rm -rf $RPM_BUILD_ROOT export DESTDIR=$RPM_BUILD_ROOT export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} make \ DESTDIR=$OCAMLFIND_DESTDIR \ DOCDIR=$RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} \ install install-doc # Strip and remove rpaths. for f in $OCAMLFIND_DESTDIR/batteries_{nothreads,threads}/run.{byte,native}; do strip $f chrpath --delete $f done cp LICENSE README $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/ # Zero-length file. rm $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/html/api/attributes.idex # Dangling symlink after installation - replace with the correct file. f=$RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/html/batteries_large.png rm $f cp doc/batteries_large.png $f # Shell script without shebang. f=$RPM_BUILD_ROOT%{_libdir}/ocaml/batteries/ocamlbuild rm $f echo '#!/bin/sh' | cat - src/batteries_toolchain/ocamlbuild > $f chmod +x $f %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc %{_docdir}/%{name}-%{version}/LICENSE %{_libdir}/ocaml/batteries %{_libdir}/ocaml/batteries_nothreads %{_libdir}/ocaml/batteries_threads %if %opt %exclude %{_libdir}/ocaml/batteries_nothreads/*.a %exclude %{_libdir}/ocaml/batteries_nothreads/*.cmxa %exclude %{_libdir}/ocaml/batteries_threads/*.a %exclude %{_libdir}/ocaml/batteries_threads/*.cmxa %endif %files devel %defattr(-,root,root,-) %doc %{_docdir}/%{name}-%{version}/GUIDELINES %doc %{_docdir}/%{name}-%{version}/README %doc %{_docdir}/%{name}-%{version}/STRUCTURE %doc %{_docdir}/%{name}-%{version}/USAGE %doc %{_docdir}/%{name}-%{version}/documentation.idex %doc %{_docdir}/%{name}-%{version}/language.idex %doc %{_docdir}/%{name}-%{version}/myocamlbuild.ml %doc %{_docdir}/%{name}-%{version}/toplevel.help %doc %{_docdir}/%{name}-%{version}/html/ %if %opt %{_libdir}/ocaml/batteries_nothreads/*.a %{_libdir}/ocaml/batteries_nothreads/*.cmxa %{_libdir}/ocaml/batteries_threads/*.a %{_libdir}/ocaml/batteries_threads/*.cmxa %endif %changelog * Mon Oct 12 2009 Richard W.M. Jones - 1.0-0.1.beta2.20090903 - Initial RPM release.