* ext/extmk.rb, lib/mkmf.rb (with_config): support --with-extension
options. [ruby-dev:27449] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
755a8aa07f
commit
d6837060be
@ -1,3 +1,8 @@
|
|||||||
|
Sat Oct 22 23:54:07 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/extmk.rb, lib/mkmf.rb (with_config): support --with-extension
|
||||||
|
options. [ruby-dev:27449]
|
||||||
|
|
||||||
Sat Oct 22 14:25:43 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
Sat Oct 22 14:25:43 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
* util.[hc] (ruby_add_suffix): constified.
|
* util.[hc] (ruby_add_suffix): constified.
|
||||||
|
15
ext/extmk.rb
15
ext/extmk.rb
@ -354,10 +354,25 @@ exts = $static_ext.sort_by {|t, i| i}.collect {|t, i| t}
|
|||||||
if $extension
|
if $extension
|
||||||
exts |= $extension.select {|d| File.directory?("#{ext_prefix}/#{d}")}
|
exts |= $extension.select {|d| File.directory?("#{ext_prefix}/#{d}")}
|
||||||
else
|
else
|
||||||
|
withes, withouts = %w[--with --without].collect {|w|
|
||||||
|
if not (w = %w[-extensions -ext].collect {|opt|arg_config(w+opt)}).any?
|
||||||
|
proc {false}
|
||||||
|
elsif (w = w.grep(String)).empty?
|
||||||
|
proc {true}
|
||||||
|
else
|
||||||
|
w.collect {|opt| opt.split(/,/)}.flatten.method(:any?)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
cond = proc {|ext|
|
||||||
|
cond1 = proc {|n| File.fnmatch(n, ext, File::FNM_PATHNAME)}
|
||||||
|
withes.call(&cond1) or !withouts.call(&cond1)
|
||||||
|
}
|
||||||
exts |= Dir.glob("#{ext_prefix}/*/**/extconf.rb").collect {|d|
|
exts |= Dir.glob("#{ext_prefix}/*/**/extconf.rb").collect {|d|
|
||||||
d = File.dirname(d)
|
d = File.dirname(d)
|
||||||
d.slice!(0, ext_prefix.length + 1)
|
d.slice!(0, ext_prefix.length + 1)
|
||||||
d
|
d
|
||||||
|
}.find_all {|ext|
|
||||||
|
with_config(ext, &cond)
|
||||||
}.sort
|
}.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
|
22
lib/mkmf.rb
22
lib/mkmf.rb
@ -793,11 +793,25 @@ def arg_config(config, *defaults, &block)
|
|||||||
$configure_args.fetch(config.tr('_', '-'), *defaults, &block)
|
$configure_args.fetch(config.tr('_', '-'), *defaults, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def with_config(config, *defaults, &block)
|
def with_config(config, *defaults)
|
||||||
unless /^--with[-_]/ =~ config
|
config = config.sub(/^--with[-_]/, '')
|
||||||
config = '--with-' + config
|
val = arg_config("--with-"+config) do
|
||||||
|
if arg_config("--without-"+config)
|
||||||
|
false
|
||||||
|
elsif block_given?
|
||||||
|
yield(config, *defaults)
|
||||||
|
else
|
||||||
|
break *defaults
|
||||||
|
end
|
||||||
|
end
|
||||||
|
case val
|
||||||
|
when "yes"
|
||||||
|
true
|
||||||
|
when "no"
|
||||||
|
false
|
||||||
|
else
|
||||||
|
val
|
||||||
end
|
end
|
||||||
arg_config(config, *defaults, &block)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def enable_config(config, *defaults)
|
def enable_config(config, *defaults)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user