Summary:        OCaml package manager and build helper
Summary(ja):	OCaml のパッケージ管理ツール及びビルド補助ツール
Name:		ocaml-findlib
Version:	1.5.2
Release:	1%{?_dist_release}

License:	BSD
Group:		Development/Tools
URL:            http://projects.camlcity.org/projects/findlib.html

Source0:        http://download.camlcity.org/download/findlib-%{version}.tar.gz

# Use ocamlopt -g patch to include debug information.
Patch1:         findlib-1.4-add-debug.patch

# Vine Patch
# Patch100:     ocaml-findlib-installpath.patch

Buildroot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	ocaml >= 4.02.0
BuildRequires:  ocaml-camlp4-devel
BuildRequires:  ncurses-devel
BuildRequires:  m4
BuildRequires:  gawk
Requires:	ocaml

Vendor:		Project Vine
Distribution:	Vine Linux

%global __ocaml_requires_opts -i Asttypes -i Parsetree

%description
Objective CAML package manager and build helper.


%package        devel
Summary:        Development files for %{name}
Summary(ja):    %{name} の開発用ファイル
Group:		Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%prep
%setup -q -n findlib-%{version}
%patch1 -p2

%build
ocamlc -version
ocamlc -where
(cd tools/extract_args && make)
tools/extract_args/extract_args -o src/findlib/ocaml_args.ml ocamlc ocamlcp ocamlmktop ocamlopt ocamldep ocamldoc ||:
cat src/findlib/ocaml_args.ml
./configure -config %{_sysconfdir}/ocamlfind.conf \
  -bindir %{_bindir} \
  -sitelib `ocamlc -where` \
  -mandir %{_mandir} \
  -with-toolbox
make all opt
#%if %opt
#make opt
#%endif
rm doc/guide-html/TIMESTAMP


%install
rm -rf $RPM_BUILD_ROOT
# Grrr destdir grrrr
mkdir -p $RPM_BUILD_ROOT%{_bindir}
make install prefix=$RPM_BUILD_ROOT OCAMLFIND_BIN=$RPM_BUILD_ROOT%{_bindir}
mv $RPM_BUILD_ROOT/$RPM_BUILD_ROOT%{_bindir}/* $RPM_BUILD_ROOT%{_bindir}

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc LICENSE doc/README
%config(noreplace) %{_sysconfdir}/ocamlfind.conf
%{_bindir}/*
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_libdir}/ocaml/*/META
%{_libdir}/ocaml/topfind
%{_libdir}/ocaml/findlib
#if %opt
%exclude %{_libdir}/ocaml/findlib/*.a
%exclude %{_libdir}/ocaml/findlib/*.cmxa
#endif
%exclude %{_libdir}/ocaml/findlib/*.mli
%exclude %{_libdir}/ocaml/findlib/Makefile.config
#exclude %{_libdir}/ocaml/findlib/make_wizard
#exclude %{_libdir}/ocaml/findlib/make_wizard.pattern
%{_libdir}/ocaml/num-top

%files devel
%doc LICENSE doc/README doc/guide-html
#if %opt
%{_libdir}/ocaml/findlib/*.a
%{_libdir}/ocaml/findlib/*.cmxa
#endif
%{_libdir}/ocaml/findlib/*.mli
%{_libdir}/ocaml/findlib/Makefile.config


%changelog
* Sun Jan 25 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.5.3-1
- updated to 1.5.2
- built with ocaml 4.02.1

* Sun May 22 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.7-1
- updated to 1.2.7
- added BR: ncurses-devel

* Sat May  9 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.4-1
- new upstream release
- spec in UTF-8

* Sun Aug  3 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.2-1
- new upstream release (dropped Patch100 was merged into upstream)

* Sun Sep 23 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.2pl1-0vl2
- rebuilt for VineSeed

* Sun Sep 23 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1.2pl1-0vl1
- new upstream release
- rebuilt with ocaml 3.10.0

* Sat May 26 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.1.1-0vl1
- initial build
