# $OpenBSD$

COMMENT =		libev-based high performance TLS proxy

DISTNAME =		hitch-1.4.8

CATEGORIES =		security

# BSD
PERMIT_PACKAGE_CDROM =	Yes

HOMEPAGE =		https://hitch-tls.org

MAINTAINER =		Klemens Nanni <kn@openbsd.org>

MASTER_SITES =		https://hitch-tls.org/source/

# uses pledge()
WANTLIB =		c crypto ev ssl

BUILD_DEPENDS =		textproc/py-docutils
LIB_DEPENDS =		devel/libev>=4
TEST_DEPENDS =		net/curl

SEPARATE_BUILD =	Yes
CONFIGURE_STYLE =	simple
CONFIGURE_ENV =		CPPFLAGS=-I${LOCALBASE}/include \
			LDFLAGS=-L${LOCALBASE}/lib \
			HITCH_CFLAGS='-Wall -W'
CONFIGURE_ARGS =	--srcdir=${WRKSRC} \
			--prefix=${PREFIX} \
			--mandir=${PREFIX}/man

# Tests request http://hitch-tls.org
TEST_TARGET =		check

post-patch:
	${SUBST_CMD} ${WRKSRC}/{hitch.conf.man.rst,src/configuration.c}

post-configure:
	ln -sf ${WRKSRC}/src/cfg_{lex,parser}.[ch] ${WRKBUILD}/src/

post-install:
	${INSTALL_DATA} ${WRKSRC}/docs/*.md ${PREFIX}/share/doc/hitch/
	${INSTALL_DATA_DIR} ${PREFIX}/share/examples/hitch/
	mv ${PREFIX}/share/{doc,examples}/hitch/hitch.conf.example

.include <bsd.port.mk>
