From 18bdd7282761330dbf1ed4e896eb2e9fdac4a9a5 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 8 Dec 2011 22:16:19 -0600 Subject: [PATCH] audit: check for hard-coded compilers Signed-off-by: Jack Nagel --- Library/Homebrew/cmd/audit.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index d3ea129a48..0a8a5a21a1 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