summaryrefslogtreecommitdiff
path: root/mail/maildrop/Makefile
blob: 003647e28cf137cf41040a63ddfa0d5c238539d6 (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
# Created by: Tom Hukins <tom@eborcom.com>
# $FreeBSD$

# The following compile-time options are available:
# WITH_AUTHLIB=yes	Enable optional support for Courier Auth Library
# WITH_FAM=yes		Enable optional support for File Alteration Monitor
# WITH_GDBM=yes		Enable database extensions using GDBM (default: off)
# MAILDROP_SUID=<uid>,
# MAILDROP_SGID=<gid>	Maildrop will be installed with suid permissions for
#			MAILDROP_SUID, and sgid permissions for MAILDROP_SGID.
# MAILDROP_TRUSTED_USERS=<user> Specify users allowed to use the -d option
# NO_MAILWRAPPER=yes	If defined, let configure guess which sendmail binary
#			to use
# MAILDROP_LOG_COLUMNS	lenght of 'File:' line in log - 8; default: 72
# WITH_DOVECOTAUTH=yes	Enable optional support for Dovecot Authentication
#			extension (http://wiki.dovecot.org/maildrop/)

PORTNAME=	maildrop
PORTVERSION=	2.6.0
PORTREVISION=	3
CATEGORIES=	mail
MASTER_SITES=	SF/courier/${PORTNAME}/${PORTVERSION}

MAINTAINER=	madpilot@FreeBSD.org
COMMENT=	Mail delivery agent (MDA) with filtering abilities

LICENSE=	GPLv3

USE_BZIP2=	yes
USES=		iconv shebangfix perl5
.if defined(.PARSEDIR)
USES+=		gmake
.endif
GNU_CONFIGURE=	yes
CONFIGURE_ARGS=	--enable-syslog=1 \
		--enable-use-flock=1 \
		--with-etcdir="${PREFIX}/etc" \
		--enable-maildirquota
CPPFLAGS+=	-I${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib

SHEBANG_FILES=	unicode/*.pl

CONFLICTS=	courier-0.65*

LIB_DEPENDS+=	pcre:${PORTSDIR}/devel/pcre

MAILDROP_LOG_COLUMNS?=	72	# lenght of 'File:' line in log

FIXDOCPATH=	liblock/lockmail.1 maildir/deliverquota.8.in \
		maildir/maildir.5 maildir/maildiracl.1.in \
		maildir/maildirkw.1 maildir/maildirmake.1.in \
		maildir/maildirquota.7 maildrop/mailbot.1 \
		maildrop/maildrop.1.in maildrop/maildropex.7 \
		maildrop/maildropfilter.7.in maildrop/maildropgdbm.7 \
		maildrop/makedat.1 maildrop/reformail.1 \
		rfc2045/makemime.1 rfc2045/reformime.1 \
		rfc2045/rfc2045.3 rfc822/rfc822.3

MAN1+=	lockmail.1 mailbot.1 maildrop-maildirmake.1 maildrop.1 makemime.1 \
	reformail.1 reformime.1
MAN5=	maildir.5
MAN7=	maildirquota.7 maildropex.7 maildropfilter.7 maildropgdbm.7
MAN8+=	maildrop-deliverquota.8
DOCS=	AUTHORS INSTALL INSTALL.html README README.html README.postfix \
	UPGRADE UPGRADE.html maildroptips.txt maildir/README.*

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

.include <bsd.port.pre.mk>

.if defined(WITH_GDBM)
LIB_DEPENDS+=		gdbm:${PORTSDIR}/databases/gdbm
CONFIGURE_ARGS+=	--with-db=gdbm
.else
CONFIGURE_ARGS+=	--with-db=db
.endif

.if defined(MAILDROP_SUID)
CONFIGURE_ARGS+=	--enable-maildrop-uid="${MAILDROP_SUID}"
.endif

.if defined(MAILDROP_SGID)
CONFIGURE_ARGS+=	--enable-maildrop-gid="${MAILDROP_SGID}"
.endif

.if !defined(NO_MAILWRAPPER)
CONFIGURE_ARGS+=	--enable-sendmail=/usr/sbin/sendmail
.endif

.if defined(WITH_FAM) || exists(${LOCALBASE}/lib/libfam.so.0)
USE_FAM=	yes
.endif

.if defined(MAILDROP_TRUSTED_USERS)
CONFIGURE_ARGS+=	--enable-trusted-users="${MAILDROP_TRUSTED_USERS}"
.endif

.if defined(WITH_DOVECOTAUTH)
PATCH_SITES+=	http://www.max.rs/ozone/
PATCHFILES+=	maildrop-2.3.0-dovecotauth.patch.txt
PATCH_DIST_STRIP=	-p1
PLIST_SUB+=	DOVECOTAUTH=""
.else
PLIST_SUB+=	DOVECOTAUTH="@comment "
.endif

post-patch:
	@${REINPLACE_CMD} -e "s/l= 72 - szbuf.Length();/l= ${MAILDROP_LOG_COLUMNS} - szbuf.Length();/" \
		${WRKSRC}/maildrop/log.C
.for f in ${FIXDOCPATH}
	@${REINPLACE_CMD} -e "s|\\\%\[set \$$man\.base\.url\.for\.relative\.links\]|${DOCSDIR}|" \
		-e "s/\(maildirmake.html\)/maildrop-\1/" \
		-e "s/\(deliverquota.html\)/maildrop-\1/" ${WRKSRC}/${f}
.endfor
.if defined(WITH_AUTHLIB)
	@${REINPLACE_CMD} -e 's|@LIBS@|@LIBS@ -rpath=:${LOCALBASE}/lib/courier-authlib|' \
		${WRKSRC}/maildrop/Makefile.in
.if exists(${.CURDIR}/../../security/courier-authlib/Makefile.dep)
.include "${.CURDIR}/../../security/courier-authlib/Makefile.dep"
.endif
BUILD_DEPENDS+=	courierauthconfig:${PORTSDIR}/security/courier-authlib-base
RUN_DEPENDS+=	courierauthconfig:${PORTSDIR}/security/courier-authlib-base
CONFIGURE_ARGS+=	--enable-authlib
.else
CONFIGURE_ARGS+=	--disable-authlib
.endif

.if defined(NOPORTDOCS)
# Just install the binary and man pages, no extra documentation
INSTALL_TARGET=	install-maildrop install-deliverquota install-man
.else
INSTALL_TARGET=	install-strip
.endif

post-install:
	${INSTALL_DATA} ${WRKSRC}/maildir/quotawarnmsg \
		${PREFIX}/etc/quotawarnmsg.sample
.if !defined(NOPORTDOCS)
	cd ${WRKSRC} && ${INSTALL_DATA} ${DOCS} ${DOCSDIR}
.if defined(WITH_DOVECOTAUTH)
	${INSTALL_DATA} ${WRKSRC}/README.dovecotauth ${DOCSDIR}
.endif
.endif
.if defined(MAILDROP_SUID)
	${CHMOD} u+s ${PREFIX}/bin/maildrop
.endif
.if defined(MAILDROP_SGID)
	${CHMOD} g+s ${PREFIX}/bin/maildrop
.endif

.include <bsd.port.post.mk>