##
## mimedefang.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 versions
%define V_mimedefang 2.43
%define V_mime_tools 5.411a-RP-Patched-02
# package information
Name: mimedefang
Summary: Mail Processing Filter for Sendmail
URL: http://www.mimedefang.org/
Vendor: Roaring Penguing Software
Packager: The OpenPKG Project
Distribution: OpenPKG
Class: EVAL
Group: Mail
License: GPL
Version: %{V_mimedefang}
Release: 20040527
# package options
%option with_clamav no
# list of sources
Source0: http://www.mimedefang.org/static/mimedefang-%{V_mimedefang}.tar.gz
Source1: http://www.mimedefang.org/static/MIME-tools-%{V_mime_tools}.tar.gz
Source2: rc.mimedefang
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, make
PreReq: OpenPKG, openpkg >= 20040130
BuildPreReq: sendmail > 8.12.0, perl, perl-mail, perl-crypto, perl-ds
PreReq: sendmail > 8.12.0, perl, perl-mail, perl-crypto, perl-ds
%if "%{with_clamav}" == "yes"
BuildPreReq: clamav
PreReq: clamav
%endif
AutoReq: no
AutoReqProv: no
%description
MIMEDefang is a framework for filtering e-mail. It uses Sendmail's
"Milter" API, some C glue code, and some Perl code to let you write
high-performance mail filters in Perl.
%track
prog mimedefang = {
version = %{V_mimedefang}
url = http://www.mimedefang.org/node.php?id=1
regex = mimedefang-(\d+\.\d+)\.tar\.gz
}
prog mimedefang:MIME-tools = {
version = %{V_mime_tools}
url = http://www.mimedefang.org/node.php?id=1
regex = MIME-tools-(.+?)\.tar\.gz
}
%prep
%setup -q
%setup -q -T -D -a 1
%build
# configure program
%{l_shtool} subst \
-e 's,use warnings,use warnings; use lib "%{l_prefix}/lib/mimedefang",g' \
mimedefang.pl.in
CC="%{l_cc}" \
CFLAGS="%{l_cflags} %{l_cppflags}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags}" \
./configure \
--cache-file=./config.cache \
--prefix=%{l_prefix} \
--sysconfdir=%{l_prefix}/etc/mimedefang \
--with-confsubdir="" \
%if "%{with_clamav}" == "yes"
--enable-clamav \
--enable-clamd \
--disable-antivir \
--disable-vexira\
--disable-uvscan \
--disable-bdc \
--disable-sweep \
--disable-trend \
--disable-AvpLinux \
--disable-aveclient \
--disable-clamav \
--disable-fsav \
--disable-fprot \
--disable-sophie \
--disable-nvcc \
--disable-trophie \
%else
--disable-anti-virus \
%endif
--with-sendmail=%{l_prefix}/sbin/sendmail \
--with-spooldir=%{l_prefix}/var/mimedefang/spool \
--with-quarantinedir=%{l_prefix}/var/mimedefang/quarantine \
--with-user=%{l_rusr}
# build program
%{l_make} %{l_mflags} install RPM_INSTALL_ROOT=$RPM_BUILD_ROOT
# build local copy of Perl extension module
%{l_prefix}/bin/perl-openpkg prepare
%{l_prefix}/bin/perl-openpkg \
-l %{l_prefix}/lib/mimedefang \
-d MIME-tools-%{V_mime_tools} \
--args "LIBS=$RPM_BUILD_ROOT/%{l_prefix}/lib/mimedefang" \
configure build
%install
# install program
rm -rf $RPM_BUILD_ROOT
%{l_make} %{l_mflags} install RPM_INSTALL_ROOT=$RPM_BUILD_ROOT
# install local copy of Perl extension module
%{l_prefix}/bin/perl-openpkg \
-l %{l_prefix}/lib/mimedefang \
-d MIME-tools-%{V_mime_tools} \
--args "LIBS=$RPM_BUILD_ROOT/%{l_prefix}/lib/mimedefang" \
install
%{l_prefix}/bin/perl-openpkg \
-l %{l_prefix}/lib/mimedefang \
-F perl-openpkg-files \
fixate cleanup
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.mimedefang} \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# create run-time data directories
%{l_shtool} mkdir -f -p -m 750 \
$RPM_BUILD_ROOT%{l_prefix}/var/mimedefang \
$RPM_BUILD_ROOT%{l_prefix}/var/mimedefang/spool \
$RPM_BUILD_ROOT%{l_prefix}/var/mimedefang/quarantine
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/mimedefang/*' \
'%attr(750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/mimedefang' \
'%attr(750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/mimedefang/*'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT