aboutsummaryrefslogtreecommitdiff
path: root/www/mod_security/Makefile
blob: 93992f953db4f92916ce0a221d1af91c04ae2adb (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
PORTNAME=	mod_security
DISTVERSIONPREFIX=	v
PORTVERSION=	2.9.6
CATEGORIES=	www security
MASTER_SITES=	https://github.com/SpiderLabs/ModSecurity/releases/download/v${PORTVERSION}/
PKGNAMEPREFIX=	${APACHE_PKGNAMEPREFIX}
DISTNAME=	${PORTNAME:S/_//:S/2//}-${PORTVERSION}

MAINTAINER=	joneum@FreeBSD.org
COMMENT=	Intrusion detection and prevention engine
WWW=		https://www.modsecurity.org/

LICENSE=	APACHE20

LIB_DEPENDS+=	libpcre.so:devel/pcre \
		libapr-1.so:devel/apr1 \
		libyajl.so:devel/yajl \
		libcurl.so:ftp/curl \
		libgdbm.so:databases/gdbm \
		libexpat.so:textproc/expat2

USES=		apache bdb gnome perl5 pkgconfig shebangfix
USE_GNOME=	libxml2
GNU_CONFIGURE=	yes
SHEBANG_FILES=	tools/rules-updater.pl.in mlogc/mlogc-batch-load.pl.in
perl_OLD_CMD=	@PERL@

AP_INC=		${LOCALBASE}/include/libxml2
AP_LIB=		${LOCALBASE}/lib
MODULENAME=	mod_security2
SRC_FILE=	*.c

PORTDOCS=	*
DOCSDIR=	${PREFIX}/share/doc/${MODULENAME}

SUB_FILES+=	pkg-message
SUB_FILES+=	README
SUB_FILES+=	${APMOD_FILE}.sample
APMOD_FILE=	280_${PORTNAME}.conf
SUB_LIST+=	APMOD_FILE=${APMOD_FILE}

OPTIONS_DEFINE=	DOCS FUZZYHASH LUA MLOGC
OPTIONS_SUB=	yes

LUA_CONFIGURE_ON=	--with-lua=${LOCALBASE}
LUA_CONFIGURE_OFF+=	--without-lua
LUA_USES=		lua:51+

MLOGC_DESC=		Build ModSecurity Log Collector
MLOGC_CONFIGURE_ON=	--disable-errors
MLOGC_CONFIGURE_OFF=	--disable-mlogc

FUZZYHASH_DESC=		Allow matching contents using fuzzy hashes with ssdeep
FUZZYHASH_CONFIGURE_ON=	--with-ssdeep=${LOCALBASE}
FUZZYHASH_CONFIGURE_OFF=--without-ssdeep
FUZZYHASH_LIB_DEPENDS=	libfuzzy.so:security/ssdeep

ETCDIR=		${PREFIX}/etc/modsecurity

REINPLACE_ARGS=	-i ""
AP_EXTRAS+=	-DWITH_LIBXML2
CONFIGURE_ARGS+=--with-apxs=${APXS} --with-pcre=${LOCALBASE} --with-yajl=${LOCALBASE} --with-curl=${LOCALBASE}

post-patch:
	@${REINPLACE_CMD} -e "s/lua5.1/lua-${LUA_VER}/g" ${WRKSRC}/configure

pre-install:
	@${MKDIR} ${STAGEDIR}${PREFIX}/${APACHEMODDIR}

post-install:
	@${MKDIR} ${STAGEDIR}${ETCDIR}
	${INSTALL_DATA} ${WRKSRC}/modsecurity.conf-recommended \
		${STAGEDIR}${ETCDIR}/modsecurity.conf.sample
	${INSTALL_DATA} ${WRKSRC}/unicode.mapping \
		${STAGEDIR}${ETCDIR}/unicode.mapping

	@${MKDIR} ${STAGEDIR}${DOCSDIR}
	(cd ${WRKSRC} && ${COPYTREE_SHARE} doc ${STAGEDIR}${DOCSDIR})
	${INSTALL_DATA} ${WRKDIR}/README ${STAGEDIR}${DOCSDIR}

	@${MKDIR} ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/modules.d
	${INSTALL_DATA} ${WRKDIR}/${APMOD_FILE}.sample ${STAGEDIR}${PREFIX}/${APACHEETCDIR}/modules.d

.include <bsd.port.mk>