Generate revision.h by configure in the build directory (#19545)

configure created revision.h in $srcdir when it was missing.  Since
version.h includes "revision.h", the copy in $srcdir is found before
the one in the build directory.

This used to be harmless because file2lastrev.rb, run with --srcdir,
overwrote that copy in $srcdir on every build.  Since 4361d8e48f
(GH-19367), make writes only ./revision.h via lastrev and ifchange, so
the copy in $srcdir was left stale, and every out-of-place build
sharing that $srcdir kept embedding the revision at the time of that
configure run.
This commit is contained in:
Takashi Kokubun authored and GitHub committed 2026-10-26 17:09:17 -07:00
1 parent c6c27d0320
commit 5167808893
1 file changed
+6 -4
Notes: git 2026-10-27 00:09:48 +00:00
Merged-By: k0kubun <takashikkbn@gmail.com>
+6 -4
View File
@@ -4693,11 +4693,13 @@ AC_SUBST(XCC_WRAPPER)
AS_CASE([" $CPP "], [*" $CC "*], [CPP=`echo " $CPP " | sed "s| $CC |"' $(CC) |;s/^ *//;s/ *$//'`])
AS_IF([test ! -f "$srcdir/revision.h"], [
# Generate revision.h in the build directory, as make does; one in
# $srcdir would shadow it, since version.h includes "revision.h".
AS_IF([test ! -f "$srcdir/revision.h" -a ! -f revision.h], [
AS_IF([test "x$HAVE_BASERUBY" = xyes], [
${BASERUBY} -C "$srcdir" tool/file2lastrev.rb -q --revision.h > "$srcdir/revision.h"
${BASERUBY} -C "$srcdir" tool/file2lastrev.rb -q --revision.h > revision.h
], [
touch "$srcdir/revision.h"
touch revision.h
])
])
@@ -4724,7 +4726,7 @@ AC_CONFIG_FILES(Makefile:template/Makefile.in, [
AS_CASE("$VCS",
['$(GIT)'|git], [VCSUP='$(VCS) pull --rebase $(GITPULLOPTIONS)'],
[VCSUP='$(VCS)'])
for f in "$srcdir/version.h" "$srcdir/revision.h"; do
for f in "$srcdir/version.h" "$srcdir/revision.h" revision.h; do
test -f "$f" || continue
sed -n \
-e '[/^@%:@define \(RUBY_RELEASE_[A-Z]*\) \([0-9][0-9]*\)/]{' \