Allow archs_for_command to take Pathnames. Fixes Homebrew/homebrew#1106.
This commit is contained in:
parent
e05c728e45
commit
e7d7ceccee
@ -132,23 +132,24 @@ end
|
|||||||
|
|
||||||
# returns array of architectures suitable for -arch gcc flag
|
# returns array of architectures suitable for -arch gcc flag
|
||||||
def archs_for_command cmd
|
def archs_for_command cmd
|
||||||
cmd = `/usr/bin/which #{cmd}` unless Pathname.new(cmd).absolute?
|
cmd = cmd.to_s # If we were passed a Pathname, turn it into a string.
|
||||||
cmd.gsub! ' ', '\\ '
|
cmd = `/usr/bin/which #{cmd}` unless Pathname.new(cmd).absolute?
|
||||||
|
cmd.gsub! ' ', '\\ ' # Escape spaces in the filename.
|
||||||
|
|
||||||
IO.popen("/usr/bin/file #{cmd}").readlines.inject(%w[]) do |archs, line|
|
IO.popen("/usr/bin/file #{cmd}").readlines.inject(%w[]) do |archs, line|
|
||||||
case line
|
case line
|
||||||
when /Mach-O executable ppc/
|
when /Mach-O executable ppc/
|
||||||
archs << :ppc7400
|
archs << :ppc7400
|
||||||
when /Mach-O 64-bit executable ppc64/
|
when /Mach-O 64-bit executable ppc64/
|
||||||
archs << :ppc64
|
archs << :ppc64
|
||||||
when /Mach-O executable i386/
|
when /Mach-O executable i386/
|
||||||
archs << :i386
|
archs << :i386
|
||||||
when /Mach-O 64-bit executable x86_64/
|
when /Mach-O 64-bit executable x86_64/
|
||||||
archs << :x86_64
|
archs << :x86_64
|
||||||
else
|
else
|
||||||
archs
|
archs
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# String extensions added by inreplace below.
|
# String extensions added by inreplace below.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user