aboutsummaryrefslogtreecommitdiffstats
path: root/mail/courier/Makefile
blob: a6a792e3b611c49c53b2e849e56f8f6503e5d7d2 (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
# New ports collection makefile for: Courier MTA
# Date created:     17 Oct 2001
# Whom:         Yarema <yds@CoolRat.org>
#
# $FreeBSD$
#

PORTNAME=   courier
PORTVERSION=    0.42.2
CATEGORIES= mail ipv6
MASTER_SITES=   ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= courier

MAINTAINER= ports@FreeBSD.org
COMMENT=    Courier SMTP IMAP POP3 HTTP mail server suite

RUN_DEPENDS=    ${LOCALBASE}/share/sysconftool/sysconftool:${PORTSDIR}/devel/sysconftool \
        ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Net/CIDR.pm:${PORTSDIR}/net/p5-Net-CIDR

.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=    62
MAILGID=    62
ETCDIR=     ${PREFIX}/etc
SYSCONFDIR= ${ETCDIR}/courier
USERDB=     ${ETCDIR}/userdb
LIBEXECDIR= ${PREFIX}/libexec
LOCALSTATEDIR=  /var/spool/courier
CACHEDIR=   /var/spool/webmail
CALENDIR=   /var/spool/calendar
MIMETYPES=  ${LOCALBASE}/etc/apache/mime.types:${LOCALBASE}/etc/apache2/mime.types

USE_BZIP2=  yes
USE_SUBMAKE=    yes
USE_PERL5=  yes
USE_GMAKE=  yes
USE_AUTOMAKE=   yes
USE_LIBTOOL=    yes
USE_OPENSSL=    yes
USE_AUTOMAKE_VER=15
CONFIGURE_ENV=  REHASH=${SCRIPTDIR}/c_rehash
CONFIGURE_ARGS= --disable-root-check --with-db=db \
        --enable-syslog=1 --enable-use-flock \
        --with-mailuser=${MAILOWN} \
        --with-mailgroup=${MAILGRP} \
        --with-mailuid=${MAILUID} \
        --with-mailgid=${MAILGID} \
        --with-etcdir=${ETCDIR} \
        --sysconfdir=${SYSCONFDIR} \
        --with-userdb=${USERDB} \
        --datadir=${DATADIR} \
        --libexecdir=${LIBEXECDIR} \
        --localstatedir=${LOCALSTATEDIR} \
        --enable-mimetypes=${MIMETYPES} \
        --enable-imageurl=${IMAGEURL} \
        --with-cachedir=${CACHEDIR} \
        --with-cacheowner=${CACHEOWN} \
        --with-calendardir=${CALENDIR} \
        --with-default-maildrop=${MAILDROPDEFAULT} \
        --enable-workarounds-for-imap-client-bugs

# Respect the make.conf(5) NOUUCP setting
WITH_TRANSPORT= local esmtp dsn
.if defined(NOUUCP)
PLIST_SUB+= SUB_UUCP="@comment "
.else
WITH_TRANSPORT+=uucp
PLIST_SUB+= SUB_UUCP=""
.endif

PKGMESSAGE= ${WRKDIR}/.PKGMESSAGE

INSTALL_TARGET= install-strip install-perms

PLIST_SUB+= BINOWN="${BINOWN}" BINGRP="${BINGRP}" \
        MAILOWN="${MAILOWN}" MAILGRP="${MAILGRP}" \
        MAILUID="${MAILUID}" MAILGID="${MAILGID}" \
        CACHEOWN="${CACHEOWN}"

SCRIPTS_ENV=    WRKDIRPREFIX="${WRKDIRPREFIX}" \
        WITH_EXPECT="${WITH_EXPECT:L}" \
        WITH_GNUPG="${WITH_GNUPG:L}" \
        WITH_ASPELL="${WITH_ASPELL:L}" \
        WITH_ISPELL="${WITH_ISPELL:L}" \
        WITH_LDAP1="${WITH_LDAP1:L}" \
        WITH_LDAP2="${WITH_LDAP2:L}" \
        WITH_MYSQL="${WITH_MYSQL:L}" \
        WITH_PGSQL="${WITH_PGSQL:L}" \
        WITH_VPOPMAIL="${WITH_VPOPMAIL:L}" \
        WITH_PROCMAIL="${WITH_PROCMAIL:L}" \
        WITH_SENDFAX="${WITH_SENDFAX:L}" \
        WITH_IPV6="${WITH_IPV6:L}" \
        WITH_TRANSPORT="${WITH_TRANSPORT}" \
        WITH_GHOSTSCRIPT_AFPL="${WITH_GHOSTSCRIPT_AFPL:no}" \
        TOUCH="${TOUCH}" \
        MKDIR="${MKDIR}"

.if exists(${WRKDIRPREFIX}${.CURDIR}/Makefile.inc)
.include "${WRKDIRPREFIX}${.CURDIR}/Makefile.inc"
.endif
.include "${.CURDIR}/Makefile.man"
.include "${.CURDIR}/Makefile.doc"
.include "${.CURDIR}/Makefile.own"

pre-everything::
    @${SETENV} ${SCRIPTS_ENV} ${SH} ${SCRIPTDIR}/configure.${PORTNAME}

pre-fetch:
.if !defined(WITH_GHOSTSCRIPT_AFPL) || ${WITH_GHOSTSCRIPT_AFPL} != yes
    @${ECHO} ""
    @${ECHO} "      Define WITH_GHOSTSCRIPT_AFPL=yes to use"
    @${ECHO} "      AFPL Postscript interpreter instead of GNU one"
    @${ECHO} ""
.endif

post-patch:
    @${PERL} -pi -e 's:\@datadir\@:\@sysconfdir\@:g;' \
        ${WRKSRC}/*/mk*cert.* \
        ${WRKSRC}/*/*/mk*cert.*
    @${PERL} -pi -e 's:^(TLS_CERTFILE=)\@datadir\@:$$1\@sysconfdir\@:g;' \
        ${WRKSRC}/*/*.dist.in \
        ${WRKSRC}/*/*/*.dist.in
    @${PERL} -pi -e 's:^(RANDFILE = )\@datadir\@\S+:$$1\@sysconfdir\@/random.tmp:g;' \
        ${WRKSRC}/*/*.cnf.in \
        ${WRKSRC}/*/*/*.cnf.in

pre-configure:
    @${SED} s:%%PREFIX%%:${PREFIX}: \
        ${.CURDIR}/pkg-message \
        > ${WRKDIR}/.PKGMESSAGE
    @${SED} s:%%PREFIX%%:${PREFIX}: \
        ${FILESDIR}/crontab \
        > ${WRKDIR}/crontab

# patch around a bug in autoconf where the INSTALL macro does
# not get set properly in directories more than one level deep
post-build:
    @${PERL} -pi -e 's:^(auth)\s+(required).*:$$1\t\t$$2\tpam_unix.so\ttry_first_pass:g; \
            s:^(account)\s+(required).*:$$1 \t$$2\tpam_unix.so:g; \
            s:^(session)\s+(required).*:$$1 \t$$2\tpam_permit.so:g;' \
        ${WRKSRC}/*/*.authpam* \
        ${WRKSRC}/*/*/*.authpam*
    @${PERL} -pi -e 's:^transform = .*freebsd.*:transform = s,x,x:;' ${WRKSRC}/Makefile ${WRKSRC}/*/Makefile ${WRKSRC}/*/*/Makefile
    @${LN} ${WRKSRC}/gpglib/README.html ${WRKSRC}/gpglib/README.gpglib.html
    @${LN} ${WRKSRC}/imap/FAQ       ${WRKSRC}/imap/FAQ.imap
    @${LN} ${WRKSRC}/imap/FAQ.html      ${WRKSRC}/imap/FAQ.imap.html
    @${LN} ${WRKSRC}/imap/README        ${WRKSRC}/imap/README.imap
    @${LN} ${WRKSRC}/imap/README.html   ${WRKSRC}/imap/README.imap.html
    @${LN} ${WRKSRC}/maildrop/README.html   ${WRKSRC}/maildrop/README.maildrop.html
    @${LN} ${WRKSRC}/pcp/README.html    ${WRKSRC}/pcp/README.pcp.html
    @${LN} ${WRKSRC}/webmail/BUGS       ${WRKSRC}/webmail/BUGS.webmail
    @${LN} ${WRKSRC}/webmail/BUGS.html  ${WRKSRC}/webmail/BUGS.webmail.html
    @${LN} ${WRKSRC}/webmail/SECURITY   ${WRKSRC}/webmail/SECURITY.webmail
    @${LN} ${WRKSRC}/webmail/SECURITY.html  ${WRKSRC}/webmail/SECURITY.webmail.html

pre-install:
    @PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL

post-install:
    @PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
    @strip ${PREFIX}/libexec/courier/modules/*/*
    @${LN} -f ${SYSCONFDIR}/maildrop ${SYSCONFDIR}/maildropfilter
    @${INSTALL_DATA} /dev/null ${SYSCONFDIR}/locallowercase
    @${INSTALL_SCRIPT} ${FILESDIR}/courier.sh ${PREFIX}/etc/rc.d
    @${INSTALL_DATA} ${WRKDIR}/crontab ${PREFIX}/etc/courier/
.for file in ${OWNER0}
    @${CHOWN} ${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 !defined(NOPORTDOCS)
    @${INSTALL} -d -o ${DOCOWN} -g ${DOCGRP} ${DOCSDIR}/html
    @${INSTALL_DATA} ${DATADIR}/htmldoc/* ${DOCSDIR}/html
.for file in ${DOCS}
    @${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
.endfor
.endif
    @${RM} -rf ${DATADIR}/htmldoc
    @for F in ${MANPREFIX}/man/man[1-9ln]/*; \
        do ${CHMOD} ${MANMODE} $$F; \
    done
    @${CHOWN} -Rh ${MANOWN}:${MANGRP} ${MANPREFIX}/man/man[1-9ln]
    @${CHOWN} -Rh ${SHAREOWN}:${SHAREGRP} ${DATADIR}
    @${CHMOD} -R a+r ${DATADIR}/courierwebadmin
    @${CHMOD} -R a-w ${DATADIR}
    @${ECHO} ""
    @${CAT} ${PKGMESSAGE}
    @${ECHO} ""

post-clean:
    @${RM} -f ${WRKDIRPREFIX}${.CURDIR}/Makefile.inc

.include <bsd.port.mk>