# $OpenBSD: Makefile.template,v 1.78 2018/07/09 15:00:06 jca Exp $

COMMENT =		library used by the modsecurity modules

V =			3.0.2
DISTNAME =		modsecurity-v${V}
PKGNAME =		libmodsecurity-${V}

SHARED_LIBS =		modsecurity               0.0 # 3.2

CATEGORIES =		security

HOMEPAGE =		https://github.com/SpiderLabs/ModSecurity

# Apache 2
PERMIT_PACKAGE_CDROM =	Yes

WANTLIB += ${COMPILER_LIBCXX} GeoIP c crypto curl fuzzy iconv
WANTLIB += lzma m nghttp2 pcre ssl xml2 yajl z ${MODLUA_WANTLIB}

MASTER_SITES =		https://github.com/SpiderLabs/ModSecurity/releases/download/v${V}/

MODULES =		lang/lua
# ModSecurity doesn't support 5.1 and configure prefers 5.3.
MODLUA_VERSION =	5.3
MODLUA_SA =		Yes

# C++11
COMPILER =		base-clang ports-gcc

LIB_DEPENDS =		devel/libyajl \
			devel/pcre \
			net/curl \
			net/GeoIP \
			security/ssdeep \
			textproc/libxml \
			${MODLUA_LIB_DEPENDS}

USE_GMAKE =		Yes
CONFIGURE_STYLE =	gnu

# Disabling LMDB support to avoid the port picking lmdb
# https://github.com/SpiderLabs/ModSecurity/commit/6143eb9
CONFIGURE_ARGS =	--disable-doxygen-doc \
			--without-lmdb
CONFIGURE_ENV =		CPPFLAGS="-I${LOCALBASE}/include -I${MODLUA_INCL_DIR}" \
			LDFLAGS="-L${LOCALBASE}/lib" \
			CC=${CC} \
			CFLAGS="${CFLAGS}" \
			CXX=${CXX} \
			CXXFLAGS="${CXXFLAGS}"

NO_TEST =		Yes

.include <bsd.port.mk>
