summaryrefslogtreecommitdiff
path: root/mail/rspamd-devel/Makefile
blob: 8fe025e397e91c2208f46081837c9a7edf8262f3 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
PORTNAME=	rspamd
PORTVERSION=	2.8.a2.20210324
CATEGORIES=	mail
PKGNAMESUFFIX=	-devel

MAINTAINER=	vsevolod@FreeBSD.org
COMMENT=	Fast spam filtering system dev version

LICENSE=	APACHE20
LICENSE_FILE=	${WRKSRC}/LICENSE.md

LIB_DEPENDS=	libpcre.so:devel/pcre \
		libicui18n.so:devel/icu \
		libsodium.so:security/libsodium
BUILD_DEPENDS=	ragel:devel/ragel
RUN_DEPENDS=	ca_root_nss>=3.*:security/ca_root_nss

USES=		cmake gnome perl5 pkgconfig sqlite ssl compiler:c++17-lang
USE_LDCONFIG=	yes
USE_PERL5=	build run
USE_GNOME=	glib20

CONFLICTS_INSTALL=	rspamd

USERS=		rspamd
GROUPS=		rspamd

OPTIONS_DEFINE=			BLAS CGP GPERF LUAJIT
OPTIONS_DEFINE_amd64=		HYPERSCAN
OPTIONS_DEFAULT_amd64=		LUAJIT
OPTIONS_DEFAULT_armv7=		LUAJIT
OPTIONS_DEFAULT_i386=		LUAJIT
OPTIONS_DEFAULT_powerpc=	LUAJIT
OPTIONS_DEFAULT_powerpc64=	LUAJIT
OPTIONS_DEFAULT_powerpc64le=	LUAJIT
OPTIONS_SUB=	yes

BLAS_DESC=	Use OpenBLAS to accelerate KANN
CGP_DESC=	Install Communigate Pro(tm) helper
GPERF_DESC=	Google perf-tools profiling
HYPERSCAN_DESC=	Use hyperscan optimizations (amd64 only)
LUAJIT_DESC=	Use LuaJIT instead of standard Lua

SUB_FILES=	pkg-message rspamd.newsyslog.conf.sample
PLIST_SUB+=	ETCDIR=etc/rspamd \
		RSPAMDVERSION=${PORTVERSION:C/^([^.]+\.[^.]+).*/\1/}
CMAKE_ARGS+=	-DCONFDIR=${PREFIX}/etc/rspamd \
		-DLOGDIR=/var/log/rspamd \
		-DDBDIR=/var/db/rspamd \
		-DRUNDIR=/var/run/rspamd \
		-DMANDIR=${MANPREFIX}/man \
		-DCMAKE_INSTALL_PREFIX=${PREFIX} \
		-DBUILD_PORT=yes \
		-DLIBDIR=${PREFIX}/lib/rspamd \
		-DDEBUG=ON \
		-DGIT_ID=${GH_TAGNAME}
USE_GITHUB=	yes
GH_TAGNAME=	f66453cf8

DEBUG_FLAGS=	-g -O0

USE_RC_SUBR=	rspamd

BLAS_CMAKE_ON=	-DENABLE_BLAS=ON
BLAS_LIB_DEPENDS=	libblis.so:math/blis liblapack.so:math/lapack
BLAS_USES=	blaslapack:openblas

GPERF_CMAKE_ON=	-DENABLE_GPERF_TOOLS=ON
GPERF_LIB_DEPENDS=	libprofiler.so:devel/google-perftools

HYPERSCAN_CMAKE_ON=	-DENABLE_HYPERSCAN=ON
HYPERSCAN_LIB_DEPENDS=	libhs.so:devel/hyperscan

LUAJIT_CMAKE_OFF=	-DENABLE_LUAJIT=OFF
LUAJIT_LIB_DEPENDS=	libluajit-5.1.so:lang/luajit
LUAJIT_USES_OFF=	lua:51+

CGP_RUN_DEPENDS+=	\
	p5-AnyEvent-HTTP>=0:www/p5-AnyEvent-HTTP \
	p5-AnyEvent>=0:devel/p5-AnyEvent \
	p5-EV>=0:devel/p5-EV \
	p5-JSON-XS>=0:converters/p5-JSON-XS

.include <bsd.port.options.mk>

.if ${ARCH:Mpowerpc*}
LUAJIT_LIB_DEPENDS=	libluajit-5.1.so:lang/luajit-openresty
USES+=		compiler:gcc-c++11-lib
.endif

post-install:
	@${MKDIR} \
		${STAGEDIR}/var/log/rspamd \
		${STAGEDIR}/var/db/rspamd \
		${STAGEDIR}/var/run/rspamd
	${RM} ${STAGEDIR}/${ETCDIR}/rspamd.conf.sample
	# Linux specific
	${RM} ${STAGEDIR}/${ETCDIR}/rspamd.systemd.conf
	${RM} ${STAGEDIR}/${ETCDIR}/rspamd.sysvinit.conf
	${INSTALL_DATA} ${WRKDIR}/rspamd.newsyslog.conf.sample ${STAGEDIR}${ETCDIR}
	@${MKDIR} ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d
	${LN} -s ${ETCDIR}/rspamd.newsyslog.conf ${STAGEDIR}${PREFIX}/etc/newsyslog.conf.d
post-install-CGP-on:
	${INSTALL_SCRIPT} ${WRKSRC}/utils/cgp_rspamd.pl ${STAGEDIR}${PREFIX}/bin/rspamd-cgp-helper

.include <bsd.port.mk>