Skip to content

Commit 29f817f

Browse files
committed
auto merge of #17139 : brson/rust/lualatex, r=alexcrichton
Bugs in pdflatex (#12804) are preventing the guide from landing (#16657). This solves the immediate problem by changing the build system to prefer lualatex, xelatex to pdflatex (which is apparently obsolete). Because the xelatex on the snapshot bot seems to completely ignore the `-output-directory` option, I also had to frob the makefiles a bit for that case.
2 parents 1f4117f + 7864243 commit 29f817f

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

mk/docs.mk

+21-7
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,22 @@ endif
7676

7777
# Check for the various external utilities for the EPUB/PDF docs:
7878

79-
ifeq ($(CFG_PDFLATEX),)
80-
$(info cfg: no pdflatex found, deferring to xelatex)
79+
ifeq ($(CFG_LUALATEX),)
80+
$(info cfg: no lualatex found, deferring to xelatex)
8181
ifeq ($(CFG_XELATEX),)
82-
$(info cfg: no xelatex found, deferring to lualatex)
83-
ifeq ($(CFG_LUALATEX),)
84-
$(info cfg: no lualatex found, disabling LaTeX docs)
82+
$(info cfg: no xelatex found, deferring to pdflatex)
83+
ifeq ($(CFG_PDFLATEX),)
84+
$(info cfg: no pdflatex found, disabling LaTeX docs)
8585
NO_PDF_DOCS = 1
8686
else
87-
CFG_LATEX := $(CFG_LUALATEX)
87+
CFG_LATEX := $(CFG_PDFLATEX)
8888
endif
8989
else
9090
CFG_LATEX := $(CFG_XELATEX)
91+
XELATEX = 1
9192
endif
9293
else
93-
CFG_LATEX := $(CFG_PDFLATEX)
94+
CFG_LATEX := $(CFG_LUALATEX)
9495
endif
9596

9697

@@ -187,12 +188,25 @@ doc/$(1).tex: $$(D)/$(1).md doc/footer.tex doc/version.tex | doc/
187188
ifneq ($(NO_PDF_DOCS),1)
188189
ifeq ($$(SHOULD_BUILD_PDF_DOC_$(1)),1)
189190
DOC_TARGETS += doc/$(1).pdf
191+
ifneq ($(XELATEX),1)
190192
doc/$(1).pdf: doc/$(1).tex
191193
@$$(call E, latex compiler: $$@)
192194
$$(Q)$$(CFG_LATEX) \
193195
-interaction=batchmode \
194196
-output-directory=doc \
195197
$$<
198+
else
199+
# The version of xelatex on the snap bots seemingly ingores -output-directory
200+
# So we'll output to . and move to the doc directory manually.
201+
# This will leave some intermediate files in the build directory.
202+
doc/$(1).pdf: doc/$(1).tex
203+
@$$(call E, latex compiler: $$@)
204+
$$(Q)$$(CFG_LATEX) \
205+
-interaction=batchmode \
206+
-output-directory=. \
207+
$$<
208+
$$(Q)mv ./$(1).pdf $$@
209+
endif # XELATEX
196210
endif # SHOULD_BUILD_PDF_DOCS_$(1)
197211
endif # NO_PDF_DOCS
198212

0 commit comments

Comments
 (0)