Marcus Meissner
7988b83fbe
Change default C++ std to -std=gnu++98. OBS-URL: https://build.opensuse.org/request/show/402898 OBS-URL: https://build.opensuse.org/package/show/security/clamav?expand=0&rev=130
193 lines
5.8 KiB
RPMSpec
193 lines
5.8 KiB
RPMSpec
#
|
|
# spec file for package clamav
|
|
#
|
|
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
|
|
Name: clamav
|
|
BuildRequires: ncurses-devel
|
|
BuildRequires: sed
|
|
BuildRequires: sendmail-devel
|
|
%define llvm --disable-llvm
|
|
BuildRequires: bc
|
|
BuildRequires: pkgconfig
|
|
BuildRequires: zlib-devel
|
|
%ifarch %ix86 x86_64
|
|
%define llvm --enable-llvm
|
|
# Needed for compiling LLVM.
|
|
BuildRequires: gcc-c++
|
|
%endif
|
|
BuildRequires: check-devel
|
|
BuildRequires: libbz2-devel
|
|
BuildRequires: libopenssl-devel
|
|
BuildRequires: libxml2-devel
|
|
BuildRequires: pcre-devel
|
|
BuildRequires: pwdutils
|
|
BuildRequires: python-devel
|
|
%define clamav_check --enable-check
|
|
Summary: Antivirus Toolkit
|
|
License: GPL-2.0
|
|
Group: Productivity/Security
|
|
Version: 0.99.1
|
|
Release: 0
|
|
Url: http://www.clamav.net
|
|
Requires: latex2html-pngicons
|
|
Obsoletes: clamav-db < 0.88.3
|
|
Requires(pre): %_sbindir/groupadd %_sbindir/useradd %_sbindir/usermod
|
|
Requires(pre): /usr/bin/awk /bin/sed /bin/tar
|
|
Source0: http://downloads.sourceforge.net/clamav/%{name}-%{version}.tar.gz
|
|
Source11: clamav.keyring
|
|
Source3: clamav-updateclamconf
|
|
Source4: clamav-rpmlintrc
|
|
Source6: clamav-tmpfiles.conf
|
|
Source7: service.clamd
|
|
Source8: service.freshclam
|
|
Source9: service.clamav-milter
|
|
Patch1: clamav-conf.patch
|
|
Patch3: clamav-gcc47.patch
|
|
BuildRequires: systemd
|
|
%systemd_requires
|
|
|
|
%description
|
|
ClamAV is an open source (GPL) antivirus engine designed for detecting
|
|
Trojans, viruses, malware and other malicious threats. It is the de
|
|
facto standard for mail gateway scanning. It provides a high
|
|
performance mutli-threaded scanning daemon, command line utilities for
|
|
on demand file scanning, and an intelligent tool for automatic
|
|
signature updates. The core ClamAV library provides numerous file
|
|
format detection mechanisms, file unpacking support, archive support,
|
|
and multiple signature languages for detecting threats.
|
|
|
|
%prep
|
|
%setup -q
|
|
%patch1 -p1
|
|
%patch3 -p1
|
|
|
|
%build
|
|
CFLAGS="-fstack-protector"
|
|
CXXFLAGS="-fstack-protector"
|
|
export CFLAGS="%optflags $CFLAGS -fPIE -fno-strict-aliasing"
|
|
export CXXFLAGS="%optflags $CXXFLAGS -fPIE -fno-strict-aliasing -std=gnu++98"
|
|
export LDFLAGS="-pie"
|
|
%if "%_lib" == "lib64"
|
|
# tomsfastmath needs this for correct operation on 64-bit platforms
|
|
CFLAGS="$CFLAGS -DFP_64BIT"
|
|
%endif
|
|
%configure \
|
|
--disable-clamav \
|
|
--disable-static \
|
|
--with-dbdir=/var/lib/clamav \
|
|
--with-user=vscan \
|
|
--with-group=vscan \
|
|
--enable-milter \
|
|
%clamav_check \
|
|
%llvm \
|
|
--enable-clamdtop \
|
|
--disable-timestamps
|
|
|
|
make V=1 %{?jobs:-j%jobs}
|
|
|
|
%install
|
|
%makeinstall
|
|
install -m755 %SOURCE3 %buildroot%_sbindir/updateclamconf
|
|
install -d -m755 %buildroot/var/lib/clamav
|
|
install -d -m755 %buildroot/%_tmpfilesdir
|
|
install -m644 %SOURCE6 %buildroot%_tmpfilesdir/clamav.conf
|
|
mkdir -p %buildroot/var/spool/amavis
|
|
rm %buildroot/%_libdir/*.la
|
|
# Remove bogus dependencies from libclamav.pc
|
|
sed -i 's/^Libs: .*/Libs: -lclamav/' %buildroot%_libdir/pkgconfig/libclamav.pc
|
|
|
|
# fix the new config file names
|
|
pushd %buildroot/etc
|
|
mv clamd.conf.sample clamd.conf
|
|
mv clamav-milter.conf.sample clamav-milter.conf
|
|
mv freshclam.conf.sample freshclam.conf
|
|
popd
|
|
|
|
# Systemd...
|
|
install -d -m 0755 %buildroot/%{_unitdir}
|
|
install -m 0644 %{SOURCE7} %buildroot/%{_unitdir}/clamd.service
|
|
install -m 0644 %{SOURCE8} %buildroot/%{_unitdir}/freshclam.service
|
|
install -m 0644 %{SOURCE9} %buildroot/%{_unitdir}/clamav-milter.service
|
|
# this is broken if system does not have systemd so don't
|
|
# use it at all on systems without mandatory systemd
|
|
for srvname in clamd freshclam clamav-milter;do
|
|
(export PATH=/usr/sbin:/sbin:$PATH ;ln -sf $(which service) %{buildroot}/%{_sbindir}/rc${srvname})
|
|
done
|
|
|
|
%check
|
|
|
|
# regression tests
|
|
%if !0%{?qemu_user_space_build:1}
|
|
VALGRIND_GENSUP=1 make check
|
|
%endif
|
|
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
%config(noreplace) %_sysconfdir/*.conf
|
|
#systemd...
|
|
%{_unitdir}/clamd.service
|
|
%{_unitdir}/freshclam.service
|
|
%{_unitdir}/clamav-milter.service
|
|
%_tmpfilesdir
|
|
%doc AUTHORS BUGS ChangeLog COPYING FAQ NEWS README UPGRADE
|
|
%doc docs/*.pdf docs/html
|
|
%doc %_mandir/*/*
|
|
%_bindir/*
|
|
%_sbindir/*
|
|
%_includedir/*
|
|
%_libdir/lib*
|
|
%_libdir/pkgconfig/libclamav.pc
|
|
%defattr(-,vscan,vscan)
|
|
%dir %attr(750,vscan,vscan) /var/spool/amavis
|
|
%dir /var/lib/clamav
|
|
|
|
%pre
|
|
%_sbindir/groupadd -r vscan 2> /dev/null || :
|
|
%_sbindir/useradd -r -o -g vscan -u 65 -s /bin/false -c "Vscan account" -d /var/spool/amavis vscan 2> /dev/null || :
|
|
%_sbindir/usermod vscan -g vscan 2> /dev/null || :
|
|
%service_add_pre clamd.service freshclam.service clamav-milter.service
|
|
|
|
%post
|
|
/sbin/ldconfig
|
|
systemd-tmpfiles --create %_tmpfilesdir/clamav.conf
|
|
%service_add_post clamd.service freshclam.service clamav-milter.service
|
|
|
|
# merge config files on update
|
|
test "0$1" -lt 2 && exit 0
|
|
umask 022
|
|
for f in /etc/clamd.conf /etc/freshclam.conf /etc/clamav-milter.conf; do
|
|
if test -e $f.rpmnew; then
|
|
echo "Merging $f and $f.rpmnew"
|
|
%_sbindir/updateclamconf -v override="$OVERRIDE" $f $f.rpmnew > $f.tmp
|
|
if test $? = 0; then
|
|
mv $f $f.old
|
|
mv $f.tmp $f
|
|
else
|
|
echo "Merging $f with $f.rpmnew failed"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
%preun
|
|
%service_del_preun clamd.service freshclam.service clamav-milter.service
|
|
|
|
%postun
|
|
/sbin/ldconfig
|
|
%service_del_postun clamd.service freshclam.service clamav-milter.service
|
|
|
|
%changelog
|