git: 5f3c28572766 - main - textproc/groff: allow to build preconv(1) without encoding autodetection

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Fri, 12 Aug 2022 07:33:24 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5f3c28572766ba100ad975c4515b17ea3605d21f

commit 5f3c28572766ba100ad975c4515b17ea3605d21f
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-08-12 07:32:10 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-08-12 07:32:10 +0000

    textproc/groff: allow to build preconv(1) without encoding autodetection
    
    After commit f515b0e657e7, I've received another complaint that, quote,
    "the number of dependencies of [this] groff thing is quite unreasonable"
    and entails installing e.g. Ninja and Meson, which in turn pulls Python,
    etc.  This happens because `textproc/uchardet' which can be used by the
    preconv(1) utility for automatic encoding detection is built with CMake.
    
    As this dependency is optional upstream, allow conservative ports users
    to disable it and thus avoid pulling CMake and all that stuff.
---
 textproc/groff/Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/textproc/groff/Makefile b/textproc/groff/Makefile
index 507647b37d69..e427326a72a0 100644
--- a/textproc/groff/Makefile
+++ b/textproc/groff/Makefile
@@ -11,7 +11,6 @@ LICENSE=	GPLv3
 
 BUILD_DEPENDS=	psselect:print/psutils \
 		gsfonts>=0:print/gsfonts
-LIB_DEPENDS=	libuchardet.so:textproc/uchardet
 RUN_DEPENDS:=	psselect:print/psutils
 
 MAKE_JOBS_UNSAFE=	yes
@@ -46,6 +45,14 @@ DATADIR=	${PREFIX}/share/${PORTNAME}/${PORTVERSION}
 DOCSDIR=	${PREFIX}/share/doc/${PORTNAME}-${PORTVERSION}
 EXAMPLESDIR=	${DOCSDIR}/examples
 
+OPTIONS_DEFINE=	UCHARDET
+OPTIONS_DEFAULT=	UCHARDET
+
+UCHARDET_DESC=	Automatic encoding detection in preconv(1)
+UCHARDET_LIB_DEPENDS=	libuchardet.so:textproc/uchardet
+UCHARDET_USES=	pkgconfig
+UCHARDET_CONFIGURE_OFF=	--with-uchardet=no
+
 post-install:
 	${INSTALL_DATA} ${FILESDIR}/mdoc.local ${STAGEDIR}${PREFIX}/share/groff/site-tmac
 	${REINPLACE_CMD} -i "" -e "s/missing/gs/" ${STAGEDIR}${DATADIR}/font/devhtml/DESC