Use the modern %bcond syntax

- Dropped bcond appdata since it is always on
This commit is contained in:
Cristian Le 2025-05-19 12:05:02 +02:00
commit 375de55897

View file

@ -1,56 +1,36 @@
# Do we add appdata-files?
# consider conditional on whether %%_metainfodir is defined or not instead -- rex
%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_without appdata
%else
%bcond_with appdata
%endif
# Set to bcond_without or use --with bootstrap if bootstrapping a new release
# or architecture
%bcond_with bootstrap
%bcond bootstrap 0
# Build with Emacs support
%bcond_without emacs
%bcond emacs 1
# Run git tests
%bcond_without git_test
%bcond git_test 1
# Set to bcond_with or use --without gui to disable qt gui build
%bcond_without gui
%bcond gui 1
# Use ncurses for colorful output
%bcond_without ncurses
# Setting the Python-version used by default
%if 0%{?rhel} && 0%{?rhel} < 8
%bcond_with python3
%else
%bcond_without python3
%endif
%bcond ncurses 1
# Enable RPM dependency generators for cmake files written in Python
%bcond_without rpm
%bcond rpm 1
%bcond_without sphinx
%bcond sphinx 1
%if !0%{?rhel}
%bcond_with bundled_jsoncpp
%bcond_with bundled_rhash
%else
%bcond_without bundled_jsoncpp
%bcond_without bundled_rhash
%endif
%bcond bundled_jsoncpp 0%{?rhel}
%bcond bundled_rhash 0%{?rhel}
# cppdap is currently shipped as a static lib from upstream,
# so we do not have it in the repos.
%bcond_without bundled_cppdap
%bcond bundled_cppdap 1
# Run tests
%bcond_without test
%bcond test 1
# Enable X11 tests
%bcond_without X11_test
%bcond X11_test 1
# Do not build non-lto objects to reduce build time significantly.
%global build_cflags %(echo '%{build_cflags}' | sed -e 's!-ffat-lto-objects!-fno-fat-lto-objects!g')
@ -160,11 +140,7 @@ Provides: bundled(jsoncpp)
%else
BuildRequires: jsoncpp-devel
%endif
%if 0%{?fedora} || 0%{?rhel} >= 7
BuildRequires: libarchive-devel
%else
BuildRequires: libarchive3-devel
%endif
BuildRequires: libuv-devel
%if %{with bundled_rhash}
Provides: bundled(rhash)
@ -180,21 +156,10 @@ BuildRequires: emacs
%endif
BuildRequires: openssl-devel
%if %{with rpm}
%if %{with python3}
%{!?python3_pkgversion: %global python3_pkgversion 3}
BuildRequires: python%{python3_pkgversion}-devel
%else
BuildRequires: python2-devel
%endif
BuildRequires: python3-devel
%endif
%if %{with gui}
%if 0%{?fedora} || 0%{?rhel} > 9
BuildRequires: pkgconfig(Qt6Widgets)
%elif 0%{?rhel} > 7
BuildRequires: pkgconfig(Qt5Widgets)
%else
BuildRequires: pkgconfig(QtGui)
%endif
BuildRequires: desktop-file-utils
%endif
@ -239,10 +204,8 @@ Requires: %{name} = %{version}-%{release}
Requires: %{name}-filesystem = %{version}-%{release}
Requires: (%{name}-rpm-macros = %{version}-%{release} if rpm-build)
%if %{with emacs}
%if 0%{?fedora} || 0%{?rhel} >= 7
Requires: emacs-filesystem%{?_emacs_version: >= %{_emacs_version}}
%endif
%endif
Requires: vim-filesystem
BuildArch: noarch
@ -305,18 +268,6 @@ using anything from the PyPI package called cmake.
%prep
%autosetup -n %{orig_name}-%{tar_version} -p 1
%if %{with rpm}
%if %{with python3}
echo '#!%{__python3}' > %{name}.prov
echo '#!%{__python3}' > %{name}.req
%else
echo '#!%{__python2}' > %{name}.prov
echo '#!%{__python2}' > %{name}.req
%endif
tail -n +2 %{SOURCE4} >> %{name}.prov
tail -n +2 %{SOURCE5} >> %{name}.req
%endif
%build
%{set_build_flags}
@ -396,8 +347,8 @@ touch -r %{SOURCE2} %{buildroot}%{rpm_macros_dir}/macros.%{name}
%if %{with rpm} && 0%{?_rpmconfigdir:1}
# RPM auto provides
install -p -m0644 -D %{SOURCE3} %{buildroot}%{_prefix}/lib/rpm/fileattrs/%{name}.attr
install -p -m0755 -D %{name}.prov %{buildroot}%{_prefix}/lib/rpm/%{name}.prov
install -p -m0755 -D %{name}.req %{buildroot}%{_prefix}/lib/rpm/%{name}.req
install -p -m0755 -D %{SOURCE4} %{buildroot}%{_prefix}/lib/rpm/%{name}.prov
install -p -m0755 -D %{SOURCE5} %{buildroot}%{_prefix}/lib/rpm/%{name}.req
%endif
mkdir -p %{buildroot}%{_libdir}/%{orig_name}
# Install copyright files for main package
@ -431,7 +382,6 @@ desktop-file-install --delete-original \
--dir=%{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/%{name}-gui.desktop
%if %{with appdata}
# Register as an application to be visible in the software center
#
# NOTE: It would be *awesome* if this file was maintained by the upstream
@ -469,7 +419,6 @@ SentUpstream: 2014-09-17
</application>
EOF
%endif
%endif
# create manifests for splitting files and directories for filesystem-package
find %{buildroot}%{_datadir}/%{name} -type d | \
@ -540,13 +489,8 @@ popd
%{_datadir}/aclocal/%{name}.m4
%{bash_completionsdir}/c*
%if %{with emacs}
%if 0%{?fedora} || 0%{?rhel} >= 7
%{_emacs_sitelispdir}/%{name}
%{_emacs_sitestartdir}/%{name}-init.el
%else
%{_emacs_sitelispdir}
%{_emacs_sitestartdir}
%endif
%endif
%{vimfiles_root}/indent/%{name}.vim
%{vimfiles_root}/syntax/%{name}.vim
@ -565,9 +509,7 @@ popd
%if %{with gui}
%files gui
%{_bindir}/%{name}-gui
%if %{with appdata}
%{_metainfodir}/*.appdata.xml
%endif
%{_datadir}/applications/%{name}-gui.desktop
%{_datadir}/mime/packages
%{_datadir}/icons/hicolor/*/apps/CMake%{?name_suffix}Setup.png