--- rpms/clamav/sme9/clamav.spec 2018/10/24 12:03:16 1.22 +++ rpms/clamav/sme9/clamav.spec 2018/11/12 22:37:19 1.23 @@ -11,11 +11,24 @@ %{?rh7:%define _without_milter 1} %{?el2:%define _without_milter 1} +# Work around https://bugzilla.clamav.net/show_bug.cgi?id=12162 by bundling +# newer zlib version from RHEL/CentOS 7 (#1600458) +%global zlibversion 1.2.7 +%global zlibrelease 17%{?dist} + + Summary: Anti-virus software Name: clamav Version: 0.100.2 -Release: 1%{?dist} -License: GPL +Release: 2%{?dist} +# ClamAV is GPLv2, zlib is zlib, /contrib/dotzlib/ has Boost license +%if 0%{?zlibversion:1} && 0%{?zlibrelease:1} +License: GPLv2 and zlib and Boost +%else +License: GPLv2 +%endif + + Group: Applications/System URL: http://www.clamav.net/ @@ -24,24 +37,51 @@ Source1: clamav.init Source2: clamav-milter.init Source10: http://db.local.clamav.net/main.cvd Source11: http://db.local.clamav.net/daily.cvd + +%if 0%{?zlibversion:1} && 0%{?zlibrelease:1} +# Cheerfully borrowed from zlib.spec in RHEL/CentOS 7 +Source90: http://www.zlib.net/zlib-%{zlibversion}.tar.bz2 +#Source90: zlib-1.2.7.tar.bz2 +%endif + +%if 0%{?zlibversion:1} && 0%{?zlibrelease:1} +# Cheerfully borrowed from zlib.spec in RHEL/CentOS 7, see +# also https://git.centos.org/tree/rpms!zlib.git/c7/SOURCES +Patch90: zlib-1.2.5-minizip-fixuncrypt.patch +# resolves: #805113 +Patch91: zlib-1.2.7-optimized-s390.patch +# resolves: #844791 +Patch92: zlib-1.2.7-z-block-flush.patch +# resolves: #1127330 +Patch93: zlib-1.2.7-fix-serious-but-very-rare-decompression-bug-in-inftr.patch +# resolves: #1337441 +Patch94: zlib-1.2.7-Fix-bug-where-gzopen-gzclose-would-write-an-empty-fi.patch +%endif + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: bzip2-devel BuildRequires: curl-devel BuildRequires: gmp-devel BuildRequires: ncurses-devel -BuildRequires: zlib-devel %{!?_without_milter:BuildRequires: sendmail-devel >= 8.12} BuildRequires: check-devel BuildRequires: openssl-devel BuildRequires: libxml2-devel BuildRequires: pcre-devel - +BuildRequires: xz ### Do not require the latest release of clamav-db specifically (people may use freshclam onward) #Requires: clamav-db = %{version}-%{release} Requires: clamav-db +Provides: bundled(libmspack) = 0.5-0.1.alpha.modified_by_clamav +%if 0%{?zlibversion:1} && 0%{?zlibrelease:1} +Provides: bundled(zlib) = %{zlibversion}-%{zlibrelease} +%else +Requires: zlib-devel +%endif + ### Fedora Extras introduced them differently :( Obsoletes: libclamav <= %{version}-%{release} Obsoletes: clamav-lib <= %{version}-%{release} @@ -165,6 +205,21 @@ you will need to install %{name}-devel. s|^#(User) .+$|$1 clamav|; ' etc/clamav-milter.conf.sample >etc/clamav-milter.conf +%if 0%{?zlibversion:1} && 0%{?zlibrelease:1} +# Cheerfully borrowed from zlib.spec in RHEL/CentOS 7, see +# https://git.centos.org/blob/rpms!zlib.git/c7/SPECS!zlib.spec +tar xfj %{SOURCE90} +pushd zlib-%{zlibversion} +%patch90 -p1 -b .fixuncrypt +%ifarch s390 s390x +%patch91 -p1 -b .optimized-deflate +%endif +%patch92 -p1 -b .z-flush +%patch93 -p1 +%patch94 -p1 +popd +%endif + %{__perl} -p -e ' s|^(Checks) .+$|$1 24|; s|^(Example)|#$1|; @@ -211,6 +266,26 @@ CLAMAV_FLAGS="--config-file=%{_sysconfdi EOF %build + +%if 0%{?zlibversion:1} && 0%{?zlibrelease:1} +# Cheerfully borrowed from zlib.spec in RHEL/CentOS 7, see +# https://git.centos.org/blob/rpms!zlib.git/c7/SPECS!zlib.spec +pushd zlib-%{zlibversion} +%ifarch ppc64 ppc64le +export CFLAGS="$RPM_OPT_FLAGS -fPIC -O3" +%else +export CFLAGS="$RPM_OPT_FLAGS -fPIC" +%endif + +export LDFLAGS="$LDFLAGS -Wl,-z,relro" + +./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix} --static +make %{?_smp_mflags} +make install DESTDIR=%{_builddir}/%{name}-%{version}/zlib-%{zlibversion}-%{zlibrelease} +popd +%endif + + %configure \ --program-prefix="%{?_program_prefix}" \ --disable-clamav \ @@ -226,6 +301,11 @@ EOF --with-group="clamav" \ --with-libcurl=%{_prefix} \ --with-user="clamav" + +%if 0%{?zlibversion:1} && 0%{?zlibrelease:1} + --with-zlib=%{_builddir}/%{name}-%{version}/zlib-%{zlibversion}-%{zlibrelease}%{_prefix} \ +%endif + ### Disable JIT until it is implemented securely (RHbz #573191) # --enable-llvm \ %{__make} %{?_smp_mflags} @@ -410,6 +490,10 @@ fi %exclude %{_libdir}/libclammspack.la %changelog +* Mon Nov 12 2018 John Crisp - 0.100.3-1 +- Bundle zlib 1.2.7-17.el7 to avoid malformed database errors (#1600458) +- [SME: 10645] + * Wed Oct 24 2018 Daniel Berteaud - 0.100.2-1.sme - Update to 0.100.2 [SME: 10579]