diff options
Diffstat (limited to 'tool/mkconfig.rb')
-rwxr-xr-x | tool/mkconfig.rb | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/tool/mkconfig.rb b/tool/mkconfig.rb index 6db60724e9..55e781a28e 100755 --- a/tool/mkconfig.rb +++ b/tool/mkconfig.rb @@ -63,8 +63,8 @@ File.foreach "config.status" do |line| when /^(?:X|(?:MINI|RUN|(?:HAVE_)?BASE|BOOTSTRAP|BTEST)RUBY(?:_COMMAND)?$)/; next when /^INSTALLDOC|TARGET$/; next when /^DTRACE/; next - when /^MJIT_(CC|SUPPORT)$/; # pass - when /^MJIT_/; next + when /^RJIT_(CC|SUPPORT)$/; # pass + when /^RJIT_/; next when /^(?:MAJOR|MINOR|TEENY)$/; vars[name] = val; next when /^LIBRUBY_D?LD/; next when /^RUBY_INSTALL_NAME$/; next vars[name] = (install_name = val).dup if $install_name @@ -88,7 +88,7 @@ File.foreach "config.status" do |line| unless $install_name $install_name = "ruby" val.gsub!(/\$\$/, '$') - val.scan(%r[\G[\s;]*(/(?:\\.|[^/])*/)?([sy])(\\?\W)((?:(?!\3)(?:\\.|.))*)\3((?:(?!\3)(?:\\.|.))*)\3([gi]*)]) do + val.scan(%r[\G[\s;]*(/(?:\\.|[^/])*+/)?([sy])(\\?\W)((?:(?!\3)(?:\\.|.))*+)\3((?:(?!\3)(?:\\.|.))*+)\3([gi]*)]) do |addr, cmd, sep, pat, rep, opt| if addr Regexp.new(addr[/\A\/(.*)\/\z/, 1]) =~ $install_name or next @@ -122,8 +122,16 @@ File.foreach "config.status" do |line| universal, val = val, 'universal' if universal when /^arch$/ if universal - platform = val.sub(/universal/, %q[#{arch && universal[/(?:\A|\s)#{Regexp.quote(arch)}=(\S+)/, 1] || RUBY_PLATFORM[/\A[^-]*/]}]) + platform = val.sub(/universal/, '$(arch)') end + when /^target_cpu$/ + if universal + val = 'cpu' + end + when /^target$/ + val = '"$(target_cpu)-$(target_vendor)-$(target_os)"' + when /^host(?:_(?:os|vendor|cpu|alias))?$/ + val = %["$(#{name.sub(/^host/, 'target')})"] when /^includedir$/ val = '"$(SDKROOT)"'+val if /darwin/ =~ arch end @@ -185,17 +193,19 @@ print " # Ruby installed directory.\n" print " TOPDIR = File.dirname(__FILE__).chomp!(#{relative_archdir.dump})\n" print " # DESTDIR on make install.\n" print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n" -print <<'ARCH' if universal +print <<"UNIVERSAL", <<'ARCH' if universal + universal = #{universal} +UNIVERSAL arch_flag = ENV['ARCHFLAGS'] || ((e = ENV['RC_ARCHS']) && e.split.uniq.map {|a| "-arch #{a}"}.join(' ')) arch = arch_flag && arch_flag[/\A\s*-arch\s+(\S+)\s*\z/, 1] + cpu = arch && universal[/(?:\A|\s)#{Regexp.quote(arch)}=(\S+)/, 1] || RUBY_PLATFORM[/\A[^-]*/] ARCH -print " universal = #{universal}\n" if universal print " # The hash configurations stored.\n" print " CONFIG = {}\n" print " CONFIG[\"DESTDIR\"] = DESTDIR\n" versions = {} -IO.foreach(File.join(srcdir, "version.h")) do |l| +File.foreach(File.join(srcdir, "version.h")) do |l| m = /^\s*#\s*define\s+RUBY_(PATCHLEVEL)\s+(-?\d+)/.match(l) if m versions[m[1]] = m[2] @@ -216,7 +226,7 @@ IO.foreach(File.join(srcdir, "version.h")) do |l| end end if versions.size != 4 - IO.foreach(File.join(srcdir, "include/ruby/version.h")) do |l| + File.foreach(File.join(srcdir, "include/ruby/version.h")) do |l| m = /^\s*#\s*define\s+RUBY_API_VERSION_(\w+)\s+(-?\d+)/.match(l) if m versions[m[1]] ||= m[2] @@ -268,7 +278,7 @@ EOS print <<EOS if $unicode_emoji_version CONFIG["UNICODE_EMOJI_VERSION"] = #{$unicode_emoji_version.dump} EOS -print <<EOS if /darwin/ =~ arch +print prefix.start_with?("/System/") ? <<EOS : <<EOS if /darwin/ =~ arch if sdkroot = ENV["SDKROOT"] sdkroot = sdkroot.dup elsif File.exist?(File.join(CONFIG["prefix"], "include")) || @@ -279,6 +289,8 @@ print <<EOS if /darwin/ =~ arch end CONFIG["SDKROOT"] = sdkroot EOS + CONFIG["SDKROOT"] = "" +EOS print <<EOS CONFIG["platform"] = #{platform || '"$(arch)"'} CONFIG["archdir"] = "$(rubyarchdir)" @@ -340,7 +352,6 @@ print <<EOS RbConfig::expand(val) end - # :nodoc: # call-seq: # # RbConfig.fire_update!(key, val) -> array @@ -356,7 +367,7 @@ print <<EOS # RbConfig::CONFIG.values_at("CC", "LDSHARED") # => ["gcc-8", "gcc-8 -shared"] # # returns updated keys list, or +nil+ if nothing changed. - def RbConfig.fire_update!(key, val, mkconf = MAKEFILE_CONFIG, conf = CONFIG) + def RbConfig.fire_update!(key, val, mkconf = MAKEFILE_CONFIG, conf = CONFIG) # :nodoc: return if mkconf[key] == val mkconf[key] = val keys = [key] |