summaryrefslogtreecommitdiff
path: root/mail/rspamd/Makefile
blob: 8ac2d18979cd39cc2f7294571ed3d5bb4f697af5 (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
# $NetBSD: Makefile,v 1.48 2018/10/07 20:10:57 fhajny Exp $

DISTNAME=	rspamd-1.8.0
CATEGORIES=	mail
MASTER_SITES=	${MASTER_SITE_GITHUB:=vstakhov/}

MAINTAINER=	bartosz.kuzma@gmail.com
HOMEPAGE=	https://www.rspamd.com/
COMMENT=	Fast, free and open-source spam filtering system
LICENSE=	2-clause-bsd

.include "options.mk"

DEPENDS+=	${LUA_PKGPREFIX}-lpeg-[0-9]*:../../devel/lua-lpeg
DEPENDS+=	ragel-[0-9]*:../../devel/ragel

USE_CMAKE=	yes
USE_TOOLS+=	perl pkg-config
USE_LANGUAGES=	c99
BUILD_DEFS+=	VARBASE

# Not really true, but difficult to avoid picking up 5.3
LUA_VERSIONS_ACCEPTED=	53

CPPFLAGS.SunOS+=	-D__EXTENSIONS__

LDFLAGS+=	${COMPILER_RPATH_FLAG}${PREFIX}/lib/rspamd
TEST_TARGET=	run-test

RSPAMD_USER?=	rspamd
RSPAMD_GROUP?=	rspamd
PKG_GROUPS=	${RSPAMD_GROUP}
PKG_USERS=	${RSPAMD_USER}:${RSPAMD_GROUP}

PKG_GROUPS_VARS=	RSPAMD_GROUP
PKG_USERS_VARS=		RSPAMD_USER

PKG_GECOS.${RSPAMD_USER}=	rspamd user

PKG_SYSCONFSUBDIR=	rspamd

EGDIR=		${PREFIX}/share/examples/${PKGBASE}
LOGDIR=		${VARBASE}/log/rspamd
DBDIR=		${VARBASE}/db/rspamd
RUNDIR=		${VARBASE}/run/rspamd

FILES_SUBST+=	RSPAMD_USER=${RSPAMD_USER}
FILES_SUBST+=	RSPAMD_GROUP=${RSPAMD_GROUP}

RCD_SCRIPTS=	rspamd

CMAKE_ARGS+=	-DMANDIR:PATH=${PREFIX}/${PKGMANDIR}
CMAKE_ARGS+=	-DLOGDIR:PATH=${LOGDIR}
CMAKE_ARGS+=	-DRUNDIR:PATH=${VARBASE}/run/rspamd
CMAKE_ARGS+=	-DDBDIR:PATH=${DBDIR}
CMAKE_ARGS+=	-DCONFDIR:PATH=${PKG_SYSCONFDIR}
CMAKE_ARGS+=	-DRSPAMD_USER=${RSPAMD_USER}
CMAKE_ARGS+=	-DRSPAMD_GROUP=${RSPAMD_GROUP}
CMAKE_ARGS+=	-DENABLE_SQLITE=ON
# Torch requires LuaJIT2, but LuaJIT2 only supports Lua 5.1
CMAKE_ARGS+=	-DENABLE_LUAJIT=OFF
CMAKE_ARGS+=	-DENABLE_TORCH=OFF

REPLACE_PERL+=	utils/rspamd_stats.pl

MAKE_DIRS+=	${PKG_SYSCONFDIR}/modules.d
MAKE_DIRS+=	${PKG_SYSCONFDIR}/scores.d

OWN_DIRS_PERMS+=	${DBDIR} ${RSPAMD_USER} ${RSPAMD_GROUP} 0700
OWN_DIRS_PERMS+=	${LOGDIR} ${RSPAMD_USER} ${RSPAMD_GROUP} 0750
OWN_DIRS_PERMS+=	${RUNDIR} ${RSPAMD_USER} ${RSPAMD_GROUP} 0755

.include "cfgfiles.mk"

.for file in ${CFGFILES}
CONF_FILES+=	${EGDIR}/${file} ${PKG_SYSCONFDIR}/${file}
.endfor

###
### Generate list of config files
###
.PHONY: cfgfiles
cfgfiles: do-extract
	@${ECHO} "# \$$NetBSD\$$" > ${.CURDIR}/cfgfiles.mk
	@${ECHO} "# Do not edit, regenerate post-extract using 'make cfgfiles'" >> ${.CURDIR}/cfgfiles.mk
	@${ECHO} "CFGFILES= \\" >> ${.CURDIR}/cfgfiles.mk
	cd ${WRKSRC}/conf && ${FIND} * -type f | ${SORT} | ${TR} '\n' ' ' >> ${.CURDIR}/cfgfiles.mk
	@${ECHO} >> ${.CURDIR}/cfgfiles.mk

post-extract:
	${FIND} ${WRKSRC}/conf -type d -exec ${CHMOD} ${PKGDIRMODE} {} \;
	${FIND} ${WRKSRC}/conf -type f -exec ${CHMOD} ${DOCMODE} {} \;

.include "../../databases/hiredis/buildlink3.mk"
.include "../../databases/sqlite3/buildlink3.mk"
.include "../../devel/fann/buildlink3.mk"
.include "../../devel/glib2/buildlink3.mk"
.include "../../devel/libevent/buildlink3.mk"
.include "../../lang/lua/buildlink3.mk"
.include "../../mail/gmime/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../sysutils/file/buildlink3.mk"
.include "../../textproc/icu/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"