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

ruby-changes:68041

From: Lars <ko1@a...>
Date: Mon, 20 Sep 2021 00:15:51 +0900 (JST)
Subject: [ruby-changes:68041] 576b2e64cd (master): MINGW-UCRT: Set CONFIG['arch'] and RUBY_PLATFORM to "x64-mingw-ucrt"

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

From 576b2e64cdc5ea42ad345dd3c1c215e006c06fca Mon Sep 17 00:00:00 2001
From: Lars Kanis <kanis@c...>
Date: Fri, 25 Jun 2021 10:07:18 +0200
Subject: MINGW-UCRT: Set CONFIG['arch'] and RUBY_PLATFORM to "x64-mingw-ucrt"

This allows easy differentiation between ABI incompatible platforms like MSWIN64 and MSVCRT-based MINGW32.
This also implicates a distinct rubygem platform which is also "x64-mingw-ucrt".

Although the term "mingw32" is the OS-part for 64 bit systems as well, the "32" is misleading and confusing for many users.
Therefore the new platform string drops the "32" from the OS part to just "mingw".
This conforms to the common practice of windows platform testing per RUBY_PLATFORM=~/mswin|mingw/ .
---
 configure.ac                       | 6 +++++-
 lib/rubygems/platform.rb           | 1 +
 test/rubygems/test_gem_platform.rb | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a5de5de..b24a8f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4073,7 +4073,11 @@ AS_IF([test "${universal_binary-no}" = yes ], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L4073
     AC_DEFINE_UNQUOTED(RUBY_ARCH, "universal-" RUBY_PLATFORM_OS)
     AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "universal." RUBY_PLATFORM_CPU "-" RUBY_PLATFORM_OS)
 ], [
-    arch="${target_cpu}-${target_os}"
+    AS_IF([test "${target_os}-${rb_cv_msvcrt}" = "mingw32-ucrt" ], [
+        arch="${target_cpu}-mingw-ucrt"
+    ], [
+        arch="${target_cpu}-${target_os}"
+    ])
     AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "$arch")
 ])
 
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 4b8ac31..a5e65f9 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -104,6 +104,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/lib/rubygems/platform.rb#L104
                       when /^dotnet([\d.]*)/ then       [ 'dotnet',    $1  ]
                       when /linux-?((?!gnu)\w+)?/ then  [ 'linux',     $1  ]
                       when /mingw32/ then               [ 'mingw32',   nil ]
+                      when /mingw-?(\w+)?/ then         [ 'mingw',     $1  ]
                       when /(mswin\d+)(\_(\d+))?/ then
                         os, version = $1, $3
                         @cpu = 'x86' if @cpu.nil? and os =~ /32$/
diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb
index aae0250..8029035 100644
--- a/test/rubygems/test_gem_platform.rb
+++ b/test/rubygems/test_gem_platform.rb
@@ -122,6 +122,7 @@ class TestGemPlatform < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_platform.rb#L122
       'i586-linux-gnu'         => ['x86',       'linux',     nil],
       'i386-linux-gnu'         => ['x86',       'linux',     nil],
       'i386-mingw32'           => ['x86',       'mingw32',   nil],
+      'x64-mingw-ucrt'         => ['x64',       'mingw',     'ucrt'],
       'i386-mswin32'           => ['x86',       'mswin32',   nil],
       'i386-mswin32_80'        => ['x86',       'mswin32',   '80'],
       'i386-mswin32-80'        => ['x86',       'mswin32',   '80'],
-- 
cgit v1.1


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

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