Skip to content

Commit 57d5202

Browse files
authored
Merge pull request #4175 from grandixximo/fix/man-so-alias-space
docs: tolerate stray whitespace in .so manpage aliases
2 parents 9e0bd23 + 2f9ddc0 commit 57d5202

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

docs/src/Submakefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,8 @@ docclean:
13061306
-rm -f .include-stamp
13071307
-rm -f $(DOC_DIR)/.translateddocs-stamp
13081308
-rm -f $(DOC_DIR)/.gen_complist-stamp
1309+
-rm -f $(DOC_DIR)/.checkref-*-stamp
1310+
-rm -f $(DOC_DIR)/.manso-canonical-stamp
13091311
-rm -f $(OTHER_DOTFILES:.dot=.svg)
13101312

13111313

@@ -1406,6 +1408,27 @@ TRANSLATED_MAN_HTML_TARGETS := $(foreach L,$(LANGUAGES),$(MAN_HTML_TARGETS_$(cal
14061408
TRANSLATED_GENERATED_MANPAGES := $(foreach L,$(LANGUAGES), \
14071409
$(patsubst $(DOC_OUT_ADOC)/$(L)/man/%.adoc, $(DOC_MAN)/$(L)/%, \
14081410
$(wildcard $(DOC_OUT_ADOC)/$(L)/man/man?/*.adoc)))
1411+
1412+
# A .so alias stub is a language-invariant redirect (just a path). asciidoctor
1413+
# derives it from the translated NAME line, so a stray space in a translation
1414+
# can break the alias and abort the build. Overwrite every translated stub
1415+
# with the canonical English one, after the translated primaries that emit them
1416+
# are built. Stubs are found at recipe time: wildcard MAN_SRCS is empty on a
1417+
# clean build.
1418+
$(DOC_DIR)/.manso-canonical-stamp: $(GENERATED_MANPAGES) $(TRANSLATED_GENERATED_MANPAGES)
1419+
$(Q)set -e; \
1420+
for S in $$(cd $(DOC_MAN) && grep -rl '^\.so ' man1 man3 man9 2>/dev/null); do \
1421+
for L in $(LANGUAGES); do \
1422+
mkdir -p "$(DOC_MAN)/$$L/$$(dirname "$$S")"; \
1423+
cp -f "$(DOC_MAN)/$$S" "$(DOC_MAN)/$$L/$$S"; \
1424+
done; \
1425+
done
1426+
@touch $@
1427+
1428+
# Translated manpage HTML must see the canonical stubs, so order it after the
1429+
# fixup (order-only: the stub troff is already a normal prerequisite).
1430+
$(TRANSLATED_MAN_HTML_TARGETS): | $(DOC_DIR)/.manso-canonical-stamp
1431+
14091432
docs: $(TRANSLATED_MAN_HTML_TARGETS)
14101433
.SECONDARY: $(TRANSLATED_MAN_HTML_TARGETS) $(TRANSLATED_GENERATED_MANPAGES)
14111434
endif

0 commit comments

Comments
 (0)