Permalink
Browse files

Pass extra Rake cmd line args to extconf.rb

Example usage:

  rake compile -- --with-libyaml-dir=C:/devlibs/libyaml
  • Loading branch information...
1 parent 83d8702 commit 24fd9883e516399667f5ecc3d94523936797eded @jonforums jonforums committed Oct 5, 2011
Showing with 7 additions and 1 deletion.
  1. +2 −0 lib/rake/baseextensiontask.rb
  2. +5 −1 lib/rake/extensiontask.rb
@@ -24,6 +24,7 @@ class BaseExtensionTask < TaskLib
attr_accessor :platform
attr_accessor :config_options
attr_accessor :source_pattern
+ attr_accessor :extra_options
def platform
@platform ||= RUBY_PLATFORM
@@ -42,6 +43,7 @@ def init(name = nil, gem_spec = nil)
@ext_dir = "ext/#{@name}"
@lib_dir = 'lib'
@config_options = []
+ @extra_options = ARGV.select { |i| i =~ /\A--?/ }
end
def define
@@ -140,10 +140,14 @@ def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
# add options to command
cmd.push(*options)
+ # add any extra command line options
+ unless extra_options.empty?
+ cmd.push('--', *extra_options)
+ end
+
chdir tmp_path do
# FIXME: Rake is broken for multiple arguments system() calls.
# Add current directory to the search path of Ruby
- # Also, include additional parameters supplied.
sh cmd.join(' ')
end
end

0 comments on commit 24fd988

Please sign in to comment.