]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: use distributed man pages when running with --help fails
authorBernhard Voelker <mail@bernhard-voelker.de>
Fri, 4 Jan 2019 20:46:14 +0000 (21:46 +0100)
committerBernhard Voelker <mail@bernhard-voelker.de>
Wed, 16 Jan 2019 07:26:01 +0000 (08:26 +0100)
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'.

man/local.mk

index eee38396c254e1d731ae47154d61d6103fdbd05b..ee74d1f9b7c8fadee563002f8ac57443513407b6 100644 (file)
@@ -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                              \