1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add RbConfig::CONFIG["platform"]

Means the platform with the actual CPU info on universal binary.
The CPU in "arch" is fixed as "universal" to refer the header and
library paths.
This commit is contained in:
Nobuyoshi Nakada 2021-03-22 00:20:27 +09:00 committed by GitHub
parent cb396d4214
commit 5e2e8ad9a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2021-03-22 00:21:01 +09:00
Merged: https://github.com/ruby/ruby/pull/4300

Merged-By: nobu <nobu@ruby-lang.org>

View file

@ -29,6 +29,7 @@ continued_name = nil
continued_line = nil continued_line = nil
install_name = nil install_name = nil
so_name = nil so_name = nil
platform = nil
File.foreach "config.status" do |line| File.foreach "config.status" do |line|
next if /^#/ =~ line next if /^#/ =~ line
name = nil name = nil
@ -121,7 +122,7 @@ File.foreach "config.status" do |line|
universal, val = val, 'universal' if universal universal, val = val, 'universal' if universal
when /^arch$/ when /^arch$/
if universal if universal
val.sub!(/universal/, %q[#{arch && universal[/(?:\A|\s)#{Regexp.quote(arch)}=(\S+)/, 1] || RUBY_PLATFORM[/\A[^-]*/]}]) platform = val.sub(/universal/, %q[#{arch && universal[/(?:\A|\s)#{Regexp.quote(arch)}=(\S+)/, 1] || RUBY_PLATFORM[/\A[^-]*/]}])
end end
when /^oldincludedir$/ when /^oldincludedir$/
val = '"$(SDKROOT)"'+val if /darwin/ =~ arch val = '"$(SDKROOT)"'+val if /darwin/ =~ arch
@ -271,6 +272,7 @@ 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 EOS
print <<EOS print <<EOS
CONFIG["platform"] = #{platform || '"$(arch)"'}
CONFIG["archdir"] = "$(rubyarchdir)" CONFIG["archdir"] = "$(rubyarchdir)"
CONFIG["topdir"] = File.dirname(__FILE__) CONFIG["topdir"] = File.dirname(__FILE__)
# Almost same with CONFIG. MAKEFILE_CONFIG has other variable # Almost same with CONFIG. MAKEFILE_CONFIG has other variable