aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXiyue Deng2013-10-24 00:26:09 -0700
committerXiyue Deng2013-10-26 22:17:04 -0700
commit3ec40c062e5b3bdfebc5cbfb36a5766d1d0905d6 (patch)
tree8df2964fec633ff4833401bd17c7392ce3c05b2f /Library
parentaeaf6fe104e177ad6c207b9897a432be964f4c5a (diff)
downloadhomebrew-3ec40c062e5b3bdfebc5cbfb36a5766d1d0905d6.tar.bz2
Clang standard library selection.
* Add new ENV function for selecting stdlib for Clang. - The selection is no-op for non-system-clang compilers. - Both superenv and stdenv are handled. * Add new HOMEBREW_CCCFG flag and ccwrapper handling.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/ENV/4.3/cc2
-rw-r--r--Library/Homebrew/extend/ENV/std.rb12
-rw-r--r--Library/Homebrew/extend/ENV/super.rb13
3 files changed, 27 insertions, 0 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc
index 102f6c64e..e8e586da4 100755
--- a/Library/ENV/4.3/cc
+++ b/Library/ENV/4.3/cc
@@ -161,6 +161,7 @@ class Cmd
if mode == :cxx
args << '-std=c++11' if cccfg? 'x'
args << '-stdlib=libc++' if cccfg? 'g'
+ args << '-stdlib=libstdc++' if cccfg? 'h'
end
return args unless cccfg? 'O'
@@ -216,6 +217,7 @@ class Cmd
when :cxxld
args << '-Wl,-headerpad_max_install_names'
args << '-stdlib=libc++' if cccfg? 'g'
+ args << '-stdlib=libstdc++' if cccfg? 'h'
end
args
end
diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb
index 0d5613256..92bdfd794 100644
--- a/Library/Homebrew/extend/ENV/std.rb
+++ b/Library/Homebrew/extend/ENV/std.rb
@@ -333,6 +333,18 @@ module Stdenv
end
end
+ def libcxx
+ if compiler == :clang
+ append 'CXX', '-stdlib=libc++'
+ end
+ end
+
+ def libstdcxx
+ if compiler == :clang
+ append 'CXX', '-stdlib=libstdc++'
+ end
+ end
+
def replace_in_cflags before, after
CC_FLAG_VARS.each do |key|
self[key] = self[key].sub(before, after) if has_key?(key)
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index 2be8a62d4..169a4200c 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -99,6 +99,7 @@ module Superenv
# make/bsdmake wrappers currently.
# x - Enable C++11 mode.
# g - Enable "-stdlib=libc++" for clang.
+ # h - Enable "-stdlib=libstdc++" for clang.
#
# On 10.8 and newer, these flags will also be present:
# s - apply fix for sed's Unicode support
@@ -123,6 +124,18 @@ module Superenv
end
end
+ def libcxx
+ if self['HOMEBREW_CC'] == 'clang'
+ append 'HOMEBREW_CCCFG', "g", ''
+ end
+ end
+
+ def libstdcxx
+ if self['HOMEBREW_CC'] == 'clang'
+ append 'HOMEBREW_CCCFG', "h", ''
+ end
+ end
+
# m32 on superenv does not add any CC flags. It prevents "-m32" from being erased.
def m32
append 'HOMEBREW_CCCFG', "3", ''