Skip to content

Instantly share code, notes, and snippets.

@luislavena
Created November 4, 2011 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luislavena/1340253 to your computer and use it in GitHub Desktop.
Save luislavena/1340253 to your computer and use it in GitHub Desktop.
diff --git a/tasks/package.rake b/tasks/package.rake
index 491fd4e..836a09a 100644
--- a/tasks/package.rake
+++ b/tasks/package.rake
@@ -1,4 +1,4 @@
-require 'rake/gempackagetask'
+require 'rubygems/package_task'
begin
require 'rake/extensiontask'
require 'rake/javaextensiontask'
@@ -12,7 +12,7 @@ rake-compiler gem seems to be missing. Please install it with
MSG
end
-Rake::GemPackageTask.new(GEMSPEC) do |pkg|
+Gem::PackageTask.new(GEMSPEC) do |pkg|
end
if RUBY_PLATFORM =~ /java/
@@ -23,25 +23,30 @@ else
def setup_cross_compilation(ext)
unless RUBY_PLATFORM =~ /mswin|mingw/
ext.cross_compile = true
- ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
-
- # inject 1.8/1.9 pure-ruby entry point
- ext.cross_compiling do |spec|
- spec.files += ["lib/#{ext.name}.rb"]
- end
+ ext.cross_platform = "x86-mingw32" #['x86-mingw32', 'x86-mswin32-60']
+ end
+ end
+ def hack_cross_compilation(ext)
+ # inject 1.8/1.9 pure-ruby entry point
+ # HACK: add these dependencies to the task instead of using cross_compiling
+ ext.cross_platform.each do |platf|
+ Rake::Task["native:#{GEMSPEC.name}:#{platf}"].prerequisites.unshift "lib/#{ext.name}.rb"
end
end
- Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
+ em = Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext|
ext.ext_dir = 'ext'
ext.source_pattern = '*.{h,c,cpp}'
setup_cross_compilation(ext)
end
- Rake::ExtensionTask.new("fastfilereaderext", GEMSPEC) do |ext|
+ hack_cross_compilation em
+
+ ff = Rake::ExtensionTask.new("fastfilereaderext", GEMSPEC) do |ext|
ext.ext_dir = 'ext/fastfilereader'
ext.source_pattern = '*.{h,c,cpp}'
setup_cross_compilation(ext)
end
+ hack_cross_compilation ff
end
# Setup shim files that require 1.8 vs 1.9 extensions in win32 bin gems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment