aboutsummaryrefslogtreecommitdiffstats
path: root/mail/dspam-devel/Makefile
blob: 527d2ba98d13aaf30a790d8c2261dc47b4be9d17 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# New ports collection makefile for:    dspam
# Date created:         3 August 2003
# Whom:             Dominic Marks <dom@wirespeed.org.uk>
#
# $FreeBSD$
#

PORTNAME=   dspam
PORTVERSION=    2.10.6
CATEGORIES= mail
MASTER_SITES=   http://www.nuclearelephant.com/projects/dspam/sources/

MAINTAINER= rob@debank.tv
COMMENT=    A server-side bayesian spam filter

OPTIONS=    MYSQL "Use MySQL and not db4 as database" off \
        MYSQL_COMPRESS "Compress dspam <--> MySQL" off \
        MAILDROP "Use Maildrop as local delivery agent" off \
        PROCMAIL "Use Procmail as local delivery agent" off \
        SENDMAIL_LDA "Use Sendmail as local delivery agent" off \
        SENDMAIL "Play nice with sendmail server" off \
        QMAIL "Play nice with Qmail mail server" off \
        ENABLE_SPAM_DELIVERY "Deliver messages marked as spam" off \
        SIGNATURE_HEADERS "Put signatures in the header" off \
        WHITELIST "Automatic whitelisting of ham" off \
        OPT_IN  "Enable opt in" off \
        TRUSTED_USERS "Disable trusted user security" off \
        TUM "Enables TuM (Train until Mature)" off \
        ALT_BAYESIAN "Enable alternative-bayesian" on \
        NO_BIAS "Disable bias" off \
        VIRT_USERS "Enable virtual users (needs MYSQL)" off \
        SAT "Enable spam source address logging" off \
        VERBOSE_DEBUG "Enable verbose debug" off

USE_LIBTOOL_VER=13
USE_REINPLACE=  yes
INSTALLS_SHLIB= yes
GNU_CONFIGURE=  yes
CONFIGURE_ENV=  LDFLAGS="-L${LOCALBASE}/lib"
CONFIGURE_TARGET=   --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}

SED_SCRIPT= -e 's,%%DOCSDIR%%,${DOCSDIR},g' \
        -e 's,%%EXAMPLESDIR%%,${EXAMPLESDIR},g' \
        -e 's,%%LOCALBASE%%,${LOCALBASE},g'

WITH_SIGNATURE_LIFE?=   28

.include <bsd.port.pre.mk>

.if defined(WITH_MYSQL)
USE_MYSQL=  yes
CONFIGURE_ARGS+=    --with-storage-driver=mysql_drv \
        --with-mysql-includes=${LOCALBASE}/include/mysql \
        --with-mysql-libraries=${LOCALBASE}/lib/mysql
PLIST_SUB+= DB4="@comment "
PLIST_SUB+= MYSQL=""
SED_SCRIPT+=    -e 's,%%MYSQL%%,,g'
.else
LIB_DEPENDS+=   db41.1:${PORTSDIR}/databases/db41
CONFIGURE_ARGS+=    --with-db4-includes=${LOCALBASE}/include/db41
PLIST_SUB+= DB4=""
PLIST_SUB+= MYSQL="@comment "
SED_SCRIPT+=    -e '/%%MYSQL%%/D'
.endif

.if defined(WITH_MYSQL_COMPRESS)
CONFIGURE_ARGS+=    --enable-client-compression
.endif

.if defined(DSPAM_USERDIR)
CONFIGURE_ARGS+=--with-userdir=${DSPAM_USERDIR}
.else
CONFIGURE_ARGS+=--with-userdir=${PREFIX}/etc/dspam
.endif

.if defined(WITH_MAILDROP)
RUN_DEPENDS+=   maildrop:${PORTSDIR}/mail/maildrop
CONFIGURE_ARGS+=    --with-local-delivery-agent='${LOCALBASE}/bin/maildrop $u'
.endif

.if defined(WITH_PROCMAIL)
RUN_DEPENDS+=   procmail:${PORTSDIR}/mail/procmail
CONFIGURE_ARGS+=    --with-local-delivery-agent='${LOCALBASE}/bin/procmail $u'
.endif

.if defined(WITH_SENDMAIL_LDA) && exists(/usr/sbin/sendmail)
CONFIGURE_ARGS+=    --with-local-delivery-agent=/usr/sbin/sendmail
.else
.if defined(WITH_SENDMAIL_LDA) && exists(${LOCALBASE}/sbin/sendmail)
CONFIGURE_ARGS+=    --with-local-delivery-agent='${LOCALBASE}/sbin/sendmail'
.endif
.endif

.if defined(WITH_SENDMAIL)
CONFIGURE_ARGS+=    --with-dspam-mode=4511
.endif

.if defined(WITH_QMAIL)
CONFIGURE_ARGS+=    --with-dspam-mode=4511
.endif

.if defined(WITH_SIGNATURE_LIFE)
CONFIGURE_ARGS+=    --with-signature-life=${WITH_SIGNATURE_LIFE}
.endif

.if defined(WITH_ENABLE_SPAM_DELIVERY)
CONFIGURE_ARGS+=    --enable-spam-delivery
.endif

.if defined(WITH_SIGNATURE_HEADERS)
CONFIGURE_ARGS+=    --enable-signature-headers
.endif

.if defined(WITH_WHITELIST)
CONFIGURE_ARGS+=    --enable-whitelist
.endif

.if defined(WITH_OPT_IN)
CONFIGURE_ARGS+=    --enable-opt-in
.endif

.if defined(WITH_TRUSTED_USERS)
CONFIGURE_ARGS+=    --disable-trusted-user-security
.endif

.if defined(WITH_TUM)
CONFIGURE_ARGS+=    --enable-tum
.endif

.if defined(WITH_ALT_BAYESIAN)
CONFIGURE_ARGS+=    --enable-alternative-bayesian
.endif

.if defined(WITH_NO_BIAS)
CONFIGURE_ARGS+=    --disable-bias
.endif

.if defined(WITH_VIRT_USERS)
CONFIGURE_ARGS+=    --enable-virtual-users
.endif

.if defined(WITH_SAT)
CONFIGURE_ARGS+=    --enable-source-address-tracking
.endif

.if defined(WITH_VERBOSE_DEBUG)
CONFIGURE_ARGS+=    --enable-verbose-debug
.endif

DOCS=       CHANGE README

post-patch:
    @${REINPLACE_CMD} -e 's|%%LIBTOOLFLAGS%%|${LIBTOOLFLAGS}|g ; \
        s|-ldb-4.1|-ldb41|g' ${WRKSRC}/configure

pre-configure:
.if defined(WITH_MAILDROP) && (defined(WITH_PROCMAIL) || defined(WITH_SENDMAIL_LDA))
    @${ECHO_CMD} "You can only use one local delivery agent at once."
    @${FALSE}
.endif
.if defined(WITH_PROCMAIL) && (defined(WITH_MAILDROP) || defined(WITH_SENDMAIL_LDA))
    @${ECHO_CMD} "You can only use one local delivery agent at once."
    @${FALSE}
.endif
.if !defined(WITH_MYSQL) && (defined(WITH_MYSQL_COMPRESS) || defined(WITH_VIRT_USERS))
    @${ECHO_CMD} "You need MySQL support to use this feature."
    @${FALSE}
.endif

post-install:
.if defined(WITH_MYSQL)
    @${MKDIR} ${EXAMPLESDIR}
    cd ${WRKSRC}/tools.mysql_drv && \
        ${INSTALL_DATA} README *.sql* ${EXAMPLESDIR}
    ${INSTALL_DATA} ${FILESDIR}/mysql.data ${EXAMPLESDIR}
.endif
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
    cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${DOCSDIR}
.endif
    @${SED} ${SED_SCRIPT} ${PKGMESSAGE}

.include <bsd.port.post.mk>