Permalink
Browse files

Can now cross compile extensions for 1.9 using 1.8.x as base.

Be warned: works from 1.8 to 1.9, but not if your default ruby is 1.9.
There are some issues inside mkmf.rb that limits this, needs further
investigation.
  • Loading branch information...
1 parent bf78951 commit 374cc72ca79c6f130ebe0633a038bf94131dc4ba @luislavena luislavena committed May 30, 2009
Showing with 29 additions and 3 deletions.
  1. +6 −1 History.txt
  2. +12 −2 lib/rake/extensiontask.rb
  3. +11 −0 spec/lib/rake/extensiontask_spec.rb
View
@@ -1,6 +1,11 @@
-=== 0.5.1 (in Git)
+=== 0.6.0 (in Git)
* Enhancements
+ * Can now cross compile extensions for 1.9 using 1.8.x as base.
+ Be warned: works from 1.8 to 1.9, but not if your default ruby is 1.9
+
+ rake cross compile RUBY_CC_VERSION=1.9.1
+
* Allow simultaneous versions of Ruby to compile extensions.
This change allow 1.8.x compiles co-exist with 1.9.x ones
and don't override each other.
View
@@ -243,17 +243,27 @@ def define_cross_platform_tasks(for_platform)
return
end
+ # mkmf
+ mkmf_file = File.expand_path(File.join(File.dirname(rbconfig_file), '..', 'mkmf.rb'))
+
# define compilation tasks for cross platfrom!
define_compile_tasks(for_platform, ruby_ver)
- # chain fake.rb and rbconfig.rb to Makefile generation
- file "#{tmp_path}/Makefile" => ["#{tmp_path}/fake.rb", "#{tmp_path}/rbconfig.rb"]
+ # chain fake.rb, rbconfig.rb and mkmf.rb to Makefile generation
+ file "#{tmp_path}/Makefile" => ["#{tmp_path}/fake.rb",
+ "#{tmp_path}/rbconfig.rb",
+ "#{tmp_path}/mkmf.rb"]
# copy the file from the cross-ruby location
file "#{tmp_path}/rbconfig.rb" => [rbconfig_file] do |t|
cp t.prerequisites.first, t.name
end
+ # copy mkmf from cross-ruby location
+ file "#{tmp_path}/mkmf.rb" => [mkmf_file] do |t|
+ cp t.prerequisites.first, t.name
+ end
+
# genearte fake.rb for different ruby versions
file "#{tmp_path}/fake.rb" do |t|
File.open(t.name, 'w') do |f|
@@ -338,6 +338,17 @@
end
end
+ context 'mkmf' do
+ it 'should chain mkmf tasks to Makefile generation' do
+ Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/Makefile"].prerequisites.should include("tmp/universal-unknown/extension_one/#{@ruby_ver}/mkmf.rb")
+ end
+
+ it 'should take mkmf from rake-compiler configuration' do
+ mkmf_path = File.expand_path(File.join(File.dirname(@config_path), '..', 'mkmf.rb'))
+ Rake::Task["tmp/universal-unknown/extension_one/#{@ruby_ver}/mkmf.rb"].prerequisites.should include(mkmf_path)
+ end
+ end
+
context 'compile:universal-unknown' do
it "should be defined" do
Rake::Task.task_defined?('compile:universal-unknown').should be_true

0 comments on commit 374cc72

Please sign in to comment.