[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[automake-commit] 01/02: dist: add new "dist-no-built-sources" automake
From: |
Karl Berry |
Subject: |
[automake-commit] 01/02: dist: add new "dist-no-built-sources" automake option. |
Date: |
Sun, 11 Jul 2021 21:02:24 -0400 |
karl pushed a commit to branch master
in repository automake.
View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=13659a7385b69029be865d4f1b2cdfd2bee7da47
commit 13659a7385b69029be865d4f1b2cdfd2bee7da47
Author: Allison Karlitskaya <allison.karlitskaya@redhat.com>
AuthorDate: Fri Jul 9 09:03:30 2021 -0700
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.
---
NEWS | 14 +++++----
bin/automake.in | 4 ++-
doc/automake.texi | 15 ++++++++++
lib/Automake/Options.pm | 2 ++
lib/am/distdir.am | 6 +++-
t/dist-no-built-sources.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++
t/list-of-tests.mk | 1 +
7 files changed, 107 insertions(+), 7 deletions(-)
diff --git a/NEWS b/NEWS
index 0b11c22..09ade1c 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 72c3579..fde572c 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 f1deff8..c1c7b9f 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 b846fee..6c07e50 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 774d08b..3b60b6e 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 0000000..8d2d8a0
--- /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 <https://www.gnu.org/licenses/>.
+
+# 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 <<EOF
+BUILT_SOURCES = x.c
+EXTRA_DIST = y.c
+
+x.c:
+ touch \$@
+
+y.c:
+ cp x.c y.c # simulate 'undetectable' dependency on x.c
+EOF
+
+ if test "$testopt" = no-built-sources; then
+ touch y.c # no-built-sources dist needs to have all files already there
+ else
+ : # with default $(BUILT_SOURCES) dep, will try to build y.c by the rule
+ fi
+
+ $ACLOCAL
+ $AUTOMAKE
+ $AUTOCONF
+ ./configure
+ run_make dist
+
+ # In any case, the tarball should contain y.c, but not x.c.
+ # The tarball is always named based on $0, regardless of our options.
+ pkg_ver=$me-1.0
+ ! tar tf "${pkg_ver}".tar.gz "${pkg_ver}"/x.c
+ tar tf "${pkg_ver}".tar.gz "${pkg_ver}"/y.c
+
+ # And x.c should only have been built for the built-sources version.
+ if test "$testopt" = no-built-sources; then
+ # no-built-sources should not have generated this
+ ! test -e x.c
+ else
+ # built-sources build should have it
+ test -e x.c
+ fi
+done
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 934930b..277e330 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -410,6 +410,7 @@ t/dist-missing-m4.sh \
t/dist-readonly.sh \
t/dist-repeated.sh \
t/dist-pr109765.sh \
+t/dist-no-built-sources.sh \
t/dist-vs-built-sources.sh \
t/distcleancheck.sh \
t/distcom2.sh \