Skip to content

Commit

Permalink
Add proper support for x64-mingw32 platform.
Browse files Browse the repository at this point in the history
This fixes github issue rubygems#2356 .
  • Loading branch information
larskanis committed Aug 10, 2013
1 parent a539bf2 commit facdbf0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
10 changes: 9 additions & 1 deletion lib/bundler/current_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def mswin?
end

def mingw?
Bundler::WINDOWS && Gem::Platform.local.os == "mingw32"
Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu != 'x64'
end

def mingw_18?
Expand All @@ -84,5 +84,13 @@ def mingw_20?
mingw? && on_20?
end

def x64_mingw?
Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu == 'x64'
end

def x64_mingw_20?
x64_mingw? && on_20?
end

end
end
4 changes: 3 additions & 1 deletion lib/bundler/dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class Dependency < Gem::Dependency
:mingw => Gem::Platform::MINGW,
:mingw_18 => Gem::Platform::MINGW,
:mingw_19 => Gem::Platform::MINGW,
:mingw_20 => Gem::Platform::MINGW
:mingw_20 => Gem::Platform::MINGW,
:x64_mingw => Gem::Platform::X64_MINGW,
:x64_mingw_20 => Gem::Platform::X64_MINGW
}.freeze

def initialize(name, version, options = {}, &blk)
Expand Down
14 changes: 8 additions & 6 deletions lib/bundler/gem_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ module GemHelpers

GENERIC_CACHE = {}
GENERICS = [
Gem::Platform.new('java'),
Gem::Platform.new('mswin32'),
Gem::Platform.new('x86-mingw32'),
Gem::Platform::RUBY
[Gem::Platform.new('java'), Gem::Platform.new('java')],
[Gem::Platform.new('mswin32'), Gem::Platform.new('mswin32')],
[Gem::Platform.new('x64-mingw32'), Gem::Platform.new('x64-mingw32')],
[Gem::Platform.new('x86_64-mingw32'), Gem::Platform.new('x64-mingw32')],
[Gem::Platform.new('mingw32'), Gem::Platform.new('x86-mingw32')],
[Gem::Platform::RUBY, Gem::Platform.new('java')]
]

def generic(p)
return p if p == Gem::Platform::RUBY

GENERIC_CACHE[p] ||= begin
found = GENERICS.find do |p2|
p2.is_a?(Gem::Platform) && p.os == p2.os
_, found = GENERICS.find do |match, _generic|
match.is_a?(Gem::Platform) && p.os == match.os && (!match.cpu || p.cpu == match.cpu)
end
found || Gem::Platform::RUBY
end
Expand Down
1 change: 1 addition & 0 deletions lib/bundler/rubygems_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class Platform
JAVA = Gem::Platform.new('java') unless defined?(JAVA)
MSWIN = Gem::Platform.new('mswin32') unless defined?(MSWIN)
MINGW = Gem::Platform.new('x86-mingw32') unless defined?(MINGW)
X64_MINGW = Gem::Platform.new('x64-mingw32') unless defined?(X64_MINGW)

undef_method :hash if method_defined? :hash
def hash
Expand Down
6 changes: 5 additions & 1 deletion man/gemfile.5.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,17 @@ There are a number of `Gemfile` platforms:
* `mswin`:
Windows
* `mingw`:
Windows 'mingw32' platform (aka RubyInstaller)
Windows 32 bit 'mingw32' platform (aka RubyInstaller)
* `mingw_18`:
_mingw_ `AND` version 1.8
* `mingw_19`:
_mingw_ `AND` version 1.9
* `mingw_20`:
_mingw_ `AND` version 2.0
* `x64_mingw`:
Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
* `x64_mingw_20`:
_x64_mingw_ `AND` version 2.0

As with groups, you can specify one or more platforms:

Expand Down

0 comments on commit facdbf0

Please sign in to comment.