aboutsummaryrefslogtreecommitdiffstats
path: root/mail/milter-regex/Makefile
blob: fd7ccc23fb8859f6da0d8825ba2089b1f458ac7b (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
# New ports collection makefile for:    milter-regex
# Date created:             2003-10-03
# Whom:                 trevor
#
# based on the OpenBSD port by Daniel Hartmeier (dhartmei on OpenBSD.org)
# $FreeBSD$
#

PORTNAME=   milter_regex
PORTVERSION=    1.6
CATEGORIES= mail
MASTER_SITES=   http://www.benzedrine.cx/
DISTNAME=   milter-regex-${PORTVERSION}

MAINTAINER= dinoex@FreeBSD.org
COMMENT=    Milter plugin to sendmail for regular expression filtering

DIST_SUBDIR=    repacked
MAILUSER?=  mailnull
MAN8=       milter-regex.8
PLIST_FILES=    libexec/milter-regex
MAKE_ENV+=  LDFLAGS="${LDFLAGS}"

USE_RC_SUBR=    milterregex.sh

SPOOLDIR=   /var/run/milter-regex
SUB_LIST=   SPOOLDIR=${SPOOLDIR}

.include <bsd.port.pre.mk>

.if defined(SENDMAIL_MILTER_PORT)
.if defined(SENDMAIL_WITH_SHARED_MILTER)
LIB_DEPENDS+=   milter.3:${PORTSDIR}/mail/${SENDMAIL_MILTER_PORT}
.else
BUILD_DEPENDS+= ${LOCALBASE}/lib/libmilter.a:${PORTSDIR}/mail/${SENDMAIL_MILTER_PORT}
.endif
LDFLAGS+=   -L${LOCALBASE}/lib
.endif

.if !defined(SENDMAIL_MILTER_PORT)
pre-everything::
.if !exists(/usr/lib/libmilter.a)
    ${ECHO_CMD} "Fatal: milter required, see instructions in DESCR"
    ${FALSE}
.endif
.endif

post-patch:
    @${REINPLACE_CMD} -e \
        "s:/etc/milter-regex.conf:${PREFIX}/etc/milter-regex.conf:g; \
        s:/var/spool/milter-regex:${SPOOLDIR}:g; \
        s:_milter-regex:${MAILUSER}:g;" ${WRKSRC}/milter-regex.c
    @${REINPLACE_CMD} -e \
        "s:/etc/milter-regex.conf:${PREFIX}/etc/milter-regex.conf:g; \
        s:/var/spool/milter-regex:${SPOOLDIR}:g; \
        s:mailstats 1:mailstats 8:;" ${WRKSRC}/milter-regex.8
    @${REINPLACE_CMD} -e "s:-lpthread:${PTHREAD_LIBS}:g; \
        s:-I/usr/src/gnu/usr.sbin/sendmail/include:${PTHREAD_CFLAGS}:g; \
        s:-L/usr/local/lib:-L${LOCALBASE}/lib:g; \
        s/-Werror//g"  ${WRKSRC}/Makefile

do-install:
    @${INSTALL_PROGRAM} ${WRKSRC}/milter-regex ${PREFIX}/libexec
    @${INSTALL_MAN} ${WRKSRC}/milter-regex.8 ${PREFIX}/man/man8
    @${INSTALL} -d -o ${MAILUSER} -g daemon -m 0700 ${SPOOLDIR}

post-install:
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>