# $OpenBSD$

COMMENT = allows running an http server as part of another application

DISTNAME =		libmicrohttpd-0.9.54
SHARED_LIBS =		microhttpd			0.0	# 54.0
CATEGORIES =		net devel
HOMEPAGE =		https://www.gnu.org/software/libmicrohttpd/

# LGPLv2.1 or later
PERMIT_PACKAGE_CDROM =	Yes

MASTER_SITES =		${MASTER_SITE_GNU:=libmicrohttpd/}

# Test dependencies that must be present at the configure stage:
# for testcurl:		curl
# for testzzuf:		zzuf, socat
BUILD_DEPENDS =		${MODGNU_AUTOCONF_DEPENDS}		\
			${MODGNU_AUTOMAKE_DEPENDS}		\
			net/curl				\
			misc/zzuf				\
			net/socat

WANTLIB += 		ffi gcrypt gmp gnutls gpg-error hogweed iconv idn \
			intl nettle p11-kit pthread tasn1 z

LIB_DEPENDS =		devel/libffi				\
			devel/libidn				\
			security/gnutls				\
			security/libgcrypt			\
			security/libgpg-error			\
			security/libnettle

CONFIGURE_STYLE =	autoconf
SEPARATE_BUILD =	simple

AUTOCONF_VERSION =	2.69
AUTOMAKE_VERSION =	1.14

CONFIGURE_ENV +=	CPPFLAGS="-I${LOCALBASE}/include" 	\
			LDFLAGS="-L${LOCALBASE}/lib"

BUILD_ENV +=		AUTOCONF_VERSION=${AUTOCONF_VERSION}	\
			AUTOMAKE_VERSION=${AUTOMAKE_VERSION}

TEST_DEPENDS =		${MODGNU_AUTOCONF_DEPENDS}		\
			${MODGNU_AUTOMAKE_DEPENDS}
TEST_ENV +=		AUTOCONF_VERSION=${AUTOCONF_VERSION}
# testsuite:		11 PASS		0 FAIL		0 SKIP
# testcurl:		37 PASS		0 FAIL		0 SKIP
# testcurl/https:	 8 PASS		0 FAIL		3 SKIP
# 	test_tls_options, test_https_session_info: need libcurl-gnutls.
# testzzuf:		13 PASS		0 FAIL		0 SKIP

post-install:
		${INSTALL_DATA_DIR} ${PREFIX}/share/examples/libmicrohttpd
		${INSTALL_DATA} ${WRKSRC}/doc/examples/*.c	\
			${PREFIX}/share/examples/libmicrohttpd/

.include <bsd.port.mk>
