# Created by: ijliao
# $FreeBSD: branches/RELENG_9_2_0/net/libvncserver/Makefile 320925 2013-06-14 14:11:51Z bapt $

PORTNAME=	libvncserver
PORTVERSION=	0.9.9
PORTREVISION=	5
CATEGORIES=	net devel
MASTER_SITES=	SF
DISTNAME=	LibVNCServer-${PORTVERSION}

MAINTAINER=	bapt@FreeBSD.org
COMMENT=	Provide an easy API to write one's own vnc server

LICENSE=	GPLv2

LIB_DEPENDS=	jpeg:${PORTSDIR}/graphics/jpeg \
		png15:${PORTSDIR}/graphics/png

USES=	pathfix
USE_LDCONFIG=	yes
GNU_CONFIGURE=	yes
CPPFLAGS+=	-I${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib
CONFIGURE_ARGS=	--without-x

OPTIONS_DEFINE=	GNUTLS OPENSSL GCRYPT IPV6
OPTIONS_DEFAULT=	OPENSSL
GCRYPT_DESC=	libgcrypt support

GNUTLS_LIB_DEPENDS=	gnutls:${PORTSDIR}/security/gnutls
GNUTLS_CONFIGURE_ON=	--with-gnutls
GNUTLS_CONFIGURE_OFF=	--without-gnutls

OPENSSL_CONFIGURE_ON=	--with-ssl
OPENSSL_CONFIGURE_OFF=	--without-crypto --without-ssl

GCRYPT_LIB_DEPENDS=	gcrypt:${PORTSDIR}/security/libgcrypt
GCRYPT_CONFIGURE_ON=	--with-gcrypt
GCRYPT_CONFIGURE_OFF=	--without-gcrypt

IPV6_CONFIGURE_ON=	--with-ipv6
IPV6_CONFIGURE_OFF=	--without-ipv6

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MOPENSSL}
USE_OPENSSL=	yes
.endif

post-patch:
	@${REINPLACE_CMD} -e \
		's|-lpthread|${PTHREAD_LIBS}|g' ${WRKSRC}/configure
	@${REINPLACE_CMD} -e \
		'/^SUBDIRS/s|x11vnc||g' ${WRKSRC}/Makefile.in

post-install:
	${INSTALL_DATA} ${WRKSRC}/rfb/default8x16.h ${PREFIX}/include/rfb

.include <bsd.port.mk>
