diff --git a/array.c b/array.c index 4a4c44562d28bf..90e83fd3ad972f 100644 --- a/array.c +++ b/array.c @@ -3163,7 +3163,7 @@ rb_ary_to_a(VALUE ary) * forms each sub-array into a key-value pair in the new hash: * * a = [['foo', 'zero'], ['bar', 'one'], ['baz', 'two']] - * a.to_h # => {"foo"=>"zero", "bar"=>"one", "baz"=>"two"} + * a.to_h # => {"foo" => "zero", "bar" => "one", "baz" => "two"} * [].to_h # => {} * * With a block given, the block must return a 2-element array; @@ -3172,7 +3172,7 @@ rb_ary_to_a(VALUE ary) * * a = ['foo', :bar, 1, [2, 3], {baz: 4}] * a.to_h {|element| [element, element.class] } - * # => {"foo"=>String, :bar=>Symbol, 1=>Integer, [2, 3]=>Array, {:baz=>4}=>Hash} + * # => {"foo" => String, bar: Symbol, 1 => Integer, [2, 3] => Array, {baz: 4} => Hash} * * Related: see {Methods for Converting}[rdoc-ref:Array@Methods+for+Converting]. */ diff --git a/common.mk b/common.mk index 8891b65ed9b306..5623b50b853cd9 100644 --- a/common.mk +++ b/common.mk @@ -938,19 +938,23 @@ rbconfig.rb: $(RBCONFIG) $(HAVE_BASERUBY:no=)$(RBCONFIG)$(HAVE_BASERUBY:no=): $(PREP) $(RBCONFIG): $(tooldir)/mkconfig.rb config.status $(srcdir)/version.h $(srcdir)/common.mk +$(RBCONFIG): unicode-version + +unicode-version: $(Q)$(BOOTSTRAPRUBY) -n \ -e 'BEGIN{version=ARGV.shift;mis=ARGV.dup}' \ -e 'END{abort "UNICODE version mismatch: #{mis}" unless mis.empty?}' \ -e '(mis.delete(ARGF.path); ARGF.close) if /ONIG_UNICODE_VERSION_STRING +"#{Regexp.quote(version)}"/o' \ $(UNICODE_VERSION) $(UNICODE_DATA_HEADERS) + +$(RBCONFIG): $(Q)$(BOOTSTRAPRUBY) $(tooldir)/mkconfig.rb \ -arch=$(arch) -version=$(RUBY_PROGRAM_VERSION) \ -install_name=$(RUBY_INSTALL_NAME) \ -so_name=$(RUBY_SO_NAME) \ -unicode_version=$(UNICODE_VERSION) \ -unicode_emoji_version=$(UNICODE_EMOJI_VERSION) \ - > rbconfig.tmp - $(IFCHANGE) "--timestamp=$@" rbconfig.rb rbconfig.tmp + | $(IFCHANGE) "--timestamp=$@" rbconfig.rb - test-rubyspec: test-spec yes-test-rubyspec: yes-test-spec diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 31abb7e56987ea..2139264629c422 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -1410,9 +1410,7 @@ def default_gem_load_paths # REFACTOR: This should be pulled out into some kind of hacks file. begin - ## # Defaults the operating system (or packager) wants to provide for RubyGems. - require "rubygems/defaults/operating_system" rescue LoadError # Ignored @@ -1427,9 +1425,7 @@ def default_gem_load_paths end begin - ## # Defaults the Ruby implementation wants to provide for RubyGems - require "rubygems/defaults/#{RUBY_ENGINE}" rescue LoadError end diff --git a/spec/ruby/optional/capi/spec_helper.rb b/spec/ruby/optional/capi/spec_helper.rb index d937c967d062fc..49ce23d87432e3 100644 --- a/spec/ruby/optional/capi/spec_helper.rb +++ b/spec/ruby/optional/capi/spec_helper.rb @@ -89,6 +89,12 @@ def compile_extension(name) $ruby = ENV.values_at('RUBY_EXE', 'RUBY_FLAGS').join(' ') # MRI magic to consider building non-bundled extensions $extout = nil + if RbConfig::CONFIG.key?("buildlibdir") # The top directory where the libruby is built. + # Prepend the dummy macro to bypass the conversion in `with_destdir` on DOSISH + # platforms, where the drive letter is replaced with `$(DESTDIR)`. `DESTDIR` is + # overridden by the command line argument bellow. + RbConfig::MAKEFILE_CONFIG["buildlibdir"] = "$(empty)" + RbConfig::CONFIG["buildlibdir"] + end append_cflags '-Wno-declaration-after-statement' #{"append_cflags #{ruby_repository_extra_include_dir.inspect}" if ruby_repository_extra_include_dir} create_makefile(#{ext.inspect}) @@ -100,7 +106,7 @@ def compile_extension(name) # Do not capture stderr as we want to show compiler warnings make, opts = setup_make - output = IO.popen([make, "V=1", "DESTDIR=", opts], &:read) + output = IO.popen([*make, "V=1", "DESTDIR=", opts], &:read) raise "#{make} failed:\n#{output}" unless $?.success? $stderr.puts output if debug @@ -117,22 +123,34 @@ def compile_extension(name) def setup_make make = ENV['MAKE'] make ||= (RbConfig::CONFIG['host_os'].include?("mswin") ? "nmake" : "make") - make_flags = ENV["MAKEFLAGS"] || '' + env = %w[MFLAGS MAKEFLAGS GNUMAKEFLAGS].to_h {|var| [var, ENV[var]]} + make_flags = env["MAKEFLAGS"] || '' # suppress logo of nmake.exe to stderr if File.basename(make, ".*").downcase == "nmake" and !make_flags.include?("l") - ENV["MAKEFLAGS"] = "l#{make_flags}" + env["MAKEFLAGS"] = "l#{make_flags}" end opts = {} if /(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ make_flags [$1, $2].each do |fd| - fd = fd.to_i(10) + fd = IO.for_fd(fd.to_i(10), autoclose: false) opts[fd] = fd + rescue + # Jobserver is not usable, maybe no `+` flag or on Windows. + job_options = /\A\s*(?:-j\d+\s*|-\S+\Kj\d+)|(?:\G|\s)\K--jobserver-(?:auth|fds)=\S+\s*/ + env["MAKEFLAGS"] = make_flags.gsub(job_options, '') + %w[GNUMAKEFLAGS MFLAGS].each do |var| + if flags = env[var] + env[var] = flags.gsub(job_options, '') + end + end + opts.clear + break end end - [make, opts] + [[env, make], opts] end def load_extension(name)