Skip to content
Browse files

More tweaking on the windows cross-compilation rake task.

  • Loading branch information...
1 parent 5395b43 commit d8a782451444e0c0deb598e69d7e551c89296f18 @flavorjones flavorjones committed Feb 28, 2012
Showing with 16 additions and 7 deletions.
  1. +16 −7 Rakefile
View
23 Rakefile
@@ -151,23 +151,32 @@ end
desc "build a windows gem without all the ceremony."
task "gem:windows" => "gem" do
- rake_compiler_config = YAML.load_file("#{ENV['HOME']}/.rake-compiler/config.yml")
+ cross_rubies = ["1.8.7-p330", "1.9.2-p136"]
+ ruby_cc_version = cross_rubies.collect { |_| _.split("-").first }.join(":") # e.g., "1.8.7:1.9.2"
+ rake_compiler_config_path = "#{ENV['HOME']}/.rake-compiler/config.yml"
- # check that rake-compiler config contains the right patchlevels of 1.8.6 and 1.9.1. see #279.
- ["1.8.6-p383", "1.9.1-p243"].each do |version|
+ unless File.exists? rake_compiler_config_path
+ raise "rake-compiler has not installed any cross rubies. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{cross_rubies.first}'"
+ end
+ rake_compiler_config = YAML.load_file(rake_compiler_config_path)
+
+ # check that rake-compiler config contains the right patchlevels. see #279 for background,
+ # and http://blog.mmediasys.com/2011/01/22/rake-compiler-updated-list-of-supported-ruby-versions-for-cross-compilation/
+ # for more up-to-date docs.
+ cross_rubies.each do |version|
majmin, patchlevel = version.split("-")
rbconfig = "rbconfig-#{majmin}"
unless rake_compiler_config.key?(rbconfig) && rake_compiler_config[rbconfig] =~ /-#{patchlevel}/
raise "rake-compiler '#{rbconfig}' not #{patchlevel}. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{version}'"
end
end
- # verify that --export-all is in the 1.9.1 rbconfig. see #279,#374,#375.
- rbconfig_191 = rake_compiler_config["rbconfig-1.9.1"]
- raise "rbconfig #{rbconfig_191} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_191).grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
+ # verify that --export-all is in the 1.9 rbconfig. see #279,#374,#375.
+ rbconfig_19 = rake_compiler_config["rbconfig-1.9.2"]
+ raise "rbconfig #{rbconfig_19} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_19).split("\n").grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
pkg_config_path = [:libxslt, :libxml2].collect { |pkg| File.join($recipes[pkg].path, "lib/pkgconfig") }.join(":")
- sh("env PKG_CONFIG_PATH=#{pkg_config_path} RUBY_CC_VERSION=1.8.6:1.9.1 rake cross native gem") || raise("build failed!")
+ sh("env PKG_CONFIG_PATH=#{pkg_config_path} RUBY_CC_VERSION=#{ruby_cc_version} rake cross native gem") || raise("build failed!")
end
# vim: syntax=Ruby

0 comments on commit d8a7824

Please sign in to comment.
Something went wrong with that request. Please try again.