Make the -doc subpackage conditional.

This commit is contained in:
Richard W.M. Jones 2021-03-01 14:47:39 +00:00
parent 873bc81e8b
commit f1a8154bae

View File

@ -2,6 +2,10 @@
%global debug_package %{nil} %global debug_package %{nil}
%endif %endif
# Documentation adds a circular dependency, so by
# default we build without.
%bcond_with doc
%global srcname ppx-tools %global srcname ppx-tools
%global upname ppx_tools %global upname ppx_tools
@ -17,7 +21,9 @@ Source0: %{url}/archive/%{version}/%{upname}-%{version}.tar.gz
BuildRequires: ocaml >= 4.08.0 BuildRequires: ocaml >= 4.08.0
BuildRequires: ocaml-cppo BuildRequires: ocaml-cppo
BuildRequires: ocaml-dune >= 1.6 BuildRequires: ocaml-dune >= 1.6
%if %{with doc}
BuildRequires: ocaml-odoc BuildRequires: ocaml-odoc
%endif
%description %description
Tools for authors of syntactic tools (such as ppx rewriters). Tools for authors of syntactic tools (such as ppx rewriters).
@ -30,25 +36,31 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
The %{name}-devel package contains libraries and signature files for The %{name}-devel package contains libraries and signature files for
developing applications that use %{name}. developing applications that use %{name}.
%if %{with doc}
%package doc %package doc
Summary: Documentation for %{name} Summary: Documentation for %{name}
BuildArch: noarch BuildArch: noarch
%description doc %description doc
Documentation for %{name}. Documentation for %{name}.
%endif
%prep %prep
%autosetup -n %{upname}-%{version} %autosetup -n %{upname}-%{version}
%build %build
dune build %{?_smp_mflags} dune build %{?_smp_mflags}
%if %{with doc}
dune build %{?_smp_mflags} @doc dune build %{?_smp_mflags} @doc
%endif
%install %install
dune install --destdir=%{buildroot} dune install --destdir=%{buildroot}
%if %{with doc}
# We do not want the dune markers # We do not want the dune markers
find _build/default/_doc/_html -name .dune-keep -delete find _build/default/_doc/_html -name .dune-keep -delete
%endif
# We do not want the ml files # We do not want the ml files
find %{buildroot}%{_libdir}/ocaml -name \*.ml -delete find %{buildroot}%{_libdir}/ocaml -name \*.ml -delete
@ -101,15 +113,18 @@ dune runtest
%{_libdir}/ocaml/%{upname}/*.mli %{_libdir}/ocaml/%{upname}/*.mli
%{_libdir}/ocaml/%{upname}/*/*.cmt %{_libdir}/ocaml/%{upname}/*/*.cmt
%if %{with doc}
%files doc %files doc
%doc _build/default/_doc/_html/ %doc _build/default/_doc/_html/
%doc _build/default/_doc/_mlds/ %doc _build/default/_doc/_mlds/
%doc _build/default/_doc/_odoc/ %doc _build/default/_doc/_odoc/
%license LICENSE %license LICENSE
%endif
%changelog %changelog
* Mon Mar 1 12:17:35 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 6.3-4 * Mon Mar 1 12:17:35 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 6.3-4
- OCaml 4.12.0 build - OCaml 4.12.0 build
- Make the -doc subpackage conditional.
* Sat Feb 20 2021 Jerry James <loganjerry@gmail.com> - 6.3-3 * Sat Feb 20 2021 Jerry James <loganjerry@gmail.com> - 6.3-3
- Bump and rebuild - Bump and rebuild