##
##  dcc.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  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.
##

#   FIXME: rse: TODO: builds fine, but config, rc scripts, etc is missing for daemons

#   package information
Name:         dcc
Summary:      Distributed Checksum Clearinghouse (DCC)
URL:          http://www.rhyolite.com/anti-spam/dcc/
Vendor:       Rhyolite Software, LLC
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Mail
License:      Open Source
Version:      1.3.102
Release:      20090112

#   list of sources
Source0:      http://www.rhyolite.com/dcc/source/dcc-%{version}.tar.Z
Patch0:       dcc.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, gcc
PreReq:       OpenPKG, openpkg >= 20160101
BuildPreReq:  milter
PreReq:       milter

%description
    The Distributed Checksum Clearinghouse (DCC) is an anti-spam
    content filter that runs on a variety of operating systems. The
    DCC can be used by SMTP servers and mail user agents to detect
    and reject or filter spam or unsolicited bulk mail. DCC servers
    exchange or "flood" common checksums. The checksums include values
    that are constant across common variations in bulk messages,
    including "personalizations". The idea of the DCC is that if mail
    recipients could compare the mail they receive, they could recognize
    unsolicited bulk mail. A DCC server totals reports of checksums of
    messages from clients and answers queries about the total counts for
    checksums of mail messages. A DCC client reports the checksums for a
    mail message to a server and is told the total number of recipients
    of mail with each checksum. If one of the totals is higher than a
    threshold set by the client and according to local whitelists the
    message is unsolicited, the DCC client can log, discard, or reject
    the message.

%track
    prog dcc = {
        version   = %{version}
        url       = http://www.rhyolite.com/anti-spam/dcc/source/
        regex     = dcc-(__VER__)\.tar\.Z
    }

%prep
    %setup -q
    %patch -p0

%build
    CC="%{l_cc}" \
    CFLAGS="%{l_cflags -O}" \
    CPPFLAGS="%{l_cppflags}" \
    LDFLAGS="%{l_ldflags}" \
    ./configure \
        --homedir=%{l_prefix}/var/dcc/db \
        --bindir=%{l_prefix}/bin \
        --libexecdir=%{l_prefix}/libexec/dcc \
        --mandir=%{l_prefix}/man \
        --with-updatedcc_pfile=%{l_prefix}/var/dcc/updatecc.pfile \
        --with-installroot=$RPM_BUILD_ROOT \
        --with-DCC-MD5 \
        --with-uid=%{l_rusr} \
        --enable-server \
        --enable-dccifd \
        --enable-dccm \
        --with-sendmail=%{l_prefix} \
        --with-cgibin=%{l_prefix}/cgi/dcc \
        --with-rundir=%{l_prefix}/var/dcc/run \
        --with-db-memory=64 \
        --with-max-db-mem=128 \
        --with-max-log-size=0
    %{l_make} %{l_mflags}

%install
    %{l_make} %{l_mflags} install \
        DCC_SUID=`%{l_shtool} echo -e '%u'` \
        DCC_OWN=`%{l_shtool} echo -e '%u'` \
        DCC_GRP=`%{l_shtool} echo -e '%g'`
    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

