Skip to content

Commit

Permalink
Gem packaging fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tjschuck committed Oct 23, 2014
1 parent 1b5a9c1 commit 591b5cc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ GEM
PLATFORMS
java
ruby
x64-mingw32
x86-mingw32

DEPENDENCIES
bcrypt!
Expand Down
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ else
ext.cross_compile = true
ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
end

ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version|
platforms = {
"x86-mingw32" => "i686-w64-mingw32",
"x64-mingw32" => "x86_64-w64-mingw32"
}
platforms.each do |platform, prefix|
task "copy:bcrypt_ext:#{platform}:#{ruby_version}" do |t|
%w[lib tmp/#{platform}/stage/lib].each do |dir|
so_file = "#{dir}/#{ruby_version[/^\d+\.\d+/]}/bcrypt_ext.so"
if File.exists?(so_file)
sh "#{prefix}-strip -S #{so_file}"
end
end
end
end
end
end

desc "Run a set of benchmarks on the compiled extension."
Expand Down
1 change: 0 additions & 1 deletion ext/mri/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
exit 0
else
require "mkmf"
have_header('ruby/util.h')
dir_config("bcrypt_ext")
create_makefile("bcrypt_ext")
end
7 changes: 1 addition & 6 deletions lib/bcrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ module BCrypt
require "openssl"
end

begin
RUBY_VERSION =~ /(\d+.\d+)/
require "#{$1}/bcrypt_ext"
rescue LoadError
require "bcrypt_ext"
end
require 'bcrypt_ext'

require 'bcrypt/error'
require 'bcrypt/engine'
Expand Down

0 comments on commit 591b5cc

Please sign in to comment.