aboutsummaryrefslogtreecommitdiff
path: root/mail/elm+ME/Makefile
blob: a664b204fe1e4cf4a8b9f5ca1d513764917dd97b (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
# New ports collection makefile for:	elm ME+ (unofficial Elm)
# Date created:		26 June 1995
# Whom:			ache
#
# $FreeBSD$
#

PORTNAME=	elm+ME
PORTVERSION=	2.4.95${PATCHLEVEL}
CATEGORIES=	mail
DISTNAME=	${PORTNAME:S/+ME//}-${PORTVERSION:R}ME+${PORTVERSION:E:S|${PATCHLEVEL}||}

# here are the main repositories.
MASTER_SITES=	ftp://ftp.ozone.fmi.fi/KEH/ \
		http://www.ozone.fmi.fi/KEH/
# the following repositories conform to the main repository.
MASTER_SITES+=	ftp://ftp.lip6.fr/pub/unix/mail/elm-me/ \
		ftp://ftp.tu-darmstadt.de/pub/networking/mail/elm+ME/ \
		ftp://ftp.cs.tu-berlin.de/pub/net/mail/elm-me-plus/ \
		ftp://ftp.ntua.gr/pub/net/mail/elm-me/ \
		ftp://ftp.eos.hokudai.ac.jp/pub/network/mail/elm-2.4ME+/ \
		ftp://ftp.win.ne.jp/pub/network/mail/elm-2.4ME+/
# the following repositories maybe conform to the main repository.
# MASTER_SITES+=	ftp://ftp.unina.it/pub/Unix/pkgs/network/mail/elm-me+/ \
# 		ftp://ftp.rge.com/pub/mail/elm/elm-2.4ME+/ \
# 		ftp://ftp.uni-trier.de/pub/unix/network/mail/elm-me+/
PATCH_SITES=	${MASTER_SITES}
PATCHFILES=	${DISTNAME:S/+/+PL/}a.patch.gz
PATCHLEVEL=	a
PATCH_DIST_STRIP=	-p1

MAINTAINER=	cyrille.lefevre@laposte.net

LIB_DEPENDS=	iconv.3:${PORTSDIR}/converters/libiconv

# not needed since config.sh is generated by scripts/pre-configure.
# BUILD_DEPENDS=	ispell:${PORTSDIR}/textproc/ispell
# BUILD_DEPENDS=	metamail:${PORTSDIR}/mail/metamail
# BUILD_DEPENDS=	pgp:${PORTSDIR}/security/pgp
# BUILD_DEPENDS=	gpg:${PORTSDIR}/security/gnupg

# Global variables
#

WRKSRC=		${WRKDIR}/${DISTNAME:S/-//:S/ME+/.ME+./}

HAS_CONFIGURE=	yes

CONFIGURE_SCRIPT=	Configure
SCRIPTS_ENV=	CFLAGS="${CFLAGS}" ${PLIST_SUB} PREFIX="${PREFIX}" \
		LOCALBASE="${LOCALBASE}" MAN1PREFIX="${MAN1PREFIX}"
CONFIGURE_ARGS=	-S -P ${PREFIX}

MAKE_ARGS=	MJ="FORMATTER=groff FORMATTER_OPTS=-Tlatin1"
ALL_TARGET=	all documentation

INSTALLS_SHLIB=	yes
LDCONFIG_DIRS=	%%PREFIX%%/%%SHLIB_SUBDIR%%

PLIST_SUB=	SO_REV="${SO_REV}" DOC_SUBDIR="${DOC_SUBDIR}" \
		LIB_SUBDIR="${LIB_SUBDIR}" SHLIB_SUBDIR="${SHLIB_SUBDIR}"

MAN1=		answer.1 checkalias.1 elm.1 elmalias.1 elmcharset.1 \
		elmrc-write.1 elmterminal.1 elmunidata.1 fastmail.1 frm.1 \
		listalias.1 messages.1 newalias.1 newmail.1 printmail.1 \
		readmsg.1
MLINKS=		frm.1 nfrm.1	newmail.1 wnewmail.1

# Local variables
#

# evaluation should be protected 'til extraction to avoid noisy messages.
SO_REV=		$$([ -f ${WRKSRC}/hdrs/patchlevel.h ] && \
		  ${AWK} '/SHAREDTAG:/{print $$2}' ${WRKSRC}/hdrs/patchlevel.h)
MSECS=		1

RCD_SUBDIR=	etc/rc.d
LIB_SUBDIR=	lib/elm
SHLIB_SUBDIR=	libexec/elm
DOC_SUBDIR=	share/doc/elm

RCD_FILE=	00elm.sh
MIME_TYPES=	elm.mimetypes
DOC_FILES=	README.ME+ \
		shared_libs/iconv/README.ICONV \
		shared_libs/tls/README.TLS \
		doc/Alias.fmtd doc/Config.fmtd doc/Cover.fmtd \
		doc/Form.fmtd doc/Ref.fmtd doc/Users.fmtd

# Post-patch
#

post-patch: patch-install-script patch-setgid patch-nls-files

patch-install-script:
	@${SED} -e 's,%%SHLIB_SUBDIR%%,${SHLIB_SUBDIR},' \
		${FILESDIR}/${RCD_FILE} > ${WRKSRC}/${RCD_FILE}

# d_savegrpmboxid is currently broken using setgid(2) instead of setegid(2).
# will probably be fixed in a next release, for instance, fake a patch.
# the alternative would be to disable this option in pre-configure script.
patch-setgid:
	@${PERL} -pi.fbsd -e 's,setgid,setegid,' \
		${WRKSRC}/lib/localmbx.c \
		${WRKSRC}/src/init.c ${WRKSRC}/src/lock.c

patch-nls-files:
	@${PERL} -pi.fbsd -e 's,/usr/local,${PREFIX},' ${WRKSRC}/nls/LANGS

# Post-install
#

post-install: install-startup-files install-nls-files \
	      install-doc-files install-mime-types install-global-rc-file \
	      remove-catman-files remove-catman-links

install-startup-files:
	@${INSTALL_SCRIPT} ${WRKSRC}/${RCD_FILE} ${PREFIX}/${RCD_SUBDIR}

install-nls-files:
	@cd ${WRKSRC}/nls; ${MAKE} install

install-doc-files:
.if !defined(NOPORTSDOC)
	@${MKDIR} ${PREFIX}/${DOC_SUBDIR}
.for file in ${DOC_FILES}
	@${INSTALL_DATA} ${WRKSRC}/${file} ${PREFIX}/${DOC_SUBDIR}
	@${GZIP_CMD} ${PREFIX}/${DOC_SUBDIR}/${file:T}
.endfor
.endif

install-mime-types:
	@${INSTALL_DATA} ${FILESDIR}/${MIME_TYPES} \
		${PREFIX}/${LIB_SUBDIR}/${MIME_TYPES}-dist
.if !exists(${PREFIX}/${LIB_SUBDIR}/${MIME_TYPES})
	@${INSTALL_DATA} ${FILESDIR}/${MIME_TYPES} \
		${PREFIX}/${LIB_SUBDIR}
.endif

# at installation time, elm already has merged changes to the global
# rc file.  so, the only way to generate a -dist rc file is to
# backup the original rc file, then to generate the -dist rc file
# and to restore the backuped rc file. this allow us, at deinstallation
# time, to not delete an existing customized rc file.
install-global-rc-file:
	@${MV} ${PREFIX}/${LIB_SUBDIR}/elm.rc \
		${PREFIX}/${LIB_SUBDIR}/elm.rc.orig
	@${PREFIX}/${LIB_SUBDIR}/elmrc-write -G -I
	@${MV} ${PREFIX}/${LIB_SUBDIR}/elm.rc \
		${PREFIX}/${LIB_SUBDIR}/elm.rc-dist
	@${MV} ${PREFIX}/${LIB_SUBDIR}/elm.rc.orig \
		${PREFIX}/${LIB_SUBDIR}/elm.rc

remove-catman-files:
.for sect in ${MSECS}
.for page in ${MAN${sect}}
	@${RM} -f ${MAN${sect}PREFIX}/man/cat${sect}/${page}
.endfor
.endfor

remove-catman-links:
.for sect in ${MSECS}
.for page in ${MLINKS}
.if ${MAN${sect}:M${page}} == ""
	@${RM} -f ${MAN${sect}PREFIX}/man/cat${sect}/${page}
.endif
.endfor
.endfor

.include <bsd.port.pre.mk>

# some sketchy hackery
FETCH_CMD_INTERIOR=	${FETCH_CMD:M*fetch*}

# only enable the hack if FETCH_CMD is fetch
.if !empty(FETCH_CMD_INTERIOR)

# lip6 dislike $USER@localhost...
FETCH_ENV=	FTP_PASSWORD=${FTP_PASSWORD}

IFCONFIG?=	ifconfig

# well, this is a hack to make fetch happy on lip6, ugh!
HOSTIPADDR=	${IFCONFIG} | ${AWK} '/inet /{print $$2; exit}'
FTP_PASSWORD?=	${USER}@`${HOSTIPADDR}`
.endif

.include <bsd.port.post.mk>