+#
+# Conditional build:
+%bcond_without ocaml_opt # build opt
+
+%ifnarch %{ix86} %{x8664} arm aarch64 ppc sparc sparcv9
+%undefine with_ocaml_opt
+%endif
+
%define ocaml_ver 1:4.02
Summary: OCaml module manager
Summary(pl.UTF-8): Zarządca modułów OCamla
Name: ocaml-findlib
Version: 1.5.5
-Release: 2
+Release: 9
License: distributable
Group: Development/Tools
Source0: http://download.camlcity.org/download/findlib-%{version}.tar.gz
BuildRequires: ncurses-devel
BuildRequires: ocaml >= %{ocaml_ver}
BuildRequires: ocaml-camlp4
-BuildRequires: ocaml-labltk
+BuildRequires: ocaml-labltk-devel
BuildRequires: sed >= 4.0
%requires_eq ocaml
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+%if %{without ocaml_opt}
+%define no_install_post_strip 1
+# debug package strips binaries which renders ocamlfind broken
+%define _enable_debug_packages 0
+%endif
+
%description
The "findlib" library provides a scheme to manage reusable software
components (packages), and includes tools that support this scheme.
sed -i -e 's/-g//' Makefile
-%{__make} -j1 all opt
+%{__make} -j1 all %{?with_ocaml_opt:opt}
%install
rm -rf $RPM_BUILD_ROOT
%{__rm} $RPM_BUILD_ROOT%{_libdir}/ocaml/site-lib/findlib/*.mli
-# now provided by ocaml-labltk.spec
-%{__rm} -r $RPM_BUILD_ROOT%{_libdir}/ocaml/site-lib/labltk
+# now provided by ocaml-labltk.spec (might not exist if building without ocaml-labltk installed)
+%{__rm} -rf $RPM_BUILD_ROOT%{_libdir}/ocaml/site-lib/labltk
# now provided by ocaml-dbm.spec (might not exist if building without ocaml-dbm installed)
%{__rm} -rf $RPM_BUILD_ROOT%{_libdir}/ocaml/site-lib/dbm
%files devel
%defattr(644,root,root,755)
%{_libdir}/ocaml/findlib/Makefile.config
-%{_libdir}/ocaml/findlib/*.cm[ixa]*
-%{_libdir}/ocaml/findlib/*.a
+%{_libdir}/ocaml/findlib/*.cm[xi]
+%{_libdir}/ocaml/findlib/*.cma
+%if %{with ocaml_opt}
+%{_libdir}/ocaml/findlib/*.[ao]
+%{_libdir}/ocaml/findlib/*.cmxa
+%{_libdir}/ocaml/findlib/*.cmxs
+%endif
%dir %{_libdir}/ocaml/num-top
%{_libdir}/ocaml/num-top/*.cm[ia]
%{_libdir}/ocaml/ocamlfind