Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add support for cross builds for multiple target platforms. #74

Merged
merged 3 commits into from

4 participants

@larskanis

Hi Luis,

I use rake-compiler's cross compilation support in several projects and now that you released Ruby-2.0.0-p0 for 32 and 64 bit Windows platforms, it would like to update it properly for 64 bit. So attached you can find two patches that allow the following use case:

$ rake-compiler cross-ruby VERSION=1.8.7-p371
$ rake-compiler cross-ruby VERSION=1.9.3-p125
$ rake-compiler cross-ruby VERSION=2.0.0-p0
$ rake-compiler cross-ruby VERSION=2.0.0-p0 HOST=x86_64-w64-mingw32
$ rake cross compile RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0

With

ext.cross_platform = %w[i386-mingw32 x64-mingw32]

it builds 4 different targets of the extension.

Unfortunately only the compile task does work right now. The native task copies the compiled extension binaries into the lib directory in order to later build a gem from the base directory. This conflicts for the 2.0 so-file which then is built only once but packaged into two gems.

I guess the only solution is to use different temporary directories for the packaging of cross compiled gems. How would you like to solve this issue?

larskanis added some commits
@larskanis larskanis Store cross compiled Ruby into seperate directories depending on HOST…
… platform.

Also prefix the selection of rbconfig in config.yml with the corresponding
Ruby platform.

This allowes to use cross compiled Ruby-builds for multiple target
architectures on the same machine. This is especially usefull to compile
for Ruby-2.0 i386-mingw32 and x64-mingw32 platforms.
2d7bc8c
@larskanis larskanis Add possibility to set per-platform cross_config_options.
This is especially useful to set distinct library paths for different
target platforms.
8828825
@luislavena
Owner

@larskanis nice!

I honestly must admit that I've been neglecting rake-compiler support for 64bits because I want to focus on gem-compiler instead.

I'll try to update rake-compiler dependencies and ensure Travis builds again so I can merge your work.

Thank you!

@larskanis

Thank you for the pointer to gem-compiler. But since it lacks cross compilation completely, it is probably not the best choice for me, currently.
May I help regarding to travis? What about the issue with the 'native' task described above? May I propose a solution per pull request?

@luislavena
Owner

Thank you for the pointer to gem-compiler. But since it lacks cross compilation completely, it is probably not the best choice for me, currently.

I know, but wanted to mention that I'm investing my time on an different approach that might help in the long run (and that I need help, too) :wink:

I'll take a look to the Travis stuff, specially to determine if we can setup a cross-compiler or something to test the features.

Will merge this soon, promise.

@larskanis

I've setup cross compilation on travis for https://github.com/ged/ruby-pg . The rake-compiler ruby-cross task is insofar a bit tested there (but sure does not help for this project).

Do you plan to stop supporting rake-compiler in favor of gem-compiler?

@flavorjones

We've got people asking for 64-bit 2.0 support for Nokogiri at sparklemotion/nokogiri#864, so I'd love to see this merged as well. <3 <3 <3!

@fbehrens fbehrens referenced this pull request in msgpack/msgpack-ruby
Closed

ruby 2.0 compatibility #8

@stibra

Hi all,

I would like to help with time and servers for testing to bring the best experience for Ruby on Rails running on Windows Servers (2008 R2 and 2012) in enterprise and cloud enviroments using IIS for web server. There is no real need to support 32-bit anymore in Windows for production enviroment because there is no more 32-bit version of Windows Server available, so x64 is the only way to go.

Cheers,

Ratko

@larskanis larskanis Use platform specific directories for packaging gem files.
Building gems for distinct platforms within one rake run conflicted
in the lib/ directory, because all binary extensions were stored
there and were copied from there to become packaged.
This resulted in storing a binary extension of a wrong platform in
a gem.

To avoid this, the files to package are now stored in a platform specific
stage directory and are used to package the specific gem.
a3365c9
@larskanis

OK, above is a proposal for the packaging of gem files targeting distinct platforms (within one rake run). Maybe it is overly complicated, but I couldn't find a more simple and clean way to accomplish this. This way building fat binary gems for x86 and x64 should work out of the box for many projects after adding 'x64-mingw32' to the cross_platform list and the usual commands:

rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0

No longer using the lib/ directory for packaging can have implications to the projects using rake-compiler. The ffi.gem for instance does strip the binaries before packaging within lib/ . It is trivial to fix, but this patch makes rake-compiler obviously not 100% compatible to the previous state.

I also tested the cross compiled built of pg.gem, fxruby.gem and pkcs11.gem successfully.

@luislavena
Owner

Hello @larskanis

I'm working on integrate this, I haven't forgotten.

I noticed that the change on config.yml will require current users to reinstall or relocate the existing versions of installed Rubies before they can cross-compile again.

I'll merge this in an plan for 0.9.0 release this weekend.

@larskanis

I noticed that the change on config.yml will require current users to reinstall or relocate the existing versions of installed Rubies before they can cross-compile again.

Not really. They only need to run "rake-compiler update-config" once.

@flavorjones flavorjones referenced this pull request in sparklemotion/nokogiri
Closed

Support Ruby x64 on Windows #864

@luislavena luislavena merged commit 2af5978 into rake-compiler:master
@luislavena
Owner

@larskanis in case you missed, I've merged this into master and pushed further modifications so Travis now works:

https://travis-ci.org/luislavena/rake-compiler

However, there is a small issue.

Now that platform is in the configuration file, I'm no longer able to cross compile for i386-mswin32 unless I manually duplicate i386-mingw32 into i386-mswin32

This will affect my current setup for gems like mysql and sqlite3, and dunno any other developers out there building gems for both platforms.

I'll do some changes in cross-ruby task so we fake it, but wanted to let you know some of the caveats (and will serve me to point later on when people ask me questions) :grin:

Once again, thank you for your work on this and please sorry my delay on getting this merged.

Thank you! :heart: :heart: :heart:

@larskanis

Now that platform is in the configuration file, I'm no longer able to cross compile for i386-mswin32 unless I manually duplicate i386-mingw32 into i386-mswin32

That's true. I always considered this as a bug, but worried that it could be a feature. I think we can live with the fake until MSVC++ is natively available on Linux/OSX ;-)

Thank you for merging this and releasing the prerelease. I'll test it.

@luislavena
Owner

@larskanis I've encountered one issue with this while attempting to build x64-mingw32 of sqlite3-ruby gem.

cross-platforms are defined as:

    ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32', 'x64-mingw32']

Since it depends on sqlite3 dependency, it needs to be build, that is no problem :wink:

Problem is that: rake cross compile RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0 will also attempt to build x64-mingw32 without tweaking the HOST platform of the recipe, causing it to fail:

cp tmp/i386-mingw32/sqlite3_native/2.0.0/sqlite3_native.so tmp/i386-mingw32/stage/lib/sqlite3/2.0/sqlite3_native.so
cd tmp/x64-mingw32/sqlite3_native/2.0.0
/opt/rbenv/versions/1.8.7-p371/bin/ruby -I. ../../../../ext/sqlite3/extconf.rb --enable-local
LDFLAGS: "-L/home/vagrant/sqlite3-ruby/ports/i686-w64-mingw32/sqlite3/3.7.11/lib"
checking for sqlite3.h... yes
checking for sqlite3_libversion_number()... -lsqlite3

In the above output I added some debug lines to extconf.rb to check LDFLAGS (set by mini_portile)

The only alternative I think of is by making the platform selection something triggered by a flag:

$ rake cross compile RUBY_CC_VERSION=1.8.7:1.9.3:2.0.0
...
$ rake cross compile RUBY_CC_VERSION=2.0.0 X64=1

But that will require modifications to every single recipe.

I think my approach to enabling sqlite3 dependency is flawed. Any recommendation by your experiments building ruby-pg?

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 13, 2013
  1. @larskanis

    Store cross compiled Ruby into seperate directories depending on HOST…

    larskanis authored
    … platform.
    
    Also prefix the selection of rbconfig in config.yml with the corresponding
    Ruby platform.
    
    This allowes to use cross compiled Ruby-builds for multiple target
    architectures on the same machine. This is especially usefull to compile
    for Ruby-2.0 i386-mingw32 and x64-mingw32 platforms.
  2. @larskanis

    Add possibility to set per-platform cross_config_options.

    larskanis authored
    This is especially useful to set distinct library paths for different
    target platforms.
Commits on Mar 28, 2013
  1. @larskanis

    Use platform specific directories for packaging gem files.

    larskanis authored
    Building gems for distinct platforms within one rake run conflicted
    in the lib/ directory, because all binary extensions were stored
    there and were copied from there to become packaged.
    This resulted in storing a binary extension of a wrong platform in
    a gem.
    
    To avoid this, the files to package are now stored in a platform specific
    stage directory and are used to package the specific gem.
This page is out of date. Refresh to see the latest.
View
84 lib/rake/extensiontask.rb
@@ -12,7 +12,7 @@ class ExtensionTask < BaseExtensionTask
attr_accessor :config_script
attr_accessor :cross_compile
attr_accessor :cross_platform
- attr_accessor :cross_config_options
+ attr_writer :cross_config_options
attr_accessor :no_native
attr_accessor :config_includes
@@ -73,6 +73,19 @@ def define
end
end
+ def cross_config_options(for_platform=nil)
+ return @cross_config_options unless for_platform
+
+ # apply options for this platform, only
+ @cross_config_options.map do |option|
+ if option.kind_of?(Hash)
+ option[for_platform] || []
+ else
+ option
+ end
+ end.flatten
+ end
+
private
def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
# platform usage
@@ -83,14 +96,17 @@ def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
# tmp_path
tmp_path = "#{@tmp_dir}/#{platf}/#{@name}/#{ruby_ver}"
+ stage_path = "#{@tmp_dir}/#{platf}/stage"
# cleanup and clobbering
CLEAN.include(tmp_path)
+ CLEAN.include(stage_path)
CLOBBER.include("#{lib_path}/#{binary(platf)}")
CLOBBER.include("#{@tmp_dir}")
# directories we need
directory tmp_path
+ directory "#{stage_path}/#{lib_path}"
directory lib_dir
# copy binary from temporary location to final lib
@@ -98,12 +114,36 @@ def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
task "copy:#{@name}:#{platf}:#{ruby_ver}" => [lib_path, "#{tmp_path}/#{binary(platf)}"] do
install "#{tmp_path}/#{binary(platf)}", "#{lib_path}/#{binary(platf)}"
end
+ # copy binary from temporary location to staging directory
+ task "copy:#{@name}:#{platf}:#{ruby_ver}" => ["#{stage_path}/#{lib_path}", "#{tmp_path}/#{binary(platf)}"] do
+ cp "#{tmp_path}/#{binary(platf)}", "#{stage_path}/#{lib_path}/#{binary(platf)}"
+ end
+
+ # copy other gem files to staging directory
+ if @gem_spec
+ @gem_spec.files.each do |gem_file|
+ # ignore directories and the binary extension
+ next if File.directory?(gem_file) || gem_file == "#{lib_path}/#{binary(platf)}"
+ stage_file = "#{stage_path}/#{gem_file}"
+
+ # copy each file from base to stage directory
+ unless Rake::Task.task_defined?(stage_file) then
+ directory File.dirname(stage_file)
+ file stage_file => [File.dirname(stage_file), gem_file] do
+ cp gem_file, stage_file
+ end
+ end
+
+ # append each file to the copy task
+ task "copy:#{@name}:#{platf}:#{ruby_ver}" => [stage_file]
+ end
+ end
# binary in temporary folder depends on makefile and source files
# tmp/extension_name/extension_name.{so,bundle}
file "#{tmp_path}/#{binary(platf)}" => ["#{tmp_path}/Makefile"] + source_files do
jruby_compile_msg = <<-EOF
-Compiling a native C extension on JRuby. This is discouraged and a
+Compiling a native C extension on JRuby. This is discouraged and a
Java extension should be preferred.
EOF
warn_once(jruby_compile_msg) if defined?(JRUBY_VERSION)
@@ -136,7 +176,7 @@ def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
# rbconfig.rb will be present if we are cross compiling
if t.prerequisites.include?("#{tmp_path}/rbconfig.rb") then
- options.push(*@cross_config_options)
+ options.push(*cross_config_options(platf))
end
# add options to command
@@ -186,6 +226,7 @@ def define_native_tasks(for_platform = nil, ruby_ver = RUBY_VERSION, callback =
# tmp_path
tmp_path = "#{@tmp_dir}/#{platf}/#{@name}/#{ruby_ver}"
+ stage_path = "#{@tmp_dir}/#{platf}/stage"
# lib_path
lib_path = lib_dir
@@ -209,7 +250,8 @@ def define_native_tasks(for_platform = nil, ruby_ver = RUBY_VERSION, callback =
# go through native prerequisites and grab the real extension files from there
t.prerequisites.each do |ext|
- ext_files << ext
+ # strip stage path and keep lib/... only
+ ext_files << ext.sub(stage_path+"/", '')
end
# include the files in the gem specification
@@ -221,20 +263,46 @@ def define_native_tasks(for_platform = nil, ruby_ver = RUBY_VERSION, callback =
end
# Generate a package for this gem
- Gem::PackageTask.new(spec) do |pkg|
+ pkg = Gem::PackageTask.new(spec) do |pkg|
pkg.need_zip = false
pkg.need_tar = false
+ # Do not copy any files per PackageTask, because
+ # we need the files from the staging directory
+ pkg.package_files.clear
+ end
+
+ # Copy from staging directory to gem package directory.
+ # This is derived from the code of Gem::PackageTask
+ # but uses stage_path as source directory.
+ stage_files = spec.files.map do |gem_file|
+ File.join(stage_path, gem_file)
+ end
+ file pkg.package_dir_path => stage_files do
+ mkdir_p pkg.package_dir rescue nil
+ spec.files.each do |ft|
+ fn = File.join(stage_path, ft)
+ f = File.join(pkg.package_dir_path, ft)
+ fdir = File.dirname(f)
+ mkdir_p(fdir) if !File.exist?(fdir)
+ if File.directory?(fn)
+ mkdir_p(f)
+ else
+ rm_f f
+ safe_ln(fn, f)
+ end
+ end
end
end
end
# add binaries to the dependency chain
- task "native:#{@gem_spec.name}:#{platf}" => ["#{lib_path}/#{binary(platf)}"]
+ task "native:#{@gem_spec.name}:#{platf}" => ["#{stage_path}/#{lib_dir}/#{binary(platf)}"]
# ensure the extension get copied
unless Rake::Task.task_defined?("#{lib_path}/#{binary(platf)}") then
file "#{lib_path}/#{binary(platf)}" => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
end
+ file "#{stage_path}/#{lib_dir}/#{binary(platf)}" => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
# Allow segmented packaging by platform (open door for 'cross compile')
task "native:#{platf}" => ["native:#{@gem_spec.name}:#{platf}"]
@@ -290,8 +358,8 @@ def define_cross_platform_tasks_with_version(for_platform, ruby_ver)
# lib_path
lib_path = lib_dir
- unless rbconfig_file = config_file["rbconfig-#{ruby_ver}"] then
- warn "no configuration section for specified version of Ruby (rbconfig-#{ruby_ver})"
+ unless rbconfig_file = config_file["rbconfig-#{for_platform}-#{ruby_ver}"] then
+ warn "no configuration section for specified version of Ruby (rbconfig-#{for_platform}-#{ruby_ver})"
return
end
View
47 spec/lib/rake/extensiontask_spec.rb
@@ -264,7 +264,7 @@
context 'native:my_gem:{platform}' do
it 'should depend on binary extension' do
Rake::ExtensionTask.new('extension_one', @spec)
- Rake::Task["native:my_gem:#{@platform}"].prerequisites.should include("lib/#{@ext_bin}")
+ Rake::Task["native:my_gem:#{@platform}"].prerequisites.should include("tmp/#{@platform}/stage/lib/#{@ext_bin}")
end
end
end
@@ -278,7 +278,8 @@
@spec = mock_gem_spec
@config_file = File.expand_path("~/.rake-compiler/config.yml")
@ruby_ver = RUBY_VERSION
- @config_path = mock_config_yml["rbconfig-#{@ruby_ver}"]
+ @platform = 'i386-mingw32'
+ @config_path = mock_config_yml["rbconfig-#{@platform}-#{@ruby_ver}"]
File.stub!(:open).and_yield(mock_fake_rb)
end
@@ -317,7 +318,7 @@
it 'should warn if no section of config file defines running version of ruby' do
config = mock(Hash)
- config.should_receive(:[]).with("rbconfig-#{@ruby_ver}").and_return(nil)
+ config.should_receive(:[]).with("rbconfig-#{@platform}-#{@ruby_ver}").and_return(nil)
YAML.stub!(:load_file).and_return(config)
out, err = capture_output do
Rake::ExtensionTask.new('extension_one') do |ext|
@@ -339,7 +340,7 @@
it 'should allow usage of RUBY_CC_VERSION to indicate a different version of ruby' do
config = mock(Hash)
- config.should_receive(:[]).with("rbconfig-1.9.1").and_return('/path/to/ruby/1.9.1/rbconfig.rb')
+ config.should_receive(:[]).with("rbconfig-i386-mingw32-1.9.1").and_return('/path/to/ruby/1.9.1/rbconfig.rb')
YAML.stub!(:load_file).and_return(config)
ENV['RUBY_CC_VERSION'] = '1.9.1'
@@ -350,8 +351,8 @@
it 'should allow multiple versions be supplied to RUBY_CC_VERSION' do
config = mock(Hash)
- config.should_receive(:[]).once.with("rbconfig-1.8.6").and_return('/path/to/ruby/1.8.6/rbconfig.rb')
- config.should_receive(:[]).once.with("rbconfig-1.9.1").and_return('/path/to/ruby/1.9.1/rbconfig.rb')
+ config.should_receive(:[]).once.with("rbconfig-i386-mingw32-1.8.6").and_return('/path/to/ruby/1.8.6/rbconfig.rb')
+ config.should_receive(:[]).once.with("rbconfig-i386-mingw32-1.9.1").and_return('/path/to/ruby/1.9.1/rbconfig.rb')
YAML.stub!(:load_file).and_return(config)
ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
@@ -440,15 +441,24 @@
end
context '(cross for multiple platforms)' do
- it 'should define task for each supplied platform' do
+ before :each do
@ext = Rake::ExtensionTask.new('extension_one', @spec) do |ext|
ext.cross_compile = true
ext.cross_platform = ['universal-known', 'universal-unknown']
+ ext.cross_config_options << '--with-something'
+ ext.cross_config_options << {'universal-known' => '--with-known'}
end
+ end
+ it 'should define task for each supplied platform' do
Rake::Task.should have_defined('compile:universal-known')
Rake::Task.should have_defined('compile:universal-unknown')
end
+
+ it 'should filter options for each supplied platform' do
+ @ext.cross_config_options('universal-unknown').should eq(%w[--with-something])
+ @ext.cross_config_options('universal-known').should eq(%w[--with-something --with-known])
+ end
end
end
end
@@ -460,19 +470,26 @@ def ext_bin(extension_name)
def mock_gem_spec(stubs = {})
mock(Gem::Specification,
- { :name => 'my_gem', :platform => 'ruby' }.merge(stubs)
+ { :name => 'my_gem', :platform => 'ruby', :files => [] }.merge(stubs)
)
end
def mock_config_yml
{
- 'rbconfig-1.8.6' => '/some/path/version/1.8/to/rbconfig.rb',
- 'rbconfig-1.8.7' => '/some/path/version/1.8/to/rbconfig.rb',
- 'rbconfig-1.9.1' => '/some/path/version/1.9.1/to/rbconfig.rb',
- 'rbconfig-1.9.2' => '/some/path/version/1.9.1/to/rbconfig.rb',
- 'rbconfig-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
- 'rbconfig-2.0.0' => '/some/path/version/2.0.0/to/rbconfig.rb',
- 'rbconfig-3.0.0' => '/some/fake/version/3.0.0/to/rbconfig.rb'
+ 'rbconfig-i386-mingw32-1.8.6' => '/some/path/version/1.8/to/rbconfig.rb',
+ 'rbconfig-universal-unknown-1.8.6' => '/some/path/version/1.8/to/rbconfig.rb',
+ 'rbconfig-i386-mingw32-1.8.7' => '/some/path/version/1.8/to/rbconfig.rb',
+ 'rbconfig-universal-known-1.8.7' => '/some/path/version/1.8/to/rbconfig.rb',
+ 'rbconfig-universal-unknown-1.8.7' => '/some/path/version/1.8/to/rbconfig.rb',
+ 'rbconfig-universal-unknown-1.9.1' => '/some/path/version/1.9.1/to/rbconfig.rb',
+ 'rbconfig-universal-unknown-1.9.2' => '/some/path/version/1.9.1/to/rbconfig.rb',
+ 'rbconfig-universal-unknown-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
+ 'rbconfig-i386-mingw32-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
+ 'rbconfig-universal-known-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
+ 'rbconfig-universal-unknown-1.9.3' => '/some/path/version/1.9.1/to/rbconfig.rb',
+ 'rbconfig-i386-mingw32-2.0.0' => '/some/path/version/2.0.0/to/rbconfig.rb',
+ 'rbconfig-x64-mingw32-2.0.0' => '/some/path/version/2.0.0/to/rbconfig.rb',
+ 'rbconfig-x64-mingw32-3.0.0' => '/some/fake/version/3.0.0/to/rbconfig.rb'
}
end
View
26 tasks/bin/cross-ruby.rake
@@ -60,16 +60,16 @@ end
# define a location where sources will be stored
directory "#{USER_HOME}/sources/#{RUBY_CC_VERSION}"
-directory "#{USER_HOME}/builds/#{RUBY_CC_VERSION}"
+directory "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}"
# clean intermediate files and folders
CLEAN.include("#{USER_HOME}/sources/#{RUBY_CC_VERSION}")
-CLEAN.include("#{USER_HOME}/builds/#{RUBY_CC_VERSION}")
+CLEAN.include("#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
# remove the final products and sources
CLOBBER.include("#{USER_HOME}/sources")
CLOBBER.include("#{USER_HOME}/builds")
-CLOBBER.include("#{USER_HOME}/ruby/#{RUBY_CC_VERSION}")
+CLOBBER.include("#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
CLOBBER.include("#{USER_HOME}/config.yml")
# ruby source file should be stored there
@@ -126,7 +126,7 @@ task :mingw32 do
end
# generate the makefile in a clean build location
-file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}",
+file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}",
"#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in"] do |t|
options = [
@@ -143,26 +143,26 @@ file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/
options << "--with-winsock2" if MAJOR == "1.8"
chdir File.dirname(t.name) do
- prefix = File.expand_path("../../ruby/#{RUBY_CC_VERSION}")
+ prefix = File.expand_path("../../../ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}")
options << "--prefix=#{prefix}"
- sh File.expand_path("../../sources/#{RUBY_CC_VERSION}/configure"), *options
+ sh File.expand_path("../../../sources/#{RUBY_CC_VERSION}/configure"), *options
end
end
# make
-file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile"] do |t|
+file "#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/Makefile"] do |t|
chdir File.dirname(t.prerequisites.first) do
sh MAKE
end
end
# make install
-file "#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}/ruby.exe"] do |t|
+file "#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{USER_HOME}/builds/#{MINGW_HOST}/#{RUBY_CC_VERSION}/ruby.exe"] do |t|
chdir File.dirname(t.prerequisites.first) do
sh "#{MAKE} install"
end
end
-task :install => ["#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/bin/ruby.exe"]
+task :install => ["#{USER_HOME}/ruby/#{MINGW_HOST}/#{RUBY_CC_VERSION}/bin/ruby.exe"]
desc "Update rake-compiler list of installed Ruby versions"
task 'update-config' do
@@ -175,12 +175,12 @@ task 'update-config' do
config = {}
end
- files = Dir.glob("#{USER_HOME}/ruby/*/**/rbconfig.rb").sort
+ files = Dir.glob("#{USER_HOME}/ruby/*/*/**/rbconfig.rb").sort
files.each do |rbconfig|
- version = rbconfig.match(/.*-(\d.\d.\d)/)[1]
- config["rbconfig-#{version}"] = rbconfig
- puts "Found Ruby version #{version} (#{rbconfig})"
+ version, platform = rbconfig.match(/.*-(\d.\d.\d).*\/([-\w]+)\/rbconfig/)[1,2]
+ config["rbconfig-#{platform}-#{version}"] = rbconfig
+ puts "Found Ruby version #{version} for platform #{platform} (#{rbconfig})"
end
when_writing("Saving changes into #{config_file}") {
Something went wrong with that request. Please try again.