git: 721e5776c957 - main - Mk/**tex.mk: Convert bsd.tex.mk to USES=tex

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Mon, 19 Dec 2022 14:45:10 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=721e5776c957ada07a0d148f5fc3e782a251e6dc

commit 721e5776c957ada07a0d148f5fc3e782a251e6dc
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2022-12-19 14:35:46 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2022-12-19 14:44:58 +0000

    Mk/**tex.mk: Convert bsd.tex.mk to USES=tex
    
    - Update all the consumers to use USES=tex
    - USE_TEX=yes is the old way of writing USES=tex which has been removed
      and replaced in all ports
    - Almost all of the USE_TEX features remains unchanged
    - Some consumers had the same variables defined both in the mk
      infrastructure and also in the ports which have been removed from the
      ports as those are redundant.
    
    In case any of the consumers are failing to build please make sure that
    the nexessary USES=tex is there. Unlike previous USE_TEX=yes will no
    longer load the required VARS for tex and related dependencies.
    
    Reviewed by:    portmgr
    Approved by:    portmgr (blanket)
---
 Mk/{bsd.tex.mk => Uses/tex.mk}           | 84 ++++++++++++++++++++------------
 Mk/bsd.port.mk                           |  4 --
 arabic/arabtex/Makefile                  |  2 +-
 astro/pp3/Makefile                       |  2 +-
 cad/alliance/Makefile                    |  2 +-
 cad/opencascade/Makefile                 |  1 +
 cad/opencascade740/Makefile              |  1 +
 converters/p5-LaTeXML/Makefile           |  2 +-
 databases/bbdb/Makefile                  |  1 +
 deskutils/recoll/Makefile                |  4 +-
 deskutils/zim/Makefile                   |  3 +-
 devel/avr-libc/Makefile                  |  1 +
 devel/cl-alexandria/Makefile             |  2 +-
 devel/doxygen/Makefile                   |  3 +-
 devel/forge-devel/Makefile               |  1 +
 devel/forge/Makefile                     |  1 +
 devel/gcc-arm-embedded/Makefile          |  1 +
 devel/ghub-devel/Makefile                |  1 +
 devel/ghub/Makefile                      |  1 +
 devel/magit-devel/Makefile               |  1 +
 devel/magit/Makefile                     |  1 +
 devel/ragel/Makefile                     |  1 +
 devel/tex-kpathsea/Makefile              |  3 +-
 devel/tex-libtexlua/Makefile             |  3 +-
 devel/tex-libtexluajit/Makefile          |  3 +-
 devel/tex-synctex/Makefile               |  2 +-
 devel/tex-web2c/Makefile                 |  2 +-
 devel/transient-devel/Makefile           |  1 +
 devel/transient/Makefile                 |  1 +
 editors/gnome-latex/Makefile             |  2 +-
 editors/texmacs/Makefile                 |  2 +-
 editors/texmaker/Makefile                |  2 +-
 editors/texstudio/Makefile               |  2 +-
 editors/texworks/Makefile                |  2 +-
 editors/with-editor-devel/Makefile       |  1 +
 editors/with-editor/Makefile             |  1 +
 emulators/virtualbox-ose-legacy/Makefile |  1 +
 emulators/virtualbox-ose/Makefile        |  1 +
 graphics/epix/Makefile                   |  2 +-
 graphics/evince/Makefile                 |  1 +
 graphics/ipe/Makefile                    |  4 +-
 graphics/klatexformula/Makefile          |  2 +-
 graphics/l2p/Makefile                    |  2 +-
 graphics/py-pyx/Makefile                 |  2 +-
 graphics/xournalpp/Makefile              |  2 +-
 japanese/ja-tex-xdvik/Makefile           |  2 +-
 japanese/latex-jlisting/Makefile         |  1 +
 japanese/tex-ptex/Makefile               |  2 +-
 korean/ko.TeX-fonts-base/Makefile        |  1 +
 korean/ko.TeX-fonts-extra/Makefile       |  1 +
 korean/ko.TeX/Makefile                   |  2 +-
 lang/mlton/Makefile                      |  5 +-
 lang/scheme48/Makefile                   | 12 ++---
 lang/twelf/Makefile                      |  2 +-
 lang/yap/Makefile                        |  1 +
 math/R/Makefile                          |  1 +
 math/adept/Makefile                      |  1 +
 math/asymptote/Makefile                  |  2 +-
 math/cadabra2/Makefile                   |  2 +-
 math/coq/Makefile                        |  1 +
 math/eukleides/Makefile                  |  2 +-
 math/giacxcas/Makefile                   |  2 +-
 math/gnuplot-tex-extras/Makefile         |  2 +-
 math/gnuplot/Makefile                    |  2 +-
 math/gretl/Makefile                      |  3 +-
 math/gri/Makefile                        |  2 +-
 math/octave/Makefile                     |  1 +
 math/py-plastex/Makefile                 |  2 +-
 math/sage/Makefile                       |  2 +-
 misc/latex-mk/Makefile                   |  2 +-
 net-im/pidgin-latex/Makefile             |  2 +-
 net-mgmt/netmagis-www/Makefile           |  1 +
 print/auctex/Makefile                    |  3 +-
 print/catdvi/Makefile                    |  2 +-
 print/dot2tex/Makefile                   |  6 +--
 print/dvisvg/Makefile                    |  2 +-
 print/hyperlatex/Makefile                |  2 +-
 print/latex-beamer/Makefile              |  1 +
 print/latex-biber/Makefile               |  2 +-
 print/latex-ltablex/Makefile             |  3 +-
 print/latex-resume/Makefile              |  2 +-
 print/latex2rtf/Makefile                 |  2 +-
 print/lilypond/Makefile                  |  2 +-
 print/mftrace/Makefile                   |  2 +-
 print/muttprint/Makefile                 |  2 +-
 print/sgf2tex/Makefile                   |  2 +-
 print/tex-basic-engines/Makefile         |  2 +-
 print/tex-dvipdfmx/Makefile              |  2 +-
 print/tex-dvipsk/Makefile                |  2 +-
 print/tex-formats/Makefile               |  1 +
 print/tex-jadetex/Makefile               |  2 +-
 print/tex-luatex/Makefile                |  2 +-
 print/tex-ptexenc/Makefile               |  3 +-
 print/tex-xdvik/Makefile                 |  2 +-
 print/tex-xetex/Makefile                 |  2 +-
 print/tex-xmltex/Makefile                |  2 +-
 print/texinfo/Makefile                   |  3 +-
 print/texlive-base/Makefile              |  2 +-
 print/texlive-docs/Makefile              |  2 +-
 print/texlive-full/Makefile              |  2 +-
 print/texlive-texmf-source/Makefile      |  4 +-
 print/texlive-texmf/Makefile             |  2 +-
 print/texlive-tlmgr/Makefile             |  4 +-
 print/texvc/Makefile                     |  2 +-
 print/typetools/Makefile                 |  1 +
 print/xpdfopen/Makefile                  |  3 +-
 print/xtexsh/Makefile                    |  2 +-
 science/code_saturne/Makefile            |  1 +
 science/dynare/Makefile                  |  2 +-
 science/mpqc/Makefile                    |  1 +
 textproc/bibtex2html/Makefile            |  1 +
 textproc/bibtool/Makefile                |  1 +
 textproc/dblatex/Makefile                |  2 +-
 textproc/docbook-utils/Makefile          |  3 +-
 textproc/docproj-legacy/Makefile         |  1 +
 textproc/eqe/Makefile                    |  6 ++-
 textproc/foiltex/Makefile                |  1 +
 textproc/gastex/Makefile                 |  5 +-
 textproc/gladtex/Makefile                |  4 +-
 textproc/hs-lhs2tex/Makefile             |  6 +--
 textproc/latex2html/Makefile             |  3 +-
 textproc/metauml/Makefile                |  5 +-
 textproc/p5-LaTeX-Driver/Makefile        |  2 +-
 textproc/ppower4/Makefile                | 13 ++---
 textproc/sowing/Makefile                 |  8 +--
 textproc/textogif/Makefile               | 10 ++--
 textproc/xmlto/Makefile                  |  1 +
 textproc/yodl/Makefile                   |  1 +
 www/twiki-MathModePlugin/Makefile        |  3 +-
 129 files changed, 218 insertions(+), 165 deletions(-)

diff --git a/Mk/bsd.tex.mk b/Mk/Uses/tex.mk
similarity index 92%
rename from Mk/bsd.tex.mk
rename to Mk/Uses/tex.mk
index ce8efc912194..ec6c56e1d6e1 100644
--- a/Mk/bsd.tex.mk
+++ b/Mk/Uses/tex.mk
@@ -1,37 +1,34 @@
-# bsd.tex.mk - Common part for TeX related ports
-#
-TEX_MAINTAINER=	freebsd-tex@FreeBSD.org
+# Feature: tex
+# Usage:   USES=tex
+# Valid ARGS:	(none)
+# MAINTAINER:	tex@FreeBSD.org
 
-#
-# Ports which depend on TeX should use USE_TEX.
-#
-# USE_TEX=	yes
-# imports variables only, and
-# USE_TEX=	full
+# This imports variables only, and USE_TEX=	full
 # means full TeXLive dependency except for documentation and source.
 #
-# The other valid keywords
+# USE_TEX is used to enable additional specific features and
+# fnctionalities for tex.
 #
-#  base:	base part
-#  texmf:	texmf tree (except for documentation and source)
-#  source:	source 
-#  docs:	documentation
-#
-#  web2c:	WEB2C toolchain and TeX engines
+# Valid keywords for USE_TEX are as following:
+
+#  base:		base part
+#  texmf:		texmf tree (except for documentation and source)
+#  source:		source
+#  docs:		documentation
+#  web2c:		WEB2C toolchain and TeX engines
 #  kpathsea:	kpathsea library
-#  ptexenc:	character code conversion library for pTeX
-#  basic:	basic TeX engines including tex and pdftex
-#  tlmgr:	tlmgr dependency (Perl modules)
-#  texlua:	texlua53 library
+#  ptexenc:		character code conversion library for pTeX
+#  basic:		basic TeX engines including tex and pdftex
+#  tlmgr:		tlmgr dependency (Perl modules)
+#  texlua:		texlua53 library
 #  texluajit:	texluajit library
-#  synctex:	synctex library
+#  synctex:		synctex library
 #  xpdfopen:	pdfopen/pdfclose utility
-#
-#  dvipsk:	dvipsk
+#  dvipsk:		dvipsk
 #  dvipdfmx:	DVIPDFMx
-#  xdvik:	XDvi
+#  xdvik:		XDvi
 #  gbklatex:	gbklatex
-#
+
 #  formats:	TeX, LaTeX, AMSTeX, ConTeXT, EplainTeX,
 #		CSplainTeX, METAFONT, MLTeX, PDFTeX, TeXsis
 #  tex:		TeX
@@ -52,6 +49,34 @@ TEX_MAINTAINER=	freebsd-tex@FreeBSD.org
 # USE_TEX=	formats
 # USE_TEX=	latex:build dvipsk:build
 
+.if !defined(_INCLUDE_USES_TEX_MK)
+_INCLUDE_USES_TEX_MK=    yes
+
+# List all valid USE_TEX features here
+_VALID_TEX_FEATURES= base texmf source docs web2c kpathsea ptexenc basic \
+					tlmgr texlua texluajit synctex xpdfopen dvipsk dvipdfmx \
+					xdvik gbklatex formats tex latex pdftex jadetex luatex \
+					ptex xetex xmltex texhash texhash-bootstrap updmap fmtutil full
+
+_INVALID_TEX_FEATURES=
+.  for var in ${USE_TEX:O:u:C/:(build|extract|lib|run|test)$//}
+.    if empty(_VALID_TEX_FEATURES:M${var})
+_INVALID_TEX_FEATURES+=  ${var}
+.    endif
+.  endfor
+.  if !empty(_INVALID_TEX_FEATURES)
+IGNORE= uses unknown USE_TEX features: ${_INVALID_TEX_FEATURES}
+.  endif
+
+.  if !empty(tex_ARGS)
+IGNORE=	USES=tex takes no arguments
+.  endif
+
+# Make each individual feature available as _TEX_FEATURE_<FEATURENAME>
+.  for var in ${USE_TEX}
+_TEX_FEATURE_${var:C/=.*$//:tu}= ${var:C/.*=//:S/,/ /g}
+.  endfor
+
 # default TeX distribution.  "texlive"
 TEX_DEFAULT?=	texlive
 
@@ -73,10 +98,6 @@ TEXLIVE_VERSION?=	${TEXLIVE_YEAR}0325
 PLIST_SUB+=	$V="${$V}"
 .endfor
 
-.if !empty(USE_TEX:tu:MTEXLIVE)
-IGNORE=		"texlive" must not be defined in USE_TEX 
-.endif
-
 _USE_TEX_TEXMF_DEP=	${LOCALBASE}/${TEXMFDISTDIR}/README
 _USE_TEX_TEXMF_PORT=	print/${_USE_TEX_TEXMF_PKGNAME}
 _USE_TEX_TEXMF_PKGNAME=	texlive-texmf
@@ -186,7 +207,6 @@ _C:=	BUILD RUN
 .  else
 _C:=	${_U:C/.*://:S/,/ /g:C/[<>=][^\:]*//g}
 .  endif
-#. warning DEBUG: ${_U}: _VOP=${_VOP}, _C=${_C}
 .  for _CC in ${_C:tu}
 _V:=${_UU:C/[<>=][^\:]*//:C/\:.*$//}
 .    if defined(_USE_TEX_${_V}_PORT)
@@ -203,7 +223,7 @@ TEX_${_CC}_DEPENDS+=	${_T}
 .  endfor
 .endfor
 
-.for _C in EXTRACT BUILD LIB RUN
+.for _C in EXTRACT BUILD LIB RUN TEST
 ${_C}_DEPENDS+=	${TEX_${_C}_DEPENDS:O:u}
 .endfor
 
@@ -626,3 +646,5 @@ TEX_FORMAT_XMLTEX_DIRS= \
 post-install-xmltex:
 	${LN} -sf pdftex ${STAGEDIR}${PREFIX}/bin/xmltex
 	${LN} -sf pdftex ${STAGEDIR}${PREFIX}/bin/pdfxmltex
+
+.endif # !defined(_INCLUDE_USES_TEX_MK)
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 1600ed176739..457497a17e8a 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1403,10 +1403,6 @@ USE_APACHE:=	${USE_APACHE:S/common/server,/}
 USES+=	apache:${USE_APACHE:C/2([0-9])/2.\1/g}
 .    endif
 
-.    if defined(USE_TEX)
-.include "${PORTSDIR}/Mk/bsd.tex.mk"
-.    endif
-
 .    if defined(USE_GECKO)
 .include "${PORTSDIR}/Mk/bsd.gecko.mk"
 .    endif
diff --git a/arabic/arabtex/Makefile b/arabic/arabtex/Makefile
index af97d258a3cb..04ee20ab0336 100644
--- a/arabic/arabtex/Makefile
+++ b/arabic/arabtex/Makefile
@@ -11,7 +11,7 @@ WWW=		http://www2.informatik.uni-stuttgart.de/ivi/bs/research/arab_e.htm
 
 LICENSE=	LPPL10
 
-USES=		tar:tgz
+USES=		tar:tgz tex
 USE_TEX=	base texmf
 
 NO_WRKSUBDIR=	yes
diff --git a/astro/pp3/Makefile b/astro/pp3/Makefile
index b061a7c9f393..2d3b87c7997a 100644
--- a/astro/pp3/Makefile
+++ b/astro/pp3/Makefile
@@ -11,7 +11,7 @@ WWW=		http://pp3.sourceforge.net/
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-USES=		tar:bzip2
+USES=		tar:bzip2 tex
 USE_TEX=	latex
 
 OPTIONS_DEFINE=	DOCS EXAMPLES
diff --git a/cad/alliance/Makefile b/cad/alliance/Makefile
index b14ea8020cf6..04d9855e7e1b 100644
--- a/cad/alliance/Makefile
+++ b/cad/alliance/Makefile
@@ -21,7 +21,7 @@ GL_SITE=	https://gitlab.lip6.fr
 GL_ACCOUNT=	vlsi-eda
 GL_COMMIT=	ebece102e15c110fc79f1da50524c68fd9523f0c
 
-USES=		autoreconf:build gmake libtool magick:build motif tar:bz2 xorg
+USES=		autoreconf:build gmake libtool magick:build motif tar:bz2 tex xorg
 USE_GCC=	yes
 USE_TEX=	dvipsk:build latex:build
 USE_XORG=	ice sm x11 xext xt
diff --git a/cad/opencascade/Makefile b/cad/opencascade/Makefile
index 325e005c58d2..4a07f1c2f670 100644
--- a/cad/opencascade/Makefile
+++ b/cad/opencascade/Makefile
@@ -121,6 +121,7 @@ VIS_LIB_DEPENDS=	libftgl.so:graphics/ftgl	\
 VIS_USE=		GL=glesv2
 
 DOXYGEN_IMPLIES=	DOCS
+DOXYGEN_USES=		tex
 DOXYGEN_USE=		TEX=latex:build
 DOXYGEN_BUILD_DEPENDS=	bash:shells/bash		\
 			doxygen:devel/doxygen		\
diff --git a/cad/opencascade740/Makefile b/cad/opencascade740/Makefile
index e065194e27bc..8eef300d1e2e 100644
--- a/cad/opencascade740/Makefile
+++ b/cad/opencascade740/Makefile
@@ -76,6 +76,7 @@ VIS_LIB_DEPENDS=	libftgl.so:graphics/ftgl		\
 			libfreeimageplus.so:graphics/freeimage
 
 DOXYGEN_IMPLIES=	DOCS
+DOXYGEN_USES=	tex
 DOXYGEN_USE=	TEX=latex:build
 DOXYGEN_BUILD_DEPENDS=	bash:shells/bash		\
 			doxygen:devel/doxygen		\
diff --git a/converters/p5-LaTeXML/Makefile b/converters/p5-LaTeXML/Makefile
index bf1f8dfeef73..95be14eefa43 100644
--- a/converters/p5-LaTeXML/Makefile
+++ b/converters/p5-LaTeXML/Makefile
@@ -28,7 +28,7 @@ RUN_DEPENDS=	p5-Archive-Zip>=0:archivers/p5-Archive-Zip \
 		p5-XML-LibXSLT>=1.58:textproc/p5-XML-LibXSLT \
 		p5-libwww>=0:www/p5-libwww
 
-USES=		perl5
+USES=		perl5 tex
 USE_PERL5=	configure
 USE_TEX=	kpathsea
 NO_ARCH=	yes
diff --git a/databases/bbdb/Makefile b/databases/bbdb/Makefile
index 894d65c82aa9..3d8062842dd7 100644
--- a/databases/bbdb/Makefile
+++ b/databases/bbdb/Makefile
@@ -30,6 +30,7 @@ NO_ARCH=	yes
 PLIST_SUB+=	BBDB_LISPDIR=${BBDB_LISPDIR}
 
 OPTIONS_DEFINE=	DOCS
+DOCS_USES=	tex
 DOCS_USE=	TEX=latex:build
 DOCS_CONFIGURE_ENABLE=	docs
 
diff --git a/deskutils/recoll/Makefile b/deskutils/recoll/Makefile
index 84d3e5bda28c..a1d0ef6cc9c8 100644
--- a/deskutils/recoll/Makefile
+++ b/deskutils/recoll/Makefile
@@ -52,8 +52,8 @@ CHM_LIB_DEPENDS=		libchm.so:misc/chmlib
 CHM_CONFIGURE_OFF=		--disable-python-chm
 DJVU_RUN_DEPENDS=		djvutxt:graphics/djvulibre
 IMAGE_RUN_DEPENDS=		exiftool:graphics/p5-Image-ExifTool
-LATEX_USE=			dvipsk:run \
-				latex:run
+LATEX_USES=			tex
+LATEX_USE=			TEX=dvipsk:run,latex:run
 PDF_RUN_DEPENDS=		pdftotext:graphics/poppler-utils
 PS_RUN_DEPENDS=			pstotext:print/pstotext
 QT5_USES=			gl qt:5
diff --git a/deskutils/zim/Makefile b/deskutils/zim/Makefile
index ce5c0848b1f1..80220762bd42 100644
--- a/deskutils/zim/Makefile
+++ b/deskutils/zim/Makefile
@@ -34,7 +34,8 @@ GNUPLOT_RUN_DEPENDS=	gnuplot:math/gnuplot
 GNUR_DESC=		Support of plot editor based on GNU R
 GNUR_RUN_DEPENDS=	R:math/R
 GRAPHVIZ_RUN_DEPENDS=	fdp:graphics/graphviz
-LATEX_USE=		tex=latex:run
+LATEX_USES=		tex
+LATEX_USE=		TEX=latex:run
 MERCURIAL_DESC=		Version control for notebooks using hg
 MERCURIAL_RUN_DEPENDS=	${PY_MERCURIAL}
 SCROT_DESC=		Screenshot taking and inserting support
diff --git a/devel/avr-libc/Makefile b/devel/avr-libc/Makefile
index cb04ee003ca2..836146e84b52 100644
--- a/devel/avr-libc/Makefile
+++ b/devel/avr-libc/Makefile
@@ -28,6 +28,7 @@ OPTIONS_DEFINE=	DOXYGEN
 .endif
 
 .if ${PORT_OPTIONS:MDOXYGEN}
+USES+=		tex
 USE_TEX=	latex:build
 BUILD_DEPENDS+=	doxygen:devel/doxygen \
 		fig2dev:print/fig2dev \
diff --git a/devel/cl-alexandria/Makefile b/devel/cl-alexandria/Makefile
index b8da5389757d..0b8c30784c22 100644
--- a/devel/cl-alexandria/Makefile
+++ b/devel/cl-alexandria/Makefile
@@ -20,7 +20,7 @@ OPTIONS_DEFINE=	DOCS
 
 DOCS_BUILD_DEPENDS=	sbcl:lang/sbcl \
 			texi2pdf:print/texinfo
-
+DOCS_USES=	tex
 DOCS_USE=	TEX=latex:build
 DOCS_INFO=	doc/${PORTNAME}
 
diff --git a/devel/doxygen/Makefile b/devel/doxygen/Makefile
index 6ec8055a4458..3ad72d7641d8 100644
--- a/devel/doxygen/Makefile
+++ b/devel/doxygen/Makefile
@@ -29,7 +29,7 @@ OPTIONS_DEFAULT=	GRAPHVIZ
 QT5_DESC=	Install Doxywizard GUI with Qt5
 SEARCH_DESC=	Build external search tools (doxysearch and doxyindexer)
 
-DOCS_USES=		ghostscript:build
+DOCS_USES=		ghostscript:build tex
 DOCS_USE=		TEX=base:build,dvipsk:build,pdftex:build
 DOCS_ALL_TARGET=	docs
 DOCS_BUILD_DEPENDS=	dot:graphics/graphviz
@@ -45,6 +45,7 @@ PORTDOCS=		*
 
 GRAPHVIZ_RUN_DEPENDS=	dot:graphics/graphviz
 
+LATEX_USES=	tex
 LATEX_USE=	TEX=base,dvipsk,pdftex
 
 QT5_USES=	qt:5
diff --git a/devel/forge-devel/Makefile b/devel/forge-devel/Makefile
index 9894955f4eeb..ffecddb9e066 100644
--- a/devel/forge-devel/Makefile
+++ b/devel/forge-devel/Makefile
@@ -57,6 +57,7 @@ DOCS_BUILD_DEPENDS=	gsed:textproc/gsed
 DOCS_ALL_TARGET=	html
 DOCS_BINARY_ALIAS=	sed=gsed
 PDF_BUILD_DEPENDS=	texi2pdf:print/texinfo
+PDF_USES=		tex
 PDF_USE=		TEX=dvipdfmx:build
 PDF_ALL_TARGET=		pdf
 
diff --git a/devel/forge/Makefile b/devel/forge/Makefile
index 37d7ba9dbd78..8feca75957c5 100644
--- a/devel/forge/Makefile
+++ b/devel/forge/Makefile
@@ -55,6 +55,7 @@ DOCS_BUILD_DEPENDS=	gsed:textproc/gsed
 DOCS_ALL_TARGET=	html
 DOCS_BINARY_ALIAS=	sed=gsed
 PDF_BUILD_DEPENDS=	texi2pdf:print/texinfo
+PDF_USES=		tex
 PDF_USE=		TEX=dvipdfmx:build
 PDF_ALL_TARGET=		pdf
 
diff --git a/devel/gcc-arm-embedded/Makefile b/devel/gcc-arm-embedded/Makefile
index 1f093b356517..ceb6685c82fe 100644
--- a/devel/gcc-arm-embedded/Makefile
+++ b/devel/gcc-arm-embedded/Makefile
@@ -33,6 +33,7 @@ PURE_LIB_DEPENDS_OFF=	libexpat.so:textproc/expat2 \
 			libmpc.so:math/mpc \
 			libisl.so:devel/isl
 
+PDF_USES=		tex
 PDF_USE=		TEX=base:build,tex:build,dvipsk:build
 PDF_BUILD_DEPENDS=	texi2dvi:print/texinfo
 PYGDB_USES=		python
diff --git a/devel/ghub-devel/Makefile b/devel/ghub-devel/Makefile
index c9c23029c890..3783d712ac6b 100644
--- a/devel/ghub-devel/Makefile
+++ b/devel/ghub-devel/Makefile
@@ -40,6 +40,7 @@ DOCS_BUILD_DEPENDS=	gsed:textproc/gsed
 DOCS_ALL_TARGET=	html
 DOCS_BINARY_ALIAS=	sed=gsed
 PDF_BUILD_DEPENDS=	texi2pdf:print/texinfo
+PDF_USES=		tex
 PDF_USE=		TEX=dvipdfmx:build
 PDF_ALL_TARGET=		pdf
 PDF_PLIST_FILES=	${DOCSDIR}/ghub.pdf
diff --git a/devel/ghub/Makefile b/devel/ghub/Makefile
index 28d1f144715a..07bfbeff7daf 100644
--- a/devel/ghub/Makefile
+++ b/devel/ghub/Makefile
@@ -37,6 +37,7 @@ DOCS_BUILD_DEPENDS=	gsed:textproc/gsed
 DOCS_ALL_TARGET=	html
 DOCS_BINARY_ALIAS=	sed=gsed
 PDF_BUILD_DEPENDS=	texi2pdf:print/texinfo
+PDF_USES=		tex
 PDF_USE=		TEX=dvipdfmx:build
 PDF_ALL_TARGET=		pdf
 PDF_PLIST_FILES=	${DOCSDIR}/ghub.pdf
diff --git a/devel/magit-devel/Makefile b/devel/magit-devel/Makefile
index b03de85329fe..2287db951725 100644
--- a/devel/magit-devel/Makefile
+++ b/devel/magit-devel/Makefile
@@ -58,6 +58,7 @@ LIBEGIT2_RUN_DEPENDS=		libegit2${EMACS_PKGNAMESUFFIX}>=g20200515:devel/libegit2@
 LIBEGIT2_RUN_DEPENDS_OFF=	git:devel/git
 LIBEGIT2_VARS=			MAKE_ENV+=BUILD_MAGIT_LIBGIT=true
 PDF_BUILD_DEPENDS=		texi2pdf:print/texinfo
+PDF_USES=			tex
 PDF_USE=			TEX=dvipdfmx:build
 PDF_ALL_TARGET=			pdf
 
diff --git a/devel/magit/Makefile b/devel/magit/Makefile
index 356ce58b069b..3f0242aa6cec 100644
--- a/devel/magit/Makefile
+++ b/devel/magit/Makefile
@@ -56,6 +56,7 @@ LIBEGIT2_RUN_DEPENDS=		libegit2${EMACS_PKGNAMESUFFIX}>=g20200515:devel/libegit2@
 LIBEGIT2_RUN_DEPENDS_OFF=	git:devel/git
 LIBEGIT2_VARS_OFF=		MAKE_ENV+=BUILD_MAGIT_LIBGIT=false
 PDF_BUILD_DEPENDS=		texi2pdf:print/texinfo
+PDF_USES=			tex
 PDF_USE=			TEX=dvipdfmx:build
 PDF_ALL_TARGET=			pdf
 
diff --git a/devel/ragel/Makefile b/devel/ragel/Makefile
index 6d898003ba4b..d28da5768397 100644
--- a/devel/ragel/Makefile
+++ b/devel/ragel/Makefile
@@ -18,6 +18,7 @@ OPTIONS_DEFINE=	TEXDOCS EXAMPLES
 OPTIONS_SUB=	yes
 TEXDOCS_CONFIGURE_ENABLE=	manual
 TEXDOCS_DESC=	Build pdf documentation (requires LaTeX)
+TEXDOCS_USES=		tex
 TEXDOCS_USE=		TEX=latex:build
 TEXDOCS_BUILD_DEPENDS=	fig2dev:print/transfig
 
diff --git a/devel/tex-kpathsea/Makefile b/devel/tex-kpathsea/Makefile
index 1c89ae9a8040..06dd5d76d70f 100644
--- a/devel/tex-kpathsea/Makefile
+++ b/devel/tex-kpathsea/Makefile
@@ -11,9 +11,8 @@ COMMENT=	Path searching library for TeX
 
 LICENSE=	LGPL21+
 
-USES=		libtool pathfix tar:xz
+USES=		libtool pathfix tar:xz tex
 USE_LDCONFIG=	yes
-USE_TEX=	yes
 
 GNU_CONFIGURE=	yes
 
diff --git a/devel/tex-libtexlua/Makefile b/devel/tex-libtexlua/Makefile
index 9c80ae72aeea..b08794aa305e 100644
--- a/devel/tex-libtexlua/Makefile
+++ b/devel/tex-libtexlua/Makefile
@@ -12,9 +12,8 @@ COMMENT=	Lua library for TeXLive
 LICENSE=	MIT
 LICENSE_FILE=	${WRKDIR}/LICENSE.MIT
 
-USES=		libtool pathfix pkgconfig tar:xz
+USES=		libtool pathfix pkgconfig tar:xz tex
 USE_LDCONFIG=	yes
-USE_TEX=	yes
 
 GNU_CONFIGURE=	yes
 
diff --git a/devel/tex-libtexluajit/Makefile b/devel/tex-libtexluajit/Makefile
index 717aa32ad02b..d751bae68cc6 100644
--- a/devel/tex-libtexluajit/Makefile
+++ b/devel/tex-libtexluajit/Makefile
@@ -18,9 +18,8 @@ BROKEN_powerpc64=	Does not build: uninitialized constant Config (NameError)
 BROKEN_riscv64=	Does not configure: error: Sorry, cannot preprocess lj_arch.h
 BROKEN_sparc64=	Does not configure: error: Sorry, cannot preprocess lj_arch.h
 
-USES=		libtool pathfix pkgconfig tar:xz
+USES=		libtool pathfix pkgconfig tar:xz tex
 USE_LDCONFIG=	yes
-USE_TEX=	yes
 
 GNU_CONFIGURE=	yes
 
diff --git a/devel/tex-synctex/Makefile b/devel/tex-synctex/Makefile
index 663e8b8d2ec6..b787334520cc 100644
--- a/devel/tex-synctex/Makefile
+++ b/devel/tex-synctex/Makefile
@@ -14,7 +14,7 @@ WWW=		http://itexmac.sourceforge.net/SyncTeX.html
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/synctexdir/README.txt
 
-USES=		libtool localbase pathfix pkgconfig tar:xz
+USES=		libtool localbase pathfix pkgconfig tar:xz tex
 USE_LDCONFIG=	yes
 USE_TEX=	kpathsea
 
diff --git a/devel/tex-web2c/Makefile b/devel/tex-web2c/Makefile
index c89393aff2a6..1b3d068d0b0e 100644
--- a/devel/tex-web2c/Makefile
+++ b/devel/tex-web2c/Makefile
@@ -15,7 +15,7 @@ LIB_DEPENDS=	libgmp.so:math/gmp \
 		libpng.so:graphics/png \
 		libzzip.so:devel/zziplib
 
-USES=		gnome libtool localbase pathfix pkgconfig tar:xz xorg
+USES=		gnome libtool localbase pathfix pkgconfig tar:xz tex xorg
 USE_GNOME=	cairo
 USE_LDCONFIG=	yes
 USE_TEX=	kpathsea ptexenc
diff --git a/devel/transient-devel/Makefile b/devel/transient-devel/Makefile
index 179289b52e49..2df0805a11ac 100644
--- a/devel/transient-devel/Makefile
+++ b/devel/transient-devel/Makefile
@@ -39,6 +39,7 @@ DOCS_BUILD_DEPENDS=	gsed:textproc/gsed
 DOCS_ALL_TARGET=	html
 DOCS_BINARY_ALIAS=	sed=gsed
 PDF_BUILD_DEPENDS=	texi2pdf:print/texinfo
+PDF_USES=		tex
 PDF_USE=		TEX=dvipdfmx:build
 PDF_ALL_TARGET=		pdf
 PDF_PLIST_FILES=	${DOCSDIR}/transient.pdf
diff --git a/devel/transient/Makefile b/devel/transient/Makefile
index 11deddc4a3b1..ee47e0efd008 100644
--- a/devel/transient/Makefile
+++ b/devel/transient/Makefile
@@ -34,6 +34,7 @@ DOCS_BUILD_DEPENDS=	gsed:textproc/gsed
 DOCS_ALL_TARGET=	html
 DOCS_BINARY_ALIAS=	sed=gsed
 PDF_BUILD_DEPENDS=	texi2pdf:print/texinfo
+PDF_USES=		tex
 PDF_USE=		TEX=dvipdfmx:build
 PDF_ALL_TARGET=		pdf
 PDF_PLIST_FILES=	${DOCSDIR}/transient.pdf
diff --git a/editors/gnome-latex/Makefile b/editors/gnome-latex/Makefile
index d03067557b8d..4e3c760d346a 100644
--- a/editors/gnome-latex/Makefile
+++ b/editors/gnome-latex/Makefile
@@ -19,7 +19,7 @@ LIB_DEPENDS=	libgee-0.8.so:devel/libgee \
 		libgspell-1.so:textproc/gspell
 
 USES=		compiler:c11 desktop-file-utils gettext gmake gnome \
-		pkgconfig tar:xz vala:build
+		pkgconfig tar:xz tex vala:build
 GNU_CONFIGURE=	yes
 USE_GNOME=	cairo dconf intltool gtksourceview4
 USE_TEX=	latex dvipsk
diff --git a/editors/texmacs/Makefile b/editors/texmacs/Makefile
index acc5b2f6a055..7e276b3463c4 100644
--- a/editors/texmacs/Makefile
+++ b/editors/texmacs/Makefile
@@ -24,7 +24,7 @@ BROKEN_armv6=		fails to compile: call to min is ambiguous
 BROKEN_armv7=		fails to compile: call to min is ambiguous
 
 USES=		cpe desktop-file-utils gmake iconv localbase pkgconfig python \
-		shared-mime-info shebangfix xorg
+		shared-mime-info shebangfix tex xorg
 USE_TEX=	tex:run dvipsk:run
 USE_XORG=	xext
 GNU_CONFIGURE=	yes
diff --git a/editors/texmaker/Makefile b/editors/texmaker/Makefile
index ba3f688af3bb..2676de4cdf16 100644
--- a/editors/texmaker/Makefile
+++ b/editors/texmaker/Makefile
@@ -14,7 +14,7 @@ LICENSE=	GPLv2+
 LIB_DEPENDS=	libhunspell-1.7.so:textproc/hunspell
 
 USES=		compiler:c++11-lang desktop-file-utils ghostscript:x11,run \
-		gl pkgconfig qmake qt:5 tar:bzip2
+		gl pkgconfig qmake qt:5 tar:bzip2 tex
 USE_GL=		gl
 USE_QT=		concurrent core gui network printsupport script widgets \
 		xml buildtools:build
diff --git a/editors/texstudio/Makefile b/editors/texstudio/Makefile
index 940f42c3af07..568eddf3963e 100644
--- a/editors/texstudio/Makefile
+++ b/editors/texstudio/Makefile
@@ -17,7 +17,7 @@ LIB_DEPENDS=	libhunspell-1.7.so:textproc/hunspell \
 		libquazip1-qt5.so:archivers/quazip
 
 USES=		compiler:c++11-lang desktop-file-utils dos2unix \
-		ghostscript:run gl pkgconfig qmake qt:5 xorg
+		ghostscript:run gl pkgconfig qmake qt:5 tex xorg
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	${PORTNAME}-org
diff --git a/editors/texworks/Makefile b/editors/texworks/Makefile
index 842bb7e06d14..af8406f271e3 100644
--- a/editors/texworks/Makefile
+++ b/editors/texworks/Makefile
@@ -17,7 +17,7 @@ LIB_DEPENDS=	libhunspell-1.7.so:textproc/hunspell \
 		libpoppler-qt5.so:graphics/poppler-qt5
 
 USES=		compiler:c++11-lang cmake desktop-file-utils pkgconfig \
-		qt:5
+		qt:5 tex
 USE_GITHUB=	yes
 GH_ACCOUNT=	TeXworks
 USE_QT=		buildtools:build designer:build qmake:build \
diff --git a/editors/with-editor-devel/Makefile b/editors/with-editor-devel/Makefile
index 66863787b8cd..30c1242564d1 100644
--- a/editors/with-editor-devel/Makefile
+++ b/editors/with-editor-devel/Makefile
@@ -41,6 +41,7 @@ DOCS_BUILD_DEPENDS=	gsed:textproc/gsed
 DOCS_ALL_TARGET=	html
 DOCS_BINARY_ALIAS=	sed=gsed
 PDF_BUILD_DEPENDS=	texi2pdf:print/texinfo
+PDF_USES=		tex
 PDF_USE=		TEX=dvipdfmx:build
 PDF_ALL_TARGET=		pdf
 PDF_PLIST_FILES=	${DOCSDIR}/with-editor.pdf
diff --git a/editors/with-editor/Makefile b/editors/with-editor/Makefile
index d3480496c4b8..ac532c910bcc 100644
--- a/editors/with-editor/Makefile
+++ b/editors/with-editor/Makefile
@@ -36,6 +36,7 @@ DOCS_BUILD_DEPENDS=	gsed:textproc/gsed
 DOCS_ALL_TARGET=	html
 DOCS_BINARY_ALIAS=	sed=gsed
 PDF_BUILD_DEPENDS=	texi2pdf:print/texinfo
+PDF_USES=		tex
 PDF_USE=		TEX=dvipdfmx:build
 PDF_ALL_TARGET=		pdf
 PDF_PLIST_FILES=	${DOCSDIR}/with-editor.pdf
diff --git a/emulators/virtualbox-ose-legacy/Makefile b/emulators/virtualbox-ose-legacy/Makefile
index 78e0d874e71b..52f7a0a7e456 100644
--- a/emulators/virtualbox-ose-legacy/Makefile
+++ b/emulators/virtualbox-ose-legacy/Makefile
@@ -141,6 +141,7 @@ LICENSE_DISTFILES_Additions=	${GUESTADDITIONS}
 .if ${PORT_OPTIONS:MMANUAL}
 DBKXMLDIR=	${LOCALBASE}/share/xml/docbook/4.4
 DBKXSLDIR=	${LOCALBASE}/share/xsl/docbook
+USES+=		tex
 USE_TEX=	dvipsk:build formats:build
 .endif
 
diff --git a/emulators/virtualbox-ose/Makefile b/emulators/virtualbox-ose/Makefile
index b82a3073f8be..b3653df75436 100644
--- a/emulators/virtualbox-ose/Makefile
+++ b/emulators/virtualbox-ose/Makefile
@@ -145,6 +145,7 @@ LICENSE_DISTFILES_Additions=	${GUESTADDITIONS}
 .if ${PORT_OPTIONS:MMANUAL}
 DBKXMLDIR=	${LOCALBASE}/share/xml/docbook/4.4
 DBKXSLDIR=	${LOCALBASE}/share/xsl/docbook
+USES+=		tex
 USE_TEX=	dvipsk:build formats:build
 .endif
 
diff --git a/graphics/epix/Makefile b/graphics/epix/Makefile
index cbf0088775c9..d9d3d54a4898 100644
--- a/graphics/epix/Makefile
+++ b/graphics/epix/Makefile
@@ -13,7 +13,7 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 BUILD_DEPENDS=	bash:shells/bash
 RUN_DEPENDS=	bash:shells/bash
 
-USES=		gmake makeinfo tar:bzip2
+USES=		gmake makeinfo tar:bzip2 tex
 USE_TEX=	dvipsk:build latex texmf:build
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--with-bash=${LOCALBASE}/bin/bash \
diff --git a/graphics/evince/Makefile b/graphics/evince/Makefile
index 802ee8cf7c63..02dc4fd87ff7 100644
--- a/graphics/evince/Makefile
+++ b/graphics/evince/Makefile
@@ -76,6 +76,7 @@ DBUS_MESON_TRUE=	dbus
 DBUS_LIB_DEPENDS=	libdbus-1.so:devel/dbus
 
 DVI_DESC=		DVI viewer support
+DVI_USES=		tex
 DVI_USE=		TEX=kpathsea,latex
 DVI_MESON_ENABLED=	dvi
 
diff --git a/graphics/ipe/Makefile b/graphics/ipe/Makefile
index d842224d27fd..73108b33048a 100644
--- a/graphics/ipe/Makefile
+++ b/graphics/ipe/Makefile
@@ -18,8 +18,9 @@ LIB_DEPENDS=	libcurl.so:ftp/curl \
 		libpng.so:graphics/png \
 		libspiro.so:graphics/libspiro
 
-USES=		compiler:c++11-lib gmake gnome jpeg lua:52 pkgconfig shebangfix qt:5
+USES=		compiler:c++11-lib gmake gnome jpeg lua:52 pkgconfig shebangfix qt:5 tex
 USE_GNOME=	cairo
+USE_LDCONFIG=	yes
 USE_QT=		buildtools:build core gui qmake:build widgets
 USE_TEX=	pdftex
 
@@ -39,7 +40,6 @@ MAKE_ENV=	DL_LIBS="" \
 		JPEG_LIBS="-L${LOCALBASE}/lib -ljpeg" \
 		LUA_PACKAGE="lua-${LUA_VER}" \
 		MOC="${MOC}"
-USE_LDCONFIG=	yes
 
 PLIST_SUB=	VERSION="${PORTVERSION}"
 
diff --git a/graphics/klatexformula/Makefile b/graphics/klatexformula/Makefile
index e8a6a267933e..741629338198 100644
--- a/graphics/klatexformula/Makefile
+++ b/graphics/klatexformula/Makefile
@@ -13,7 +13,7 @@ LICENSE=	GPLv2
 BUILD_DEPENDS=	help2man:misc/help2man
 
 USES=		cmake compiler:c++11-lang desktop-file-utils ghostscript:run \
-		gl qt:5 shared-mime-info tar:bzip2 localbase
+		gl qt:5 shared-mime-info tar:bzip2 localbase tex
 USE_GL=		gl
 USE_QT=		core dbus gui sql svg widgets x11extras xml \
 		buildtools:build designer:build linguisttools:build \
diff --git a/graphics/l2p/Makefile b/graphics/l2p/Makefile
index 7d4937f24e4e..9d72e69f2d75 100644
--- a/graphics/l2p/Makefile
+++ b/graphics/l2p/Makefile
@@ -20,7 +20,7 @@ SHEBANG_FILES=	${WRKSRC}/${PORTNAME}
 
 USE_PERL5=	run
 USE_TEX=	latex dvipsk
-USES=		magick:6,run perl5 shebangfix zip
+USES=		magick:6,run perl5 shebangfix tex zip
 
 do-install:
 	${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
diff --git a/graphics/py-pyx/Makefile b/graphics/py-pyx/Makefile
index de14678a6b86..2d560abc241a 100644
--- a/graphics/py-pyx/Makefile
+++ b/graphics/py-pyx/Makefile
@@ -12,7 +12,7 @@ WWW=		https://pyx-project.org/
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-USES=		python:3.4+
+USES=		python:3.4+ tex
 USE_PYTHON=	autoplist concurrent distutils
 USE_TEX=	latex:build
 
diff --git a/graphics/xournalpp/Makefile b/graphics/xournalpp/Makefile
index 63df44957f78..818682f46e70 100644
--- a/graphics/xournalpp/Makefile
+++ b/graphics/xournalpp/Makefile
@@ -18,7 +18,7 @@ LIB_DEPENDS=	libharfbuzz.so:print/harfbuzz \
 		libsndfile.so:audio/libsndfile \
 		libzip.so:archivers/libzip
 
-USES=		cmake compiler:c++11-lang gettext-tools gnome lua:53 pkgconfig xorg
+USES=		cmake compiler:c++11-lang gettext-tools gnome lua:53 pkgconfig tex xorg
 USE_GITHUB=	yes
 USE_GNOME=	atk cairo gdkpixbuf2 glib20 gtk30 librsvg2 libxml2 pango
 USE_XORG=	x11 xi
diff --git a/japanese/ja-tex-xdvik/Makefile b/japanese/ja-tex-xdvik/Makefile
index 25e62a3d3e6a..47d4e73bc174 100644
--- a/japanese/ja-tex-xdvik/Makefile
+++ b/japanese/ja-tex-xdvik/Makefile
@@ -13,7 +13,7 @@ LIB_DEPENDS=	libfreetype.so:print/freetype2 \
 		libpaper.so:print/libpaper
 RUN_DEPENDS=	tex-dvipsk>=5.995:print/tex-dvipsk
 
-USES=		iconv motif pkgconfig xorg
+USES=		iconv motif pkgconfig tex xorg
 USE_TEX=	kpathsea texhash texmf web2c
 USE_XORG=	ice sm x11 xi xmu xpm xt
 
diff --git a/japanese/latex-jlisting/Makefile b/japanese/latex-jlisting/Makefile
index c7de5d98c038..da728eee5729 100644
--- a/japanese/latex-jlisting/Makefile
+++ b/japanese/latex-jlisting/Makefile
@@ -9,6 +9,7 @@ MAINTAINER=	hiroto.kagotani@gmail.com
 COMMENT=	Support for Japanese text within lstlisting environment
 WWW=		https://sourceforge.jp/projects/mytexpert/
 
+USES=		tex
 NO_BUILD=	yes
 USE_TEX=	latex texhash
 JLDIR=		${TEXMFLOCALDIR}/tex/latex/jlisting
diff --git a/japanese/tex-ptex/Makefile b/japanese/tex-ptex/Makefile
index fd6f3c7695c4..29b4e97f25e8 100644
--- a/japanese/tex-ptex/Makefile
+++ b/japanese/tex-ptex/Makefile
@@ -14,7 +14,7 @@ MAINTAINER=	tex@FreeBSD.org
 COMMENT=	ASCII Japanese pTeX
 WWW=		https://ctan.org/pkg/ptex
 
-USES=		localbase tar:xz perl5 pkgconfig
+USES=		localbase tar:xz perl5 pkgconfig tex
 USE_TEX=	kpathsea web2c ptexenc texmf formats fmtutil
 TEXHASHDIRS=	${TEXMFDISTDIR} ${TEXMFVARDIR}
 EXTRACT_AFTER_ARGS=	${EXTRACT_FILES:S,^,${DISTNAME}/,}
diff --git a/korean/ko.TeX-fonts-base/Makefile b/korean/ko.TeX-fonts-base/Makefile
index 1cf723bdc18e..34cb45c5dbd4 100644
--- a/korean/ko.TeX-fonts-base/Makefile
+++ b/korean/ko.TeX-fonts-base/Makefile
@@ -9,6 +9,7 @@ MAINTAINER=	hyogeollee@gmail.com
 COMMENT=	Korean TeX base fonts
 WWW=		http://project.ktug.or.kr/ko.TeX/
 
+USES=		tex
 USE_TEX=	dvipsk latex
 CONFLICTS=	hlatex
 
diff --git a/korean/ko.TeX-fonts-extra/Makefile b/korean/ko.TeX-fonts-extra/Makefile
index fb3dd121bfd7..cdde83a504cc 100644
--- a/korean/ko.TeX-fonts-extra/Makefile
+++ b/korean/ko.TeX-fonts-extra/Makefile
@@ -10,6 +10,7 @@ MAINTAINER=	hyogeollee@gmail.com
 COMMENT=	Korean TeX extra fonts
 WWW=		http://project.ktug.or.kr/ko.TeX/
 
+USES=		tex
 USE_TEX=	dvipsk latex
 CONFLICTS=	hlatex
 
diff --git a/korean/ko.TeX/Makefile b/korean/ko.TeX/Makefile
index 8767b73df05b..dfff0b31efe9 100644
--- a/korean/ko.TeX/Makefile
+++ b/korean/ko.TeX/Makefile
@@ -11,7 +11,7 @@ WWW=		http://project.ktug.or.kr/ko.TeX/
 
 RUN_DEPENDS=	${BASE_MAP}:korean/ko.TeX-fonts-base
 
-USES=		shebangfix
+USES=		shebangfix tex
 SHEBANG_FILES=	util/*.pl
 USE_TEX=	latex
 CONFLICTS=	hlatex
diff --git a/lang/mlton/Makefile b/lang/mlton/Makefile
index cf49b696640c..57a1c21cb16e 100644
--- a/lang/mlton/Makefile
+++ b/lang/mlton/Makefile
@@ -83,8 +83,9 @@ MAKE_ARGS=	DESTDIR='' MLTON_VERSION=${PORTVERSION} \
 .if ${PORT_OPTIONS:MDOCS}
 BUILD_DEPENDS+=	htmldoc:textproc/htmldoc
 MAKE_ARGS+=	MLTON_BINARY_RELEASE_WITH_DOCS=true
-#USE_TEX=	latex:build
-USE_TEX=	latex:formats
+USES+=		tex
+USE_TEX=	latex:build
+#USE_TEX=	latex:formats
 INSTALL_TARGET=	install-docs install
 ALL_TARGET=	install-docs all
 .else
diff --git a/lang/scheme48/Makefile b/lang/scheme48/Makefile
index 1fbfd622fbff..1bfffd22711f 100644
--- a/lang/scheme48/Makefile
+++ b/lang/scheme48/Makefile
@@ -19,7 +19,8 @@ CPE_VENDOR=	s48
 
 OPTIONS_DEFINE=	DOCS
 
-.include <bsd.port.options.mk>
+DOCS_USES=	tex
+DOCS_CONFIGURE_ON=	--docdir="${DOCSDIR}"
 
 PLIST_SUB+=	VER=${PORTVERSION}
 
@@ -32,17 +33,14 @@ post-patch:
 	@${REINPLACE_CMD} \
 		-e '/INSTALL.*COPYING/d' \
 		${WRKSRC}/Makefile.in
-.if ${PORT_OPTIONS:MDOCS}
-USE_TEX=	yes
*** 1132 LINES SKIPPED ***