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]
#!/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
# 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;;
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"`
.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
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
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.
## 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 \
$$t/$$name.1 > $@-t \
&& rm -rf $$t \
&& chmod a-w $@-t \
- && mv $@-t $@
+ && rm -f $@ && mv $@-t $@