From 3d80a69b4f1c745a58d75a13334af118552d6ed3 Mon Sep 17 00:00:00 2001 From: John Sullivan Date: Apr 07 2024 22:34:41 +0000 Subject: Simplify and update EL7 and EL8 support. --- diff --git a/clamav.spec b/clamav.spec index 5399c0f..d38ba80 100644 --- a/clamav.spec +++ b/clamav.spec @@ -26,7 +26,7 @@ Summary: End-user tools for the Clam Antivirus scanner Name: clamav Version: 1.0.5 -Release: 3%{?dist} +Release: 4%{?dist} License: %{?with_unrar:proprietary}%{!?with_unrar:GPLv2} URL: https://www.clamav.net/ %if %{with unrar} @@ -81,12 +81,27 @@ Patch6: clamav-freshclam.service.patch # Debian patch to fix big-endian Patch7: https://salsa.debian.org/clamav-team/clamav/-/raw/unstable/debian/patches/libclamav-pe-Use-endian-wrapper-in-more-places.patch -BuildRequires: cmake +BuildRequires: cmake3 BuildRequires: gettext-devel BuildRequires: make BuildRequires: gcc-c++ BuildRequires: rust +%if 0%{?fedora} || 0%{?rhel} >= 9 BuildRequires: rust-packaging +%else +# Undefining the appropriate __cmake*_in_source_build macro causes the +# build to use a separate build path, so the build does not output to +# the source path. This separate build path is the default behavior +# for >=EL9 and fedora. +%if 0%{?rhel} == 8 +# EL8 defines cmake_in_source_build +%undefine __cmake_in_source_build +%else +# EL7 defines cmake3_in_source_build +%undefine __cmake3_in_source_build +%endif +BuildRequires: rust-toolset +%endif BuildRequires: cargo BuildRequires: bzip2-devel BuildRequires: check-devel @@ -201,7 +216,9 @@ This package contains the documentation for clamav. Summary: Auto-updater for the Clam Antivirus scanner data-files Requires: clamav-filesystem = %{version}-%{release} Requires: clamav-lib = %{version}-%{release} +%if 0%{?fedora} || 0%{?rhel} >= 8 Supplements:clamd +%endif Provides: data(clamav) = empty Provides: clamav-data-empty = %{version}-%{release} Obsoletes: clamav-data-empty < %{version}-%{release} @@ -252,12 +269,17 @@ This package contains files which are needed to run the clamav-milter. %prep %setup -q -n %{name}-%{version}%{?prerelease} +%if 0%{?fedora} || 0%{?rhel} >= 9 +# EL8 and earlier do not have the Rust cargo dependencies that are +# defined by the generate_buildrequires stage in EL9 and later, so the +# vendored packages included in the ClamAV sources suffice. sed -i -e '/cbindgen/s/version = *"0.20"/version = "0.24"/' -e '/^bindgen *=/s/= .*/= "0.63"/' libclamav_rust/Cargo.toml %cargo_prep cd libclamav_rust rm -r .cargo %cargo_prep cd .. +%endif %patch -P0 -p1 -b .rustflags %patch -P1 -p1 -b .default_confs @@ -273,9 +295,13 @@ mkdir -p libclamunrar{,_iface} %{!?with_unrar:touch libclamunrar/{Makefile.in,all,install}} +%if 0%{?fedora} || 0%{?rhel} >= 9 %generate_buildrequires +# The generate_buildrequires stage doesn't exist prior to EL9, so this +# section is conditionally removed in these build environments. cd libclamav_rust %cargo_generate_buildrequires +%endif %build @@ -284,8 +310,12 @@ export LDFLAGS=$(echo %{?__global_ldflags} | sed '/-Wl,--as-needed/!s/$/ -Wl,--a # IPv6 check is buggy and does not work when there are no IPv6 interface on build machine export have_cv_ipv6=yes -%cmake \ +%cmake3 \ +%if 0%{?fedora} || 0%{?rhel} >= 9 -DRUSTFLAGS="%build_rustflags" \ +%else + -DRUSTFLAGS="%__global_rustflags" \ +%endif -DAPP_CONFIG_DIRECTORY=%{_sysconfdir} \ -DCMAKE_INSTALL_DOCDIR=%{_pkgdocdir} \ -DCLAMAV_USER=%{updateuser} -DCLAMAV_GROUP=%{updateuser} \ @@ -296,12 +326,12 @@ export have_cv_ipv6=yes # TODO: check periodically that CLAMAVUSER is used for freshclam only -%cmake_build +%cmake3_build %install rm -rf _doc* -%cmake_install +%cmake3_install install -d -m 0755 \ %{buildroot}%{_tmpfilesdir} \ @@ -571,6 +601,9 @@ exit 0 %changelog +* Thu Apr 04 2024 John Sullivan - 1.0.5-4 +- Update EPEL 7 and 8 support for 1.0.5 + * Sat Mar 16 2024 Sérgio Basto - 1.0.5-3 - (#1679375) fixes syntax error in /etc/logrotate.d/clamd.exim