From: Allison Karlitskaya Date: Fri, 9 Jul 2021 16:03:30 +0000 (-0700) Subject: dist: add new "dist-no-built-sources" automake option. X-Git-Tag: v1.16.4~14 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=13659a7385b69029be865d4f1b2cdfd2bee7da47;p=thirdparty%2Fautomake.git dist: add new "dist-no-built-sources" automake option. Fixes automake bug https://debbugs.gnu.org/49317. * bin/automake.in: implement new option "no-dist-built-sources" to omit the dependency of distdir on $(BUILT_SOURCES). (Allison's original patch used the option name dist-pure; trivially renamed.) * lib/am/distdir.am (distdir) [DIST_BUILT_SOURCES]: conditionalize the dependency. * lib/Automake/Options.pm (_is_valid_easy_option): list it. * doc/automake.texi (List of Automake options): document it. * NEWS: mention it. * t/dist-no-built-sources.sh: test it. * t/list-of-tests.mk (handwritten_TESTS): add it. --- diff --git a/NEWS b/NEWS index 0b11c2249..09ade1c58 100644 --- a/NEWS +++ b/NEWS @@ -7,20 +7,24 @@ New in ?.?.?: * New features added + - PYTHON_PREFIX and PYTHON_EXEC_PREFIX variables now set from Python's + sys.prefix and sys.exec_prefix; new configure options + --with-python_prefix and --with-python_exec_prefix supported, + to specify explicitly. + - Common top-level files can be provided as .md; the non-md version is used if both are present: AUTHORS ChangeLog INSTALL NEWS README README-alpha THANKS - CTAGS, ETAGS, SCOPE variables can be set via configure. - - PYTHON_PREFIX and PYTHON_EXEC_PREFIX variables now set from Python's - sys.prefix and sys.exec_prefix; new configure options - --with-python_prefix and --with-python_exec_prefix supported, - to specify explicitly. + - new option "no-dist-built-sources" skips generating $(BUILT_SOURCES) + before building the tarball as part of "make dist", that is, + omits the dependency of $(distdir): $(BUILT_SOURCES). * Bugs fixed - - automake output reproducible. + - automake output more reproducible. - test-driver less likely to clash with tests writing to the same file. diff --git a/bin/automake.in b/bin/automake.in index 72c35793d..fde572cd1 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -3920,7 +3920,9 @@ sub handle_dist () $output_rules .= file_contents ('distdir', new Automake::Location, %transform, - FILENAME_FILTER => $filename_filter); + FILENAME_FILTER => $filename_filter, + DIST_BUILT_SOURCES + => ! option 'no-dist-built-sources'); } diff --git a/doc/automake.texi b/doc/automake.texi index f1deff813..c1c7b9f2b 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -10454,6 +10454,21 @@ disable automatic dependency tracking. Don't emit any code related to @code{dist} target. This is useful when a package has its own method for making distributions. +@item @option{no-dist-built-sources} +@cindex Option, @option{no-dist-built-sources} +@opindex no-dist-built-sources +@cindex @command{help2man}, and @samp{dist} target +@vindex BUILT_SOURCES, and @samp{dist} target +Don't build @code{BUILT_SOURCES} as part of @code{dist}. This option +can be set if building the distribution only requires the source +files, and doesn't compile anything as a side-effect. The default is +for @samp{$(distdir)} to depend on @samp{$(BUILT_SOURCES)} because it +is common, at least among GNU packages, to want to build the program +to generate man pages with @code{help2man} (@pxref{Errors with +distclean}). Admittedly the default behavior should perhaps be not to +have the dependency, but to preserve compatibility, we don't want to +change it now. + @item @option{no-dist-gzip} @cindex Option, @option{no-dist-gzip} @opindex no-dist-gzip diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index b846fee87..6c07e5048 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -283,12 +283,14 @@ sub _is_valid_easy_option ($) no-define no-dependencies no-dist + no-dist-built-sources no-dist-gzip no-exeext no-installinfo no-installman no-texinfo.tex nostdinc + pure-dist readme-alpha serial-tests parallel-tests diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 774d08b91..3b60b6e0b 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 2001-2020 Free Software Foundation, Inc. +## Copyright (C) 2001-2021 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -75,7 +75,11 @@ if %?SUBDIRS% AM_RECURSIVE_TARGETS += distdir distdir-am endif %?SUBDIRS% +if %?DIST_BUILT_SOURCES% +distdir: +else !%?DIST_BUILT_SOURCES% distdir: $(BUILT_SOURCES) +endif !%?DIST_BUILT_SOURCES% $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) diff --git a/t/dist-no-built-sources.sh b/t/dist-no-built-sources.sh new file mode 100644 index 000000000..8d2d8a099 --- /dev/null +++ b/t/dist-no-built-sources.sh @@ -0,0 +1,72 @@ +#! /bin/sh +# Copyright (C) 2021 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test the presence and absence of the option no-dist-built-sources. + +. test-init.sh + +# the tests are almost the same, so do a loop with a couple conditionals. +for testopt in no-built-sources dist-built-sources; do + + if test "$testopt" = no-built-sources; then + sed -e 's/AM_INIT_AUTOMAKE/AM_INIT_AUTOMAKE([no-dist-built-sources])/' \ + configure.ac >configure.tmp + cmp configure.ac configure.tmp && fatal_ 'failed to edit configure.ac' + mv -f configure.tmp configure.ac + fi + + cat >> configure.ac << 'END' +AC_OUTPUT +END + + cat > Makefile.am <