Replace %{rhel} tests with more general %{have_ublk} macro

Also force ./configure --enable-ublk or --disable-ublk option.
This commit is contained in:
Richard W.M. Jones 2023-12-19 21:50:42 +00:00
parent 64f4694063
commit 378ef997e0

View File

@ -3,6 +3,11 @@
%global have_ocaml 1
%endif
# No ublk in RHEL 9.
%if !0%{?rhel}
%global have_ublk 1
%endif
# If we should verify tarball signature with GPGv2.
%global verify_tarball_signature 1
@ -51,7 +56,7 @@ BuildRequires: libxml2-devel
# For nbdfuse.
BuildRequires: fuse3, fuse3-devel
%if !0%{?rhel}
%if 0%{?have_ublk}
# For nbdublk
BuildRequires: liburing-devel >= 2.2
BuildRequires: ubdsrv-devel >= 1.0-3.rc6
@ -182,7 +187,7 @@ Recommends: fuse3
This package contains FUSE support for %{name}.
%if !0%{?rhel}
%if 0%{?have_ublk}
%package -n nbdublk
Summary: Userspace NBD block device
Requires: %{name}%{?_isa} = %{version}-%{release}
@ -233,7 +238,13 @@ autoreconf -i
%endif
--enable-fuse \
--disable-golang \
--disable-rust
--disable-rust \
%if 0%{?have_ublk}
--enable-ublk \
%else
--disable-ublk \
%endif
%{nil}
make %{?_smp_mflags}
@ -252,7 +263,9 @@ rm $RPM_BUILD_ROOT%{_mandir}/man3/libnbd-golang.3*
rm $RPM_BUILD_ROOT%{_mandir}/man3/libnbd-ocaml.3*
%endif
%if 0%{?rhel}
# Remove this section in libnbd >= 1.20, since upstream was fixed to
# not install nbdublk completion if nbdublk was not built.
%if !0%{?have_ublk}
# Delete nbdublk on RHEL.
rm $RPM_BUILD_ROOT%{_datadir}/bash-completion/completions/nbdublk
%endif
@ -357,7 +370,7 @@ make %{?_smp_mflags} check || {
%{_mandir}/man1/nbdfuse.1*
%if !0%{?rhel}
%if 0%{?have_ublk}
%files -n nbdublk
%{_bindir}/nbdublk
%{_mandir}/man1/nbdublk.1*
@ -371,7 +384,7 @@ make %{?_smp_mflags} check || {
%{_datadir}/bash-completion/completions/nbdfuse
%{_datadir}/bash-completion/completions/nbdinfo
%{_datadir}/bash-completion/completions/nbdsh
%if !0%{?rhel}
%if 0%{?have_ublk}
%{_datadir}/bash-completion/completions/nbdublk
%endif