diff --git a/packaging/rpm/wireshark.spec.in b/packaging/rpm/wireshark.spec.in index d3addd0212..9f194440e8 100644 --- a/packaging/rpm/wireshark.spec.in +++ b/packaging/rpm/wireshark.spec.in @@ -8,8 +8,15 @@ %bcond_with toolchain_clang %bcond_with ninja %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_without qt6 +%else +%bcond_without qt5 %bcond_with qt6 +%endif %bcond_with lua %bcond_with mmdbresolve %bcond_with lz4_and_snappy @@ -26,8 +33,8 @@ # Fedora options to use clang as the compiler # https://docs.fedoraproject.org/en-US/packaging-guidelines/#compiler -%if %{with toolchain_clang} %if 0%{?fedora} +%if %{with toolchain_clang} %global toolchain clang %else %global toolchain gcc @@ -66,74 +73,55 @@ Source: https://www.wireshark.org/download/src/%{name}-%{package_version}.tar.x URL: https://www.wireshark.org/ Packager: Gerald Combs -BuildRequires: cmake >= 3.10 +# 4.13 introduces Boolean dependencies +BuildRequires: rpm-build >= 4.13.0 + +BuildRequires: cmake >= 3.13 BuildRequires: python3 %if %{with toolchain_clang} BuildRequires: clang %else BuildRequires: gcc +BuildRequires: gcc-c++ %endif BuildRequires: flex %if %{with ninja} -%if 0%{?fedora} || 0%{?rhel} -BuildRequires: ninja-build -%else -BuildRequires: ninja -%endif +BuildRequires: (ninja or ninja-build) %endif # We always require Asciidoctor for packaging builds as of 84ab55cf75, # unfortunately it's not evenly distributed across distros. # Fedora & CentOS: rubygem-asciidoctor # CentOS 8: # 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: BuildRequires: /usr/bin/asciidoctor # For the HTML guides, we need xsltproc, and the docbook stylesheets %if %{with guides} BuildRequires: /usr/bin/xsltproc -%if 0%{?suse_version} -BuildRequires: docbook-xsl-stylesheets -%else -BuildRequires: docbook-style-xsl -%endif +BuildRequires: (docbook-style-xsl or docbook-xsl-stylesheets) %endif -BuildRequires: glib2-devel >= 2.50.0 +BuildRequires: glib2-devel >= 2.54.0 BuildRequires: libpcap-devel BuildRequires: zlib-devel BuildRequires: libgcrypt-devel BuildRequires: pcre2-devel %if %{with lz4_and_snappy} -%if 0%{?suse_version} -BuildRequires: liblz4-devel -%else -BuildRequires: lz4-devel -%endif +BuildRequires: (lz4-devel or liblz4-devel) BuildRequires: snappy-devel %endif -%if 0%{?suse_version} -# SUSE uses this package name: -BuildRequires: libcares-devel -%else -# ... while Red Hat uses this one: -# (What other RPM-based distros do will have to be determined...) -BuildRequires: c-ares-devel -%endif +BuildRequires: (c-ares-devel or libcares-devel) +# On SUSE speex-devel requires speexdsp-devel, but that +# is not the case on RH/Fedora. I believe we only need +# SpeexDSP +BuildRequires: speexdsp-devel %if %{with lua} -%if 0%{?fedora} || ( 0%{?rhel} >= 8 ) -BuildRequires: compat-lua-devel < 5.3 -%else -%if 0%{?suse_version} -BuildRequires: lua51-devel -%else -BuildRequires: lua-devel < 5.3 -%endif -%endif +# We only support Lua before 5.3 (#10881) +BuildRequires: (compat-lua-devel < 5.3 or lua51-devel) %endif %if %{with nghttp2} @@ -145,16 +133,7 @@ BuildRequires: systemd-devel %endif %if %{with brotli} -%if 0%{?suse_version} -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 +BuildRequires: (brotli-devel or libbrotli-devel) %endif %if %{with zstd} @@ -183,17 +162,6 @@ Requires(pre): shadow-utils %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 # top-level directory). %description @@ -216,9 +184,6 @@ Summary: Wireshark's Qt-based GUI Group: Applications/Internet Obsoletes: wireshark-gnome < %{version} wireshark-gtk < %{version} Requires: %{name} = %{version}-%{release} -%if %{without toolchain_clang} -BuildRequires: gcc-c++ -%endif %if %{with qt5} %if 0%{?suse_version} BuildRequires: libQt5Core-devel @@ -375,36 +340,16 @@ development of Wireshark scripts and plugins. # either macro, and thus presumably does in-source builds.) %{?!__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 -%endif %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 -%if %{with ninja} -%ninja_install -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 +%cmake_install +%cmake_install --component Development %if %{with guides} %if %{with ninja}