1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00

- Introduce an option (on by default) to run sa-update and sa-compile

automatically on installation. With this, spamassassin installation
	  is no longer interactive.
	- Break out plugin options into a PLUGIN group, for clarity.
	- Add a pyzor plugin.
	- Fold pkg-install contents into the pkg-plist.
	- Add targets to ALL_TARGET, rather than invoking sub-makes multiple
	  times.
	- PORTREVISION bumps all around.
This commit is contained in:
Adam Weinberger 2014-03-09 18:04:06 +00:00
parent 438c67ddd5
commit a1d47aac42
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=347675
6 changed files with 48 additions and 113 deletions

View File

@ -1,7 +1,7 @@
# Created by: TAOKA Fumiyoshi
# $FreeBSD$
PORTREVISION= 0
PORTREVISION= 1
CATEGORIES= japanese mail perl5
PKGNAMEPREFIX= ja-p5-

View File

@ -1,6 +1,6 @@
# $FreeBSD$
PORTREVISION= 0
PORTREVISION= 1
PKGNAMESUFFIX= -Alt
MAINTAINER= adamw@FreeBSD.org

View File

@ -3,7 +3,7 @@
PORTNAME= Mail-SpamAssassin
PORTVERSION= 3.4.0
PORTREVISION?= 0 # committer: please bump PORTREVISION on Slaves
PORTREVISION?= 1 # committer: please bump PORTREVISION on Slaves
CATEGORIES?= mail perl5
MASTER_SITES= ${MASTER_SITE_APACHE:S/$/:apache/} ${MASTER_SITE_PERL_CPAN:S/$/:cpan/}
MASTER_SITE_SUBDIR= spamassassin/source/:apache Mail/:cpan
@ -21,7 +21,8 @@ BUILD_DEPENDS= p5-NetAddr-IP>=4.00.7:${PORTSDIR}/net-mgmt/p5-NetAddr-IP \
p5-libwww>=0:${PORTSDIR}/www/p5-libwww \
p5-Encode-Detect>=0:${PORTSDIR}/converters/p5-Encode-Detect \
p5-Mail-Tools>=0:${PORTSDIR}/mail/p5-Mail-Tools
RUN_DEPENDS= ${BUILD_DEPENDS}
RUN_DEPENDS= ${BUILD_DEPENDS} \
re2c>=.12.0:${PORTSDIR}/devel/re2c
CONFLICTS?= ja-p5-Mail-SpamAssassin-[0-9]* p5-Mail-SpamAssassin-devel-[0-9]* p5-Mail-SpamAssassin-Alt-[0-9]*
@ -42,23 +43,26 @@ CONFIGURE_ARGS= SYSCONFDIR="${PREFIX}/etc" \
LOCALSTATEDIR="${DBDIR}/spamassassin" \
BUILD_SPAMC=yes
OPTIONS_DEFINE= AS_ROOT SACOMPILE DKIM SSL GNUPG MYSQL PGSQL RAZOR \
SPF_QUERY RELAY_COUNTRY DCC IPV6
OPTIONS_DEFAULT= AS_ROOT DKIM SSL GNUPG RAZOR
OPTIONS_DEFINE= AS_ROOT GNUPG IPV6 MYSQL PGSQL SSL UPDATE_AND_COMPILE
OPTIONS_GROUP= PLUGINS
OPTIONS_GROUP_PLUGINS= DCC DKIM PYZOR RAZOR RELAY_COUNTRY SPF_QUERY
OPTIONS_DEFAULT=AS_ROOT DKIM GNUPG RAZOR SSL UPDATE_AND_COMPILE
AS_ROOT_DESC= Run spamd as root (recommended)
DCC_DESC= Add DCC support (see LICENSE)
DKIM_DESC= DKIM/DomainKeys Identified Mail
GNUPG_DESC= Install GnuPG (for sa-update, optional)
IPV6_DESC= IPv6 sockets support
RAZOR_DESC= Add Vipul's Razor support
RELAY_COUNTRY_DESC= Relay country support
SACOMPILE_DESC= Compile rulesets (improves speed)
SPF_QUERY_DESC= Add SPF query support
SSL_DESC= Build spamd/spamc with SSL support
UPDATE_AND_COMPILE_DESC= Download and compile rulesets (recommended)
SUB_FILES= pkg-install pkg-message
SUB_LIST= USER=${USERS} GROUP=${GROUPS} INSTALL="${INSTALL}"
PLUGINS_DESC= Select SpamAssassin plugins
DCC_DESC= Add DCC support (mail/dcc-dccd)
DKIM_DESC= DKIM/DomainKeys Identified Mail (mail/p5-Mail-DKIM)
PYZOR_DESC= Add Pyzor support (mail/pyzor)
RAZOR_DESC= Add Vipul's Razor support (mail/razor-agents)
RELAY_COUNTRY_DESC= Relay country support (net/p5-IP-Country)
SPF_QUERY_DESC= Add SPF query support (mail/p5-Mail-SPF)
SUB_FILES= pkg-message
PLIST_SUB+= USER=${USERS} GROUP=${GROUPS}
OPTIONS_SUB=yes
@ -70,9 +74,9 @@ GNUPG_RUN_DEPENDS= gnupg1>=1.4.7:${PORTSDIR}/security/gnupg1
IPV6_RUN_DEPENDS= p5-IO-Socket-INET6>=0:${PORTSDIR}/net/p5-IO-Socket-INET6
MYSQL_RUN_DEPENDS= p5-DBD-mysql>=0:${PORTSDIR}/databases/p5-DBD-mysql
PGSQL_RUN_DEPENDS= p5-DBD-Pg>=0:${PORTSDIR}/databases/p5-DBD-Pg
PYZOR_RUN_DEPENDS= pyzor:${PORTSDIR}/mail/pyzor
RAZOR_RUN_DEPENDS= razor-agents>=2.84:${PORTSDIR}/mail/razor-agents
RELAY_COUNTRY_RUN_DEPENDS= p5-IP-Country>=0:${PORTSDIR}/net/p5-IP-Country
SACOMPILE_RUN_DEPENDS= re2c>=.12.0:${PORTSDIR}/devel/re2c
SPF_QUERY_RUN_DEPENDS= p5-Mail-SPF>=0:${PORTSDIR}/mail/p5-Mail-SPF
SSL_USE= OPENSSL=yes
@ -87,11 +91,14 @@ PORTDOCS= ${DOCS} sql ldap
USE_RC_SUBR= sa-spamd
ALL_TARGET= all spamc/libspamc.so
.include <bsd.port.pre.mk>
.if ${PORT_OPTIONS:MSSL}
CFLAGS+= -I${OPENSSLINC}
LDFLAGS+= -L${OPENSSLLIB}
ALL_TARGET+= spamc/libsslspamc.so
.endif
.if ${PORT_OPTIONS:MMYSQL} || ${PORT_OPTIONS:MPGSQL}
@ -106,6 +113,12 @@ SUB_LIST+= RUN_AS_USER="-u ${USERS} -H /var/spool/spamd"
SUB_LIST+= RUN_AS_USER=""
.endif
.if ${PORT_OPTIONS:MUPDATE_AND_COMPILE} && empty(PACKAGE_BUILDING) && empty(BATCH)
PLIST_SUB+= UPDATE_ON_INSTALL="yes"
.else
PLIST_SUB+= UPDATE_ON_INSTALL="no"
.endif
post-patch::
@${FIND} ${WRKSRC} -name \*.orig -delete
@${REINPLACE_CMD} -e 's#B_CONFDIR)/local.cf#B_CONFDIR)/local.cf.sample#g' \
@ -120,35 +133,32 @@ post-patch::
@${REINPLACE_CMD} -e '/^CC =/d; \
s|@SSLCFLAGS@|& $${CFLAGS}|g' ${WRKSRC}/spamc/Makefile.in
.if ${PORT_OPTIONS:MDCC}
${REINPLACE_CMD} -e '/DCC/s/^#loadplugin/loadplugin/' ${WRKSRC}/rules/v310.pre
.endif
.if empty(PORT_OPTIONS:MDKIM)
${REINPLACE_CMD} -e '/DKIM/s/^loadplugin/#loadplugin/' ${WRKSRC}/rules/v312.pre
.endif
.if empty(PORT_OPTIONS:MPYZOR)
${REINPLACE_CMD} -e '/Pyzor/s/^loadplugin/#loadplugin/' ${WRKSRC}/rules/v310.pre
.endif
.if ${PORT_OPTIONS:MRAZOR}
${REINPLACE_CMD} -e '/Razor2/s/^#loadplugin/loadplugin/' ${WRKSRC}/rules/v312.pre
.endif
.if ${PORT_OPTIONS:MRELAY_COUNTRY}
${REINPLACE_CMD} -e '/RelayCountry/s/^# ?loadplugin/loadplugin/' ${WRKSRC}/rules/init.pre
.endif
.if empty(PORT_OPTIONS:MDKIM)
${REINPLACE_CMD} -e '/DKIM/s/^loadplugin/#loadplugin/' ${WRKSRC}/rules/v312.pre
.endif
.if empty(PORT_OPTIONS:MSPF_QUERY)
${REINPLACE_CMD} -e '/SPF/s/^loadplugin/#loadplugin/' ${WRKSRC}/rules/init.pre
.endif
.if ${PORT_OPTIONS:MDCC}
${REINPLACE_CMD} -e '/DCC/s/^#loadplugin/loadplugin/' ${WRKSRC}/rules/v310.pre
.endif
.if ${PORT_OPTIONS:MSACOMPILE}
${REINPLACE_CMD} -e '/Rule2XSBody/s/^# loadplugin/loadplugin/' ${WRKSRC}/rules/v320.pre
.endif
post-build:
(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} spamc/libspamc.so)
.if ${PORT_OPTIONS:MSSL}
(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} spamc/libsslspamc.so)
.endif
pre-su-install:
@${MKDIR} ${STAGEDIR}${DATADIR}
${INSTALL_LIB} ${WRKSRC}/spamc/libspamc.so ${STAGEDIR}${PREFIX}/lib/libspamc.so.0
@${LN} -sf libspamc.so.0 ${STAGEDIR}${PREFIX}/lib/libspamc.so
${LN} -sf libspamc.so.0 ${STAGEDIR}${PREFIX}/lib/libspamc.so
.if ${PORT_OPTIONS:MSSL}
${INSTALL_LIB} ${WRKSRC}/spamc/libsslspamc.so ${STAGEDIR}${PREFIX}/lib/libsslspamc.so.0
${LN} -sf libsslspamc.so.0 ${STAGEDIR}${PREFIX}/lib/libsslspamc.so

View File

@ -1,77 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
#
USER=%%USER%%
GROUP=%%GROUP%%
INSTALL="%%INSTALL%%"
PREFIX=%%PREFIX%%
if [ "$2" = "PRE-INSTALL" ];then exit; fi
if [ -z "${INSTALL}" ];then
echo "report this problem to scheidell@freebsd.org, $*"
exit 1
fi
if [ "$2" = "POST-INSTALL" ];then
ask() {
local question default answer
question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
read -t120 -p "${question} [${default}]? " answer
fi
echo ${answer:-${default}}
}
yesno() {
local question default answer
question=$1
default=$2
while :; do
answer=$(ask "${question}" "${default}")
case "${answer}" in
[Yy]*) return 0;;
[Nn]*) return 1;;
esac
echo "Please answer yes or no."
done
}
# Create pid directory
${INSTALL} -d -o ${USER} -g ${GROUP} /var/run/spamd
${PREFIX}/bin/spamassassin -x -L --lint
if [ ${?} -ne 0 ];then
echo "
*******************************************************
* _ _ _ _______ ______ __ _ _____ __ _ ______ *
* | | | |_____| |_____/ | \ | | | \ | | ____ *
* |__|__| | | | \_ | \_| __|__ | \_| |_____| *
* *
*******************************************************
* You must install rules before starting spamd! *
*******************************************************"
if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
if yesno "Do you wish to run sa-update to fetch new rules" "N";then
${PREFIX}/bin/sa-update || true
else
echo ""
fi
${PREFIX}/bin/spamassassin -x -L --lint
if [ ${?} -eq 0 ] && grep '^load.*Rule2XSBody' ${PREFIX}/etc/mail/spamassassin/v320.pre > /dev/null ;then
if yesno "Do you wish to compile rules with re2c (will take a long time)" "N";then
${PREFIX}/bin/sa-compile || true
fi
fi
fi
fi
exit 0
fi # post-install
exit 0

View File

@ -11,11 +11,7 @@ You should complete the following post-installation tasks:
You may get lots of annoying (but harmless) error messages
if you skip this step.
3) Run 'sa-update' to obtain the latest rules.
Then, run 'sa-compile' for a big speed boost (if you
enabled SA_COMPILE)
4) To run spamd, add the following to /etc/rc.conf:
3) To run spamd, add the following to /etc/rc.conf:
spamd_enable="YES"
SECURITY NOTE:

View File

@ -26,7 +26,7 @@ bin/spamd
@exec [ -f %B/v330.pre ] || cp %B/%f %B/v330.pre
@unexec if cmp -s %B/v340.pre.sample %B/v340.pre; then rm -f %B/v340.pre;fi
%%ETCDIR%%/v340.pre.sample
@exec [ -f %B/v340.pre ] || cp %B/%f %B/v340.pre
@exec [ -f %B/v341.pre ] || cp %B/%f %B/v340.pre
include/libspamc.h
lib/libspamc.so
lib/libspamc.so.0
@ -229,11 +229,17 @@ man/man1/spamd.1.gz
@dirrmtry %%SITE_PERL%%/Mail
@dirrmtry %%ETCDIR%%
@dirrmtry etc/mail
@unexec rm -rf /var/run/spamd
@unexec rm -rf /var/lib/spamassassin/2*
@dirrmtry /var/lib/spamassassin
@dirrmtry /var/lib
@dirrmtry /var/db/spamassassin
@unexec [ -d /var/db/spamassassin ] && echo "If you are no longer using SpamAssassin, remove /var/db/spamassassin"
@unexec pw usershow "%%USER%%" 2>/dev/null 1>&2 && echo "To delete %%USER%% permanently, 'rmuser %%USER%%'"
@unexec pw usershow "%%USER%%" 2>/dev/null 1>&2 && [ -d /var/spool/spamd ] && echo " Note that this will remove /var/spool/spamd"
@exec install -d -o %%USER%% -g %%GROUP%% /var/run/spamd
@unexec rm -rf /var/run/spamd
@exec if [ "%%UPDATE_ON_INSTALL%%" = "yes" ]; then echo "====> Downloading SpamAssassin rulesets"; %%PREFIX%%/bin/spamassassin -x -L --lint; %%PREFIX%%/bin/sa-update || true; fi
@exec if [ "%%UPDATE_ON_INSTALL%%" = "yes" ]; then echo "====> Compiling SpamAssassin rulesets"; %%PREFIX%%/bin/spamassassin -x -L --lint; %%PREFIX%%/bin/sa-compile || true; fi