summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2019-01-04 21:46:14 +0100
committerBernhard Voelker <mail@bernhard-voelker.de>2019-01-16 08:26:01 +0100
commitf114495e3ec3ded8bdbd0cc56b9e7a5b2993549c (patch)
treea575e838b1fa6218599707e5d255199afe45f8ea /man
parent39ca7731e2879cf87a2199d18ed3a3731efb9172 (diff)
downloadcoreutils-f114495e3ec3ded8bdbd0cc56b9e7a5b2993549c.tar.gz
build: use distributed man pages when running with --help fails
When building against an incompatible GLIBC version compared to that on the build host, then running the just-built binary might fail although it is the same platform - thus CROSS_COMPILING is false. As a result, generating the man pages fails. * man/local.mk (.x.1): Add a check to verify that running the utility with --help succeeds, otherwise falling back to using 'dummy-man'.
Diffstat (limited to 'man')
-rw-r--r--man/local.mk11
1 files changed, 9 insertions, 2 deletions
diff --git a/man/local.mk b/man/local.mk
index eee38396c..ee74d1f9b 100644
--- a/man/local.mk
+++ b/man/local.mk
@@ -191,9 +191,16 @@ endif
&& $(MKDIR_P) $$t \
&& (cd $$t && $(LN_S) '$(abs_top_builddir)/src/'$$prog$(EXEEXT) \
$$argv$(EXEEXT)) \
- && : $${SOURCE_DATE_EPOCH=`cat $(srcdir)/.timestamp 2>/dev/null || :`} \
+ || exit 1; \
+## Double-check whether the built binary succeeds with --help as the above
+## CROSS_COMPILING condition might have been wrong in some cases, e.g. when
+## building against an incompatible glibc version on the same platform.
+ $$t/$$argv$(EXEEXT) --help </dev/null >/dev/null \
+ && run_help2man="$(run_help2man)" \
+ || run_help2man="$(srcdir)/man/dummy-man"; \
+ : $${SOURCE_DATE_EPOCH=`cat $(srcdir)/.timestamp 2>/dev/null || :`} \
&& : $${TZ=UTC0} && export TZ \
- && export SOURCE_DATE_EPOCH && $(run_help2man) \
+ && export SOURCE_DATE_EPOCH && $${run_help2man} \
--source='$(PACKAGE_STRING)' \
--include=$(srcdir)/man/$$name.x \
--output=$$t/$$name.1 \