]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: reinstate distribution of man pages
authorPádraig Brady <P@draigBrady.com>
Sun, 1 Oct 2017 00:08:02 +0000 (17:08 -0700)
committerPádraig Brady <P@draigBrady.com>
Mon, 2 Oct 2017 00:32:48 +0000 (17:32 -0700)
man pages change little between systems,
so falling back to distributed pages make sense
when cross compiling or lacking perl.

* man/local.mk: Add all man pages to EXTRA_DIST
so that they're distributed in the generated tarball.
Use the dummy-man page generator if cross compiling.
Set TZ to avoid a distcheck failure where man pages
used a diffent month than those rebuilt (with a .timestamp).
* man/dummy-man: Only fall back to generating a stub
if copying an existing man page fails.
* man/help2man: Sync portable TZ=UTC0 specification
from upstream help2man.
* NEWS: Mention the build-related change.
Fixes https://bugs.gnu.org/28574

NEWS
man/dummy-man
man/help2man
man/local.mk

diff --git a/NEWS b/NEWS
index 5d57c727a3c2d777127f1532389b446852f2424b..2878b702d356dbc0843d9cd433dfb124cbfef99e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,11 @@ GNU coreutils NEWS                                    -*- outline -*-
   to attempt to hide the original length of the file name.
   [bug introduced in coreutils-8.28]
 
+** Build-related
+
+  Default man pages are now distributed which are used if perl is
+  not available on the build system, or when cross compiling.
+
 
 * Noteworthy changes in release 8.28 (2017-09-01) [stable]
 
index f05ce2ab4fc0241bead5202d9b04db7f379087ce..e298295d022b060d9d81aff08f9d07a34fea89c9 100755 (executable)
@@ -1,8 +1,7 @@
 #!/bin/sh
-# Poor man's placeholder for help2man invocation on systems lacking perl;
-# it generates a dummy man page stating that a proper one could not be
-# generated, and redirecting the user back to either the info
-# documentation or the '--help' output.
+# Poor man's placeholder for help2man invocation on systems lacking perl,
+# or when cross compiling.
+# It just copies the distributed man pages.
 
 set -e; set -u
 
@@ -24,12 +23,12 @@ while test $# -gt 0; do
     # Help2man options we recognize and handle.
     --output=*) output=`expr x"$1" : x'--output=\(.*\)'`;;
     --output) shift; output=$1;;
+    --include=*) include=`expr x"$1" : x'--include=\(.*\)'`;;
+    --include) shift; include=$1;;
     --source=*) source=`expr x"$1" : x'--source=\(.*\)'`;;
     --source) shift; source=$1;;
     # Recognize (as no-op) other help2man options that might be used
     # in the makefile.
-    --include=*);;
-    --include) shift;;
     --info-page=*);;
     -*) fatal_ "invalid or unrecognized help2man option '$1'";;
     --) shift; break;;
@@ -41,10 +40,13 @@ done
 test $# -gt 0 || fatal_ "missing argument"
 test $# -le 1 || fatal_ "too many non-option arguments"
 
+dist_man=$(printf '%s\n' "$include" | sed 's/\.x$/.1/')
+test -f "$dist_man" && cp "$dist_man" "$output" && exit || :
+
 baseout=`basename_ "$output"`
 sed 's/^/WARNING: /' >&2 <<END
-Cannot create proper '$baseout' man page, since perl is missing or
-inadequate on this system.  Creating a stub man page instead.
+Did not generate or find default '$baseout' man page.
+Creating a stub man page instead.
 END
 
 progname=`basename_ "$1"`
@@ -55,9 +57,8 @@ cat >"$output" <<END
 .SH NAME
 $progname $bs- a $source program
 .SH DESCRIPTION
-.B OOOPS!
-Due to the lack of perl on the build system, we were
-unable to create a proper manual page for
+.B OOPS!
+We were unable to create a proper manual page for
 .B $progname.
 For concise option descriptions, run
 .IP
index a20ef06ef8b9f53dc2fdb363100b36327b0ee254..04e4790be4ce0fc048871d1db403459a1f4664b5 100755 (executable)
@@ -256,7 +256,7 @@ my $epoch_secs = time;
 if (exists $ENV{SOURCE_DATE_EPOCH} and $ENV{SOURCE_DATE_EPOCH} =~ /^(\d+)$/)
 {
     $epoch_secs = $1;
-    $ENV{TZ} = 'UTC';
+    $ENV{TZ} = 'UTC0';
 }
 
 # Translators: the following message is a strftime(3) format string, which in
index b8a1b233cbb611e4c439a2ff042c39f22685bda8..5f3f2152dee5574c934e5c629878e9a84944787b 100644 (file)
 
 EXTRA_DIST += man/help2man man/dummy-man
 
+## Use the distributed man pages if cross compiling or lack perl
+if CROSS_COMPILING
+run_help2man = $(SHELL) $(srcdir)/man/dummy-man
+else
 ## Graceful degradation for systems lacking perl.
 if HAVE_PERL
 run_help2man = $(PERL) -- $(srcdir)/man/help2man
 else
 run_help2man = $(SHELL) $(srcdir)/man/dummy-man
 endif
+endif
 
 man1_MANS = @man1_MANS@
-EXTRA_DIST += $(man1_MANS:.1=.x)
+EXTRA_DIST += $(man1_MANS) $(man1_MANS:.1=.x)
 
 EXTRA_MANS = @EXTRA_MANS@
-EXTRA_DIST += $(EXTRA_MANS:.1=.x)
+EXTRA_DIST += $(EXTRA_MANS) $(EXTRA_MANS:.1=.x)
 
 ALL_MANS = $(man1_MANS) $(EXTRA_MANS)
 
-CLEANFILES += $(ALL_MANS)
+MAINTAINERCLEANFILES += $(ALL_MANS)
 
 # This is a kludge to remove generated 'man/*.1' from a non-srcdir build.
 # Without this, "make distcheck" might fail.
@@ -179,13 +184,14 @@ endif
 ## Note the use of $$t/$*, rather than just '$*' as in other packages.
 ## That is necessary to avoid failures for programs that are also shell
 ## built-in functions like echo, false, printf, pwd.
-       rm -f $@ $@-t                                                   \
+       rm -f $@-t                                                      \
          && t=$*.td                                                    \
          && rm -rf $$t                                                 \
          && $(MKDIR_P) $$t                                             \
          && (cd $$t && $(LN_S) '$(abs_top_builddir)/src/'$$prog$(EXEEXT) \
                                $$argv$(EXEEXT))                        \
        && : $${SOURCE_DATE_EPOCH=`cat $(srcdir)/.timestamp 2>/dev/null || :`} \
+       && : $${TZ=UTC0} && export TZ                                   \
        && export SOURCE_DATE_EPOCH && $(run_help2man)                  \
                     --source='$(PACKAGE_STRING)'                       \
                     --include=$(srcdir)/man/$$name.x                   \
@@ -198,4 +204,4 @@ endif
               $$t/$$name.1 > $@-t                      \
          && rm -rf $$t                                                 \
          && chmod a-w $@-t                                             \
-         && mv $@-t $@
+         && rm -f $@ && mv $@-t $@