tasks/bin/cross-ruby.rake in rake-compiler-0.7.1 vs tasks/bin/cross-ruby.rake in rake-compiler-0.7.5
- old
+ new
@@ -31,20 +31,21 @@
exit(1)
end
require 'rake/extensioncompiler'
-MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
+MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v > /dev/null 2>&1") }
USER_HOME = File.expand_path("~/.rake-compiler")
-RUBY_CC_VERSION = "ruby-#{ENV['VERSION'] || '1.8.6-p287'}"
+RUBY_CC_VERSION = "ruby-#{ENV['VERSION'] || '1.8.6-p398'}"
RUBY_SOURCE = ENV['SOURCE']
# grab the major "1.8" or "1.9" part of the version number
MAJOR = RUBY_CC_VERSION.match(/.*-(\d.\d).\d/)[1]
# Use Rake::ExtensionCompiler helpers to find the proper host
-MINGW_HOST = Rake::ExtensionCompiler.mingw_host
+MINGW_HOST = ENV['HOST'] || Rake::ExtensionCompiler.mingw_host
+MINGW_TARGET = MINGW_HOST.gsub('msvc', '')
# define a location where sources will be stored
directory "#{USER_HOME}/sources/#{RUBY_CC_VERSION}"
directory "#{USER_HOME}/builds/#{RUBY_CC_VERSION}"
@@ -57,11 +58,11 @@
CLOBBER.include("#{USER_HOME}/builds")
CLOBBER.include("#{USER_HOME}/ruby/#{RUBY_CC_VERSION}")
CLOBBER.include("#{USER_HOME}/config.yml")
# ruby source file should be stored there
-file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}.tar.gz" => ["#{USER_HOME}/sources"] do |t|
+file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}.tar.bz2" => ["#{USER_HOME}/sources"] do |t|
# download the source file using wget or curl
chdir File.dirname(t.name) do
if RUBY_SOURCE
url = RUBY_SOURCE
else
@@ -70,14 +71,14 @@
sh "wget #{url} || curl -O #{url}"
end
end
# Extract the sources
-source_file = RUBY_SOURCE ? RUBY_SOURCE.split('/').last : "#{RUBY_CC_VERSION}.tar.gz"
+source_file = RUBY_SOURCE ? RUBY_SOURCE.split('/').last : "#{RUBY_CC_VERSION}.tar.bz2"
file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}" => ["#{USER_HOME}/sources/#{source_file}"] do |t|
chdir File.dirname(t.name) do
- t.prerequisites.each { |f| sh "tar xfz #{File.basename(f)}" }
+ t.prerequisites.each { |f| sh "tar xf #{File.basename(f)}" }
end
end
# backup makefile.in
file "#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in.bak" => ["#{USER_HOME}/sources/#{RUBY_CC_VERSION}"] do |t|
@@ -109,26 +110,17 @@
warn "Please refer to your distribution/package manager documentation about installation."
fail
end
end
-task :environment do
- ENV['ac_cv_func_getpgrp_void'] = 'no'
- ENV['ac_cv_func_setpgrp_void'] = 'yes'
- ENV['rb_cv_negative_time_t'] = 'no'
- ENV['ac_cv_func_memcmp_working'] = 'yes'
- ENV['rb_cv_binary_elf' ] = 'no'
-end
-
# generate the makefile in a clean build location
file "#{USER_HOME}/builds/#{RUBY_CC_VERSION}/Makefile" => ["#{USER_HOME}/builds/#{RUBY_CC_VERSION}",
"#{USER_HOME}/sources/#{RUBY_CC_VERSION}/Makefile.in"] do |t|
options = [
- '--target=i386-mingw32',
"--host=#{MINGW_HOST}",
- '--build=i686-linux',
+ "--target=#{MINGW_TARGET}",
'--enable-shared',
'--disable-install-doc',
'--without-tk',
'--without-tcl'
]
@@ -186,6 +178,7 @@
Rake.application.options.show_task_pattern = //
Rake.application.display_tasks_and_comments
end
desc "Build #{RUBY_CC_VERSION} suitable for cross-platform development."
-task 'cross-ruby' => [:mingw32, :environment, :install, 'update-config']
+task 'cross-ruby' => [:mingw32, :install, 'update-config']
+