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/ .
This commit is contained in:
Lars Kanis 2021-06-25 10:07:18 +02:00 committed by Nobuyoshi Nakada
parent 52cc54ce6f
commit 576b2e64cd
Notes: git 2021-09-20 00:16:00 +09:00
3 changed files with 7 additions and 1 deletions

View File

@ -4073,7 +4073,11 @@ AS_IF([test "${universal_binary-no}" = yes ], [
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")
])

View File

@ -104,6 +104,7 @@ class Gem::Platform
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$/

View File

@ -122,6 +122,7 @@ class TestGemPlatform < Gem::TestCase
'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'],