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

ruby-changes:74397

From: Bo <ko1@a...>
Date: Wed, 9 Nov 2022 02:05:37 +0900 (JST)
Subject: [ruby-changes:74397] 2244d5084e (master): [rubygems/rubygems] Map 'universal' to the real arch in Bundler for prebuilt gem selection

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

From 2244d5084e32fea801bff1060ef528769bebaa36 Mon Sep 17 00:00:00 2001
From: Bo Anderson <mail@b...>
Date: Wed, 12 Oct 2022 14:08:35 +0100
Subject: [rubygems/rubygems] Map 'universal' to the real arch in Bundler for
 prebuilt gem selection

https://github.com/rubygems/rubygems/commit/dd0c94f16a
---
 lib/bundler/rubygems_ext.rb | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index d53d688009..22cb797b5e 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -308,6 +308,28 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/bundler/rubygems_ext.rb#L308
     end
   end
 
+  # On universal Rubies, resolve the "universal" arch to the real CPU arch, without changing the extension directory.
+  class Specification
+    if /^universal\.(?<arch>.*?)-/ =~ RUBY_PLATFORM
+      local_platform = Platform.local
+      if local_platform.cpu == "universal"
+        ORIGINAL_LOCAL_PLATFORM = local_platform.to_s.freeze
+
+        local_platform.cpu = if arch == "arm64e" # arm64e is only permitted for Apple system binaries
+          "arm64"
+        else
+          arch
+        end
+
+        def extensions_dir
+          Gem.default_ext_dir_for(base_dir) ||
+            File.join(base_dir, "extensions", ORIGINAL_LOCAL_PLATFORM,
+                      Gem.extension_api_version)
+        end
+      end
+    end
+  end
+
   require "rubygems/util"
 
   Util.singleton_class.module_eval do
-- 
cgit v1.2.3


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

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