mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
mkconfig.rb: Update around SDKROOT
c.f. https://opensource.apple.com/source/ruby/ruby-145.40.1/patches/tool_mkconfig.rb.diff * moved to "includedir" from "oldincludedir". * honor "$(prefix)/include" if exists, otherwise fallback to `xcrun`.
This commit is contained in:
parent
df0f60b690
commit
fd978621cc
1 changed files with 10 additions and 2 deletions
|
@ -124,7 +124,7 @@ File.foreach "config.status" do |line|
|
||||||
if universal
|
if universal
|
||||||
platform = 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 /^includedir$/
|
||||||
val = '"$(SDKROOT)"'+val if /darwin/ =~ arch
|
val = '"$(SDKROOT)"'+val if /darwin/ =~ arch
|
||||||
end
|
end
|
||||||
v = " CONFIG[\"#{name}\"] #{eq} #{val}\n"
|
v = " CONFIG[\"#{name}\"] #{eq} #{val}\n"
|
||||||
|
@ -269,7 +269,15 @@ print <<EOS if $unicode_emoji_version
|
||||||
CONFIG["UNICODE_EMOJI_VERSION"] = #{$unicode_emoji_version.dump}
|
CONFIG["UNICODE_EMOJI_VERSION"] = #{$unicode_emoji_version.dump}
|
||||||
EOS
|
EOS
|
||||||
print <<EOS if /darwin/ =~ arch
|
print <<EOS if /darwin/ =~ arch
|
||||||
CONFIG["SDKROOT"] = "\#{ENV['SDKROOT']}" # don't run xcrun every time, usually useless.
|
if sdkroot = ENV["SDKROOT"]
|
||||||
|
sdkroot = sdkroot.dup
|
||||||
|
elsif File.exist?(File.join(CONFIG["prefix"], "include")) ||
|
||||||
|
!(sdkroot = (IO.popen(%w[/usr/bin/xcrun --sdk macosx --show-sdk-path], in: IO::NULL, err: IO::NULL, &:read) rescue nil))
|
||||||
|
sdkroot = +""
|
||||||
|
else
|
||||||
|
sdkroot.chomp!
|
||||||
|
end
|
||||||
|
CONFIG["SDKROOT"] = sdkroot
|
||||||
EOS
|
EOS
|
||||||
print <<EOS
|
print <<EOS
|
||||||
CONFIG["platform"] = #{platform || '"$(arch)"'}
|
CONFIG["platform"] = #{platform || '"$(arch)"'}
|
||||||
|
|
Loading…
Add table
Reference in a new issue