ruby-changes:60542
From: Nobuyoshi <ko1@a...>
Date: Sat, 28 Mar 2020 06:14:19 +0900 (JST)
Subject: [ruby-changes:60542] 5ccf57f23e (ruby_2_7): Make RbConfig::CONFIG values mutable [Bug #16738]
https://git.ruby-lang.org/ruby.git/commit/?id=5ccf57f23e From 5ccf57f23eb7a35ac699edc2fc598c47fa1844a0 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 25 Mar 2020 22:00:15 +0900 Subject: Make RbConfig::CONFIG values mutable [Bug #16738] As `RbConfig.expand` modifies the argument and involved `CONFIG` values, its values should be mutable. (cherry picked from commit 4adb2d655dcd54b28366b4d17e86b21e2b622cd1) diff --git a/test/test_rbconfig.rb b/test/test_rbconfig.rb index 1bbf01b..fcbbbd8 100644 --- a/test/test_rbconfig.rb +++ b/test/test_rbconfig.rb @@ -51,4 +51,13 @@ class TestRbConfig < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_rbconfig.rb#L51 assert_match(/\$\(sitearch|\$\(rubysitearchprefix\)/, val, "#{key} #{bug7823}") end end + + if /darwin/ =~ RUBY_PLATFORM + def test_sdkroot + assert_separately([{"SDKROOT" => "$(prefix)/SDKRoot"}], "#{<<~"begin;"}\n#{<<~'end;'}") + begin; + assert_equal RbConfig::CONFIG["prefix"]+"/SDKRoot", RbConfig::CONFIG["SDKROOT"] + end; + end + end end diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb index 038fbf6..05ecb81 100755 --- a/tool/mkconfig.rb +++ b/tool/mkconfig.rb @@ -268,7 +268,7 @@ print <<EOS if $unicode_emoji_version https://github.com/ruby/ruby/blob/trunk/tool/mkconfig.rb#L268 CONFIG["UNICODE_EMOJI_VERSION"] = #{$unicode_emoji_version.dump} EOS print <<EOS if /darwin/ =~ arch - CONFIG["SDKROOT"] = ENV["SDKROOT"] || "" # don't run xcrun every time, usually useless. + CONFIG["SDKROOT"] = "\#{ENV['SDKROOT']}" # don't run xcrun every time, usually useless. EOS print <<EOS CONFIG["archdir"] = "$(rubyarchdir)" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/