aboutsummaryrefslogtreecommitdiffstats
path: root/mail/dbmail20/Makefile
blob: 6b6fa41550a9c67d77fca635614563cc11060c4a (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
# New ports collection makefile for:    dbmail
# Date created:             07/26/2003
# Whom:                 Clement Laforet <sheepkiller@cultdeadsheep.org>
#
# $FreeBSD$
#

PORTNAME=   dbmail
PORTVERSION=    2.0.11
CATEGORIES= mail
MASTER_SITES=   http://www.dbmail.org/download/2.0/
PKGNAMESUFFIX=  -${DATABASE}
EXTRACT_SUFX=   .tgz

MAINTAINER= mark_sf@kikg.ifmo.ru
COMMENT=    An SQL database-based mail system (POP3 and IMAP)

GNU_CONFIGURE=  YES
CONFIGURE_ARGS= --prefix=${PREFIX}
USE_GMAKE=  YES
USE_OPENSSL=    YES
USE_RC_SUBR=    dbmail-pop3d.sh dbmail-lmtpd.sh dbmail-imapd.sh
USE_LDCONFIG=   yes

CFLAGS += -fPIC

.if defined(WITH_POSTGRESQL)
CONFIGURE_ARGS+=    --with-pgsql
USE_PGSQL=      yes
DATABASE=       postgresql
PLIST_SUB+=     PGSQL=""
PLIST_SUB+=     MYSQL="@comment "
LDFLAGS+=       -L${LOCALBASE}/lib/
.else
USE_MYSQL=      YES
CONFIGURE_ARGS+=    --with-mysql
DATABASE=       mysql
PLIST_SUB+=     MYSQL=""
PLIST_SUB+=     PGSQL="@comment "
CFLAGS+=        -I${LOCALBASE}/include/mysql
LDFLAGS+=       -L${LOCALBASE}/lib/mysql
.endif

CONFIGURE_ENV+=     LDFLAGS="${LDFLAGS}" LOCALBASE=${LOCALBASE}
PORTDOCS=       INSTALL README EXTRAS

MAN1=           dbmail-smtp.1
MAN8=           dbmail-imapd.8 dbmail-lmtpd.8 dbmail-pop3d.8 \
            dbmail-users.8 dbmail-util.8
MANCOMPRESSED=      no
SUB_FILES=      pkg-message

pre-everything::
    @${ECHO} ""
    @${ECHO} "You may use the following build options:"
    @${ECHO} "   By default dbmail uses MySQL backend database."
    @${ECHO} "   To build dbmail with PostgreSQL as backend database,"
    @${ECHO} "  define WITH_POSTGRESQL"
    @${ECHO} ""

post-patch:
    @${FIND} ${WRKSRC} -name CVS -type d | ${XARGS} ${RM} -fr
    @${FIND} ${WRKSRC} -name '*.orig' -type f -delete

post-configure:
    @${REINPLACE_CMD} -i.orig 's!/etc/dbmail.conf!${PREFIX}/etc/dbmail.conf!g' \
        ${WRKSRC}/dbmail.h

post-install:
    ${INSTALL_DATA} ${WRKSRC}/dbmail.conf ${PREFIX}/etc/dbmail.conf-dist
    @${MKDIR} ${DATADIR}/sql
    ${INSTALL_DATA} ${WRKSRC}/sql/${DATABASE}/* ${DATADIR}/sql
    cd ${WRKSRC}/man && ${INSTALL_MAN} ${MAN1} ${MAN1PREFIX}/man/man1
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
    cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
.endif
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>