summaryrefslogtreecommitdiff
path: root/mail/mimedefang/Makefile
blob: 8d71f43997695b75ac45ee44e19081ce20c0b8bf (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
PORTNAME=	mimedefang
PORTVERSION=	2.86
PORTREVISION=	1

CATEGORIES=	mail
MASTER_SITES=	https://mimedefang.org/releases/

MAINTAINER=	m.tsatsenko@gmail.com
COMMENT=	Milter based anti-spam and anti-virus filtering program
WWW=		https://www.mimedefang.org/

LICENSE=	GPLv2

BUILD_DEPENDS=	\
	p5-IO-Stringy>=0:devel/p5-IO-Stringy \
	p5-MIME-Tools>=5.417:mail/p5-MIME-Tools \
	p5-Mail-Tools>=0:mail/p5-Mail-Tools \
	p5-Digest-SHA1>=0:security/p5-Digest-SHA1 \
	spamassassin>=3.0:mail/spamassassin
RUN_DEPENDS:=	${BUILD_DEPENDS}

USES=		cpe perl5 shebangfix
perl_OLD_CMD=	perl
GNU_CONFIGURE=	yes
GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
CONFIGURE_ARGS+=	--sysconfdir=${PREFIX}/etc \
			--with-confsubdir=mimedefang \
			--with-user=${MIMEDEFANG_USER} \
			--with-spooldir=${SPOOLDIR} \
			--with-quarantinedir=${QUARANTINEDIR} \
			--with-ipheader \
			--prefix=${PREFIX}
CONFIGURE_ENV+=		PERL=${PERL}

SUB_FILES=	pkg-message

PLIST_SUB+=	USER="${MIMEDEFANG_USER}" \
		GROUP="${MIMEDEFANG_GROUP}" \
		MIMEDEFANG_RUNDIR="${SPOOLDIR}" \
		MIMEDEFANG_QUARANTINEDIR="${QUARANTINEDIR}"

MIMEDEFANG_USER?=	mailnull
MIMEDEFANG_GROUP?=	mailnull
SPOOLDIR?=		/var/spool/MIMEDefang
QUARANTINEDIR?=		/var/spool/MD-Quarantine
CONFIG_FILES=	mimedefang-filter sa-mimedefang.cf mimedefang-ip-key

OPTIONS_DEFINE=	CLAMAV DOCS EXAMPLES
OPTIONS_DEFAULT=	CLAMAV

CLAMAV_DESC=	Enable Clamav

CLAMAV_BUILD_DEPENDS=		clamscan:security/clamav
CLAMAV_RUN_DEPENDS=		clamscan:security/clamav
CLAMAV_CONFIGURE_ENABLE=	antivirus clamav clamd

.include <bsd.port.options.mk>

.include "${PORTSDIR}/mail/sendmail/bsd.milter.mk"

CONFIGURE_ARGS+=	--with-milterinc=${MILTERBASE}/include --with-milterlib=${MILTERBASE}/lib

post-patch:
	@${REINPLACE_CMD} -e '/fgrep -e/d' ${WRKSRC}/configure

pre-install:
	@${REINPLACE_CMD} -e '/LOCAL_STATE_DIR/s,/var/lib,/var/db,' ${WRKSRC}/mimedefang.pl

post-install:
	@${REINPLACE_CMD} -e 's,%%CHMOD%%,${CHMOD},g' ${WRKSRC}/examples/init-script
	${INSTALL_SCRIPT} ${WRKSRC}/examples/init-script ${STAGEDIR}${PREFIX}/etc/rc.d/mimedefang

post-install-DOCS-on:
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
	${INSTALL_DATA} ${WRKSRC}/README* ${STAGEDIR}${DOCSDIR}/

post-install-EXAMPLES-on:
	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
	@cd ${WRKSRC}/examples/ && ${INSTALL_DATA} stream-by-domain-filter \
		suggested-minimum-filter-for-windows-clients README ${STAGEDIR}${EXAMPLESDIR}/

.include <bsd.port.mk>