Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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].
*/
Expand Down
8 changes: 6 additions & 2 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions lib/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
28 changes: 23 additions & 5 deletions spec/ruby/optional/capi/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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

Expand All @@ -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)
Expand Down