Better handling of optional camomile subpackage.

Remove camomile from dune files on RHEL.

Fixes: commit bdcd1e64d0
This commit is contained in:
Richard W.M. Jones 2021-03-08 11:56:27 +00:00
parent 88f69932ac
commit ab4b47dc0d
1 changed files with 29 additions and 4 deletions

View File

@ -1,8 +1,15 @@
%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
# Optionally disable camomile dep on RHEL.
%if !0%{?rhel}
%bcond_without camomile
%else
%bcond_with camomile
%endif
Name: ocaml-gettext
Version: 0.4.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: OCaml library for i18n
License: LGPLv2+ with exceptions
@ -25,12 +32,14 @@ BuildRequires: chrpath
BuildRequires: autoconf
%if !0%{?rhel}
BuildRequires: ocaml-ounit-devel
%endif
%if %{with camomile}
BuildRequires: ocaml-camomile-devel >= 0.8.6-3
BuildRequires: ocaml-camomile-data
%endif
BuildRequires: autoconf, automake
%if !0%{?rhel}
%if %{with camomile}
# ocaml-gettext program needs camomile data files
Requires: ocaml-camomile-data
%endif
@ -64,7 +73,7 @@ The %{name}-devel package contains libraries and signature files for
developing applications that use %{name}.
%if !0%{?rhel}
%if %{with camomile}
%package camomile
Summary: Parts of %{name} which depend on Camomile
Requires: %{name} = %{version}-%{release}
@ -96,6 +105,13 @@ signature files for developing applications that use
sed -i -e 's/batteries//' test/dune
sed -i -e 's/batteries//' test/test-stub/dune
%if %{without camomile}
# Remove dependency on camomile.
rm -r src/lib/gettext-camomile
rm -r test/test-camomile
sed -i -e 's/camomile//' `find -name dune`
%endif
%build
make build
@ -114,6 +130,12 @@ dune install --destdir=$RPM_BUILD_ROOT
# Remove this, we will use our own rules for documentation.
rm -rf $RPM_BUILD_ROOT/usr/doc
%if %{without camomile}
# If you use --without camomile but happen to have the camomile
# packages installed then it will still build them.
rm -rf $RPM_BUILD_ROOT/%{_libdir}/ocaml/gettext-camomile
%endif
%files
%doc LICENSE.txt
@ -156,7 +178,7 @@ rm -rf $RPM_BUILD_ROOT/usr/doc
%{_mandir}/man5/ocaml-gettext.5*
%if !0%{?rhel}
%if %{with camomile}
%files camomile
%doc LICENSE.txt
%{_libdir}/ocaml/gettext-camomile
@ -180,6 +202,9 @@ rm -rf $RPM_BUILD_ROOT/usr/doc
%changelog
* Mon Mar 8 23:22:35 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 0.4.2-2
- Better handling of optional camomile subpackage.
* Tue Mar 2 23:22:35 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 0.4.2-1
- New upstream version 4.2
- Remove patch now upstream.