]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
dist: correct sense of no-dist-built-sources option.
authorBogdan <bogdro_rep@gmx.us>
Mon, 24 Feb 2025 18:30:42 +0000 (10:30 -0800)
committerKarl Berry <karl@freefriends.org>
Mon, 24 Feb 2025 18:30:42 +0000 (10:30 -0800)
Primarily from https://bugs.gnu.org/69908.

* bin/automake.in (preprocess_file) <DIST_BUILT_SOURCES>:
make the option name be "no-dist-built-sources",
per Options.pm and automake.texi; then set it with a single !.
* lib/am/distdir.am (distdir) [DIST_BUILT_SOURCES]: insert the
dependency on $(BUILT_SOURCES) when DIST_BUILT_SOURCES is true,
not false; i.e., sense was reversed.
* t/dist-no-built-sources.sh: edit the test configure.ac
in the no-dist-built-sources case. Rename the testopt value to
match the Automake option.
* NEWS: mention this.

NEWS
bin/automake.in
lib/am/distdir.am
t/dist-no-built-sources.sh

diff --git a/NEWS b/NEWS
index 26b433314c9a26254211c9dabbb0d3121ca9bd94..da6b5e4937b3c920b83c59d5cf17cf246d57f82a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,10 @@ New in 1.x:
     is set to "false", do nothing but exit unsuccessfully, also to match
     previous behavior. (bug#74434)
 
+  - The no-dist-built-sources Automake option hopefully now operates as
+    intended, i.e., omits the dependency on $(BUILT_SOURCES) for the
+    distdir target. (bug#69908)
+
   - The compile script is more robust to Windows configurations;
     specifically, avoiding double-path translation on MSYS. (bug#75939)
 
index 7e5a5f29504c173d75ce35829cf7484c1179fc50..70c512af2ea74dbb26d92a0a11fdc8cd3dad059c 100644 (file)
@@ -6922,7 +6922,7 @@ sub preprocess_file
                 'SHAR'        => !! option 'dist-shar',
                 'ZIP'         => !! option 'dist-zip',
                 'ZSTD'        => !! option 'dist-zstd',
-                'DIST_BUILT_SOURCES' => !! option 'dist-built-sources',
+                'DIST_BUILT_SOURCES' => ! option 'no-dist-built-sources',
 
                 'INSTALL-INFO' =>  ! option 'no-installinfo',
                 'INSTALL-MAN'  =>  ! option 'no-installman',
index d7e4916b54847dafadfc9ea7eca6c6ccacf41a58..b214ab2f2f0d6e157bc246ed95a990eae73ef5e8 100644 (file)
@@ -76,10 +76,10 @@ AM_RECURSIVE_TARGETS += distdir distdir-am
 endif %?SUBDIRS%
 
 if %?DIST_BUILT_SOURCES%
-distdir:
+distdir: $(BUILT_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) distdir-am
 else !%?DIST_BUILT_SOURCES%
-distdir: $(BUILT_SOURCES)
+distdir:
        $(MAKE) $(AM_MAKEFLAGS) distdir-am
 endif !%?DIST_BUILT_SOURCES%
 
index 4f838b9ce39041297e057657980a08f2dcd2ec2a..a3d57881fce5e051e4f6bc93cdaf14a2caacf7f6 100644 (file)
 . 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
+# 
+# test-init.sh creates configure.ac with an AM_INIT_AUTOMAKE call with
+# no options. The default is [no-no-]dist-built-sources, i.e., distdir
+# does depend on $(BUILT_SOURCES), so test that first. (There is no
+# Automake option named dist-built-sources, only --no-no-dist-built-sources.)
+# 
+# The second time around, add the no-dist-built-sources option,
+# and the distdir target should not depend on anything.
+#
+for testopt in dist-built-sources no-dist-built-sources; do
 
-  if test "$testopt" = no-built-sources; then
+  if test "$testopt" = no-dist-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'
+    cmp configure.ac configure.tmp \
+    && fatal_ 'failed to edit configure.ac for dist-built-sources'
     mv -f configure.tmp configure.ac
   fi
 
+#printf "\n\f test=$testopt, configure.ac is:\n"
+#cat configure.ac
+
   cat >> configure.ac << 'END'
 AC_OUTPUT
 END
@@ -43,8 +56,8 @@ 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
+  if test "$testopt" = no-dist-built-sources; then
+    touch y.c # no-dist-built-sources dist needs to have all files already
   else
     : # with default $(BUILT_SOURCES) dep, will try to build y.c by the rule
   fi
@@ -55,6 +68,9 @@ EOF
   ./configure
   run_make dist
 
+#printf "\n\f test=$testopt, Makefile has:\n"
+#grep ^distdir: Makefile
+
   # 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
@@ -63,15 +79,19 @@ EOF
   tar tf "${pkg_ver}".tar "${pkg_ver}"/y.c
 
   # And x.c should have been built only for the built-sources version.
-  if test "$testopt" = no-built-sources; then
+  if test "$testopt" = no-dist-built-sources; then
     # no-built-sources should not have generated this
     ! test -e x.c
+    grep 'distdir:$' Makefile
   else
     # built-sources build should have it
     test -e x.c
+    grep 'distdir: \$(BUILT_SOURCES)' Makefile
   fi
 
   # If the test runs fast enough, the make dist second time through
   # won't do anything since the tarball will be considered up to date.
   rm -f "${pkg_ver}".tar.gz "${pkg_ver}".tar
 done
+
+: