summaryrefslogtreecommitdiff
path: root/mail/opendkim/Makefile
blob: 920c5eefb2607c1dbc78ba4618a62c26ccfe053d (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
# Created by: Hirohisa Yamaguchi <umq@ueo.co.jp>
# $FreeBSD$

PORTNAME=		opendkim
PORTVERSION=		2.8.3
CATEGORIES=		mail security
MASTER_SITES=		SF
MASTER_SITE_SUBDIR=	${PORTNAME} \
			${PORTNAME}/Previous%20Releases

MAINTAINER=		umq@ueo.co.jp
COMMENT=		DKIM library and milter implementation

LICENSE=		BSD SENDMAIL
LICENSE_COMB=		multi

LICENSE_FILE_SENDMAIL=	${WRKSRC}/LICENSE.Sendmail
LICENSE_GROUPS_SENDMAIL=	FSF OSI
LICENSE_NAME_SENDMAIL=	Sendmail Open Source License
LICENSE_PERMS_SENDMAIL=	dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

GNU_CONFIGURE=	yes
NO_OPTIONS_SORT=yes
USES=		pkgconfig:build
USE_OPENSSL=	yes
USE_LDCONFIG=	yes

MAN8=		opendkim-genkey.8 opendkim-genzone.8 opendkim-testadsp.8 \
		opendkim-testkey.8 opendkim-testmsg.8
PORTDOCS=	*

OPTIONS_SINGLE=		RESOLV
OPTIONS_SINGLE_RESOLV=	STOCK_RESOLVER UNBOUND
OPTIONS_DEFINE=		FILTER GNUTLS LUA MEMCACHED BDB_BASE OPENDBX OPENLDAP \
			POPAUTH QUERY_CACHE STATS
OPTIONS_DEFAULT=	FILTER LUA UNBOUND

STOCK_RESOLVER_DESC=	Use the stock resolver library
UNBOUND_DESC=		Use unbound DNS library
FILTER_DESC=		OpenDKIM filter, requires libmilter/Sendmail
GNUTLS_DESC=		Use GnuTLS instead of OpenSSL
LUA_DESC=		Describe filter policy with lua
MEMCACHED_DESC=		Use memcached as a data set
BDB_BASE_DESC=		Use Berkeley DB from base
OPENDBX_DESC=		Store filter policies via OpenDBX
OPENLDAP_DESC=		Store filter policies in LDAP
POPAUTH_DESC=		Use POP authentication DB
QUERY_CACHE_DESC=	Cache DNS query results locally
STATS_DESC=		Setup statistics tools

MAKE_ARGS+=	pkgconfigdir="${PREFIX}/libdata/pkgconfig"

.include "${.CURDIR}/Makefile.options"
.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MFILTER}
USE_RC_SUBR=		milter-opendkim
MAN5+=			opendkim.conf.5
MAN8+=			opendkim.8
PLIST_SUB+=		FILTER=""
SUB_FILES=		pkg-message
WITHOUT_MILTER_CFLAGS=	yes
WITHOUT_MILTER_LDFLAGS=	yes
.include "${PORTSDIR}/mail/sendmail/bsd.milter.mk"
CONFIGURE_ARGS+=	--with-milter=${MILTERBASE}
.else
CONFIGURE_ARGS+=	--disable-filter
PLIST_SUB+=		FILTER="@comment "
.endif

.if ${PORT_OPTIONS:MGNUTLS}
LIB_DEPENDS+=		gnutls:${PORTSDIR}/security/gnutls
CONFIGURE_ARGS+=	--with-gnutls=${LOCALBASE}
.else
CONFIGURE_ARGS+=	--with-openssl=${OPENSSLBASE}
.endif

.include "${.CURDIR}/Makefile.features"

.if ${PORT_OPTIONS:MDEBUG}
CONFIGURE_ARGS+=	--enable-debug
.endif

.if ! ${PORT_OPTIONS:MDOCS}
CONFIGURE_ARGS+=--docdir=${WRKDIR}/doc
.endif

.if ${PORT_OPTIONS:MSTATS}
CONFIGURE_ARGS+=	--enable-stats
MAN8+=			opendkim-expire.8 opendkim-gengraphs.8 \
			opendkim-genstats.8 opendkim-stats.8
. if ${PORT_OPTIONS:MOPENDBX}
MAN1+=			opendkim-spam.1
MAN8+=			opendkim-importstats.8
. endif
PLIST_SUB+=		STATS=""
.else
PLIST_SUB+=		STATS="@comment "
.endif
.if ${PORT_OPTIONS:MPOPAUTH} \
	|| ${PORT_OPTIONS:MQUERY_CACHE} \
	|| (${PORT_OPTIONS:MFFR} && ${PORT_OPTIONS:MLDAP_CACHING} ) \
	|| (${PORT_OPTIONS:MFFR} && ${PORT_OPTIONS:MREPUTATION} ) \
	|| ${PORT_OPTIONS:MSTATS}
. if ${PORT_OPTIONS:MBDB_BASE}
CONFIGURE_ARGS+=	--with-db-lib=c
. else
CONFIGURE_ARGS+=	--with-db-incdir=${BDB_INCLUDE_DIR} \
			--with-db-libdir=${BDB_LIB_DIR} \
			--with-db-lib=${BDB_LIB_NAME}
USE_BDB=		40+
. endif
.endif
.if ${PORT_OPTIONS:MUNBOUND}
CONFIGURE_ARGS+=	--with-unbound
LIB_DEPENDS+=		unbound:${PORTSDIR}/dns/unbound
.endif
.if ${PORT_OPTIONS:MPOPAUTH}
CONFIGURE_ARGS+=	--enable-popauth
.endif
.if ${PORT_OPTIONS:MQUERY_CACHE}
CONFIGURE_ARGS+=	--enable-query_cache
.endif
.if ${PORT_OPTIONS:MMEMCACHED}
CONFIGURE_ARGS+=	--with-libmemcached
LIB_DEPENDS+=		memcached:${PORTSDIR}/databases/libmemcached
.else
CONFIGURE_ARGS+=	--without-libmemcached
.endif
.if ${PORT_OPTIONS:MOPENDBX}
CONFIGURE_ARGS+=	--with-odbx
LIB_DEPENDS+=		opendbx:${PORTSDIR}/databases/opendbx
PLIST_SUB+=		ODBX=""
.else
CONFIGURE_ARGS+=	--without-odbx
PLIST_SUB+=		ODBX="@comment "
.endif
.if ${PORT_OPTIONS:MOPENLDAP}
CONFIGURE_ARGS+=	--with-openldap
LIB_DEPENDS+=		ldap:${PORTSDIR}/net/openldap24-sasl-client
USE_OPENLDAP=		yes
.else
CONFIGURE_ARGS+=	--without-openldap
.endif
.if ${PORT_OPTIONS:MLUA}
CONFIGURE_ARGS+=	--with-lua
. if ${PORT_OPTIONS:MFILTER}
MAN3+=			opendkim-lua.3
. endif
MAN8+=			miltertest.8
PLIST_SUB+=		LUA=""
USE_LUA=		5.1
.else
PLIST_SUB+=		LUA="@comment "
.endif

pre-configure:
	${REINPLACE_CMD} -e '/PKG_CONFIG/s/lua5/lua-5/' \
	-e '/PKG_CONFIG/s/cyrussasl/libsasl2/' \
	${WRKSRC}/configure

post-patch:
.if ${PORT_OPTIONS:MLCOV}
	${CP} ${FILESDIR}/lcov-helper.sh ${WRKSRC}/libopendkim/tests/
	${CP} ${FILESDIR}/lcov-helper.sh ${WRKSRC}/opendkim/tests/
	${FIND} ${WRKSRC} -type f -name \*-helper.sh -exec ${CHMOD} 755 {} +
.endif

post-install:
.if ! ${PORT_OPTIONS:MDEBUG} && ${PORT_OPTIONS:MFILTER}
	@${STRIP_CMD} ${PREFIX}/sbin/opendkim
.endif
	@${MKDIR} ${PREFIX}/etc/mail
	${INSTALL_DATA} ${WRKSRC}/opendkim/opendkim.conf.sample ${PREFIX}/etc/mail/
.if ${PORT_OPTIONS:MFILTER}
	@${CAT} ${PKGMESSAGE}
.endif

regression-test: build
	cd ${WRKSRC} ; ${MAKE} check

.include <bsd.port.mk>