summaryrefslogtreecommitdiff
path: root/mail/courier-imap/Makefile
blob: 36676cf8aa7367f3dca6e813d9ece3dfa6b51499 (plain)
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
# $NetBSD: Makefile,v 1.29 2004/05/12 23:40:12 wiz Exp $

DISTNAME=	courier-imap-2.2.1
PKGREVISON=	1

COMMENT=	IMAP server for access to Maildir-style mailboxes
HOMEPAGE=	http://www.inter7.com/courierimap/

DEPENDS+=	courier-auth>=${BASE_VERS}:../../mail/courier-auth
DEPENDS+=	courier-maildirmake>=${BASE_VERS}:../../mail/courier-maildirmake

USE_BUILDLINK3=		yes
USE_LANGUAGES=		c c++
USE_PERL5=		yes
REPLACE_PERL=		sysconftool

USE_PKGINSTALL=		yes
DEINSTALL_EXTRA_TMPL+=	${.CURDIR}/DEINSTALL
INSTALL_EXTRA_TMPL=	${.CURDIR}/../courier-auth/INSTALL

.include "../courier-auth/Makefile.common"

CONFIGURE_ENV+=		OPENSSL=${SSLBASE}/bin/openssl

INSTALL_MAKE_FLAGS=	${MAKE_FLAGS} sysconfdir=${EGDIR}

SYSCONFTOOL=		${PREFIX}/sbin/imapd.sysconftool
GEN_FILES=		imapd imapd-ssl pop3d pop3d-ssl
SSLCNF_FILES=		imapd.cnf pop3d.cnf
FILES_SUBST+=		SYSCONFTOOL=${SYSCONFTOOL:Q}
FILES_SUBST+=		SSLCERTS=${SSLCERTS}
FILES_SUBST+=		GEN_FILES=${GEN_FILES:Q}

CONF_FILES_PERMS=	# empty
.for FILE in ${GEN_FILES}
CONF_FILES_PERMS+=	${EGDIR}/${FILE}.dist ${PKG_SYSCONFDIR}/${FILE}	\
			${ROOT_USER} ${ROOT_GROUP} 0600
.endfor
.for FILE in ${SSLCNF_FILES}
CONF_FILES_PERMS+=	${EGDIR}/${FILE} ${PKG_SYSCONFDIR}/${FILE}	\
			${ROOT_USER} ${ROOT_GROUP} 0600
.endfor
RCD_SCRIPTS=		courierimap courierimaps courierpop courierpops

.include "../../security/openssl/buildlink3.mk"
.include "../../mk/bdb.buildlink3.mk"

pre-configure:
	cd ${WRKSRC}; for file in					\
		imap/imapd.dist.in imap/imapd-ssl.dist.in		\
		imap/pop3d.dist.in imap/pop3d-ssl.dist.in		\
		imap/imapd.cnf.in imap/pop3d.cnf.in			\
		imap/mkimapdcert.in imap/mkpop3dcert.in;		\
	do								\
		${SED}	-e "s|^IMAPDSTART=.*|IMAPDSTART=YES|g"		\
			-e "s|^IMAPDSSLSTART=.*|IMAPDSSLSTART=YES|g"	\
			-e "s|^POP3DSTART=.*|POP3DSTART=YES|g"		\
			-e "s|^POP3DSSLSTART=.*|POP3DSSLSTART=YES|g"	\
			-e "s|@datadir@/imapd.pem|${SSLCERTS}/imapd.pem|g" \
			-e "s|@datadir@/imapd.rand|@sysconfdir@/imapd.rand|g" \
			-e "s|@datadir@/pop3d.pem|${SSLCERTS}/pop3d.pem|g" \
			-e "s|@datadir@/pop3d.rand|@sysconfdir@/pop3d.rand|g" \
			$${file} > $${file}.fixed;			\
		${MV} -f $${file}.fixed $${file};			\
	done

post-install:
	${INSTALL_DATA_DIR} ${EGDIR}
	${INSTALL_DATA_DIR} ${DOCDIR}
	${INSTALL_SCRIPT} ${WRKSRC}/sysconftool ${SYSCONFTOOL}
	${INSTALL_DATA} ${WRKSRC}/imap/BUGS ${DOCDIR}/BUGS.imap
	${INSTALL_DATA} ${WRKSRC}/imap/README ${DOCDIR}/README.imap
	${INSTALL_DATA} ${WRKSRC}/imap/imapd.authpam ${EGDIR}
	${INSTALL_DATA} ${WRKSRC}/imap/pop3d.authpam ${EGDIR}

.include "../../mk/bsd.pkg.mk"