%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
%define debug_package %{nil}
Name: ocaml-pgocaml
Version: 1.1
Release: 1%{?dist}
Summary: OCaml library for type-safe access to PostgreSQL databases
Group: Development/Libraries
License: LGPLv2+ with exceptions
URL: http://developer.berlios.de/projects/pgocaml/
Source0: http://download.berlios.de/pgocaml/pgocaml-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: ocaml >= 3.10.0
BuildRequires: ocaml-findlib-devel, ocaml-ocamldoc
BuildRequires: ocaml-extlib-devel
BuildRequires: ocaml-pcre-devel, pcre-devel
BuildRequires: ocaml-calendar-devel
BuildRequires: ocaml-csv-devel
BuildRequires: ocaml-camlp4-devel
# The find-requires/provides scripts don't understand the packed
# CalendarLib module well. Ignore the packed submodules.
%define _use_internal_dependency_generator 0
%define __find_requires /usr/lib/rpm/ocaml-find-requires.sh -i Asttypes -i Calendar_builder -i Calendar_sig -i Date -i Date_sig -i Fcalendar -i Ftime -i Period -i Printer -i Time -i Time_sig -i Time_Zone -i Utils -i Version
%define __find_provides /usr/lib/rpm/ocaml-find-provides.sh
%description
PG'OCaml is a type-safe, simple interface to PostgreSQL from OCaml. It
lets you embed SQL statements directly into OCaml code.
%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 pgocaml-%{version}
%build
# Don't build or run the test programs because that would need
# a live PostgreSQL database around.
make pGOCaml_config.ml pgocaml.cma pgocaml.cmxa pa_pgsql.cmo \
pgocaml_prof META
make doc
strip pgocaml_prof
%install
rm -rf $RPM_BUILD_ROOT
export DESTDIR=$RPM_BUILD_ROOT
export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml
mkdir -p $OCAMLFIND_DESTDIR
ocamlfind install pgocaml META *.mli *.cmi *.cmx *.cma *.cmxa *.a pa_*.cmo
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 0755 pgocaml_prof $RPM_BUILD_ROOT%{_bindir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc COPYING.LIB
%{_libdir}/ocaml/pgocaml
%if %opt
%exclude %{_libdir}/ocaml/pgocaml/*.a
%exclude %{_libdir}/ocaml/pgocaml/*.cmxa
%exclude %{_libdir}/ocaml/pgocaml/*.cmx
%endif
%exclude %{_libdir}/ocaml/pgocaml/*.mli
%{_bindir}/pgocaml_prof
%files devel
%defattr(-,root,root,-)
%doc README.txt README.profiling BUGS.txt CONTRIBUTORS.txt COPYING.LIB HOW_IT_WORKS.txt html/*
%if %opt
%{_libdir}/ocaml/pgocaml/*.a
%{_libdir}/ocaml/pgocaml/*.cmxa
%{_libdir}/ocaml/pgocaml/*.cmx
%endif
%{_libdir}/ocaml/pgocaml/*.mli
%changelog
* Tue Mar 4 2008 Richard W.M. Jones <rjones@redhat.com> - 1.1-1
- New upstream release 1.1.
- Clarify license is LGPLv2+ with exceptions.
- New home page and download URL.
* Mon Mar 3 2008 Richard W.M. Jones <rjones@redhat.com> - 0.9-5
- Ignore modules which are really submodules of CalendarLib.
* Sat Mar 1 2008 Richard W.M. Jones <rjones@redhat.com> - 0.9-4
- Add missing BR for ocaml-camlp4-devel.
- Add missing BR for pcre-devel.
- Check it builds in mock.
* Sat Feb 23 2008 Richard W.M. Jones <rjones@redhat.com> - 0.9-3
- Check it builds with OCaml 3.10.1
- Only keep license file in main package.
- Clarify license is LGPLv2 with exceptions.
* Mon Sep 3 2007 Richard W.M. Jones <rjones@redhat.com> - 0.9-2
- Added the syntax extension.
* Mon Sep 3 2007 Richard W.M. Jones <rjones@redhat.com> - 0.9-1
- Initial RPM release.