aboutsummaryrefslogtreecommitdiffstats
path: root/mail/cclient/Makefile
blob: c87df467cc224344b6646cddac761b320f62c7c2 (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
# Created by: Kelly Yancey <kbyanc@FreeBSD.org>
# $FreeBSD$

PORTNAME=   cclient
PORTVERSION=    2007f
PORTEPOCH=  1
CATEGORIES= mail devel ipv6
MASTER_SITES=   ftp://ftp.cac.washington.edu/imap/%SUBDIR%/ \
        http://atreides.freenix.no/~anders/%SUBDIR%/ \
        ftp://ftp.funet.fi/pub/mirrors/ftp.cac.washington.edu/imap/%SUBDIR%/ \
        ftp://ftp.nuug.no/pub/anders/distfiles/%SUBDIR%/
MASTER_SITE_SUBDIR= . old
DISTNAME=   imap-${PORTVERSION}

MAINTAINER= anders@FreeBSD.org
COMMENT=    Mark Crispin's C-client mail access routines

LICENSE=    AL2
LICENSE_FILE=   ${WRKSRC}/LICENSE.txt

OPTIONS_DEFINE= SSL SSL_AND_PLAINTEXT IPV6 MBX_DEFAULT
OPTIONS_DEFAULT=    SSL
SSL_AND_PLAINTEXT_DESC= Allow plain text passwords and SSL
MBX_DEFAULT_DESC=   Use MBX as default mailbox format

MAKE_JOBS_UNSAFE=   yes

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MSSL}
USE_OPENSSL=    yes
.endif

.include <bsd.port.pre.mk>

USE_LDCONFIG=   yes
ALL_TARGET= bsf
.if ! ${PORT_OPTIONS:MSSL}
MAKE_ARGS+= SSLTYPE=none SSLDIR=${OPENSSLBASE}
.else
.if ${PORT_OPTIONS:MSSL_AND_PLAINTEXT}
MAKE_ARGS+= SSLTYPE=unix SSLDIR=${OPENSSLDIR}
.else
MAKE_ARGS+= SSLTYPE=unix.nopwd SSLDIR=${OPENSSLDIR}
.endif
.endif

WRKSRC=     ${WRKDIR}/${DISTNAME}

SHLIBBASE=  c-client4
SHLIBMAJ=   9
SHLIBNAME=  lib${SHLIBBASE}.so.${SHLIBMAJ}
MAKE_ENV+=  SHLIBNAME=${SHLIBNAME} SHLIBBASE=${SHLIBBASE}
PLIST_SUB=  SHLIBNAME=${SHLIBNAME} SHLIBBASE=${SHLIBBASE}

post-patch:
.for file in Makefile src/osdep/unix/Makefile src/osdep/unix/Makefile.gss
    @${REINPLACE_CMD} -e "s|/usr/local|${PREFIX}|g" ${WRKSRC}/${file}
.endfor
    @${REINPLACE_CMD} -e "s:/etc/ssl/certs:${PREFIX}/certs:g; \
        s:/etc/ssl/private:${PREFIX}/certs:g" ${WRKSRC}/Makefile
    @${REINPLACE_CMD} -e "s:/etc/c-client.cf:${PREFIX}/etc/c-client.cf:" \
        ${WRKSRC}/src/osdep/unix/env_unix.h
.if ${PORT_OPTIONS:MSSL}
    @${REINPLACE_CMD} -e " \
        s:SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib:SSLINCLUDE=${OPENSSLINC} SSLLIB=${OPENSSLLIB}: \
        " ${WRKSRC}/Makefile
.endif
.if ${PORT_OPTIONS:MIPV6}
    @${REINPLACE_CMD} -e "s|^IP=4|IP=6|" ${WRKSRC}/Makefile \
        ${WRKSRC}/src/osdep/unix/Makefile
.endif
.if ${PORT_OPTIONS:MMBX_DEFAULT}
    @${REINPLACE_CMD} -e "s|^CREATEPROTO=unixproto|CREATEPROTO=mbxproto|" \
        ${WRKSRC}/src/osdep/unix/Makefile
.endif

post-configure:
    @${ECHO_MSG} ">> The c-client shared library will be named ${SHLIBNAME}"

HEADERS=    c-client.h dummy.h env.h env_unix.h fdstring.h flockcyg.h \
        flocksim.h flstring.h fs.h ftl.h imap4r1.h linkage.c linkage.h \
        mail.h misc.h netmsg.h newsrc.h nl.h nntp.h osdep.h pseudo.h \
        rfc822.h smtp.h sslio.h tcp.h tcp_unix.h unix.h utf8.h \
        utf8aux.h
PORTREV_H=  ${WRKDIR}/portrevision.h

post-build:
    @${ECHO_CMD} "#define CCLIENT_PORTVERSION \"${PORTVERSION}\"" >${PORTREV_H}
.if ${PORT_OPTIONS:MSSL}
    @${ECHO_CMD} "#define CCLIENT_SSLENABLED \"yes\"" >>${PORTREV_H}
.else
    @${ECHO_CMD} "#define CCLIENT_SSLENABLED \"no\"" >>${PORTREV_H}
.endif

do-install:
    ${MKDIR} ${PREFIX}/include/c-client
.for f in ${HEADERS}
    ${INSTALL_DATA} ${WRKSRC}/c-client/${f} ${PREFIX}/include/c-client
.endfor
    ${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
        ${WRKSRC}/c-client/${SHLIBNAME} ${PREFIX}/lib
    ${LN} -sf ${SHLIBNAME} ${PREFIX}/lib/lib${SHLIBBASE}.so
    ${INSTALL_DATA} ${WRKSRC}/c-client/c-client.a \
        ${PREFIX}/lib/lib${SHLIBBASE}.a
    ${INSTALL_DATA} ${WRKSRC}/c-client/CFLAGS ${PREFIX}/include/c-client
    ${INSTALL_DATA} ${WRKSRC}/c-client/LDFLAGS ${PREFIX}/include/c-client
    ${INSTALL_DATA} ${WRKSRC}/c-client/OSCFLAGS ${PREFIX}/include/c-client

post-install:
    ${INSTALL_DATA} ${PORTREV_H} ${PREFIX}/include/c-client
.if ${PORT_OPTIONS:MSSL}
    @${ECHO} "================================================================================"
    @${ECHO} "Warning: You have chosen to include SSL support. Applications/ports that use"
    @${ECHO} "the cclient library but do not support SSL may stop working or have problems"
    @${ECHO} "linking. Linking them explicitly with ssl (-lssl -lcrypto) may or may not help."
    @${ECHO} "================================================================================"
.endif

.include <bsd.port.post.mk>