clamav/clamav.spec
Reinhard Max a7d93681e5 Accepting request 148449 from home:m_meister:branches:security
- pids and sockets of clamd and freshclam now reside in /var/run
  instead of /var/lib (bnc#770395)
- modified pid path in clamd's, freshclam's and clamav-milter's
  init scripts

OBS-URL: https://build.opensuse.org/request/show/148449
OBS-URL: https://build.opensuse.org/package/show/security/clamav?expand=0&rev=73
2013-01-14 15:06:55 +00:00

196 lines
5.6 KiB
RPMSpec

#
# spec file for package clamav
#
# Copyright (c) 2013 SUSE LINUX Products 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
BuildRequires: sendmail-devel
%define llvm --disable-llvm
%if 0%{?suse_version} >= 1010
BuildRequires: bc
BuildRequires: pkgconfig
BuildRequires: zlib-devel
%ifarch %ix86 x86_64
%define llvm --enable-llvm
# Needed for compiling LLVM.
BuildRequires: gcc-c++
%endif
%endif
%if 0%{?suse_version} >= 1030
BuildRequires: check-devel
BuildRequires: libbz2-devel
BuildRequires: pwdutils
BuildRequires: python-devel
%define clamav_check --enable-check
%else
BuildRequires: bzip2
%define clamav_check --disable-check
%endif
Summary: Antivirus Toolkit
License: GPL-2.0
Group: Productivity/Security
Version: 0.97.6
Release: 0
Url: http://www.clamav.net
Requires: latex2html-pngicons
Obsoletes: clamav-db < 0.88.3
PreReq: %_sbindir/groupadd %_sbindir/useradd %_sbindir/usermod
PreReq: /usr/bin/awk /bin/sed /bin/tar
PreReq: %insserv_prereq
Source0: %{name}-%{version}.tar.gz
Source1: clamav-rcclamd
Source2: clamav-rcfreshclam
Source3: clamav-updateclamconf
Source4: clamav-rpmlintrc
Source5: clamav-rcmilter
Source6: clamav-tmpfiles.conf
Patch1: clamav-conf.patch
Patch2: clamav-sles9.patch
Patch3: clamav-gcc47.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%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
%if 0%{?suse_version} == 0910
# SLES9's libmilter doesn't have smfi_insheader()
%patch2
%endif
%patch3 -p1
%build
%if 0%{?suse_version} >= 1010
CFLAGS="-fstack-protector"
CXXFLAGS="-fstack-protector"
%endif
export CFLAGS="%optflags $CFLAGS"
export CXXFLAGS="%optflags $CXXFLAGS"
%if 0%{?suse_version} == 0910
# SLES9 needs this macro to enable the quarantine feature in libmilter
CFLAGS="$CFLAGS -D_FFR_QUARANTINE -D_FFR_SMFI_OPENSOCKET"
%endif
./configure \
--prefix=%_prefix \
--libdir=%_libdir \
--mandir=%_mandir \
--sysconfdir=%_sysconfdir \
--disable-clamav \
--disable-static \
--with-dbdir=/var/lib/clamav \
--with-user=vscan \
--with-group=vscan \
--enable-milter \
%clamav_check \
%llvm \
--disable-zlib-vcheck \
--enable-clamdtop \
--disable-timestamps
make %{?jobs:-j%jobs}
%install
%makeinstall
ln -sf docs/html/{clamdoc,index}.html
mkdir -p %buildroot/etc/init.d
install -m755 %SOURCE1 %buildroot/etc/init.d/clamd
ln -s /etc/init.d/clamd %buildroot%_sbindir/rcclamd
install -m755 %SOURCE2 %buildroot/etc/init.d/freshclam
ln -s /etc/init.d/freshclam %buildroot%_sbindir/rcfreshclam
install -m755 %SOURCE5 %buildroot/etc/init.d/clamav-milter
ln -s /etc/init.d/clamav-milter %buildroot%_sbindir/rcclamav-milter
install -m755 %SOURCE3 %buildroot%_sbindir/updateclamconf
install -d -m755 %buildroot/var/{lib,run}/clamav
install -d -m755 %buildroot/usr/lib/tmpfiles.d
install -m644 %SOURCE6 %buildroot/usr/lib/tmpfiles.d/clamav.conf
mkdir -p %buildroot/var/spool/amavis
%if 0%{?suse_version} > 1020
rm %buildroot/%_libdir/*.la
%endif
# Remove bogus dependencies from libclamav.pc
sed -i 's/^Libs: .*/Libs: -lclamav/' %buildroot%_libdir/pkgconfig/libclamav.pc
%check
# regressoin tests
%if !0%{?qemu_user_space_build:1}
VALGRIND_GENSUP=1 make check
%endif
%files
%defattr(-,root,root,-)
%config(noreplace) %_sysconfdir/*.conf
%config %attr(744,root,root)/etc/init.d/*
%dir /usr/lib/tmpfiles.d
/usr/lib/tmpfiles.d/clamav.conf
%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(700,vscan,root) /var/spool/amavis
%dir /var/lib/clamav
%dir %attr(755,vscan,vscan) /var/run/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 || :
%post
/sbin/ldconfig
# 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
%stop_on_removal clamd freshclam
%postun
/sbin/ldconfig
%restart_on_update clamd freshclam
%insserv_cleanup
%changelog