aboutsummaryrefslogtreecommitdiffstats
path: root/Library/ENV
diff options
context:
space:
mode:
authorJack Nagel2015-02-08 20:04:06 -0500
committerJack Nagel2015-02-08 20:04:06 -0500
commitfd031f256ae457d93c0472250655e71f2f066563 (patch)
tree38e8ad8af69f574c1a6a9f479c08a49dc3b2cdca /Library/ENV
parent60452a526f7575be369a0110c9d2b0b08c7f0d5a (diff)
downloadbrew-fd031f256ae457d93c0472250655e71f2f066563.tar.bz2
Add predicate methods for compiler shim configuration
Diffstat (limited to 'Library/ENV')
-rwxr-xr-xLibrary/ENV/4.3/cc37
1 files changed, 29 insertions, 8 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc
index 65a95d373..5e985a042 100755
--- a/Library/ENV/4.3/cc
+++ b/Library/ENV/4.3/cc
@@ -84,7 +84,8 @@ class Cmd
# software uses gcc -v (wrongly) to sniff the GCC version.
return @args.dup
end
- if !cccfg?("O") || tool == "ld" || configure?
+
+ if !refurbish_args? || tool == "ld" || configure?
args = @args.dup
else
args = refurbished_args
@@ -128,13 +129,13 @@ class Cmd
loop do
case arg = enum.next
when "-arch"
- if cccfg?("K")
+ if permit_arch_flags?
args << arg << enum.next
else
enum.next
end
when "-m32", "-m64"
- args << arg if cccfg?("K")
+ args << arg if permit_arch_flags?
when /^-Xarch_/
refurbished = refurbish_arg(enum.next, enum)
unless refurbished.empty?
@@ -205,7 +206,7 @@ class Cmd
def cflags
args = []
- return args unless cccfg? 'O' or configure?
+ return args unless refurbish_args? || configure?
args << '-pipe'
args << '-w' unless configure?
@@ -217,9 +218,9 @@ class Cmd
def cxxflags
args = cflags
- args << '-std=c++11' if cccfg? 'x'
- args << '-stdlib=libc++' if cccfg? 'g'
- args << '-stdlib=libstdc++' if cccfg? 'h'
+ args << "-std=c++11" if cxx11?
+ args << "-stdlib=libc++" if libcxx?
+ args << "-stdlib=libstdc++" if libstdcxx?
args
end
@@ -276,7 +277,7 @@ class Cmd
end
def make_fuss?
- cccfg? 'O' and not configure?
+ refurbish_args? && !configure?
end
def configure?
@@ -288,6 +289,26 @@ class Cmd
flags.split('').all?{|c| ENV['HOMEBREW_CCCFG'].include? c } if ENV['HOMEBREW_CCCFG']
end
+ def refurbish_args?
+ cccfg?("O")
+ end
+
+ def cxx11?
+ cccfg?("x")
+ end
+
+ def libcxx?
+ cccfg?("g")
+ end
+
+ def libstdcxx?
+ cccfg?("h")
+ end
+
+ def permit_arch_flags?
+ cccfg?("K")
+ end
+
def canonical_path(path)
path = Pathname.new(path)
path = path.realpath if path.exist?