aboutsummaryrefslogtreecommitdiffstats
path: root/mail/courier/Makefile
blob: c5e7b00a5139b0cd331966bff20430d193a2efaa (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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# Created by: Yarema <yds@CoolRat.org>
# $FreeBSD$

PORTNAME=   courier
PORTVERSION=    0.65.3
PORTREVISION=   1
CATEGORIES= mail ipv6
MASTER_SITES=   SF

MAINTAINER= bsd@dino.sk
COMMENT=    Courier SMTP IMAP POP3 HTTP mail server suite

BUILD_DEPENDS=  courierauthconfig:${PORTSDIR}/security/courier-authlib-base
LIB_DEPENDS=    pcre:${PORTSDIR}/devel/pcre
RUN_DEPENDS=    courierauthconfig:${PORTSDIR}/security/courier-authlib-base \
        ${LOCALBASE}/share/sysconftool/sysconftool:${PORTSDIR}/devel/sysconftool \
        ${LOCALBASE}/etc/mime.types:${PORTSDIR}/misc/mime-support \
        p5-Net-CIDR>=0:${PORTSDIR}/net-mgmt/p5-Net-CIDR \
        ca_root_nss>=3.*:${PORTSDIR}/security/ca_root_nss

CONFLICTS=  courier-imap-2.* couriermlm-0.* \
        exim-4.* maildrop-1.* \
        postfix-1.* postfix-2.* \
        qmail-*-1.* qmail-1.* \
        sendmail-*-8.* sendmail-8.* \
        smail-3.* sqwebmail-3.* \
        zmailer-2.*

.if !defined(BATCH) && !defined(PACKAGE_BUILDING)
IS_INTERACTIVE= yes
.endif

#
# User-serviceable variables
#
# [ There's no need to add trailing ``/''s ]
#
# set IMAGEURL to where on the web server URL the images are found
# set CACHEOWN to who you'd like to own the cache files
# set MAILDROPDEFAULT to what you'd like the $DEFAULT in maildrop to be
#     recomended values are: /var/mail, ./Mailbox or ./Maildir
#
IMAGEURL?=  /webmail
CACHEOWN?=  pop
MAILDROPDEFAULT?=./Maildir
# End of user-serviceable variables
MAILOWN=    courier
MAILGRP=    courier
MAILUID=    465
MAILGID=    465
ETCDIR=     ${PREFIX}/etc
SYSCONFDIR= ${ETCDIR}/courier
LIBEXECDIR= ${PREFIX}/libexec
LOCALSTATEDIR=  /var/spool/courier
CACHEDIR=   /var/spool/webmail
CALENDIR=   /var/spool/calendar
MIMETYPES=  ${LOCALBASE}/etc/mime.types
WITH_TRANSPORT= local esmtp dsn

USE_AUTOTOOLS=  libtool aclocal automake
AUTOMAKE_ARGS=  --add-missing
USE_BZIP2=  yes
USE_GCC=    any
USE_FAM=    yes
USES=       gettext pkgconfig gmake perl5
USE_OPENSSL=    yes
USE_SUBMAKE=    yes

USE_RC_SUBR=    courier

CPPFLAGS+=  -I${LOCALBASE}/include
LDFLAGS+=   -L${LOCALBASE}/lib
MAKE_ENV:=  ${CONFIGURE_ENV}

CONFIGURE_ARGS= --disable-root-check \
        --with-db=db \
        --enable-syslog=1 --enable-use-flock \
        --program-transform-name=s,^,, \
        --enable-utf7-folder-encoding \
        --enable-unicode \
        --with-mailuser=${MAILOWN} \
        --with-mailgroup=${MAILGRP} \
        --with-mailuid=${MAILUID} \
        --with-mailgid=${MAILGID} \
        --with-etcdir=${ETCDIR} \
        --sysconfdir=${SYSCONFDIR} \
        --datadir=${DATADIR} \
        --libexecdir=${LIBEXECDIR} \
        --localstatedir=${LOCALSTATEDIR} \
        --enable-mimetypes=${MIMETYPES} \
        --enable-imageurl=${IMAGEURL} \
        --with-cachedir=${CACHEDIR} \
        --with-cacheowner=${CACHEOWN} \
        --with-calendardir=${CALENDIR} \
        --with-certsdir=${SYSCONFDIR} \
        --with-transport='${WITH_TRANSPORT}' \
        --with-default-maildrop=${MAILDROPDEFAULT} \
        --with-paranoid-smtpext \
        --enable-workarounds-for-imap-client-bugs \
        --cache-file=${WRKDIR}/courier.cache

INSTALL_TARGET= install-strip install-perms

PLIST_SUB+= BINOWN="${BINOWN}" BINGRP="${BINGRP}" \
        MAILOWN="${MAILOWN}" MAILGRP="${MAILGRP}" \
        MAILUID="${MAILUID}" MAILGID="${MAILGID}" \
        CACHEOWN="${CACHEOWN}" CACHEDIR="${CACHEDIR}" \
        CALENDIR="${CALENDIR}" LOCALSTATEDIR="${LOCALSTATEDIR}"
SUB_LIST:=  ${PLIST_SUB}
SUB_FILES+= pkg-install pkg-message crontab sharedindexupdate

OPTIONS_DEFINE= LDAP GNUPG PROCMAIL SENDFAX UUCP IPV6 MAILDROPFLAGS \
        WEBMAILFLAGS WEBMAILRSENT
OPTIONS_GROUP=  EXPERIMENTAL
OPTIONS_GROUP_EXPERIMENTAL= WEBMAILXFACE
OPTIONS_RADIO=  ALIASES SPELL
OPTIONS_RADIO_ALIASES=  SYSTEMALIASES EMPTYALIASES
OPTIONS_RADIO_SPELL=    ASPELL ISPELL

OPTIONS_DEFAULT=WEBMAILRSENT SYSTEMALIASES

LDAP_DESC=  LDAP-based mail aliasing support
GNUPG_DESC= GNU Privacy Guard support for WebMail
ASPELL_DESC=    ASpell support for WebMail
ISPELL_DESC=    ISpell support for WebMail
PROCMAIL_DESC=  Procmail local delivery support
SENDFAX_DESC=   mgetty+sendfax support
UUCP_DESC=  UUCP support
MAILDROPFLAGS_DESC= maildrop set flags patch
WEBMAILFLAGS_DESC=  webmail show flags patch
WEBMAILXFACE_DESC=  experimental webmail X-Face patch
WEBMAILRSENT_DESC=  enable Autorename Sent folder
SYSTEMALIASES_DESC= symlink system /etc/aliases
EMPTYALIASES_DESC=  create empty aliases file

NO_STAGE=   yes
.include <bsd.port.options.mk>
.include "${.CURDIR}/Makefile.doc"
.include "${.CURDIR}/Makefile.man"
.include "${.CURDIR}/Makefile.own"

.if ${PORT_OPTIONS:MLDAP}
USE_OPENLDAP=   yes
WITH_AUTH_LDAP= yes
RUN_DEPENDS+=   ${LOCALBASE}/lib/courier-authlib/libauthldap.so:${PORTSDIR}/net/courier-authlib-ldap
CONFIGURE_ARGS+=--with-ldapaliasd
PLIST_SUB+= WITHLDAP=""
SUB_LIST+=  WITHLDAP=""
.else
CONFIGURE_ARGS+=--without-ldapaliasd
PLIST_SUB+= WITHLDAP="@comment "
SUB_LIST+=  WITHLDAP="@comment "
.endif

.if ${PORT_OPTIONS:MSYSTEMALIASES}
PLIST_SUB+= WITHSYSTEMALIASES=""
SUB_LIST+=  WITHSYSTEMALIASES=""
.else
PLIST_SUB+= WITHSYSTEMALIASES="@comment "
SUB_LIST+=  WITHSYSTEMALIASES="@comment "
.endif

.if ${PORT_OPTIONS:MEMPTYALIASES}
PLIST_SUB+= WITHEMPTYALIASES=""
SUB_LIST+=  WITHEMPTYALIASES=""
.else
PLIST_SUB+= WITHEMPTYALIASES="@comment "
SUB_LIST+=  WITHEMPTYALIASES="@comment "
.endif

.if exists(${.CURDIR}/../../security/courier-authlib/Makefile.dep)
.include "${.CURDIR}/../../security/courier-authlib/Makefile.dep"
.endif

.if ${PORT_OPTIONS:MGNUPG}
BUILD_DEPENDS+= gpg:${PORTSDIR}/security/gnupg
RUN_DEPENDS+=   gpg:${PORTSDIR}/security/gnupg
.endif

.if ${PORT_OPTIONS:MASPELL}
BUILD_DEPENDS+= aspell:${PORTSDIR}/textproc/aspell
RUN_DEPENDS+=   aspell:${PORTSDIR}/textproc/aspell
CONFIGURE_ARGS+=--with-ispell=${LOCALBASE}/bin/aspell
.elif ${PORT_OPTIONS:MISPELL}
BUILD_DEPENDS+= ispell:${PORTSDIR}/textproc/ispell
RUN_DEPENDS+=   ispell:${PORTSDIR}/textproc/ispell
CONFIGURE_ARGS+=--with-ispell=${LOCALBASE}/bin/ispell
.else
CONFIGURE_ARGS+=--without-ispell
.endif

.if ${PORT_OPTIONS:MPROCMAIL}
BUILD_DEPENDS+= procmail:${PORTSDIR}/mail/procmail
RUN_DEPENDS+=   procmail:${PORTSDIR}/mail/procmail
.endif

.if ${PORT_OPTIONS:MSENDFAX}
USE_GHOSTSCRIPT=yes
SENDFAX_DEPENDS=sendfax:${PORTSDIR}/comms/mgetty+sendfax \
        pnmscale:${PORTSDIR}/graphics/netpbm
BUILD_DEPENDS+= ${SENDFAX_DEPENDS}
RUN_DEPENDS+=   ${SENDFAX_DEPENDS}
WITH_TRANSPORT+=fax
PLIST_SUB+= WITHFAX=""
SUB_LIST+=  WITHFAX=""
.else
PLIST_SUB+= WITHFAX="@comment "
SUB_LIST+=  WITHFAX="@comment "
.endif

.if ${PORT_OPTIONS:MUUCP}
.if !exists(/usr/bin/uux)
BUILD_DEPENDS+= uux:${PORTSDIR}/net/freebsd-uucp
RUN_DEPENDS+=   uux:${PORTSDIR}/net/freebsd-uucp
.endif
WITH_TRANSPORT+=uucp
PLIST_SUB+= WITHUUCP=""
.else
PLIST_SUB+= WITHUUCP="@comment "
.endif

.if ${PORT_OPTIONS:MIPV6}
CONFIGURE_ARGS+=--with-ipv6
.else
CONFIGURE_ARGS+=--without-ipv6
.endif

.if ${PORT_OPTIONS:MMAILDROPFLAGS}
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-maildrop__maildir.C
.endif

.if ${PORT_OPTIONS:MWEBMAILXFACE}
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-webmail__msg2html.c
.endif

.if ${PORT_OPTIONS:MWEBMAILFLAGS}
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-webmail__folder.c ${FILESDIR}/extra-patch-webmail__maildir.c
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-webmail__maildir.h ${FILESDIR}/extra-patch-webmail__images__sqwebmail.css
.endif

.if ${PORT_OPTIONS:MWEBMAILRSENT}
CONFIGURE_ARGS+=--enable-autorenamesent
.else
CONFIGURE_ARGS+=--disable-autorenamesent
.endif

pre-everything::
    @${ECHO_MSG} "===> --------------------------------------------------------"
    @${ECHO_MSG} "===>  Run 'make config' to (re)configure ${PKGNAME}"
    @${ECHO_MSG} "===> --------------------------------------------------------"

pre-patch:
    @${CP} ${TEMPLATES}/config.guess ${TEMPLATES}/config.sub ${WRKSRC}

post-patch:
    @${REINPLACE_CMD} -e 's|^PROG=\./|PROG=exec ./|g' \
        ${WRKSRC}/courier/module.*/courier.config
    @${REINPLACE_CMD} -e 's|@mydatadir@|@sysconfdir@|g' \
        ${WRKSRC}/*/mk*cert.* \
        ${WRKSRC}/*/*/mk*cert.*
    @${REINPLACE_CMD} -e 's|^\(TLS_CERTFILE=\)@mydatadir@|\1@sysconfdir@|g' \
        ${WRKSRC}/*/*.dist.in \
        ${WRKSRC}/*/*/*.dist.in
    @${REINPLACE_CMD} -e 's|^\(RANDFILE[[:space:]]*=[[:space:]]*\)@mydatadir@|\1@sysconfdir@|g' \
        ${WRKSRC}/*/*.cnf.openssl.in \
        ${WRKSRC}/*/*/*.cnf.openssl.in
    @${REINPLACE_CMD} -e 's|$$(INSTALL_DATA) \(.$$$$file.\)|${INSTALL_MAN} \1|' \
        ${WRKSRC}/Makefile.in \
        ${WRKSRC}/*/Makefile.in \
        ${WRKSRC}/*/*/Makefile.in \
        ${WRKSRC}/*/*/*/Makefile.in
    @${REINPLACE_CMD} -e 's|^\(INSTALL_STRIP_PROGRAM=\).*$$|\1"${INSTALL_PROGRAM} -s"|' \
            -e 's|; ldapaliasd="yes"||' \
        ${WRKSRC}/configure \
        ${WRKSRC}/*/configure \
        ${WRKSRC}/*/*/configure \
        ${WRKSRC}/*/*/*/configure
    @${REINPLACE_CMD} -E -e 's/(root|bin)[[:space:]]*bin/root   wheel/g' \
        ${WRKSRC}/courier/perms.sh.in

pre-configure:
    @if [ -f "${WRKDIR}/courier.cache" -a -s "${WRKDIR}/courier.cache" ]; then \
        ${RM} -f "${WRKDIR}/courier.cache"; \
    fi
    @cp ${LOCALBASE}/share/gettext/po/Makefile.in.in ${WRKSRC}/pcp/po
    @cp ${LOCALBASE}/share/libtool/config/ltmain.sh ${WRKSRC}
.for oldlt in . bdbobj cgi courier courier/libs courier/filters courier/filters/perlfilter courier/module.dsn courier/module.esmtp courier/module.local courier/module.uucp gdbmobj gpglib http11 imap ldapaddressbook libhmac liblock maildir maildrop makedat md5 numlib pcp random128 rfc822 rfc1035 rfc2045 sha1 tcpd unicode webmail
    @cd ${WRKSRC}/${oldlt} && ${SETENV} ${SCRIPTS_ENV} ${SH} /usr/local/bin/aclocal
.endfor

post-build:
    @${PERL} -pi -e 's|^(auth)\s+(required).*|$$1\t\t$$2\tpam_unix.so\ttry_first_pass|g;' \
             -e 's|^(account)\s+(required).*|$$1 \t$$2\tpam_unix.so|g;' \
             -e 's|^(session)\s+(required).*|$$1 \t$$2\tpam_permit.so|g;' \
        ${WRKSRC}/*/*.authpam* \
        ${WRKSRC}/*/*/*.authpam*
    @${LN} -f ${WRKSRC}/gpglib/README.html      ${WRKSRC}/gpglib/README.gpglib.html
    @${LN} -f ${WRKSRC}/imap/BUGS           ${WRKSRC}/imap/BUGS.imap
    @${LN} -f ${WRKSRC}/imap/BUGS.html      ${WRKSRC}/imap/BUGS.imap.html
    @${LN} -f ${WRKSRC}/imap/README         ${WRKSRC}/imap/README.imap
    @${LN} -f ${WRKSRC}/imap/README.html        ${WRKSRC}/imap/README.imap.html
    @${LN} -f ${WRKSRC}/maildrop/README.html    ${WRKSRC}/maildrop/README.maildrop.html
    @${LN} -f ${WRKSRC}/pcp/README.html     ${WRKSRC}/pcp/README.pcp.html
    @${LN} -f ${WRKSRC}/webmail/BUGS        ${WRKSRC}/webmail/BUGS.webmail
    @${LN} -f ${WRKSRC}/webmail/BUGS.html       ${WRKSRC}/webmail/BUGS.webmail.html
    @${LN} -f ${WRKSRC}/webmail/SECURITY        ${WRKSRC}/webmail/SECURITY.webmail
    @${LN} -f ${WRKSRC}/webmail/SECURITY.html   ${WRKSRC}/webmail/SECURITY.webmail.html

post-install:
    @${LN} -f ${SYSCONFDIR}/maildrop ${SYSCONFDIR}/maildropfilter
    @${INSTALL_DATA} /dev/null ${SYSCONFDIR}/locallowercase
    @${INSTALL_DATA} ${WRKDIR}/crontab ${SYSCONFDIR}/
    @${INSTALL_SCRIPT} ${WRKDIR}/sharedindexupdate ${DATADIR}/
.for file in ${OWNER0}
    @-${CHOWN} -Rh ${BINOWN}:${BINGRP} ${PREFIX}/${file}
.endfor
    @${GREP} '^@exec ' ${TMPPLIST} \
        | ${SED} -e 's:^@exec ::' -e 's:%D:${PREFIX}:g' \
        > ${WRKDIR}/.PLIST.exec \
        && ${SH} ${WRKDIR}/.PLIST.exec
.if ${PORT_OPTIONS:MDOCS}
    @${INSTALL} ${_DOCOWNGRP} -d ${DOCSDIR}/html
.for f in ${DOCS}
    @${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
.endfor
.for f in ${HTMLDOCS}
    @${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}/html
.endfor
    @${INSTALL_DATA} ${DATADIR}/htmldoc/* ${DOCSDIR}/html
.endif
    @${RM} -rf ${DATADIR}/htmldoc
    @-${CHOWN} -Rh ${SHAREOWN}:${SHAREGRP} ${DATADIR}
    @${CHMOD} -R a+r ${DATADIR}/courierwebadmin
    @${CHMOD} -R a-w ${DATADIR} ${LIBEXECDIR}/courier
    @${CHMOD} 550 ${LIBEXECDIR}/courier/modules/esmtp/courieresmtp*
    @${ECHO_MSG}
    @${CAT} ${PKGMESSAGE}
    @${ECHO_MSG}
.if defined(BATCH) || defined(PACKAGE_BUILDING)
    @${ECHO_MSG} "  To activate Courier in /etc/mail/mailer.conf or to"
    @${ECHO_MSG} "  replace {sendmail,mailq,newaliases} with Courier"
    @${ECHO_MSG} "  versions execute the following as root user:"
    @${ECHO_MSG}
    @${ECHO_MSG} "PKG_PREFIX=\"${PREFIX}\" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL"
    @${ECHO_MSG}
.else
    @PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.endif

.include <bsd.port.mk>