%define toolname findlib
Summary: OCAML FindLib package manager
Name: ocaml-%{toolname}
Version: 0.3.1
Release: 1
Copyright: GPL-like
Group: Development/Languages
Source: http://www.ocaml-programming.de/packages/%{toolname}-%{version}.tar.gz
Vendor: Gerd Stolpmann
Url: http://www.ocaml-programming.de/packages/documentation/%{toolname}/
Prereq: fileutils, ocaml
Requires: fileutils, ocaml
%define dir_man usr/man
%define dir_bin usr/bin
%define dir_sitelib usr/lib/ocaml/site-lib
%define files_doc LICENSE README INSTALL
BuildRoot: /tmp/root-%{name}
%description
Provides a scheme to manage reusable software components (packages),
as collections of OCaml modules for which metainformation can be stored.
The library contains functions to look the directory up that
stores a package, to query metainformation about a package, and
to retrieve dependency information about multiple packages.
Metainformation includes a version string, the archives the package consists of, additional linker
options, and dependencies dependent on other packages.
%prep
%setup -n %{toolname}
./configure -mandir "/%{dir_man}" -bindir "/%{dir_bin}" -sitelib "/%{dir_sitelib}"
%build
make all
make opt
%install
# Install binary, libs, manuals
DIR_BIN="${RPM_BUILD_ROOT}/%{dir_bin}"
DIR_MAN="${RPM_BUILD_ROOT}/%{dir_man}"
DIR_SITELIB="${RPM_BUILD_ROOT}/%{dir_sitelib}"
install -m 755 -d "${DIR_BIN}"
install -m 755 -d "${DIR_MAN}"
install -m 755 -d "${DIR_SITELIB}"
make install "OCAML_SITELIB=${DIR_SITELIB}" "OCAMLFIND_BIN=${DIR_BIN}" "OCAMLFIND_MAN=${DIR_MAN}"
# Move doc files to root, if needed
for F in %{files_doc} ; do test -f "./doc/${F}" && mv -f "./doc/${F}" . ; done
# HTML manual
if test -d doc/html ; then mv doc/html htmlman; else mkdir htmlman ; fi
%post
# Create a symbolic link to version-specific HTML manual
cd /usr/doc/HTML/
if test -L "%{name}" ; then rm -f "%{name}" ; fi
if test ! -e "%{name}" ; then ln -s "../%{name}-%{version}/htmlman" "%{name}" ; fi
%postun
cd /usr/doc/HTML/
if test "$1" = "0" -a -L %{name} ; then rm -f %{name} ; fi
%clean
if test `dirname "${RPM_BUILD_ROOT}"` != "/" ; then rm -rf "${RPM_BUILD_ROOT}" ; fi
%files
%defattr(-,root,root)
%doc %{files_doc} htmlman
/%{dir_bin}
/%{dir_man}/man1
/%{dir_man}/man3
/%{dir_man}/man5
/%{dir_sitelib}
%changelog
* Fri Sep 1 2000 Olivier Montanuy <Olivier.Montanuy@wanadoo.fr>
- created and tested package, with html manual