aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/ENV/4.3/cc14
-rw-r--r--Library/ENV/libsuperenv.rb1
2 files changed, 11 insertions, 4 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc
index 727fa565a..d05e81074 100755
--- a/Library/ENV/4.3/cc
+++ b/Library/ENV/4.3/cc
@@ -1,6 +1,7 @@
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
require File.expand_path("../libsuperenv", File.dirname(__FILE__))
+require 'pathname'
require 'set'
require 'stringio'
@@ -147,10 +148,12 @@ class Cmd
when /^-I(.+)?/
# Support both "-Ifoo" (one argument) and "-I foo" (two arguments)
path = $1.chuzzle || whittler.next
- args << "-I#{path}" if keep?(path) and iset.add?(path.cleanpath)
+ path = canonical_path(path)
+ args << "-I#{path}" if keep?(path) and iset.add?(path)
when /^-L(.+)?/
path = $1.chuzzle || whittler.next
- args << "-L#{path}" if keep?(path) and lset.add?(path.cleanpath)
+ path = canonical_path(path)
+ args << "-L#{path}" if keep?(path) and lset.add?(path)
else
args << arg
end
@@ -159,7 +162,7 @@ class Cmd
end
def keep? path
- case path.cleanpath
+ case path
when %r{^#{Regexp.escape(brewfix)}}, %r{^#{Regexp.escape(brewtmp)}}
# maybe homebrew is installed to /sw or /opt/brew
true
@@ -270,6 +273,11 @@ class Cmd
def cccfg? flags
flags.split('').all?{|c| ENV['HOMEBREW_CCCFG'].include? c } if ENV['HOMEBREW_CCCFG']
end
+ def canonical_path(path)
+ path = Pathname.new(path)
+ path = path.realpath if path.exist?
+ path.to_s
+ end
end
if __FILE__ == $PROGRAM_NAME
diff --git a/Library/ENV/libsuperenv.rb b/Library/ENV/libsuperenv.rb
index 5e7035eb2..c6b8c1c4b 100644
--- a/Library/ENV/libsuperenv.rb
+++ b/Library/ENV/libsuperenv.rb
@@ -6,7 +6,6 @@
$:.unshift "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8"
class String
- def cleanpath; require 'pathname'; Pathname.new(self).realpath.to_s rescue self end
def chuzzle; s = chomp; s unless s.empty? end
end