%define pkg_name    camlpdf
%define pkg_version 2.3
# %define patchlevel  1
%define pkg_release 1%{?_dist_release}

Summary: OCaml library for reading, writing and modifying PDF files
Name:    ocaml-%{pkg_name}
Version: %{pkg_version}
# Version: %{pkg_version}.p%{patchlevel}
Release: %{pkg_release}

License: LGPL v2.1+
Group:   Development/Languages
URL:     https://github.com/johnwhitington/camlpdf

Source0: camlpdf-%{pkg_version}.tar.gz
# Source0: camlpdf-%{pkg_version}-patchlevel%{patchlevel}.tar.gz

BuildRequires: ocaml
BuildRequires: ocaml-findlib

Requires: ocaml

Vendor: Project Vine
Distribution: Vine Linux


%description
OCaml library for reading, writing and modifying PDF files

%prep
%{__rm} -rf ${RPM_BUILD_ROOT}
%setup -q -n %{pkg_name}-%{pkg_version}
# %setup -q -n %{pkg_name}-%{pkg_version}-patchlevel%{patchlevel}

%build
%{__make}

%install
INSTALLDIR=${RPM_BUILD_ROOT}%{_libdir}/ocaml
MYCONF=my.conf
touch ${MYCONF}
%{__mkdir_p} ${INSTALLDIR}

%{__make} install \
 OCAMLFIND_INSTFLAGS="-destdir ${INSTALLDIR} -ldconf ${MYCONF}"

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post
echo "%{_libdir}/ocaml/%{pkg_name}" >> %{_libdir}/ocaml/ld.conf

%preun
%{__perl} -pi -e "s|^%{_libdir}/ocaml/%{pkg_name}\n$||" \
 %{_libdir}/ocaml/ld.conf


%files
%doc doc/camlpdf/html examples
%doc Changes LICENSE README.md introduction_to_camlpdf.pdf
%{_libdir}/ocaml/camlpdf


%changelog
* Sun Oct 06 2019 Toshiaki Ara <ara_t@384.jp> 2.3-1
- update to 2.3

* Sun Apr 15 2018 Toshiaki Ara <ara_t@384.jp> 2.2.p1
- initial build for Vine Linux

