# NOTE: before committing to this port, contact portmgr to arrange for an
# experimental ports run.  Untested commits may be backed out at portmgr's
# discretion.

PORTNAME=	gettext-tools
PORTREVISION=	0

COMMENT=	GNU gettext development and translation tools
WWW=		https://www.gnu.org/software/gettext/

LICENSE=	GPLv3+
LICENSE_FILE=	${WRKSRC}/../COPYING

.include "${.CURDIR}/../gettext/Makefile.common"

BUILD_DEPENDS=	libtextstyle>=${PORTVERSION}:devel/libtextstyle
LIB_DEPENDS=	libtextstyle.so:devel/libtextstyle \
		libunistring.so:devel/libunistring

USES=		charsetfix cpe gettext-runtime gnome iconv libtool \
		localbase python shebangfix tar:xz
CPE_VENDOR=	gnu
CPE_PRODUCT=	gettext
USE_GNOME=	libxml2
USE_LDCONFIG=	yes

SHEBANG_FILES=	src/spit.py.in

GNU_CONFIGURE=	yes
CONFIGURE_ARGS=	-C --disable-csharp --disable-java \
		--with-installed-libtextstyle --with-xz --without-emacs \
		ac_cv_lib_rt_sched_yield=no

INSTALL_TARGET=	install-strip
TEST_TARGET=	check

DATADIR=	${PREFIX}/share/gettext
DOCSDIR=	${PREFIX}/share/doc/gettext

WRKSRC_SUBDIR=	gettext-tools

INFO=		gettext
PLIST_SUB=	PORTVERSION=${PORTVERSION} VERSION=${PORTVERSION}

OPTIONS_DEFINE=	DOCS EXAMPLES THREADS
OPTIONS_DEFAULT=THREADS
OPTIONS_EXCLUDE_DragonFly=	THREADS

THREADS_CONFIGURE_ENABLE=	threads

post-patch:
# Point some files to the installed gettext-runtime.
	@${LN} -s ${LOCALBASE}/include/libintl.h \
		${WRKSRC}/../gettext-runtime/intl/libgnuintl.h
	@${ECHO_CMD} $$'# Generated by libtool\nlibrary_names=libintl.so\nlibdir=${LOCALBASE}/lib' \
		> ${WRKSRC}/../gettext-runtime/intl/libintl.la
	@${ECHO_CMD} $$'# Generated by libtool\nlibrary_names=libasprintf.so\nlibdir=${LOCALBASE}/lib' \
		> ${WRKSRC}/../gettext-runtime/libasprintf/libasprintf.la

post-install:
	${RMDIR} ${STAGEDIR}${PREFIX}/lib/gettext

.include <bsd.port.mk>
