Extract body of refurbished_args loop
This commit is contained in:
parent
8c426e8207
commit
fb296f8224
@ -118,15 +118,25 @@ class Cmd
|
||||
end
|
||||
|
||||
def refurbished_args
|
||||
lset = Set.new(libpath + syslibpath)
|
||||
iset = Set.new(cpath.flatten)
|
||||
@lset = Set.new(libpath + syslibpath)
|
||||
@iset = Set.new(cpath.flatten)
|
||||
|
||||
args = []
|
||||
whittler = @args.each
|
||||
enum = @args.each
|
||||
|
||||
loop do
|
||||
case arg = whittler.next
|
||||
args += refurbish_arg(enum.next, enum)
|
||||
end
|
||||
|
||||
args
|
||||
end
|
||||
|
||||
def refurbish_arg(arg, enum)
|
||||
args = []
|
||||
|
||||
case arg
|
||||
when '-arch', /^-Xarch_/
|
||||
whittler.next
|
||||
enum.next
|
||||
when '-m32'
|
||||
# If ENV.m32 was set, we allow the "-m32" flag, but we don't add anything
|
||||
args << '-m32' if cccfg? '3'
|
||||
@ -144,29 +154,29 @@ class Cmd
|
||||
when /^-W.*/
|
||||
args << arg if arg =~ /^-W[alp],/ or arg =~ /^-Wno-/
|
||||
when '-macosx_version_min', '-dylib_install_name'
|
||||
args << "-Wl,#{arg},#{whittler.next}"
|
||||
args << "-Wl,#{arg},#{enum.next}"
|
||||
when '-multiply_definedsuppress'
|
||||
args << "-Wl,-multiply_defined,suppress"
|
||||
when '-undefineddynamic_lookup'
|
||||
args << "-Wl,-undefined,dynamic_lookup"
|
||||
when /^-isysroot/
|
||||
# We set the sysroot
|
||||
whittler.next
|
||||
enum.next
|
||||
when '-dylib'
|
||||
args << "-Wl,#{arg}"
|
||||
when /^-I(.+)?/
|
||||
# Support both "-Ifoo" (one argument) and "-I foo" (two arguments)
|
||||
val = chuzzle($1) || whittler.next
|
||||
val = chuzzle($1) || enum.next
|
||||
path = canonical_path(val)
|
||||
args << "-I#{val}" if keep?(path) and iset.add?(path)
|
||||
args << "-I#{val}" if keep?(path) && @iset.add?(path)
|
||||
when /^-L(.+)?/
|
||||
val = chuzzle($1) || whittler.next
|
||||
val = chuzzle($1) || enum.next
|
||||
path = canonical_path(val)
|
||||
args << "-L#{val}" if keep?(path) and lset.add?(path)
|
||||
args << "-L#{val}" if keep?(path) && @lset.add?(path)
|
||||
else
|
||||
args << arg
|
||||
end
|
||||
end
|
||||
|
||||
args
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user