The attached patch assumes that "no-dist-built-sources" is the right option name
Yes, good. I played around with the test some more for cleanliness, but didn't touch your changes to the code. Hopefully "no-dist-built-sources" now operates as intended. Pushed and closing ... thanks Bogdan. -k ----------------------------------------------------------------------------- dist: correct sense of no-dist-built-sources option. 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. diff --git a/NEWS b/NEWS index 26b433314..da6b5e493 100644 --- 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) diff --git a/bin/automake.in b/bin/automake.in index 7e5a5f295..70c512af2 100644 --- a/bin/automake.in +++ b/bin/automake.in @@ -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', diff --git a/lib/am/distdir.am b/lib/am/distdir.am index d7e4916b5..b214ab2f2 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -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% diff --git a/t/dist-no-built-sources.sh b/t/dist-no-built-sources.sh index 4f838b9ce..a3d57881f 100644 --- a/t/dist-no-built-sources.sh +++ b/t/dist-no-built-sources.sh @@ -19,15 +19,28 @@ . 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 + +: compile finished at Mon Feb 24 10:29:51 2025