Permalink
Browse files

Track full Ruby version (x.y.z) when cross-compiling.

Exposed also 'update-config' task for rake-compiler so
migration to new syntax is possible.
  • Loading branch information...
1 parent 5deba36 commit 18c73cc0e91ced20f7de453bf02eec6867376b62 @luislavena luislavena committed Mar 22, 2009
Showing with 14 additions and 6 deletions.
  1. +3 −0 History.txt
  2. +11 −6 tasks/bin/cross-ruby.rake
View
3 History.txt
@@ -14,6 +14,9 @@
* Display list of available tasks when calling rake-compiler script
+ * Track Ruby full versioning (x.y.z).
+ This will help the compilation of extensions targetting 1.8.6/7 and 1.9.1
+
=== Bugfixes
* Better output of Rake development tasks (Thanks to Luis Parravicini).
View
17 tasks/bin/cross-ruby.rake
@@ -141,11 +141,10 @@ file "#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/bin/ruby.exe" => ["#{USER_HOME}/build
sh "make install"
end
end
+task :install => ["#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/bin/ruby.exe"]
-# rbconfig.rb location
-file "#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/lib/ruby/#{MAJOR}/i386-mingw32/rbconfig.rb" => ["#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/bin/ruby.exe"]
-
-file :update_config => ["#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/lib/ruby/#{MAJOR}/i386-mingw32/rbconfig.rb"] do |t|
+desc "Update rake-compiler list of installed Ruby versions"
+task 'update-config' do
config_file = "#{USER_HOME}/config.yml"
if File.exist?(config_file) then
puts "Updating #{config_file}"
@@ -155,7 +154,13 @@ file :update_config => ["#{USER_HOME}/ruby/#{RUBY_CC_VERSION}/lib/ruby/#{MAJOR}/
config = {}
end
- config["rbconfig-#{MAJOR}"] = File.expand_path(t.prerequisites.first)
+ 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})"
+ end
when_writing("Saving changes into #{config_file}") {
File.open(config_file, 'w') do |f|
@@ -171,4 +176,4 @@ task :default do
end
desc "Build #{RUBY_CC_VERSION} suitable for cross-platform development."
-task 'cross-ruby' => [:mingw32, :environment, :update_config]
+task 'cross-ruby' => [:mingw32, :environment, :install, 'update-config']

0 comments on commit 18c73cc

Please sign in to comment.