1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00
freebsd-ports/mail/elm+ME/Makefile

300 lines
7.9 KiB
Makefile

# Created by: ache
# $FreeBSD$
PORTNAME= elm+ME
PORTVERSION= ${ELM_VERSION}.${ELM_REVISION}${ELM_PATCHLEVEL:S/_//}
CATEGORIES= mail
MASTER_SITES= http://www.elmme-mailer.org/ \
ftp://ftp.elmme-mailer.org/elmme-mailer.org/src/elm-2.4ME+/ \
ftp://ftp.funet.fi/pub/unix/mail/elm/elm-2.4ME+/
DISTNAME= elm-${ELM_VERSION}ME+${ELM_REVISION}
PATCH_SITES= ${MASTER_SITES}
PATCHFILES= # see below.
PATCH_DIST_STRIP= -p1
MAINTAINER= johans@FreeBSD.org
COMMENT= Modern branch of an old mail user agent
# 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
MAKE_JOBS_UNSAFE= yes
# Global variables
#
CONFLICTS_INSTALL= elm-[0-9]* newmail-[0-9]* mailutils-[0-9]*
WRKSRC= ${WRKDIR}/${DISTNAME:S/-//:S/ME+/.ME+./}
HAS_CONFIGURE= yes
USE_OPENSSL= yes
CONFIGURE_SCRIPT= Configure
SCRIPTS_ENV= CONFIG_PATH="${CONFIG_PATH}" CFLAGS="${CFLAGS}" \
PREFIX="${PREFIX}" LOCALBASE="${LOCALBASE}" \
MAN1PREFIX="${MAN1PREFIX}" CONF_DIR="${CONF_DIR}" \
LIB_DIR="${LIB_DIR}" SHLIB_DIR="${SHLIB_DIR}" \
STAGE_DIR="${STAGE_DIR}" ELM_SHLIBS="${ELM_SHLIBS}" \
OPENSSLLIB="${OPENSSLLIB}" OPENSSLINC="${OPENSSLINC}" \
OPENSSLBASE="${OPENSSLBASE}" CC="${CC}" \
ICONV_PREFIX="${ICONV_PREFIX}" ICONV_LINK="${ICONV_LINK}"
CONFIGURE_ARGS= -b -S -P ${PREFIX} -c ../${CONFIG_PATH:T}
MAKE_ENV= MJ="FORMATTER=groff FORMATTER_OPTS=-Tlatin1"
ALL_TARGET= all
USE_LDCONFIG= yes
PLIST_SUB= SO_REV="${SO_REV}" \
MAIL_DIR="${MAIL_DIR:S,^${PREFIX}/,,}" \
CONF_DIR="${CONF_DIR:S,^${PREFIX}/,,}" \
LIB_DIR="${LIB_DIR:S,^${PREFIX}/,,}" \
SHLIB_DIR="${SHLIB_DIR:S,^${PREFIX}/,,}" \
ELM_SHLIBS="${ELM_SHLIBS}" \
${ELM_SHLIBS:U:S/^/ELM_/:S/$/=""/} \
${ELM_UNSHLIBS:U:S/^/ELM_/:S/$/="@comment "/}
MAN1= answer.1 checkalias.1 elm.1 elmalias.1 elmbindata.1 \
elmcharset.1 elmlibregister.1 elmmimetypes.1 \
elmrc-write.1 elmregister.1 \
elmstringconvert.1 elmterminal.1 elmunidata.1 elmuninstall.1 \
fastmail.1 frm.1 listalias.1 messages.1 newalias.1 newmail.1 \
printmail.1 prlong.1 readmsg.1
MLINKS= frm.1 nfrm.1 newmail.1 wnewmail.1
OPTIONS_DEFINE= ICONV SMTP TLS
OPTIONS_DEFAULT=ICONV SMTP TLS
SMTP_DESC= Enable SMTP submission protocol (RFC2746) support
TLS_DESC= Enable POP STLS and IMAP STARTTLS support
NO_STAGE= yes
.include <bsd.port.options.mk>
# Local variables
#
ELM_VERSION= 2.4
ELM_REVISION= 126
ELM_PATCHLEVEL= _ # a...z = patch-level, _ means no patch-level.
ELM_PATCHDONE= false
.for level in _ a b c d e f g h i j k l m n o p q r s t u v w x y z
_level=${level}
. if ${_level} != _ && ${ELM_PATCHDONE} == false
PATCHFILES+= ${DISTNAME:S/+/+PL/}${level}.patch.gz
. endif
. if ${ELM_PATCHLEVEL} == ${_level}
ELM_PATCHDONE= true
. endif
.endfor
.if ${PORT_OPTIONS:MICONV}
USES+= iconv
.endif
.for shlib in iconv smtp tls
.if ${PORT_OPTIONS:M${shlib:U}}
ELM_SHLIBS+= ${shlib}
.else
ELM_UNSHLIBS+= ${shlib}
.endif
.endfor
# 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
STAGE_DIR= ${WRKDIR}/stage
MAIL_DIR= ${PREFIX}/etc/mail
CONF_DIR= ${MAIL_DIR}/elm
LIB_DIR= ${PREFIX}/lib/elm
SHLIB_DIR= ${PREFIX}/lib
CONFIG_PATH= ${WRKDIR}/config.sh
MIME_TYPES= elm.mimetypes
MIME_CSETS= elm.mimecharsets
ELM_RC= elm.rc
LOCAL_CONF_FILES= ${MIME_TYPES} ${MIME_CSETS} ${TERM_INFO} ${ELM_RC}
DOC_FILES= MIME.txt README.ME+
.for shlib in ${ELM_SHLIBS}
DOC_FILES+= shared_libs/${shlib:L}/README.${shlib:U}
.endfor
.include <bsd.port.pre.mk>
.if empty(ICONV_LIB)
ICONV_LINK=
.else
ICONV_LINK= iconv
.endif
# Post-patch
#
post-patch: fix-permissions patch-setgid patch-nls-files
fix-permissions:
@${CHMOD} -R u+w ${WRKSRC}
# from <sys/unistd.h>:
# Although we have saved user/group IDs, we do not use them in setuid
# as described in POSIX 1003.1, because the feature does not work for
# root. We use the saved IDs in seteuid/setegid, which are not currently
# part of the POSIX 1003.1 specification. XXX revisit for 1003.1-2001
# as this is now mandatory.
patch-setgid:
@if [ "$$(/sbin/sysctl -n kern.saved_ids)" -eq 0 ]; then \
${REINPLACE_CMD} -e 's|setgid|setegid|' \
${WRKSRC}/lib/mbox/localmbx.c \
${WRKSRC}/src/init.c ${WRKSRC}/src/lock.c; \
${REINPLACE_CMD} -e 's|have_saved_ids = 0|have_saved_ids = 1|' \
${WRKSRC}/lib/read_rc.c; \
fi
patch-nls-files:
@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|' ${WRKSRC}/nls/LANGS
# Pre-configure
#
pre-configure: configure-shlibs
TEE?= tee
configure-shlibs:
@${CP} /dev/null ${CONFIG_PATH}
.for shlib in ${ELM_SYSTEM_SHLIBS}
@${ECHO_CMD} "\# Support for ${shlib:U}" \
> ${WRKSRC}/shared_libs/${shlib:L}/config.res
.endfor
.for shlib in ${ELM_SHLIBS}
@${ECHO_CMD} "${shlib:L}_ok='define'" \
| ${TEE} -a ${CONFIG_PATH} \
>> ${WRKSRC}/shared_libs/${shlib:L}/config.res
.endfor
.for shlib in ${ELM_UNSHLIBS}
@${ECHO_CMD} "${shlib:L}_ok='undef'" \
| ${TEE} -a ${CONFIG_PATH} \
>> ${WRKSRC}/shared_libs/${shlib:L}/config.res
.endfor
# Post-configure
#
post-configure: rename-readmes
rename-readmes:
.for shlib in ${ELM_SHLIBS}
@if [ -f ${WRKSRC}/shared_libs/${shlib:L}/README.ME+ ]; then \
${MV} ${WRKSRC}/shared_libs/${shlib:L}/README.ME+ \
${WRKSRC}/shared_libs/${shlib:L}/README.${shlib:U}; \
fi
.endfor
# Pre-install
#
pre-su-install: create-install-dirs backup-conf-files
create-install-dirs:
@${MKDIR} ${CONF_DIR} ${LIB_DIR} ${SHLIB_DIR}
backup-conf-files:
.for file in ${LOCAL_CONF_FILES}
@if [ -f ${LIB_DIR}/${file} ]; then \
${MV} ${LIB_DIR}/${file} ${CONF_DIR}/${file}.orig; \
elif [ -f ${CONF_DIR}/${file} ]; then \
${MV} ${CONF_DIR}/${file} ${CONF_DIR}/${file}.orig; \
fi
.endfor
# Post-install
#
post-install: install-nls-files \
install-doc-files install-mime-types \
install-conf-files restore-conf-files \
merge-global-rc-file \
remove-catman-files remove-catman-links \
remove-tempfiles
install-nls-files:
@cd ${WRKSRC}/nls; ${MAKE} install
install-doc-files:
.if ${PORT_OPTIONS:MDOCS}
@${MKDIR} ${DOCSDIR}
. for file in ${DOC_FILES}
@${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
@${GZIP_CMD} ${DOCSDIR}/${file:T}
. endfor
.endif
install-mime-types:
@${INSTALL_DATA} ${FILESDIR}/${MIME_TYPES} ${CONF_DIR}/${MIME_TYPES}
install-conf-files:
.for file in ${LOCAL_CONF_FILES}
@${INSTALL_DATA} ${CONF_DIR}/${file} ${CONF_DIR}/${file}-dist
.endfor
# for instance, don't restore obsolete files :( except elm.rc :)
restore-conf-files:
.for file in ${ELM_RC} # ${LOCAL_CONF_FILES}
@if [ -f ${CONF_DIR}/${file}.orig ]; then \
${MV} ${CONF_DIR}/${file}.orig ${CONF_DIR}/${file}; \
fi
.endfor
merge-global-rc-file:
@${LIB_DIR}/elmrc-write -G -I
@${LIB_DIR}/elmlibregister -G -I ${ELM_SHLIBS}
@${INSTALL_DATA} ${CONF_DIR}/${ELM_RC} ${CONF_DIR}/${ELM_RC}-dist
@${RM} -f ${CONF_DIR}/${ELM_RC}.old-values
remove-catman-files:
.for sect in ${MSECS}
. for page in ${MAN${sect}}
@${RM} -f ${MAN${sect}PREFIX}/man/cat${sect}/${page}
@${RM} -f ${MAN${sect}PREFIX}/man/cat${sect}/${page}~_~
@${RM} -f ${MAN${sect}PREFIX}/man/man${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}
@${RM} -f ${MAN${sect}PREFIX}/man/cat${sect}/${page}~_~
@${RM} -f ${MAN${sect}PREFIX}/man/man${sect}/${page}~_~
. endif
. endfor
.endfor
remove-tempfiles:
.for file in ${PREFIX}/bin/wnewmail ${PREFIX}/bin/nfrm ${LIB_DIR}/elmuninstall
@${RM} -f ${file}~_~
.endfor
# some sketchy hackery
FETCH_CMD_INTERIOR= ${FETCH_CMD:M*fetch*}
# only enable the hack if FETCH_CMD is fetch
.if !empty(FETCH_CMD_INTERIOR)
# some ftp servers dislike $USER@localhost...
FETCH_ENV= FTP_PASSWORD=${FTP_PASSWORD}
IFCONFIG?= ifconfig
HOSTIPADDR= ${IFCONFIG} | ${AWK} '/inet /{print $$2; exit}'
FTP_PASSWORD?= ${USER}@`${HOSTIPADDR}`
.endif
.include <bsd.port.post.mk>