mirror of
https://https.git.savannah.gnu.org/git/coreutils.git
synced 2026-01-26 07:27:53 +00:00
build: reinstate distribution of man pages
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
This commit is contained in:
parent
6774b991db
commit
856b828320
5
NEWS
5
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]
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
16
man/local.mk
16
man/local.mk
@ -18,22 +18,27 @@
|
||||
|
||||
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 $@
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user