From 5815ebf0143a0aadd0488c16c7d36b37bf0385da Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 30 Mar 2026 18:43:15 +0900 Subject: [PATCH 1/3] Honor RUBY_DUMP_AST environment variable if set --- .github/actions/setup/baseruby/action.yml | 2 +- .github/actions/setup/directories/action.yml | 1 + configure.ac | 10 +++++++--- win32/Makefile.sub | 6 ++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup/baseruby/action.yml b/.github/actions/setup/baseruby/action.yml index 76fe068897a163..9c93be0f9a9a82 100644 --- a/.github/actions/setup/baseruby/action.yml +++ b/.github/actions/setup/baseruby/action.yml @@ -45,7 +45,7 @@ runs: ln -sr "$srcdir" "$builddir/.src" pushd "$builddir" .src/configure "--prefix=${installdir}" --disable-install-doc - CONFIGURE_ARGS=--with-out-ext=-test- make install + CONFIGURE_ARGS=--with-out-ext=-test- make install dump_ast install dump_ast "${installdir}/bin" { echo "${installdir}/bin/dump_ast" diff --git a/.github/actions/setup/directories/action.yml b/.github/actions/setup/directories/action.yml index 78b57c17619a51..a1727246b3d7bf 100644 --- a/.github/actions/setup/directories/action.yml +++ b/.github/actions/setup/directories/action.yml @@ -162,6 +162,7 @@ runs: sed -f tool/prereq.status template/$mk.in > $mk done make up + echo RUBY_DUMP_AST=true >> "$GITHUB_ENV" # Cleanup, runs even on failure - if: always() && inputs.makeup diff --git a/configure.ac b/configure.ac index f636d19e3f1026..6fbbb11178d219 100644 --- a/configure.ac +++ b/configure.ac @@ -119,12 +119,16 @@ AC_SUBST(X_BUILD_EXEEXT) AC_ARG_WITH(dump-ast, AS_HELP_STRING([--with-dump-ast=DUMP_AST], [use DUMP_AST as dump_ast; for cross-compiling with a host-built dump_ast]), [DUMP_AST=$withval DUMP_AST_TARGET='$(empty)'], - [AS_IF([test "$cross_compiling" = yes], [ + [AS_IF([test ${RUBY_DUMP_AST+set}], [ + DUMP_AST="${RUBY_DUMP_AST}" + DUMP_AST_TARGET='$(empty)' + ], [test "$cross_compiling" = yes], [ DUMP_AST='build-tool/dump_ast$(BUILD_EXEEXT)' + DUMP_AST_TARGET='$(DUMP_AST)' ], [ DUMP_AST='./dump_ast$(BUILD_EXEEXT)' - ]) - DUMP_AST_TARGET='$(DUMP_AST)']) + DUMP_AST_TARGET='$(DUMP_AST)' + ])]) dnl Without baseruby, .rbinc files cannot be regenerated, so clear the dnl dependency on dump_ast to avoid rebuilding pre-generated .rbinc files. AS_IF([test "$HAVE_BASERUBY" = no], [DUMP_AST_TARGET='$(empty)']) diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 203179006f8951..4f95c10bcb5690 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -567,6 +567,12 @@ ABI_VERSION_HDR = $(hdrdir)/ruby/internal/abi.h !if defined(DUMP_AST) DUMP_AST_TARGET = $(empty) +!else if defined(RUBY_DUMP_AST) +DUMP_AST = $(RUBY_DUMP_AST) +DUMP_AST_TARGET = $(empty) +!else if "$(CROSS_COMPILING)" == "yes" +DUMP_AST = ruby-dump_ast$(BUILD_EXEEXT) +DUMP_AST_TARGET = $(DUMP_AST) !else DUMP_AST = dump_ast$(BUILD_EXEEXT) DUMP_AST_TARGET = $(DUMP_AST) From 97d602a55f9e77bd64c2130dc0a755f657b4ce65 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 26 Jul 2026 16:52:41 +0900 Subject: [PATCH 2/3] Setup baseruby before setup directories BASERUBY is required by `makeup: true`. --- .github/workflows/annocheck.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/annocheck.yml b/.github/workflows/annocheck.yml index f58363f76a23e6..1fda0b98877b3b 100644 --- a/.github/workflows/annocheck.yml +++ b/.github/workflows/annocheck.yml @@ -67,17 +67,17 @@ jobs: sparse-checkout: /.github persist-credentials: false + - uses: ruby/setup-ruby@003a5c4d8d6321bd302e38f6f0ec593f77f06600 # v1.319.0 + with: + ruby-version: '3.1' + bundler: none + - uses: ./.github/actions/setup/directories with: srcdir: src builddir: build makeup: true - - uses: ruby/setup-ruby@003a5c4d8d6321bd302e38f6f0ec593f77f06600 # v1.319.0 - with: - ruby-version: '3.1' - bundler: none - # Minimal flags to pass the check. # -g0 disables backtraces when SEGV. Do not set that. - name: Run configure From f373b40430e67daac0ebc429d1e1d5ed4dbb2e98 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 26 Jul 2026 17:11:01 +0900 Subject: [PATCH 3/3] Check baseruby version before `makeup` --- .github/actions/setup/directories/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup/directories/action.yml b/.github/actions/setup/directories/action.yml index a1727246b3d7bf..bb1c92bd735168 100644 --- a/.github/actions/setup/directories/action.yml +++ b/.github/actions/setup/directories/action.yml @@ -157,6 +157,7 @@ runs: shell: bash working-directory: ${{ inputs.srcdir }} run: | + ruby tool/missing-baseruby.bat --verbose touch config.status .rbconfig.time for mk in Makefile GNUmakefile; do sed -f tool/prereq.status template/$mk.in > $mk