1 # Created by: Neil Blakey-Milner
8 MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-stable/${PORTVERSION}
10 MAINTAINER= ports@FreeBSD.org
11 COMMENT= Easy virtual domain and authentication package for use with qmail
16 BUILD_DEPENDS= ${LOCALBASE}/bin/tcprules:${PORTSDIR}/sysutils/ucspi-tcp
17 RUN_DEPENDS= ${LOCALBASE}/bin/tcprules:${PORTSDIR}/sysutils/ucspi-tcp
21 USES= qmail gmake fakeroot
23 CONFLICTS= vpopmail-devel-5.*
31 VCFGDIR?= ${WRKDIR}/vcfg
32 VCFGFILES?= inc_deps lib_deps tcp.smtp
34 CONFIGURE_ENV+= VCFGDIR="${VCFGDIR}" \
35 AUTOCONF=true ACLOCAL=true AUTOMAKE=true AUTOHEADER=true
36 CONFIGURE_ARGS= --enable-qmaildir=${QMAIL_PREFIX} \
37 --enable-tcprules-prog=${LOCALBASE}/bin/tcprules \
38 --enable-tcpserver-file=${VPOPMAIL_DIR}/etc/tcp.smtp \
39 --enable-non-root-build \
40 --enable-logging=${LOGLEVEL} \
41 --enable-vpopuser=nobody \
42 --enable-vpopgroup=nobody
44 OPTIONS_DEFINE= DOCS \
72 OPTIONS_SINGLE_AUTH= CDB MYSQL PGSQL LDAP LDAP_SASL ORACLE SYBASE
74 OPTIONS_DEFAULT=MD5_PASSWORDS \
83 CDB_DESC= Auth via CDB
84 PASSWD_DESC= /etc/passwd account support
85 MYSQL_DESC= Auth via MySQL
86 PGSQL_DESC= Auth via PostgreSQL
87 SYBASE_DESC= Auth via Sybase
88 MD5_PASSWORDS_DESC= Store passwords in MD5 format
89 CLEAR_PASSWD_DESC= Store passwords in plaintext
90 LEARN_PASSWORDS_DESC= Learn passwords during POP auth
91 MYSQL_REPLICATION_DESC= MySQL database replication support
92 MYSQL_LIMITS_DESC= MySQL mailbox limitations support
93 ORACLE_DESC= Auth via Oracle
94 LDAP_DESC= Auth via LDAP
95 LDAP_SASL_DESC= Auth via LDAP SASL
96 VALIAS_DESC= Store aliases in DB instead of .qmail files
97 ROAMING_DESC= roaming users support
98 IP_ALIAS_DESC= IP alias support
99 QMAIL_EXT_DESC= qmail-like user-* address support
100 FILE_LOCKING_DESC= file locking support
101 FILE_SYNC_DESC= fsync support (decreases performance)
102 USERS_BIG_DIR_DESC= Hashing user directories (BIGDIR)
103 SEEKABLE_DESC= Make input to vdelivermail seekable
104 SPAMASSASSIN_DESC= SpamAssassin support
105 SUID_VCHKPW_DESC= Set vchkpw setugid vpopmail:vchkpw
106 SMTP_AUTH_PATCH_DESC= Swap Challenge/Response for CRAM-MD5
107 ONCHANGE_SCRIPT_DESC= vpopmail/etc/onchange script support
108 FPIC_DESC= Compile with -fPIC
109 MAILDROP_DESC= Maildrop MDA support
110 DOMAIN_QUOTAS_DESC= Domain quotas support
111 SPAMFOLDER_DESC= Move spam to Junk (requires SA)
112 SINGLE_DOMAIN_DESC= Optimize for a single domain setup
113 AUTH_LOG_DESC= Log auth attempts when using a DB
114 SQL_LOG_DESC= Log to selected SQL database
115 SQL_LOG_TRIM_DESC= Trim logs of deleted users/domains
117 # Compatibility with older KNOB, correctly will enable if set,
118 # but be unset if unselected in the 'config' dialog
119 .if defined(WITH_POSTGRESQL)
122 .if defined(WITH_MYSQL_LOG)
123 PORT_OPTIONS+= SQL_LOG
125 .if defined(WITH_PGSQL_LOG)
126 PORT_OPTIONS+= SQL_LOG
128 .if defined(WITH_SQL_LOG_REMOVE_DELETED)
129 PORT_OPTIONS+= SQL_LOG_TRIM
132 DOMAIN_QUOTAS_CONFIGURE_ON= --enable-domainquotas=y
133 DOMAIN_QUOTAS_CONFIGURE_OFF= --enable-domainquotas=n
134 PASSWD_CONFIGURE_ON= --enable-passwd
135 MD5_PASSWORDS_CONFIGURE_OFF= --disable-md5-passwords
136 VALIAS_CONFIGURE_ON= --enable-valias
137 CLEAR_PASSWD_CONFIGURE_OFF= --disable-clear-passwd
138 LEARN_PASSWORDS_CONFIGURE_ON= --enable-learn-passwords
139 LDAP_CONFIGURE_ON= --enable-auth-module=ldap
140 ORACLE_CONFIGURE_ON= --enable-auth-module=oracle
141 SYBASE_CONFIGURE_ON= --enable-auth-module=sybase
142 SINGLE_DOMAIN_CONFIGURE_ON= --disable-many-domains
143 IP_ALIAS_CONFIGURE_ON= --enable-ip-alias-domains
144 QMAIL_EXT_CONFIGURE_ON= --enable-qmail-ext
145 FILE_LOCKING_CONFIGURE_OFF= --disable-file-locking
146 FILE_SYNC_CONFIGURE_ON= --enable-file-sync
147 AUTH_LOG_CONFIGURE_OFF= --disable-auth-logging
148 USERS_BIG_DIR_CONFIGURE_OFF= --disable-users-big-dir
149 SEEKABLE_CONFIGURE_OFF= --disable-make-seekable
150 ROAMING_CONFIGURE_ON= --enable-roaming-users \
151 --enable-relay-clear-minutes=${RELAYCLEAR}
153 MYSQL_CONFIGURE_ON= --enable-auth-module=mysql \
154 --enable-incdir=${LOCALBASE}/include/mysql \
155 --enable-libdir=${LOCALBASE}/lib/mysql
156 MYSQL_REPLICATION_CONFIGURE_ON= --enable-mysql-replication
157 MYSQL_LIMITS_CONFIGURE_ON= --enable-mysql-limits
159 PGSQL_CONFIGURE_ON= --enable-auth-module=pgsql
160 SQL_LOG_CONFIGURE_ON= --enable-sql-logging
161 ONCHANGE_SCRIPT_CONFIGURE_ON= --enable-onchange-script
162 MAILDROP_CONFIGURE_ON= --enable-maildrop=y \
163 --enable-maildrop-prog=${LOCALBASE}/bin/maildrop
164 MAILDROP_CONFIGURE_OFF= --enable-maildrop=n
166 MAILDROP_RUN_DEPENDS= maildrop:${PORTSDIR}/${MAILDROP_PORT}
167 MAILDROP_BUILD_DEPENDS= maildrop:${PORTSDIR}/${MAILDROP_PORT}
169 SPAMASSASSIN_CONFIGURE_ON= --enable-spamassassin \
170 --enable-spamc-prog=${LOCALBASE}/bin/spamc \
171 --enable-spam-threshold=${SPAM_THRESHOLD}
172 SPAMASSASSIN_BUILD_DEPENDS= spamc:${PORTSDIR}/mail/spamassassin
173 SPAMASSASSIN_RUN_DEPENDS= spamc:${PORTSDIR}/mail/spamassassin
174 SPAMFOLDER_CONFIGURE_ON= --enable-spam-junkfolder
176 INSTALL_TARGET= install-strip
178 .include <bsd.port.options.mk>
180 .if ${PORT_OPTIONS:MSUID_VCHKPW}
183 PLIST_SUB+= VCHKPW_MODE="${VCHKPW_MODE}"
185 # PostgreSQL database configuration options
187 # WITH_PGSQL_USER - the username for connecting to the PostgreSQL server (postgres)
188 # WITH_PGSQL_DB - the name of the PostgreSQL database to use (vpopmail)
190 # Oracle database configuration options
192 # WARNING: This is NOT TESTED, not in the least.
193 # Please report any success or failure to the port maintainer
195 # WITH_ORACLE_PROC - the name of the Oracle Pro-C precompiler, default 'proc'
196 # WITH_ORACLE_SERVICE - the Oracle service name (jimmy)
197 # WITH_ORACLE_USER - the username for connecting to the Oracle server (system)
198 # WITH_ORACLE_PASSWD - the password for connecting to the Oracle server (manager)
199 # WITH_ORACLE_DB - the name of the Oracle database to connect to (orcl1)
200 # WITH_ORACLE_HOME - the Oracle installation directory (/export/home/oracle)
202 # Sybase database configuration options
204 # WARNING: This is NOT TESTED, not in the least.
205 # Please report any success or failure to the port maintainer
207 # WITH_SYBASE_SERVER - the Sybase server name (empty)
208 # WITH_SYBASE_USER - the username for connecting to the Sybase server (sa)
209 # WITH_SYBASE_PASSWD - the password for connecting to the Sybase server (empty)
210 # WITH_SYBASE_APP - the app for connecting to the Sybase server (vpopmail)
211 # WITH_SYBASE_DB - the name of the Sybase database to connect to (vpopmail)
213 # Courier IMAP configuration options for authvchkpw
215 # WARNING: This is NOT TESTED, not in the least.
216 # Please report any success or failure to the port maintainer
218 # WITH_COURIER_IMAPLOGIN - the path to the imaplogin program
219 # WITH_COURIER_IMAPD - the path to the imapd program
221 # User-configurable variables
223 # ONCHANGE_SCRIPT - see README.onchange
224 # MAILDROP - see README.maildrop
226 # Define these to change from the default behaviour
228 # MAILDROP_PORT - the port that provides the bin/maildrop program
230 # Set these to the values you'd prefer
232 # RELAYCLEAR - time in minutes before clearing relay hole (requires roaming)
233 # SPAM_THRESHOLD - minimum score required to delete spam messages (requires spamassassin)
234 # LOGLEVEL - n - no logging, y - log all,
235 # e - log errors, p - log passwords in errors,
236 # v - verbose success and errors with passwords
237 # QMAIL_PREFIX - location of qmail directory
238 # VPOPMAIL_DIR - installation area for vpopmail (see comment below)
244 MAILDROP_PORT?= mail/maildrop
245 WITH_COURIER_IMAPLOGIN?= ${LOCALBASE}/sbin/imaplogin
246 WITH_VPOPMAIL_AUTHVCHKPW?= ${VPOPMAIL_DIR}/bin/authvchkpw
247 WITH_COURIER_IMAPD?= ${LOCALBASE}/bin/imapd
248 WITH_ORACLE_PROC?= proc
249 VPOPMAIL_DIR?= ${PREFIX}/vpopmail
251 # Uncomment this, or set PREFIX to /home if you have an existing
252 # vpopmail install with the vpopmail users' home directory set to
253 # /home/vpopmail - package rules dictate we default to LOCALBASE/vpopmail
257 # End of user-configurable variables
259 .if ${PORT_OPTIONS:MLDAP}
261 .if ${PORT_OPTIONS:MLDAP_SASL}
262 WANT_OPENLDAP_SASL= yes
264 LDAP_FILES= ${WRKSRC}/doc/README.ldap \
265 ${WRKSRC}/ldap/nsswitch.conf \
266 ${WRKSRC}/ldap/pam_ldap.conf \
267 ${WRKSRC}/ldap/pam_ldap.secret \
268 ${WRKSRC}/ldap/qmailUser.schema \
269 ${WRKSRC}/ldap/slapd.conf \
270 ${WRKSRC}/ldap/vpopmail.ldif
273 .if ${PORT_OPTIONS:MMYSQL}
276 .if defined(WITH_MYSQL_USER) || defined(WITH_MYSQL_READ_USER) || defined(WITH_MYSQL_UPDATE_USER)
277 BROKEN_MYSQL_PARAMS= true
279 .if defined(WITH_MYSQL_SERVER) || defined(WITH_MYSQL_READ_SERVER) || defined(WITH_MYSQL_UPDATE_SERVER)
280 BROKEN_MYSQL_PARAMS= true
282 .if defined(WITH_MYSQL_PASSWD) || defined(WITH_MYSQL_READ_PASSWD) || defined(WITH_MYSQL_UPDATE_PASSWD)
283 BROKEN_MYSQL_PARAMS= true
285 .if defined(WITH_MYSQL_DB)
286 BROKEN_MYSQL_PARAMS= true
288 .if defined(BROKEN_MYSQL_PARAMS)
289 BROKEN= The MySQL connection parameters are no longer setup at compile time - please edit the ${VPOPMAIL_DIR}/etc/vpopmail.mysql file instead
293 .if defined(DEFAULT_DOMAIN)
294 BROKEN= The default vpopmail domain is no longer setup at compile time - please edit the ${VPOPMAIL_DIR}/etc/defaultdomain file instead
297 .if defined(WITH_APOP)
298 BROKEN= The WITH_APOP option is deprecated; set WITH_CLEAR_PASSWD instead, APOP will just work
301 .if ${PORT_OPTIONS:MPGSQL}
305 .if ${PORT_OPTIONS:MSQL_LOG_TRIM}
306 EXTRA_PATCHES+= ${FILESDIR}/sql-remove-deleted.patch
309 .if ${PORT_OPTIONS:MSMTP_AUTH_PATCH}
310 EXTRA_PATCHES+= ${FILESDIR}/vchkpw-smtp-auth.patch
313 .if ${PORT_OPTIONS:MMAILDROP}
314 MAILDROP_FILES= ${WRKSRC}/maildrop/maildroprc.v1 \
315 ${WRKSRC}/maildrop/maildroprc.v2
318 .if empty(PORT_OPTIONS:MDOCS)
319 EXTRA_PATCHES+= ${FILESDIR}/Makefile.in-noportdocs.patch
322 .if ${PORT_OPTIONS:MFPIC} && ( ${ARCH} == "x86_64" || ${ARCH} == "ia64" )
327 # Some suggestions from Gabriel Ambuehl <gabriel_ambuehl@buz.ch>
330 DOCS= README README.activedirectory README.filelocking \
331 README.ipaliasdomains README.ldap README.maildrop \
333 README.onchange README.oracle README.pgsql \
334 README.qmail-default README.quotas \
335 README.roamingusers README.spamassassin README.sybase \
336 README.vdelivermail README.vlimits \
337 README.vpopmaild README.vpopmaild README.vqmaillocal \
341 # This port doesn't honour PREFIX, it honours vpopmail's home directory.
342 # Since we create vpopmail if it doesn't exist, we set it so that it
343 # does honour PREFIX. -- nbm
347 ${AWK} -F: '/^${USERS}:/ { print $$3 }' ${UID_FILES} > ${WRKSRC}/vpopmail.uid
348 ${AWK} -F: '/^${USERS}:/ { sub(/\/usr\/local/, "${PREFIX}", $$9); print $$9 }' ${UID_FILES} > ${WRKSRC}/vpopmail.dir
349 ${AWK} -F: '/^${GROUPS}:/ { print $$3 }' ${GID_FILES} > ${WRKSRC}/vpopmail.gid
350 .if ${PORT_OPTIONS:MPGSQL}
351 .if defined(WITH_PGSQL_DB)
352 ${REINPLACE_CMD} -E -e "s/(#define DB.*)vpopmail(.*)/\1${WITH_PGSQL_DB}\2/" ${WRKSRC}/vpgsql.h
354 .if defined(WITH_PGSQL_USER)
355 ${REINPLACE_CMD} -E -e "s/(#define PG_CONNECT.*)postgres(.*)/\1${WITH_PGSQL_USER}\2/" ${WRKSRC}/vpgsql.h
358 .if ${PORT_OPTIONS:MORACLE}
359 .if defined(WITH_ORACLE_SERVICE)
360 ${REINPLACE_CMD} -E -e "s/(#define ORACLE_SERVICE.*)jimmy(.*)/\1${WITH_ORACLE_SERVICE}\2/" ${WRKSRC}/voracle.h
362 .if defined(WITH_ORACLE_USER)
363 ${REINPLACE_CMD} -E -e "s/(#define ORACLE_USER.*)system(.*)/\1${WITH_ORACLE_USER}\2/" ${WRKSRC}/voracle.h
365 .if defined(WITH_ORACLE_PASSWD)
366 ${REINPLACE_CMD} -E -e "s/(#define ORACLE_PASSWD.*)manager(.*)/\1${WITH_ORACLE_PASSWD}\2/" ${WRKSRC}/voracle.h
368 .if defined(WITH_ORACLE_HOME)
369 ${REINPLACE_CMD} -E -e "s@(#define ORACLE_HOME.*)/export/home/oracle(.*)@\1${WITH_ORACLE_HOME}\2@" ${WRKSRC}/voracle.h
371 .if defined(WITH_ORACLE_DB)
372 ${REINPLACE_CMD} -E -e "s/(#define ORACLE_DATABASE.*)orcl1(.*)/\1${WITH_ORACLE_DB}\2/" ${WRKSRC}/voracle.h
374 cd ${WRKSRC} && ${WITH_ORACLE_PROC} voracle.pc
376 .if ${PORT_OPTIONS:MSYBASE}
377 .if defined(WITH_SYBASE_SERVER)
378 ${REINPLACE_CMD} -E -e "s/(#define SYBASE_SERVER.*)\"\"(.*)/\1\"${WITH_SYBASE_SERVER}\"\2/" ${WRKSRC}/vsybase.h
380 .if defined(WITH_SYBASE_USER)
381 ${REINPLACE_CMD} -E -e "s/(#define SYBASE_USER.*)sa(.*)/\1${WITH_SYBASE_USER}\2/" ${WRKSRC}/vsybase.h
383 .if defined(WITH_SYBASE_PASSWD)
384 ${REINPLACE_CMD} -E -e "s/(#define SYBASE_PASSWD.*)\"\"(.*)/\1\"${WITH_SYBASE_PASSWD}\"\2/" ${WRKSRC}/vsybase.h
386 .if defined(WITH_SYBASE_APP)
387 ${REINPLACE_CMD} -E -e "s@(#define SYBASE_APP.*)vpopmail(.*)@\1${WITH_SYBASE_APP}\2@" ${WRKSRC}/vsybase.h
389 .if defined(WITH_SYBASE_DB)
390 ${REINPLACE_CMD} -E -e "s/(#define SYBASE_DATABASE.*)vpopmail(.*)/\1${WITH_SYBASE_DB}\2/" ${WRKSRC}/vsybase.h
393 ${REINPLACE_CMD} -E -e "s@(#define PATH_IMAPLOGIN.*)VPOPMAILDIR.*@\1\"${WITH_COURIER_IMAPLOGIN}\"@" ${WRKSRC}/authvchkpw.c
394 ${REINPLACE_CMD} -E -e "s@(#define PATH_AUTHVCHKPW.*)VPOPMAILDIR.*@\1\"${WITH_VPOPMAIL_AUTHVCHKPW}\"@" ${WRKSRC}/authvchkpw.c
395 ${REINPLACE_CMD} -E -e "s@(#define PATH_IMAPD.*)VPOPMAILDIR.*@\1\"${WITH_COURIER_IMAPD}\"@" ${WRKSRC}/authvchkpw.c
399 ${MKDIR} ${STAGEDIR}${VPOPMAIL_DIR}/etc
400 if [ -e "${VCFGDIR}/tcp.smtp" ]; then \
401 ${INSTALL_DATA} ${VCFGDIR}/tcp.smtp ${STAGEDIR}${VPOPMAIL_DIR}/etc/tcp.smtp-dist; \
403 ${TOUCH} ${STAGEDIR}${VPOPMAIL_DIR}/etc/tcp.smtp-dist; \
405 .if ${PORT_OPTIONS:MLDAP}
406 @${ECHO_CMD} "# LDAP CONNECTION SETTINGS FOR VPOPMAIL" > ${STAGEDIR}${VPOPMAIL_DIR}/etc/vpopmail.ldap-dist
407 @${ECHO_CMD} "# Line format:" >> ${STAGEDIR}${VPOPMAIL_DIR}/etc/vpopmail.ldap-dist
408 @${ECHO_CMD} "# host|port|user|password|basedn" >> ${STAGEDIR}${VPOPMAIL_DIR}/etc/vpopmail.ldap-dist
409 @${ECHO_CMD} "localhost|389|cn=vpopmailuser, o=vpopmail|vpoppasswd|o=vpopmail" >> ${STAGEDIR}${VPOPMAIL_DIR}/etc/vpopmail.ldap-dist
411 .if ${PORT_OPTIONS:MLDAP}
412 ${MKDIR} ${STAGEDIR}${VPOPMAIL_DIR}/ldap
413 ${INSTALL_DATA} ${LDAP_FILES} ${STAGEDIR}${VPOPMAIL_DIR}/ldap
415 .if ${PORT_OPTIONS:MMAILDROP}
416 ${MKDIR} ${STAGEDIR}${VPOPMAIL_DIR}/maildrop
417 ${INSTALL_DATA} ${MAILDROP_FILES} ${STAGEDIR}${VPOPMAIL_DIR}/maildrop
419 .if ${PORT_OPTIONS:MDOCS}
420 ${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/doc/,} ${STAGEDIR}${VPOPMAIL_DIR}/doc/
423 .include <bsd.port.mk>