pkgsrc/mail/cyrus-imapd/Makefile
2005-12-05 23:55:01 +00:00

181 lines
5.6 KiB
Makefile

# $NetBSD: Makefile,v 1.58 2005/12/05 23:55:10 rillig Exp $
DISTNAME= cyrus-imapd-2.2.12
PKGREVISION= 2
CATEGORIES= mail
MASTER_SITES= ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ \
ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/OLD-VERSIONS/imap/
MAINTAINER= recht@NetBSD.org
HOMEPAGE= http://asg.web.cmu.edu/cyrus/imapd/
COMMENT= Cyrus IMAP server
USE_PKGLOCALEDIR= yes
GNU_CONFIGURE= yes
PERL5_CONFIGURE= no
BDB_ACCEPTED= db4 db3
USE_PKGINSTALL= yes
DEINSTALL_EXTRA_TMPL+= ${.CURDIR}/DEINSTALL
.include "../../mk/bsd.prefs.mk"
# CYRUS_USER username of the Cyrus administrator
# CYRUS_GROUP group of the Cyrus administrator
#
CYRUS_USER?= cyrus
CYRUS_GROUP?= mail
BUILD_DEFS+= CYRUS_USER CYRUS_GROUP
FILES_SUBST+= CYRUS_USER=${CYRUS_USER:Q}
FILES_SUBST+= CYRUS_GROUP=${CYRUS_GROUP:Q}
CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR:Q}
CONFIGURE_ARGS+= --with-cyrus-user=${CYRUS_USER:Q}
CONFIGURE_ARGS+= --with-cyrus-group=${CYRUS_GROUP:Q}
CONFIGURE_ARGS+= --with-cyrus-prefix=${PREFIX}/cyrus
CONFIGURE_ARGS+= --with-statedir=${VARBASE}/run
CONFIGURE_ARGS+= --with-openssl=${SSLBASE:Q}
CONFIGURE_ARGS+= --with-sasl=${BUILDLINK_PREFIX.cyrus-sasl}
CONFIGURE_ARGS+= --with-perl=${PERL5:Q}
CONFIGURE_ARGS+= --with-libwrap=${BUILDLINK_PREFIX.tcp_wrappers}
CONFIGURE_ENV+= ac_cv_lib_wrap_request_init=yes
CONFIGURE_ARGS+= --enable-listext
CONFIGURE_ARGS+= --enable-murder
CONFIGURE_ARGS+= --enable-nntp
CONFIGURE_ARGS+= --without-zephyr
CONFIGURE_ARGS+= --without-ucdsnmp
PKG_OPTIONS_VAR= PKG_OPTIONS.cyrus-imapd
PKG_SUPPORTED_OPTIONS= gssapi kerberos kerberos4
.include "../../mk/bsd.options.mk"
.if !empty(PKG_OPTIONS:Mkerberos)
. if empty(PKG_OPTIONS:Mgssapi)
PKG_OPTIONS+= gssapi
. endif
.endif
.if !empty(PKG_OPTIONS:Mkerberos4)
. if exists(/usr/include/kerberosIV/krb.h)
CRYPTO+= uses Kerberos encryption code
CONFIGURE_ARGS+= --with-auth=krb
CONFIGURE_ARGS+= --with-krb=/usr
. endif
.elif !empty(PKG_OPTIONS:Mgssapi)
. include "../../mk/krb5.buildlink3.mk"
CONFIGURE_ARGS+= --with-auth=krb5
CONFIGURE_ARGS+= --enable-gssapi=${KRB5BASE:Q}
CONFIGURE_ARGS+= --with-gss_impl=${GSSIMPL.${KRB5_TYPE}}
GSSIMPL.heimdal= heimdal
GSSIMPL.mit-krb5= mit
CONFIGURE_ENV+= COMPILE_ET=${KRB5BASE}/bin/compile_et
COMERRBASE= ${KRB5BASE}
.else
CONFIGURE_ARGS+= --with-auth=unix
CONFIGURE_ARGS+= --without-krb
CONFIGURE_ARGS+= --disable-gssapi
.endif
.if exists(/usr/bin/compile_et)
COMERRBASE?= /usr
.endif
.if defined(COMERRBASE)
. if exists(${COMERRBASE}/include/krb5/com_err.h)
CPPFLAGS+= -I${COMERRBASE}/include/krb5
. endif
CONFIGURE_ENV+= COMPILE_ET=${COMERRBASE}/bin/compile_et
.else
CONFIGURE_ARGS+= --with-com-err=yes
.endif
# CYRUS_IDLE selects the method used to implement IMAP IDLE. Valid values
# are "poll", "idled" or "no". The default is "poll".
#
CYRUS_IDLE?= poll
BUILD_DEFS+= CYRUS_IDLE
.if (${CYRUS_IDLE} != "poll") && (${CYRUS_IDLE} != "idled") && \
(${CYRUS_IDLE} != "no")
PKG_FAIL_REASON+= "CYRUS_IDLE must be poll, idled or no"
.endif
CONFIGURE_ARGS+= --with-idle=${CYRUS_IDLE:Q}
.if ${CYRUS_IDLE} == "idled"
PLIST_SUBST+= IDLED=
.else
PLIST_SUBST+= IDLED="@comment "
.endif
MAKE_ENV+= PERL=${PERL5:Q}
HTMLDIR= ${PREFIX}/share/doc/html/cyrus-imapd
EGDIR= ${PREFIX}/share/examples/cyrus-imapd
CONF_FILES= ${EGDIR}/imapd.conf ${PKG_SYSCONFDIR}/imapd.conf
CONF_FILES+= ${EGDIR}/normal.conf ${PKG_SYSCONFDIR}/cyrus.conf
RCD_SCRIPTS= cyrus
FILES_SUBST+= IMAPDCONF=${PKG_SYSCONFDIR}/imapd.conf
PERL5_PACKLIST= \
auto/Cyrus/IMAP/.packlist \
auto/Cyrus/SIEVE/managesieve/.packlist
.include "../../lang/perl5/module.mk"
.include "../../security/cyrus-sasl2/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../security/tcp_wrappers/buildlink3.mk"
.include "../../mk/bdb.buildlink3.mk"
CONFIGURE_ENV+= BDB_TYPE=${BDB_TYPE:Q}
# Only imap/mupdate needs to be build with pthreads support, so selectively
# enable it via patches for just that one program.
#
.include "../../mk/pthread.buildlink3.mk"
# Change references of some manpages from foo.8 to cyrus-foo.8 to avoid
# manpage conflicts with other packages. Also change references to
# "/etc/{cyrus,imapd}.conf" into "${PKG_SYSCONFDIR}/{cyrus,imapd}.conf".
#
post-patch:
cd ${WRKSRC}/man; \
set -- deliver 8 fetchnews 8 idled 8 imapd 8 lmtpd 8 master 8 \
nntpd 8 notifyd 8 pop3d 8 quota 8; \
while [ $$# -gt 0 ]; do \
man=$$1.$$2; \
for file in Makefile.in *.[0-9]; do \
${SED} -e "s|\(\$$(srcdir)/\)\($$man\)|\1cyrus-\2|g" \
-e "s|\(\\\fB\)\($$1($$2)\\\fR\)|\1cyrus-\2|g" \
$$file > $$file.fixed; \
${MV} -f $$file.fixed $$file; \
done; \
if [ -f $$man ]; then \
${MV} $$man cyrus-$$man; \
fi; \
shift 2; \
done
${FIND} ${WRKSRC} -type f -print | \
${XARGS} -n 1 ${GREP} -l -e /etc/imapd\.conf -e /etc/cyrus\.conf | \
while read file; do \
${SED} -e "s|/etc/\(cyrus\.conf\)|${PKG_SYSCONFDIR}/\1|g" \
-e "s|/etc/\(imapd\.conf\)|${PKG_SYSCONFDIR}/\1|g" \
$$file > $$file.fixed; \
${MV} -f $$file.fixed $$file; \
done
post-install:
${INSTALL_SCRIPT} ${WRKSRC}/tools/masssievec ${PREFIX}/cyrus/bin
${INSTALL_SCRIPT} ${WRKSRC}/tools/mkimap ${PREFIX}/cyrus/bin
${INSTALL_SCRIPT} ${WRKSRC}/tools/mknewsgroups ${PREFIX}/cyrus/bin
${INSTALL_SCRIPT} ${WRKSRC}/tools/translatesieve ${PREFIX}/cyrus/bin
${INSTALL_SCRIPT} ${WRKSRC}/tools/rehash ${PREFIX}/cyrus/bin
${INSTALL_DATA_DIR} ${EGDIR}
${INSTALL_DATA} ${FILESDIR}/imapd.conf ${EGDIR}
cd ${WRKSRC}/master/conf; for file in *.conf; do \
${INSTALL_DATA} $$file ${EGDIR}; \
done
${INSTALL_DATA_DIR} ${HTMLDIR}
cd ${WRKSRC}/doc; for file in *.html cyrusv2.mc; do \
${INSTALL_DATA} $$file ${HTMLDIR}; \
done
.include "../../mk/bsd.pkg.mk"