aboutsummaryrefslogtreecommitdiffstats
path: root/mail/vpopmail/Makefile
blob: c007fbd7acde9e4aa7e41352ff42951b5aaee754 (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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# Created by: Neil Blakey-Milner
# $FreeBSD$

PORTNAME=   vpopmail
PORTVERSION=    5.4.32
PORTREVISION=   2
CATEGORIES= mail
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}-stable/${PORTVERSION} \
        SF/${PORTNAME}/${PORTNAME}-devel/${PORTVERSION}

MAINTAINER= bdrewery@FreeBSD.org
COMMENT=    Easy virtual domain and authentication package for use with qmail

LICENSE=    GPLv2 GPLv3
LICENSE_COMB=   dual

BUILD_DEPENDS=  ${LOCALBASE}/bin/tcprules:${PORTSDIR}/sysutils/ucspi-tcp
RUN_DEPENDS=    ${LOCALBASE}/bin/tcprules:${PORTSDIR}/sysutils/ucspi-tcp

PATCH_STRIP=    -p1

USES=       qmail

CONFLICTS=  vpopmail-devel-5.*

GNU_CONFIGURE=  YES
USE_GMAKE=  YES

USERS=      vpopmail
GROUPS=     vchkpw

VCFGDIR?=   ${WRKDIR}/vcfg
VCFGFILES?= inc_deps lib_deps tcp.smtp

CONFIGURE_ENV+= VCFGDIR="${VCFGDIR}" \
        AUTOCONF=true ACLOCAL=true AUTOMAKE=true AUTOHEADER=true
CONFIGURE_ARGS= --enable-qmaildir=${QMAIL_PREFIX} \
        --enable-tcprules-prog=${LOCALBASE}/bin/tcprules \
        --enable-tcpserver-file=${VPOPMAIL_DIR}/etc/tcp.smtp \
        --enable-non-root-build \
        --enable-vpopuser=${USERS} \
        --enable-vpopgroup=${GROUPS}

OPTIONS_DEFINE= DOCS \
        PASSWD \
        MD5_PASSWORDS \
        CLEAR_PASSWD \
        LEARN_PASSWORDS \
        MYSQL \
        MYSQL_REPLICATION \
        MYSQL_LIMITS \
        PGSQL \
        SYBASE \
        ORACLE \
        LDAP \
        LDAP_SASL \
        VALIAS \
        ROAMING \
        IP_ALIAS \
        QMAIL_EXT \
        FILE_LOCKING \
        FILE_SYNC \
        USERS_BIG_DIR \
        SEEKABLE \
        SPAMASSASSIN \
        SUID_VCHKPW \
        SMTP_AUTH_PATCH \
        ONCHANGE_SCRIPT \
        FPIC \
        MAILDROP \
        DOMAIN_QUOTAS \
        SPAMFOLDER \
        SINGLE_DOMAIN \
        AUTH_LOG \
        SQL_LOG \
        SQL_LOG_TRIM

OPTIONS_DEFAULT=MD5_PASSWORDS \
        ROAMING \
        FILE_LOCKING \
        USERS_BIG_DIR \
        SEEKABLE \
        FPIC \
        AUTH_LOG

PASSWD_DESC=            Auth via /etc/passwd
MYSQL_DESC=         Auth via MySQL
PGSQL_DESC=         Auth via PostgreSQL
SYBASE_DESC=            Auth via Sybase
MD5_PASSWORDS_DESC=     Store passwords in MD5 format
CLEAR_PASSWD_DESC=      Store passwords in plaintext
LEARN_PASSWORDS_DESC=       Learn passwords during POP auth
MYSQL_REPLICATION_DESC=     MySQL database replication support
MYSQL_LIMITS_DESC=      MySQL mailbox limitations support
ORACLE_DESC=            Auth via Oracle
LDAP_DESC=          Auth via LDAP
LDAP_SASL_DESC=         Auth via LDAP SASL
VALIAS_DESC=            valias processing
ROAMING_DESC=           roaming users support
IP_ALIAS_DESC=          IP alias support
QMAIL_EXT_DESC=         qmail-like user-* address support
FILE_LOCKING_DESC=      file locking support
FILE_SYNC_DESC=         fsync support (decreases performance)
USERS_BIG_DIR_DESC=     Hashing user directories (BIGDIR)
SEEKABLE_DESC=          Make input to vdelivermail seekable
SPAMASSASSIN_DESC=      SpamAssassin support
SUID_VCHKPW_DESC=       Set vchkpw setugid vpopmail:vchkpw
SMTP_AUTH_PATCH_DESC=       Swap Challenge/Response for CRAM-MD5
ONCHANGE_SCRIPT_DESC=       vpopmail/etc/onchange script support
FPIC_DESC=          Compile with -fPIC
MAILDROP_DESC=          Maildrop MDA support
DOMAIN_QUOTAS_DESC=     Domain quotas support
SPAMFOLDER_DESC=        Move spam to Junk (requires SA)
SINGLE_DOMAIN_DESC=     Optimize for a single domain setup
AUTH_LOG_DESC=          Log auth attempts when using a DB
SQL_LOG_DESC=           Log to selected SQL database
SQL_LOG_TRIM_DESC=      Trim logs of deleted users/domains

# Compatibility with older KNOB, correctly will enable if set,
# but be unset if unselected in the 'config' dialog
.if defined(WITH_POSTGRESQL)
PORT_OPTIONS+=  PGSQL
.endif
.if defined(WITH_MYSQL_LOG)
PORT_OPTIONS+=  SQL_LOG
.endif
.if defined(WITH_PGSQL_LOG)
PORT_OPTIONS+=  SQL_LOG
.endif
.if defined(WITH_SQL_LOG_REMOVE_DELETED)
PORT_OPTIONS+=  SQL_LOG_TRIM
.endif

.include <bsd.port.pre.mk>

# PostgreSQL database configuration options
#
# WITH_PGSQL_USER - the username for connecting to the PostgreSQL server (postgres)
# WITH_PGSQL_DB - the name of the PostgreSQL database to use (vpopmail)
#
# Oracle database configuration options
#
# WARNING: This is NOT TESTED, not in the least.
# Please report any success or failure to the port maintainer
#
# WITH_ORACLE_PROC - the name of the Oracle Pro-C precompiler, default 'proc'
# WITH_ORACLE_SERVICE - the Oracle service name (jimmy)
# WITH_ORACLE_USER - the username for connecting to the Oracle server (system)
# WITH_ORACLE_PASSWD - the password for connecting to the Oracle server (manager)
# WITH_ORACLE_DB  - the name of the Oracle database to connect to (orcl1)
# WITH_ORACLE_HOME - the Oracle installation directory (/export/home/oracle)
#
# Sybase database configuration options
#
# WARNING: This is NOT TESTED, not in the least.
# Please report any success or failure to the port maintainer
#
# WITH_SYBASE_SERVER - the Sybase server name (empty)
# WITH_SYBASE_USER - the username for connecting to the Sybase server (sa)
# WITH_SYBASE_PASSWD - the password for connecting to the Sybase server (empty)
# WITH_SYBASE_APP - the app for connecting to the Sybase server (vpopmail)
# WITH_SYBASE_DB  - the name of the Sybase database to connect to (vpopmail)
#
# Courier IMAP configuration options for authvchkpw
#
# WARNING: This is NOT TESTED, not in the least.
# Please report any success or failure to the port maintainer
#
# WITH_COURIER_IMAPLOGIN - the path to the imaplogin program
# WITH_COURIER_IMAPD - the path to the imapd program

# User-configurable variables
#
# ONCHANGE_SCRIPT   - see README.onchange
# MAILDROP      - see README.maildrop
#
# Define these to change from the default behaviour
#
# MAILDROP_PORT     - the port that provides the bin/maildrop program
#
# Set these to the values you'd prefer
#
# RELAYCLEAR    - time in minutes before clearing relay hole (requires roaming)
# SPAM_THRESHOLD - minimum score required to delete spam messages (requires spamassassin)
# LOGLEVEL  - n - no logging, y - log all,
#                 e - log errors, p - log passwords in errors,
#         v - verbose success and errors with passwords
# QMAIL_PREFIX  - location of qmail directory
# VPOPMAIL_DIR  - installation area for vpopmail (see comment below)
#
#
RELAYCLEAR?=    30
SPAM_THRESHOLD?=15
LOGLEVEL?=  y
MAILDROP_PORT?= mail/maildrop
WITH_COURIER_IMAPLOGIN?=    ${LOCALBASE}/sbin/imaplogin
WITH_VPOPMAIL_AUTHVCHKPW?=  ${VPOPMAIL_DIR}/bin/authvchkpw
WITH_COURIER_IMAPD?=        ${LOCALBASE}/bin/imapd
WITH_ORACLE_PROC?=  proc
VPOPMAIL_DIR?=          ${PREFIX}/vpopmail

# Uncomment this, or set PREFIX to /home if you have an existing
# vpopmail install with the vpopmail users' home directory set to
# /home/vpopmail - package rules dictate we default to LOCALBASE/vpopmail
#
#PREFIX?=   /home

# End of user-configurable variables

.if ${PORT_OPTIONS:MLDAP}
USE_OPENLDAP=   yes
.if ${PORT_OPTIONS:MLDAP_SASL}
WANT_OPENLDAP_SASL= yes
.endif
CONFIGURE_ARGS+=    --enable-auth-module=ldap
LDAP_FILES=     ${WRKSRC}/doc/README.ldap \
            ${WRKSRC}/ldap/nsswitch.conf \
            ${WRKSRC}/ldap/pam_ldap.conf \
            ${WRKSRC}/ldap/pam_ldap.secret \
            ${WRKSRC}/ldap/qmailUser.schema \
            ${WRKSRC}/ldap/slapd.conf \
            ${WRKSRC}/ldap/vpopmail.ldif
PLIST_SUB+= LDAP=""
.else
PLIST_SUB+= LDAP="@comment "
.endif

.if ${PORT_OPTIONS:MMYSQL}
USE_MYSQL=      yes
CONFIGURE_ARGS+=    --enable-auth-module=mysql \
            --enable-incdir=${LOCALBASE}/include/mysql \
            --enable-libdir=${LOCALBASE}/lib/mysql
PLIST_SUB+= MYSQL=""
.if ${PORT_OPTIONS:MMYSQL_REPLICATION}
CONFIGURE_ARGS+=    --enable-mysql-replication
.endif
.if ${PORT_OPTIONS:MMYSQL_LIMITS}
CONFIGURE_ARGS+=    --enable-mysql-limits
.endif

.if defined(WITH_MYSQL_USER) || defined(WITH_MYSQL_READ_USER) || defined(WITH_MYSQL_UPDATE_USER)
BROKEN_MYSQL_PARAMS=    true
.endif
.if defined(WITH_MYSQL_SERVER) || defined(WITH_MYSQL_READ_SERVER) || defined(WITH_MYSQL_UPDATE_SERVER)
BROKEN_MYSQL_PARAMS=    true
.endif
.if defined(WITH_MYSQL_PASSWD) || defined(WITH_MYSQL_READ_PASSWD) || defined(WITH_MYSQL_UPDATE_PASSWD)
BROKEN_MYSQL_PARAMS=    true
.endif
.if defined(WITH_MYSQL_DB)
BROKEN_MYSQL_PARAMS=    true
.endif
.if defined(BROKEN_MYSQL_PARAMS)
BROKEN= The MySQL connection parameters are no longer setup at compile time - please edit the ${VPOPMAIL_DIR}/etc/vpopmail.mysql file instead
.endif
.else
PLIST_SUB+= MYSQL="@comment "
.endif

.if defined(DEFAULT_DOMAIN)
BROKEN= The default vpopmail domain is no longer setup at compile time - please edit the ${VPOPMAIL_DIR}/etc/defaultdomain file instead
.endif

.if defined(WITH_APOP)
BROKEN=     The WITH_APOP option is deprecated; set WITH_CLEAR_PASSWD instead, APOP will just work
.endif

.if ${PORT_OPTIONS:MPGSQL}
USE_PGSQL=      yes
CONFIGURE_ARGS+=    --enable-auth-module=pgsql
.endif

.if ${PORT_OPTIONS:MSQL_LOG}
CONFIGURE_ARGS+=    --enable-sql-logging
.if ${PORT_OPTIONS:MSQL_LOG_TRIM}
EXTRA_PATCHES+= ${FILESDIR}/sql-remove-deleted.patch
.endif
.endif

.if ${PORT_OPTIONS:MSMTP_AUTH_PATCH}
EXTRA_PATCHES+= ${FILESDIR}/vchkpw-smtp-auth.patch
.endif

.if ${PORT_OPTIONS:MONCHANGE_SCRIPT}
CONFIGURE_ARGS+=    --enable-onchange-script
.endif

.if ${PORT_OPTIONS:MMAILDROP}
CONFIGURE_ARGS+=    --enable-maildrop=y \
            --enable-maildrop-prog=${LOCALBASE}/bin/maildrop
BUILD_DEPENDS+= maildrop:${PORTSDIR}/${MAILDROP_PORT}
RUN_DEPENDS+=   maildrop:${PORTSDIR}/${MAILDROP_PORT}
MAILDROP_FILES=     ${WRKSRC}/maildrop/maildroprc.v1 \
            ${WRKSRC}/maildrop/maildroprc.v2
PLIST_SUB+= MAILDROP=""
.else
CONFIGURE_ARGS+=    --enable-maildrop=n
PLIST_SUB+= MAILDROP="@comment "
.endif

.if ${PORT_OPTIONS:MDOMAIN_QUOTAS}
CONFIGURE_ARGS+=    --enable-domainquotas=y
.else
CONFIGURE_ARGS+=    --enable-domainquotas=n
.endif

.if empty(PORT_OPTIONS:MDOCS)
EXTRA_PATCHES+= ${FILESDIR}/Makefile.in-noportdocs.patch
.endif

.if ${PORT_OPTIONS:MFPIC} && ( ${ARCH} == "amd64" || ${ARCH} == "ia64" )
CFLAGS+=    -fPIC
.endif

#
# Some suggestions from Gabriel Ambuehl <gabriel_ambuehl@buz.ch>
#

CONFIGURE_ARGS+=    --enable-logging=${LOGLEVEL}

.if ${PORT_OPTIONS:MPASSWD}
CONFIGURE_ARGS+=    --enable-passwd
.endif

.if empty(PORT_OPTIONS:MMD5_PASSWORDS)
CONFIGURE_ARGS+=    --disable-md5-passwords
.endif

.if ${PORT_OPTIONS:MVALIAS}
CONFIGURE_ARGS+=    --enable-valias
.endif

.if ${PORT_OPTIONS:MROAMING}
CONFIGURE_ARGS+=    --enable-roaming-users \
            --enable-relay-clear-minutes=${RELAYCLEAR}
.endif

.if empty(PORT_OPTIONS:MCLEAR_PASSWD)
CONFIGURE_ARGS+=    --disable-clear-passwd
.endif

.if ${PORT_OPTIONS:MLEARN_PASSWORDS}
CONFIGURE_ARGS+=    --enable-learn-passwords
.endif

.if ${PORT_OPTIONS:MSYBASE}
CONFIGURE_ARGS+=    --enable-auth-module=sybase
.endif

.if ${PORT_OPTIONS:MORACLE}
CONFIGURE_ARGS+=    --enable-auth-module=oracle
.endif

.if ${PORT_OPTIONS:MSINGLE_DOMAIN}
CONFIGURE_ARGS+=    --disable-many-domains
.endif

.if ${PORT_OPTIONS:MIP_ALIAS}
CONFIGURE_ARGS+=    --enable-ip-alias-domains
.endif

.if ${PORT_OPTIONS:MQMAIL_EXT}
CONFIGURE_ARGS+=    --enable-qmail-ext
.endif

.if empty(PORT_OPTIONS:MFILE_LOCKING)
CONFIGURE_ARGS+=    --disable-file-locking
.endif

.if ${PORT_OPTIONS:MFILE_SYNC}
CONFIGURE_ARGS+=    --enable-file-sync
.endif

.if empty(PORT_OPTIONS:MAUTH_LOG)
CONFIGURE_ARGS+=    --disable-auth-logging
.endif

.if empty(PORT_OPTIONS:MUSERS_BIG_DIR)
CONFIGURE_ARGS+=    --disable-users-big-dir
.endif

.if empty(PORT_OPTIONS:MSEEKABLE)
CONFIGURE_ARGS+=    --disable-make-seekable
.endif

.if ${PORT_OPTIONS:MSPAMASSASSIN}
BUILD_DEPENDS+=     spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin
CONFIGURE_ARGS+=    --enable-spamassassin \
            --enable-spamc-prog=${LOCALBASE}/bin/spamc \
            --enable-spam-threshold=${SPAM_THRESHOLD}
.if ${PORT_OPTIONS:MSPAMFOLDER}
CONFIGURE_ARGS+=    --enable-spam-junkfolder
.endif
.endif

DOCS=       README README.activedirectory README.filelocking \
        README.ipaliasdomains README.ldap README.maildrop \
        README.mysql \
        README.onchange README.oracle README.pgsql \
        README.qmail-default README.quotas \
        README.roamingusers README.spamassassin README.sybase \
        README.vdelivermail README.vlimits \
        README.vpopmaild README.vpopmaild README.vqmaillocal \
        UPGRADE

#
# This port doesn't honour PREFIX, it honours vpopmail's home directory.
# Since we create vpopmail if it doesn't exist, we set it so that it
# does honour PREFIX. -- nbm
#

pre-configure:
    ${AWK} -F: '/^${USERS}:/ { print $$3 }' ${UID_FILES} > ${WRKSRC}/vpopmail.uid
    ${AWK} -F: '/^${USERS}:/ { sub(/\/usr\/local/, "${PREFIX}", $$9); print $$9 }' ${UID_FILES} > ${WRKSRC}/vpopmail.dir
    ${AWK} -F: '/^${GROUPS}:/ { print $$3 }' ${GID_FILES} > ${WRKSRC}/vpopmail.gid
.if ${PORT_OPTIONS:MPGSQL}
.if defined(WITH_PGSQL_DB)
    ${REINPLACE_CMD} -E -e "s/(#define DB.*)vpopmail(.*)/\1${WITH_PGSQL_DB}\2/" ${WRKSRC}/vpgsql.h
.endif
.if defined(WITH_PGSQL_USER)
    ${REINPLACE_CMD} -E -e "s/(#define PG_CONNECT.*)postgres(.*)/\1${WITH_PGSQL_USER}\2/" ${WRKSRC}/vpgsql.h
.endif
.endif
.if ${PORT_OPTIONS:MORACLE}
.if defined(WITH_ORACLE_SERVICE)
    ${REINPLACE_CMD} -E -e "s/(#define ORACLE_SERVICE.*)jimmy(.*)/\1${WITH_ORACLE_SERVICE}\2/" ${WRKSRC}/voracle.h
.endif
.if defined(WITH_ORACLE_USER)
    ${REINPLACE_CMD} -E -e "s/(#define ORACLE_USER.*)system(.*)/\1${WITH_ORACLE_USER}\2/" ${WRKSRC}/voracle.h
.endif
.if defined(WITH_ORACLE_PASSWD)
    ${REINPLACE_CMD} -E -e "s/(#define ORACLE_PASSWD.*)manager(.*)/\1${WITH_ORACLE_PASSWD}\2/" ${WRKSRC}/voracle.h
.endif
.if defined(WITH_ORACLE_HOME)
    ${REINPLACE_CMD} -E -e "s@(#define ORACLE_HOME.*)/export/home/oracle(.*)@\1${WITH_ORACLE_HOME}\2@" ${WRKSRC}/voracle.h
.endif
.if defined(WITH_ORACLE_DB)
    ${REINPLACE_CMD} -E -e "s/(#define ORACLE_DATABASE.*)orcl1(.*)/\1${WITH_ORACLE_DB}\2/" ${WRKSRC}/voracle.h
.endif
    cd ${WRKSRC} && ${WITH_ORACLE_PROC} voracle.pc
.endif
.if ${PORT_OPTIONS:MSYBASE}
.if defined(WITH_SYBASE_SERVER)
    ${REINPLACE_CMD} -E -e "s/(#define SYBASE_SERVER.*)\"\"(.*)/\1\"${WITH_SYBASE_SERVER}\"\2/" ${WRKSRC}/vsybase.h
.endif
.if defined(WITH_SYBASE_USER)
    ${REINPLACE_CMD} -E -e "s/(#define SYBASE_USER.*)sa(.*)/\1${WITH_SYBASE_USER}\2/" ${WRKSRC}/vsybase.h
.endif
.if defined(WITH_SYBASE_PASSWD)
    ${REINPLACE_CMD} -E -e "s/(#define SYBASE_PASSWD.*)\"\"(.*)/\1\"${WITH_SYBASE_PASSWD}\"\2/" ${WRKSRC}/vsybase.h
.endif
.if defined(WITH_SYBASE_APP)
    ${REINPLACE_CMD} -E -e "s@(#define SYBASE_APP.*)vpopmail(.*)@\1${WITH_SYBASE_APP}\2@" ${WRKSRC}/vsybase.h
.endif
.if defined(WITH_SYBASE_DB)
    ${REINPLACE_CMD} -E -e "s/(#define SYBASE_DATABASE.*)vpopmail(.*)/\1${WITH_SYBASE_DB}\2/" ${WRKSRC}/vsybase.h
.endif
.endif
    ${REINPLACE_CMD} -E -e "s@(#define PATH_IMAPLOGIN.*)VPOPMAILDIR.*@\1\"${WITH_COURIER_IMAPLOGIN}\"@" ${WRKSRC}/authvchkpw.c
    ${REINPLACE_CMD} -E -e "s@(#define PATH_AUTHVCHKPW.*)VPOPMAILDIR.*@\1\"${WITH_VPOPMAIL_AUTHVCHKPW}\"@" ${WRKSRC}/authvchkpw.c
    ${REINPLACE_CMD} -E -e "s@(#define PATH_IMAPD.*)VPOPMAILDIR.*@\1\"${WITH_COURIER_IMAPD}\"@" ${WRKSRC}/authvchkpw.c
    ${MKDIR} ${VCFGDIR}

post-install:
    ${MKDIR} ${VPOPMAIL_DIR}/etc
    if [ -e "${VCFGDIR}/tcp.smtp" ]; then \
        ${INSTALL_DATA} ${VCFGDIR}/tcp.smtp ${VPOPMAIL_DIR}/etc/tcp.smtp-dist; \
    else \
        ${TOUCH} ${VPOPMAIL_DIR}/etc/tcp.smtp-dist; \
    fi;
    if [ ! -f ${VPOPMAIL_DIR}/etc/tcp.smtp ]; then \
        ${INSTALL_DATA} ${VPOPMAIL_DIR}/etc/tcp.smtp-dist ${VPOPMAIL_DIR}/etc/tcp.smtp; \
    fi
    if [ ! -f ${VPOPMAIL_DIR}/etc/vlimits.default ]; then \
        ${INSTALL_DATA} ${VPOPMAIL_DIR}/etc/vlimits.default-dist ${VPOPMAIL_DIR}/etc/vlimits.default; \
    fi
    if [ ! -f ${VPOPMAIL_DIR}/etc/vusagec.conf ]; then \
        ${INSTALL_DATA} ${VPOPMAIL_DIR}/etc/vusagec.conf-dist ${VPOPMAIL_DIR}/etc/vusagec.conf; \
    fi
.if ${PORT_OPTIONS:MMYSQL}
    if [ ! -f ${VPOPMAIL_DIR}/etc/vpopmail.mysql ]; then \
        ${CP} ${VPOPMAIL_DIR}/etc/vpopmail.mysql-dist ${VPOPMAIL_DIR}/etc/vpopmail.mysql; \
    fi
.endif
    ${TOUCH} ${VPOPMAIL_DIR}/etc/defaultdomain
.if ${PORT_OPTIONS:MLDAP}
    @${ECHO_CMD} "# LDAP CONNECTION SETTINGS FOR VPOPMAIL" > ${VPOPMAIL_DIR}/etc/vpopmail.ldap-dist
    @${ECHO_CMD} "# Line format:" >> ${VPOPMAIL_DIR}/etc/vpopmail.ldap-dist
    @${ECHO_CMD} "# host|port|user|password|basedn" >> ${VPOPMAIL_DIR}/etc/vpopmail.ldap-dist
    @${ECHO_CMD} "localhost|389|cn=vpopmailuser, o=vpopmail|vpoppasswd|o=vpopmail" >> ${VPOPMAIL_DIR}/etc/vpopmail.ldap-dist
    if [ ! -f ${VPOPMAIL_DIR}/etc/vpopmail.ldap ]; then \
        ${CP} ${VPOPMAIL_DIR}/etc/vpopmail.ldap-dist ${VPOPMAIL_DIR}/etc/vpopmail.ldap; \
    fi
    @${ECHO_CMD} "You need to specify the LDAP connection settings in the ${VPOPMAIL_DIR}/etc/vpopmail.ldap file"
.endif
    ${CHOWN} -R vpopmail:vchkpw ${VPOPMAIL_DIR}/bin/ ${VPOPMAIL_DIR}/etc/
.if ${PORT_OPTIONS:MSPAMASSASSIN}
    ${ECHO_CMD} "***********************************************************************"
    ${ECHO_CMD} "Now you should add the following options to your spamd.sh startup file:"
    ${ECHO_CMD} "-v -u vpopmail"
    ${ECHO_CMD} "***********************************************************************"
.endif
.if ${PORT_OPTIONS:MLDAP}
    ${MKDIR} ${VPOPMAIL_DIR}/ldap
    ${INSTALL_DATA} ${LDAP_FILES} ${VPOPMAIL_DIR}/ldap
.endif
.if ${PORT_OPTIONS:MMAILDROP}
    ${MKDIR} ${VPOPMAIL_DIR}/maildrop
    ${INSTALL_DATA} ${MAILDROP_FILES} ${VPOPMAIL_DIR}/maildrop
.endif
.if ${PORT_OPTIONS:MSUID_VCHKPW}
    ${CHMOD} ug+s ${VPOPMAIL_DIR}/bin/vchkpw
.endif
.if ${PORT_OPTIONS:MDOCS}
    ${INSTALL_DATA} ${DOCS:S,^,${WRKSRC}/doc/,} ${VPOPMAIL_DIR}/doc/
.endif

.include <bsd.port.post.mk>