##
## sophie.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2004 The OpenPKG Project
## Copyright (c) 2000-2004 Ralf S. Engelschall
## Copyright (c) 2000-2004 Cable & Wireless
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: sophie
Summary: Sophie Anti-Virus Scanner Daemon
URL: http://www.vanja.com/tools/sophie/
Vendor: Vanja Hrustic et al.
Packager: The OpenPKG Project
Distribution: OpenPKG
Class: EVAL
Group: System
License: GPL
Version: 3.04rc2
Release: 20040203
# package options
%option with_fsl yes
# list of sources
Source0: http://www.vanja.com/tools/sophie/sophie-%{version}.tar.bz2
Source1: fsl.sophie
Source2: rc.sophie
Source3: sophie.cfg
Source4: sophie.savi
Source5: sophie.sh
Patch0: sophie.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, sav, make, gcc
PreReq: OpenPKG, openpkg >= 20040130, sav
%if "%{with_fsl}" == "yes"
BuildPreReq: fsl >= 1.0.6
PreReq: fsl >= 1.0.6
%endif
AutoReq: no
AutoReqProv: no
%description
Sophie is a daemon which uses the libsavi library from Sophos
Anti-Virus. On startup, Sophie initializes SAVI (Sophos Anti-Virus
Interface), loads virus patterns into memory, opens local UNIX
domain socket, and waits for someone to connect and instructs it
which path to scan. Since it is loaded in RAM, scanning is very
fast. Of course, speed of scanning also depends on SAVI settings and
size of the file.
%track
prog sophie = {
version = 3.04rc2
url = http://www.vanja.com/tools/sophie/
regex = sophie-(__VER__)\.tar\.bz2
}
%prep
%setup -q
%patch -p1
%{l_shtool} subst %{l_value -s -a} \
sophie.c \
sophie_init.c
%{l_shtool} subst \
-e 's;^\(#define[ ]*DEFAULT_PIDFILE\)[ ].*$;\1 "%{l_prefix}/var/sophie/sophie.pid";' \
-e 's;^\(#define[ ]*DEFAULT_SOCKETFILE\)[ ].*$;\1 "%{l_prefix}/var/sophie/sophie.sock";' \
sophie.h
case "%{l_platform -t}" in
*-freebsd* ) %{l_shtool} subst -e 's; -lrt;;' configure ;;
esac
%build
LD_LIBRARY_PATH="%{l_prefix}/lib/sav:${LD_LIBRARY_PATH-/usr/lib}"
export LD_LIBRARY_PATH
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
LIBS="%{l_fsl_libs}" \
./configure \
--prefix=%{l_prefix} \
--with-savilib=%{l_prefix}/lib/sav \
--disable-net
%{l_make} %{l_mflags -O}
%install
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/sophie \
$RPM_BUILD_ROOT%{l_prefix}/man/man8 \
$RPM_BUILD_ROOT%{l_prefix}/libexec/sophie \
$RPM_BUILD_ROOT%{l_prefix}/var/sophie
%{l_shtool} install -c -s -m 755 \
sophie \
$RPM_BUILD_ROOT%{l_prefix}/libexec/sophie/
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE sophie.sh} \
$RPM_BUILD_ROOT%{l_prefix}/bin/sophie
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE fsl.sophie} \
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.sophie} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE sophie.cfg} \
%{SOURCE sophie.savi} \
$RPM_BUILD_ROOT%{l_prefix}/etc/sophie/
%{l_shtool} install -c -m 644 \
sophie.8 \
$RPM_BUILD_ROOT%{l_prefix}/man/man8/
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
'%not %dir %{l_prefix}/etc/fsl' \
'%config %{l_prefix}/etc/fsl/fsl.sophie' \
'%config %{l_prefix}/etc/sophie/*' \
'%dir %attr(1777,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/sophie'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT