# Created by: Kirill Ponomarew <ponomarew@oberon.net>
# $FreeBSD: dns/libidn/Makefile 328685 2013-09-29 12:53:16Z mandree $

PORTNAME=	libidn
PORTVERSION=	1.28
PORTREVISION=	1
CATEGORIES=	dns
MASTER_SITES=	GNU

MAINTAINER=	gaod@hychen.org
COMMENT=	Internationalized Domain Names command line tool

OPTIONS_DEFINE=	DOCS NLS

USE_LDCONFIG=	yes
GNU_CONFIGURE=	yes
CONFIGURE_ENV=	LIBS="-L${LOCALBASE}/lib"
CPPFLAGS+=	-I${LOCALBASE}/include
USE_PERL5=	build
USES=		iconv pathfix perl5 pkgconfig

INFO=		libidn

NO_STAGE=	yes
.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MNLS}
USES+=		gettext
PLIST_SUB+=	NLS=""
.else
CONFIGURE_ARGS+=--disable-nls
PLIST_SUB+=	NLS="@comment "
.endif

post-patch:
	@${REINPLACE_CMD} -e 's|@image{components}||g' \
		${WRKSRC}/doc/libidn.texi
	@${REINPLACE_CMD} -e 's|$$(AUTOMAKE)|${TRUE}|; /imagesdir = / s|infodir|docdir|' \
		${WRKSRC}/doc/Makefile.in
.if ! ${PORT_OPTIONS:MDOCS}
	@${REINPLACE_CMD} -e '/^install-data-am: / s| install-imagesDATA||' \
		${WRKSRC}/doc/Makefile.in
.endif
.if ${PORT_OPTIONS:MNLS}
	@${REINPLACE_CMD} -e 's/-lidn/& -lintl/' ${WRKSRC}/libidn.pc.in
.endif

post-install:
.if ${PORT_OPTIONS:MDOCS}
	${MKDIR} ${DOCSDIR}
.for i in FAQ NEWS README
	${INSTALL_DATA} ${WRKSRC}/${i} ${DOCSDIR}
.endfor
.endif

.include "Makefile.man"
.include <bsd.port.mk>
