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
commit18bdd7282761330dbf1ed4e896eb2e9fdac4a9a5 (patch)
treee6b8160c4e3b1837f9cd182004654be812c356ee /Library
parentf501e7f00b7816aae703463815f5cef0e38e0086 (diff)
downloadbrew-18bdd7282761330dbf1ed4e896eb2e9fdac4a9a5.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