From 6762780f3efd4dcdc2d59438d2a5a93c054c372f Mon Sep 17 00:00:00 2001 From: Xiyue Deng Date: Wed, 31 Oct 2012 02:44:18 -0700 Subject: [PATCH] Whitelist Homebrew's own prefix in superenv. This allows Homebrew to be installed into /opt or /sw. Closes Homebrew/homebrew#15780. Signed-off-by: Max Howell Cleaned up the patch a little. Still ugly though, but logic is unusual so that's just how it is. --- Library/ENV/4.3/cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index cdf69e5f3d..6c1b4a0b79 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -120,12 +120,16 @@ class Cmd args << "-I#{path}" if iset.add?(path.cleanpath) when /^-L(.+)/ path = $1.chuzzle || whittler.next - case path.cleanpath + doit = case path.cleanpath + when %r{^#$brewfix} + # maybe homebrew is installed to /sw or /opt/brew + true when %r{^/opt}, %r{^/sw}, %r{/usr/X11} - # NOOP + false else - args << "-L#{path}" if lset.add?(path.cleanpath) + true end + args << "-L#{path}" if doit and lset.add?(path.cleanpath) else args << arg end