[前][次][番号順一覧][スレッド一覧]

ruby-changes:68252

From: Koichi <ko1@a...>
Date: Tue, 5 Oct 2021 02:07:49 +0900 (JST)
Subject: [ruby-changes:68252] bc96a45f12 (master): introduce debug.gem

https://git.ruby-lang.org/ruby.git/commit/?id=bc96a45f12

From bc96a45f12503956e323e6c2a47aa550ca1da3dc Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Fri, 1 Oct 2021 03:13:00 +0900
Subject: introduce debug.gem

For the `test-bundled-gems`, make `debug.so` with extconf.rb and
`make` command directly because `rake-compiler` assume ruby is
installed (but `test-bundled-gems` can run without installation).
---
 common.mk                 |  2 +-
 gems/bundled_gems         |  1 +
 tool/rbinstall.rb         | 17 ++++++++++++++++-
 tool/test-bundled-gems.rb | 10 ++++++++++
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/common.mk b/common.mk
index 711ef25b2f..b36e0b53f0 100644
--- a/common.mk
+++ b/common.mk
@@ -1377,7 +1377,7 @@ no-test-bundled-gems-prepare: no-test-bundled-gems-precheck https://github.com/ruby/ruby/blob/trunk/common.mk#L1377
 yes-test-bundled-gems-prepare: yes-test-bundled-gems-precheck
 	$(ACTIONS_GROUP)
 	$(XRUBY) -C "$(srcdir)" bin/gem install --no-document \
-		--install-dir .bundle --conservative "bundler" "minitest:~> 5" "test-unit" "rake" "hoe" "yard" "pry" "packnga" "rexml" "json-schema"
+		--install-dir .bundle --conservative "bundler" "minitest:~> 5" "test-unit" "rake" "hoe" "yard" "pry" "packnga" "rexml" "json-schema" "test-unit-rr"
 	$(ACTIONS_ENDGROUP)
 
 PREPARE_BUNDLED_GEMS = test-bundled-gems-prepare
diff --git a/gems/bundled_gems b/gems/bundled_gems
index c6a4c77d14..275309de5a 100644
--- a/gems/bundled_gems
+++ b/gems/bundled_gems
@@ -13,3 +13,4 @@ matrix 0.4.2 https://github.com/ruby/matrix https://github.com/ruby/ruby/blob/trunk/gems/bundled_gems#L13
 prime 0.1.2 https://github.com/ruby/prime
 rbs 1.6.2 https://github.com/ruby/rbs
 typeprof 0.15.3 https://github.com/ruby/typeprof
+debug 1.2.2 https://github.com/ruby/debug
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 0e88d93c8f..6629b4aa73 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -989,6 +989,20 @@ def install_default_gem(dir, srcdir, bindir) https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L989
 end
 
 install?(:ext, :comm, :gem, :'bundled-gems') do
+  if CONFIG['CROSS_COMPILING'] == 'yes'
+    # The following hacky steps set "$ruby = BASERUBY" in tool/fake.rb
+    $hdrdir = ''
+    $extmk = nil
+    $ruby = nil  # ...
+    ruby_path = $ruby + " -I#{Dir.pwd}" # $baseruby + " -I#{Dir.pwd}"
+  else
+    # ruby_path = File.expand_path(with_destdir(File.join(bindir, ruby_install_name)))
+    ENV['RUBYLIB'] = nil
+    ENV['RUBYOPT'] = nil
+    ruby_path = File.expand_path(with_destdir(File.join(bindir, ruby_install_name))) + " --disable=gems -I#{with_destdir(archlibdir)}"
+  end
+  Gem.instance_variable_set(:@ruby, ruby_path) if Gem.ruby != ruby_path
+
   gem_dir = Gem.default_dir
   install_dir = with_destdir(gem_dir)
   prepare "bundled gems", gem_dir
@@ -1009,7 +1023,8 @@ install?(:ext, :comm, :gem, :'bundled-gems') do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L1023
     :format_executable => true,
   }
   gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
-  extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
+  extensions_dir = with_destdir(Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir)
+
   File.foreach("#{srcdir}/gems/bundled_gems") do |name|
     next if /^\s*(?:#|$)/ =~ name
     next unless /^(\S+)\s+(\S+).*/ =~ name
diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb
index 6419ffaa50..ef491f9db4 100644
--- a/tool/test-bundled-gems.rb
+++ b/tool/test-bundled-gems.rb
@@ -1,5 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/tool/test-bundled-gems.rb#L1
 require 'rbconfig'
 require 'timeout'
+require 'fileutils'
 
 github_actions = ENV["GITHUB_ACTIONS"] == "true"
 
@@ -40,6 +41,15 @@ File.foreach("#{gem_dir}/bundled_gems") do |line| https://github.com/ruby/ruby/blob/trunk/tool/test-bundled-gems.rb#L41
     test_command << " 'TESTOPTS=-e /test_stub_value_block_args_5__break_if_not_passed|test_no_method_error_on_unexpected_methods/'"
   end
 
+  if gem == "debug"
+    build_dir = 'ext/-test-/gems/debug'
+    FileUtils.mkdir_p(build_dir)
+    extconf_path = File.expand_path('../../gems/src/debug/ext/debug/extconf.rb', __FILE__)
+    system("#{ruby} -C #{build_dir} #{extconf_path}") or raise
+    system("cd #{build_dir} && make extout=../../../../.ext libdir=../../../..") or raise
+    ENV["RUBYLIB"] = [File.expand_path(build_dir + "/.."), ENV.fetch("RUBYLIB", nil)].compact.join(":")
+  end
+
   print "[command]" if github_actions
   puts test_command
   pid = Process.spawn(test_command, "#{/mingw|mswin/ =~ RUBY_PLATFORM ? 'new_' : ''}pgroup": true)
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]