From 6fce4348570f3022c987de9f2f3aefb4b7d5b483 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 3 Nov 2011 21:08:59 -0500 Subject: [PATCH] Add utility methods to determine clang version Signed-off-by: Jack Nagel --- Library/Homebrew/utils.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 48068b9e19..cca54f229e 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -340,6 +340,20 @@ module MacOS extend self end end + def clang_version + @clang_version ||= if File.exist? "/usr/bin/clang" + `/usr/bin/clang --version` =~ /clang version (\d\.\d)/ + $1 + end + end + + def clang_build_version + @clang_build_version ||= if File.exist? "/usr/bin/clang" + `/usr/bin/clang --version` =~ %r[tags/Apple/clang-(\d{3}(\.\d)*)] + $1 + end + end + def x11_installed? Pathname.new('/usr/X11/lib/libpng.dylib').exist? end