From a99b74593542ab87a29f8ddf0525c62c7938f3ec Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 3 Nov 2011 21:10:57 -0500 Subject: [PATCH] Parse `compiler --version` instead of -v For GCC and LLVM-GCC, '-v' is not a synonym for --version. When run without any other options or arguments, it gives similar output, but it is better to just parse the (terser) --version output. Signed-off-by: Jack Nagel --- Library/Homebrew/utils.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index dc7bf5d42a..48068b9e19 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -261,7 +261,7 @@ module MacOS extend self end def gcc_42_build_version - `/usr/bin/gcc-4.2 -v 2>&1` =~ /build (\d{4,})/ + `/usr/bin/gcc-4.2 --version` =~ /build (\d{4,})/ if $1 $1.to_i elsif system "/usr/bin/which gcc" @@ -276,7 +276,7 @@ module MacOS extend self end def gcc_40_build_version - `/usr/bin/gcc-4.0 -v 2>&1` =~ /build (\d{4,})/ + `/usr/bin/gcc-4.0 --version` =~ /build (\d{4,})/ if $1 $1.to_i else @@ -335,7 +335,7 @@ module MacOS extend self # for Xcode 3 on OS X 10.5 this will not exist # NOTE may not be true anymore but we can't test @llvm_build_version ||= if File.exist? "/usr/bin/llvm-gcc" - `/usr/bin/llvm-gcc -v 2>&1` =~ /LLVM build (\d{4,})/ + `/usr/bin/llvm-gcc --version` =~ /LLVM build (\d{4,})/ $1.to_i end end