diff mbox series

[yocto-autobuilder-helper,v2] scripts/run-docs-build: Add support for installing texlive for pdf generation

Message ID 20241030163536.437177-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series [yocto-autobuilder-helper,v2] scripts/run-docs-build: Add support for installing texlive for pdf generation | expand

Commit Message

Richard Purdie Oct. 30, 2024, 4:35 p.m. UTC
To build the latexpdf output for the docs, we need Xetex (which can handle
international characters). Rather than require it on all autobuilder workers,
along with dependencies, we install a copy onto NFS which the workers can
use. The full install is 6GB so just install the pieces we've found we
need via tlmgr on top of a small install. This script creates the install
if it isn't present.

For local docs builds, we assume the user has the tools available from
the host OS. It is unlikely most users using this script would have the
NAS path present so this seems like a reasonable compromise.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 scripts/run-docs-build | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox series

Patch

diff --git a/scripts/run-docs-build b/scripts/run-docs-build
index 2e7298e..3348378 100755
--- a/scripts/run-docs-build
+++ b/scripts/run-docs-build
@@ -42,6 +42,26 @@  mkdir buildtools
 ${buildtools_localpath} -y -d $builddir/buildtools
 . $builddir/buildtools/environment-setup*
 
+# To build the latexpdf output we need Xetex (which can handle international characters)
+# Rather than require it on all autobuilder workers, along with dependencies, we install
+# a copy onto NFS which the workers can use. The full install is 6GB so just install
+# the pieces we've found we need via tlmgr on top of a small install. This script 
+# creates the install if it isn't present.
+# For local docs builds, we assume the user has the tools available.
+if [ -e /srv/autobuilder/valkyrie.yocto.io/ ]; then
+    textooldir=/srv/autobuilder/valkyrie.yocto.io/docs-build-tex-tools
+    if [ ! -e ${textooldir} ]; then
+        mkdir -p /tmp/textemp
+        pushd /tmp/textemp
+        wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
+        zcat < install-tl-unx.tar.gz | tar xf -
+        cd install-tl-*/
+        ./install-tl --scheme=small --texdir=${textooldir} --no-interaction
+        PATH=$PATH:${textooldir}/bin/x86_64-linux tlmgr install titlesec varwidth tabulary needspace upquote framed capt-of wrapfig fncychap gnu-freefont ctex
+        popd
+    PATH=$PATH:${textooldir}/bin/x86_64-linux
+fi
+
 # Getting the old docbook built docs from an archive. Not rebuilding them.
 docbookarchive_localpath=${sharedir}/cluster-downloads-cache/`basename ${docbookarchive_url}`
 if [ ! -e ${docbookarchive_localpath} ]; then