summaryrefslogtreecommitdiff
path: root/mail/imap-uw/Makefile
blob: 07b3e6a1b35ca9b828a523fb5456d50907f37696 (plain)
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
# $NetBSD: Makefile,v 1.121 2007/08/19 05:42:35 obache Exp $
#
# ATTENTION:
# The Kerberos support in this software is known to be problematic. If you
# upgrade this package you *must* test it on a system with Kerberos libraries
# but not running Kerberos before committing the changes.
#
# NOTE ALSO:
# The most common reason to install this package is as a prerequisite for pine.
# If you upgrade this package, you *must* test mail/pine with the new version.

DISTNAME=	imap-2006j2
PKGNAME=	${DISTNAME:S/-/-uw-/}
PKGREVISION=	3
CATEGORIES=	mail
MASTER_SITES=	ftp://ftp.cac.washington.edu/imap/
EXTRACT_SUFX=	.tar.Z

MAINTAINER=	jwise@NetBSD.org
HOMEPAGE=	http://www.washington.edu/imap/
COMMENT=	University of Washington's IMAP, POP2, and POP3 servers

USE_LIBTOOL=		yes
MAKE_ENV+=		LIBTOOL=libtool
MAKE_ENV+=		LTCOMPILE="libtool --mode=compile"
MAKE_ENV+=		LTLINK="libtool --mode=link"
LTINSTALL_PROGRAM=	${SETENV} ${MAKE_ENV} ${LIBTOOL} --mode=install ${INSTALL_PROGRAM}
LTINSTALL_LIB=		${SETENV} ${MAKE_ENV} ${LIBTOOL} --mode=install ${INSTALL_LIB}

WRKSRC=		${WRKDIR}/${DISTNAME:S/2$//}

.include "../../mk/bsd.prefs.mk"

# Each platform has its own special target in the imap Makefiles.
OPSYSVARS+=		BUILD_TARGET
BUILD_TARGET.SunOS=	gso
.if ${OPSYS} == Linux && exists(/usr/include/security/pam_appl.h)
BUILD_TARGET.Linux=	lnp
.else
BUILD_TARGET.Linux=	slx
.endif
.if ${OPSYS} == Darwin
LDFLAGS+=		-flat_namespace
.   if exists(/usr/include/pam/pam_appl.h)
BUILD_TARGET.Darwin=	oxp
.   else
BUILD_TARGET.Darwin=	osx
.   endif
.endif
.if ${OPSYS} == "IRIX"
.  if ${OS_VERSION} >= 6.5
BUILD_TARGET.IRIX=	sg6
.  else
BUILD_TARGET.IRIX=	sgi
.  endif
.endif
BUILD_TARGET.OSF1=	osf
BUILD_TARGET.OpenBSD=	bso
.if ${OPSYS} == NetBSD && exists(/usr/include/security/pam_appl.h)
BUILD_TARGET.NetBSD=	nep
.endif
BUILD_TARGET.*=		neb
MESSAGE_SRC=		${PKGDIR}/MESSAGE

.include "options.mk"

# The defaults for these values are set in pkgsrc/mk/defaults/mk.conf.
#IMAP_UW_CCLIENT_MBOX_FMT?=	unix
#IMAP_UW_MAILSPOOLHOME?=	.Mailbox
BUILD_DEFS+=			IMAP_UW_CCLIENT_MBOX_FMT IMAP_UW_MAILSPOOLHOME

CCLIENT_LIB=		libc-client.la
CCLIENT_PICLIB=		libc-client_pic.a
CCLIENT_MAJOR=		4
CCLIENT_MINOR=		4
MAKE_ENV+=		CCLIENT_MAJOR=${CCLIENT_MAJOR:Q}
MAKE_ENV+=		CCLIENT_MINOR=${CCLIENT_MINOR:Q}

EXTRASPECIALS+=		CREATEPROTO=${IMAP_UW_CCLIENT_MBOX_FMT:Q}proto

MAKE_FLAGS+=		EXTRALDFLAGS=${LDFLAGS:Q}
MAKE_FLAGS+=		EXTRACFLAGS=${CFLAGS:Q}
MAKE_FLAGS+=		EXTRASPECIALS=${EXTRASPECIALS:Q}

SUBST_CLASSES+=		mbox
SUBST_STAGE.mbox=	do-configure
SUBST_FILES.mbox=	src/osdep/unix/env_unix.c
.if defined(IMAP_USE_MAILSPOOLHOME)
SUBST_SED.mbox=		-e 's|@SPOOLDIR@|myhomedir ()|'			\
			-e 's|@MAILBOX@|"${IMAP_UW_MAILSPOOLHOME}"|'
.else
SUBST_SED.mbox=		-e 's|@SPOOLDIR@|MAILSPOOL|'			\
			-e 's|@MAILBOX@|myusername ()|'
.endif

SUBST_CLASSES+=		man
SUBST_STAGE.man=	post-build
SUBST_FILES.man=	src/imapd/imapd.8 src/ipopd/ipopd.8
SUBST_SED.man=		-e "s|/usr/etc/imapd|${PREFIX}/libexec/imapd|g"	\
			-e "s|/etc/rimapd|${PREFIX}/sbin/rimapd|g"	\
			-e "s|/usr/etc/ipop2d|${PREFIX}/libexec/ipop2d|g" \
			-e "s|/usr/etc/ipop3d|${PREFIX}/libexec/ipop3d|g"

INSTALLATION_DIRS+=	bin lib libexec sbin				\
			${PKGMANDIR}/man1 ${PKGMANDIR}/man8

# Generate _pic.a library from shared objects.
post-build:
	cd ${WRKSRC}/c-client;						\
	${LIBTOOL} --mode=link ${CC} -o ${CCLIENT_PICLIB:.a=.la} *.lo

do-install: install-headers install-lib install-doc
	${LTINSTALL_PROGRAM} ${WRKSRC}/imapd/imapd ${PREFIX}/libexec
	${LTINSTALL_PROGRAM} ${WRKSRC}/ipopd/ipop2d ${PREFIX}/libexec
	${LTINSTALL_PROGRAM} ${WRKSRC}/ipopd/ipop3d ${PREFIX}/libexec
	${LTINSTALL_PROGRAM} ${WRKSRC}/mtest/mtest ${PREFIX}/sbin
	${LN} -sf ../libexec/imapd ${PREFIX}/sbin/rimapd
	${INSTALL_MAN} ${WRKSRC}/src/imapd/imapd.8 ${PREFIX}/${PKGMANDIR}/man8
	${INSTALL_MAN} ${WRKSRC}/src/ipopd/ipopd.8 ${PREFIX}/${PKGMANDIR}/man8
	${LN} -sf ipopd.8 ${PREFIX}/${PKGMANDIR}/man8/ipop2d.8
	${LN} -sf ipopd.8 ${PREFIX}/${PKGMANDIR}/man8/ipop3d.8
	${LTINSTALL_PROGRAM} ${WRKSRC}/mailutil/mailutil ${PREFIX}/bin
	${INSTALL_MAN} ${WRKSRC}/src/mailutil/mailutil.1 ${PREFIX}/${PKGMANDIR}/man1
	${LTINSTALL_PROGRAM} ${WRKSRC}/dmail/dmail ${PREFIX}/bin
	${INSTALL_MAN} ${WRKSRC}/src/dmail/dmail.1 ${PREFIX}/${PKGMANDIR}/man1
	${LTINSTALL_PROGRAM} ${WRKSRC}/mlock/mlock ${PREFIX}/bin
	${LTINSTALL_PROGRAM} ${WRKSRC}/tmail/tmail ${PREFIX}/bin
	${INSTALL_MAN} ${WRKSRC}/src/tmail/tmail.1 ${PREFIX}/${PKGMANDIR}/man1

.PHONY: install-headers install-lib install-doc
install-headers:
	${INSTALL_DATA_DIR} ${PREFIX}/include/c-client
	${CAT} ${PKGDIR}/PLIST |					\
	while read entry; do						\
		case "$$entry" in					\
		include/c-client/*)					\
			src="${WRKSRC}/c-client/`${BASENAME} $$entry`";	\
			dest="${PREFIX}/$$entry";			\
			${INSTALL_DATA} $$src $$dest;			\
		esac;							\
	done

install-lib:
	${LTINSTALL_LIB} ${WRKSRC}/c-client/${CCLIENT_LIB} ${PREFIX}/lib
	${INSTALL_LIB} ${WRKSRC}/c-client/.libs/${CCLIENT_PICLIB} ${PREFIX}/lib
	${RANLIB} ${PREFIX}/lib/${CCLIENT_PICLIB}

DOCDIR=	${PREFIX}/share/doc/${PKGBASE}
install-doc:
	${INSTALL_DATA_DIR} ${DOCDIR}
	${CP} -R ${WRKSRC}/docs/* ${DOCDIR}
	${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${DOCDIR}
	${FIND} ${DOCDIR} -type d -print | ${XARGS} ${CHMOD} ${PKGDIRMODE}
	${FIND} ${DOCDIR} -type f -print | ${XARGS} ${CHMOD} ${SHAREMODE}

.include "../../mk/bsd.pkg.mk"