rpm: Update spec for latest dependencies

SpeexDSP is now required.
Update the required cmake and glib versions.
Our CMake build process now expects a C++ compiler to always be present,
so require it even if not building the GUI.

Only default to Qt 6 on distributions where we know we have it,
otherwise default to Qt 5 for now.

Update the required RPM version to 4.13 (which all distributions that
can currently build have) to ensure we have Boolean dependencies.
Use Boolean dependencies instead of checking the distribution, hopefully
to improve building on various other RPM-based distributions.

Redefine the cmake_install macro on SUSE to what is used on RH/Fedora.
The default SUSE macro calls the builder (make or ninja) insted of
cmake --install, which makes it difficult to pass options.

Remove tests and workarounds for RHEL 7, and SUSE < 15.2, since those
distributions are too old to build anyway.
Remove a workaround for an old broken librotli-devel package in
SUSE that's been long since fixed.
This commit is contained in:
John Thacker 2023-01-21 18:25:32 -05:00
parent c65d5a0a80
commit dda2ead9c0
1 changed files with 30 additions and 85 deletions

View File

@ -8,8 +8,15 @@
%bcond_with toolchain_clang %bcond_with toolchain_clang
%bcond_with ninja %bcond_with ninja
%bcond_with ccache %bcond_with ccache
# In rpm 4.17.1 it's possible to define these so that
# the one is set, the default is the inverse of the other
%if 0%{?fedora} || 0%{?rhel} >= 9
%bcond_with qt5 %bcond_with qt5
%bcond_without qt6
%else
%bcond_without qt5
%bcond_with qt6 %bcond_with qt6
%endif
%bcond_with lua %bcond_with lua
%bcond_with mmdbresolve %bcond_with mmdbresolve
%bcond_with lz4_and_snappy %bcond_with lz4_and_snappy
@ -26,8 +33,8 @@
# Fedora options to use clang as the compiler # Fedora options to use clang as the compiler
# https://docs.fedoraproject.org/en-US/packaging-guidelines/#compiler # https://docs.fedoraproject.org/en-US/packaging-guidelines/#compiler
%if %{with toolchain_clang}
%if 0%{?fedora} %if 0%{?fedora}
%if %{with toolchain_clang}
%global toolchain clang %global toolchain clang
%else %else
%global toolchain gcc %global toolchain gcc
@ -66,74 +73,55 @@ Source: https://www.wireshark.org/download/src/%{name}-%{package_version}.tar.x
URL: https://www.wireshark.org/ URL: https://www.wireshark.org/
Packager: Gerald Combs <gerald[AT]wireshark.org> Packager: Gerald Combs <gerald[AT]wireshark.org>
BuildRequires: cmake >= 3.10 # 4.13 introduces Boolean dependencies
BuildRequires: rpm-build >= 4.13.0
BuildRequires: cmake >= 3.13
BuildRequires: python3 BuildRequires: python3
%if %{with toolchain_clang} %if %{with toolchain_clang}
BuildRequires: clang BuildRequires: clang
%else %else
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++
%endif %endif
BuildRequires: flex BuildRequires: flex
%if %{with ninja} %if %{with ninja}
%if 0%{?fedora} || 0%{?rhel} BuildRequires: (ninja or ninja-build)
BuildRequires: ninja-build
%else
BuildRequires: ninja
%endif
%endif %endif
# We always require Asciidoctor for packaging builds as of 84ab55cf75, # We always require Asciidoctor for packaging builds as of 84ab55cf75,
# unfortunately it's not evenly distributed across distros. # unfortunately it's not evenly distributed across distros.
# Fedora & CentOS: rubygem-asciidoctor # Fedora & CentOS: rubygem-asciidoctor
# CentOS 8: <added in - https://bugzilla.redhat.com/show_bug.cgi?id=1820896> # CentOS 8: <added in - https://bugzilla.redhat.com/show_bug.cgi?id=1820896>
# openSUSE 15.3: ruby2.5-rubygem-asciidoctor # openSUSE 15.3: ruby2.5-rubygem-asciidoctor
# SLES 12 SP5: ruby2.1-rubygem-asciidoctor
# All of the packages provide this, so we can rely on it: # All of the packages provide this, so we can rely on it:
BuildRequires: /usr/bin/asciidoctor BuildRequires: /usr/bin/asciidoctor
# For the HTML guides, we need xsltproc, and the docbook stylesheets # For the HTML guides, we need xsltproc, and the docbook stylesheets
%if %{with guides} %if %{with guides}
BuildRequires: /usr/bin/xsltproc BuildRequires: /usr/bin/xsltproc
%if 0%{?suse_version} BuildRequires: (docbook-style-xsl or docbook-xsl-stylesheets)
BuildRequires: docbook-xsl-stylesheets
%else
BuildRequires: docbook-style-xsl
%endif
%endif %endif
BuildRequires: glib2-devel >= 2.50.0 BuildRequires: glib2-devel >= 2.54.0
BuildRequires: libpcap-devel BuildRequires: libpcap-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
BuildRequires: libgcrypt-devel BuildRequires: libgcrypt-devel
BuildRequires: pcre2-devel BuildRequires: pcre2-devel
%if %{with lz4_and_snappy} %if %{with lz4_and_snappy}
%if 0%{?suse_version} BuildRequires: (lz4-devel or liblz4-devel)
BuildRequires: liblz4-devel
%else
BuildRequires: lz4-devel
%endif
BuildRequires: snappy-devel BuildRequires: snappy-devel
%endif %endif
%if 0%{?suse_version} BuildRequires: (c-ares-devel or libcares-devel)
# SUSE uses this package name: # On SUSE speex-devel requires speexdsp-devel, but that
BuildRequires: libcares-devel # is not the case on RH/Fedora. I believe we only need
%else # SpeexDSP
# ... while Red Hat uses this one: BuildRequires: speexdsp-devel
# (What other RPM-based distros do will have to be determined...)
BuildRequires: c-ares-devel
%endif
%if %{with lua} %if %{with lua}
%if 0%{?fedora} || ( 0%{?rhel} >= 8 ) # We only support Lua before 5.3 (#10881)
BuildRequires: compat-lua-devel < 5.3 BuildRequires: (compat-lua-devel < 5.3 or lua51-devel)
%else
%if 0%{?suse_version}
BuildRequires: lua51-devel
%else
BuildRequires: lua-devel < 5.3
%endif
%endif
%endif %endif
%if %{with nghttp2} %if %{with nghttp2}
@ -145,16 +133,7 @@ BuildRequires: systemd-devel
%endif %endif
%if %{with brotli} %if %{with brotli}
%if 0%{?suse_version} BuildRequires: (brotli-devel or libbrotli-devel)
BuildRequires: libbrotli-devel
# On SUSE libbrotli-devel installs the libbrotlidec.so, libbrotlienc.so
# and libbrotlicommon.so symlinks, but only installs the libbrotlicommon1 and libbrotlienc1
# packages, leaving the libbrotlidec.so symlink broken, so we have to include libbrotlidec1
# as a build-time dependency...
BuildRequires: libbrotlidec1
%else
BuildRequires: brotli-devel
%endif
%endif %endif
%if %{with zstd} %if %{with zstd}
@ -183,17 +162,6 @@ Requires(pre): shadow-utils
%endif %endif
%endif %endif
%if %{setcap_dumpcap}
# Actually we require rpmbuild (the program) >= 4.7.0 but the package name
# where we can find it varies. So we check the 'rpm' version because either
# rpmbuild is in that package (e.g., in older distros) or it's in the
# 'rpm-build' package which generally requires a matching version of 'rpm'.
#
# All of this is to save users the trouble of getting through an full compile
# only to have rpmbuild barf because it doesn't understand capabilities.
BuildRequires: rpm >= 4.7.0
%endif
# NOTE: the below description has been copied to org.wireshark.Wireshark.metainfo.xml (in the # NOTE: the below description has been copied to org.wireshark.Wireshark.metainfo.xml (in the
# top-level directory). # top-level directory).
%description %description
@ -216,9 +184,6 @@ Summary: Wireshark's Qt-based GUI
Group: Applications/Internet Group: Applications/Internet
Obsoletes: wireshark-gnome < %{version} wireshark-gtk < %{version} Obsoletes: wireshark-gnome < %{version} wireshark-gtk < %{version}
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
%if %{without toolchain_clang}
BuildRequires: gcc-c++
%endif
%if %{with qt5} %if %{with qt5}
%if 0%{?suse_version} %if 0%{?suse_version}
BuildRequires: libQt5Core-devel BuildRequires: libQt5Core-devel
@ -375,36 +340,16 @@ development of Wireshark scripts and plugins.
# either macro, and thus presumably does in-source builds.) # either macro, and thus presumably does in-source builds.)
%{?!__cmake_builddir: %global __cmake_builddir %{?__builddir}%{!?__builddir:.}} %{?!__cmake_builddir: %global __cmake_builddir %{?__builddir}%{!?__builddir:.}}
# SUSE 15.1 moved to out of source builds but automatically enters the
# builddir before building, but does not when entering %%install.
# Fedora, RHEL, and later versions of SUSE do the opposite.
%if 0%{?rhel} && ( 0%{?rhel} <= 7 ) || (0%{?suse_version} && 0%{?sle_version} <= 150100)
%if %{with ninja}
%ninja_build
%else
%if (0%{?suse_version} && 0%{?sle_version} <= 150100)
make %{?_smp_mflags}
%else
make %{?_smp_mflags} -C %{__cmake_builddir}
%endif
%endif
%else
%cmake_build %cmake_build
%endif
%install %install
%if (0%{?suse_version} && 0%{?sle_version} <= 150100) && %{with ninja}
cd %{__cmake_builddir} %if 0%{?suse_version}
%define cmake_install DESTDIR=%{buildroot} %__cmake --install %{__cmake_builddir}
%endif %endif
%if %{with ninja} %cmake_install
%ninja_install %cmake_install --component Development
DESTDIR=%{buildroot} %{__ninja} %{__ninja_common_opts} install-headers
%else
make DESTDIR=$RPM_BUILD_ROOT -C %{__cmake_builddir} install
make DESTDIR=$RPM_BUILD_ROOT -C %{__cmake_builddir} install-headers
%endif
%if %{with guides} %if %{with guides}
%if %{with ninja} %if %{with ninja}