aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils.rb
diff options
context:
space:
mode:
authorJack Nagel2011-11-03 21:08:59 -0500
committerJack Nagel2011-11-25 13:14:46 -0600
commit8da6c368062f773c2e78daaf7b00d66ba108d887 (patch)
treef712d4f84806b689476db0316e35c90164f75a26 /Library/Homebrew/utils.rb
parentfb809331a03dad5f26fbf91fff20f36148fe6594 (diff)
downloadhomebrew-8da6c368062f773c2e78daaf7b00d66ba108d887.tar.bz2
Add utility methods to determine clang version
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/utils.rb')
-rw-r--r--Library/Homebrew/utils.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 48068b9e1..cca54f229 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