File squid-ecap-av.spec of Package squid-ecap-av
%define realname squid-ecap-av
%define realver 1.0.6
%undefine extraver
%define srcext tar.bz2
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}
Version: %{realver}
Release: wiz%{?extraver:0.}1
License: GPL-2.0
Group: Productivity/Networking/Web/Proxy
URL: http://squid-ecap-av.sourceforge.net/
Summary: Antivirus eCAP adapter for Squid 3.1 and above
# Install-time parameters
Requires: squid >= 3.1 clamav
%if 0%{?suse_version}
Enhances: squid >= 3.1
%endif
# Build-time parameters
BuildRequires: cmake gcc-c++ libstdc++-devel pkgconfig
%if 0%{?suse_version} >= 1130 || 0%{?rhel_version} >= 600 || 0%{?centos_version} >= 600 || 0%{?scientificlinux_version} >= 600
BuildRequires: file-devel pkgconfig(libecap)
%else
BuildRequires: file libecap-devel
%endif
%if 0%{?sles_version}
BuildRequires: file-devel
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source: http://sourceforge.net/projects/squid-ecap-av/files/1.x.x/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
Securepoint eCAP antivirus adapter is an loadable eCAP adapter for the popular
Squid HTTP-Proxy which allows you to scan all traffic going through for known
viruses. Currently the only supported virus scan engine is clamav.
Features
* content type detection via libmagic
* configurable skiplist dependent of the detected content type
* data trickling
* patience pages (not yet)
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
%build
mkdir build
cd build
cmake \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DMODDIR=%{_libdir}/squid \
-DCMAKE_FLAGS="%{optflags}" \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -Wl,--strip-all" \
%if 0%{?suse_version}
-DDOCDIR=%{_defaultdocdir}/%{name} \
%else
-DDOCDIR=%{_defaultdocdir}/%{name}-%{version} \
%endif
..
%__make %{?_smp_mflags}
%install
cd build
%__make install DESTDIR=%{buildroot}
cd ${OLDPWD}
%__install -D -m644 src/ecap_adapter_av.skip %{buildroot}%{_sysconfdir}/squid/ecap_adapter_av.skip
cat > %{buildroot}%{_sysconfdir}/squid/ecap_adapter_av.conf <<EOF
# ---------------------------------------------------------------
# Example config for Securepoint eCAP antivirus adapter
# ---------------------------------------------------------------
# scan engine to use
# supported engines:
# * clamav clamd
# * commtouch csamd
engine = clamav
# path to the unix socket the daemon is listening on
%if 0%{?suse_version}
avdsocket = /var/lib/clamav/clamd-socket
%else
avdsocket = /var/run/clamav/clamd.sock
%endif
# skip scanning of bodies larger than 'maxscansize', set to 0 to always scan
# the whole body
#
# maxscansize = size units
#
# 'size' is the limit specified as a number of units.
# 'units' specifies whether to use bytes, KB, MB.
# If no units are specified bytes are assumed.
maxscansize = 4 MB
# path to the magic database file used by magic_load()
# see libmagic(3)
%if 0%{?suse_version}
magicdb = /usr/share/misc/magic.mgc
%else
magicdb = /usr/share/file/magic.mgc
%endif
# path to the file containing the list of mimetypes not to scan
skiplist = /etc/squid/ecap_adapter_av.skip
# send some bytes each 'trickletime' seconds
trickletime = 30
# directory to store temporary files in
tempdir = /var/tmp
EOF
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%files
%defattr(-,root,root)
%doc CHANGES LICENSE-eCAP LICENSE.txt NOTICE README
%dir %{_sysconfdir}/squid/
%config(noreplace) %{_sysconfdir}/squid/ecap_adapter_av.*
%dir %{_libdir}/squid/
%{_libdir}/squid/ecap_adapter_av.so
%changelog