aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2011-12-08 22:16:19 -0600
committerJack Nagel2011-12-08 23:08:42 -0600
commit3dac87e62cd83b4724f9f3bea08d6ab8473c29ef (patch)
treec35381a04760c2c6acee74714c7883c78ead05d5 /Library
parent8f95b3e9ff70e3a93f8856f7b05f562a48501fee (diff)
downloadhomebrew-3dac87e62cd83b4724f9f3bea08d6ab8473c29ef.tar.bz2
audit: check for hard-coded compilers
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/cmd/audit.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index d3ea129a4..0a8a5a21a 100755
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -135,6 +135,15 @@ def audit_formula_text name, text
problems << " * MacPorts patches should specify a revision instead of trunk"
end
+ # Avoid hard-coding compilers
+ if text =~ %r[(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?(gcc|llvm-gcc|clang)['" ]]
+ problems << " * Use \"\#{ENV.cc}\" instead of hard-coding \"#{$3}\""
+ end
+
+ if text =~ %r[(system|ENV\[.+\]\s?=)\s?['"](/usr/bin/)?((g|llvm-g|clang)\+\+)['" ]]
+ problems << " * Use \"\#{ENV.cxx}\" instead of hard-coding \"#{$3}\""
+ end
+
return problems
end