aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/tab.rb
diff options
context:
space:
mode:
authorMisty De Meo2013-07-27 00:11:45 -0700
committerMisty De Meo2013-09-01 13:19:13 -0700
commitb71682bdc79e49e43bfc4f9652f613a2ed398ed2 (patch)
tree86a7bc3c082f081f7f67037f21368fd5bb774de8 /Library/Homebrew/tab.rb
parent3ac74331a86d031179c3e25fe46bcb9f292dacc1 (diff)
downloadbrew-b71682bdc79e49e43bfc4f9652f613a2ed398ed2.tar.bz2
Tab: track C++ stdlib in use
There are subtle incompatibilities between Apple's libstdc++ and the libstdc++ used by the various GNU GCC formulae. In addition, we'll likely also be supporting libc++ in the future, and that's also incompatible with the other stdlibs. Tracking it in the tab lets us make sure that dependencies are all built against the same stdlib to avoid subtle breakage.
Diffstat (limited to 'Library/Homebrew/tab.rb')
-rw-r--r--Library/Homebrew/tab.rb22
1 files changed, 18 insertions, 4 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index a55df156d..9b19e9510 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -1,3 +1,4 @@
+require 'cxxstdlib'
require 'ostruct'
require 'options'
require 'utils/json'
@@ -9,7 +10,7 @@ require 'utils/json'
class Tab < OpenStruct
FILENAME = 'INSTALL_RECEIPT.json'
- def self.create f, args
+ def self.create f, stdlib, compiler, args
f.build.args = args
sha = HOMEBREW_REPOSITORY.cd do
@@ -23,7 +24,9 @@ class Tab < OpenStruct
:poured_from_bottle => false,
:tapped_from => f.tap,
:time => Time.now.to_i, # to_s would be better but Ruby has no from_s function :P
- :HEAD => sha
+ :HEAD => sha,
+ :compiler => compiler,
+ :stdlib => stdlib
end
def self.from_file path
@@ -59,7 +62,9 @@ class Tab < OpenStruct
:poured_from_bottle => false,
:tapped_from => "",
:time => nil,
- :HEAD => nil
+ :HEAD => nil,
+ :stdlib => :libstdcxx,
+ :compiler => :clang
end
def with? name
@@ -92,6 +97,13 @@ class Tab < OpenStruct
used_options + unused_options
end
+ def cxxstdlib
+ # Older tabs won't have these values, so provide sensible defaults
+ lib = stdlib || :libstdcxx
+ cc = compiler || MacOS.default_compiler
+ CxxStdlib.new(lib.to_sym, cc.to_sym)
+ end
+
def to_json
Utils::JSON.dump({
:used_options => used_options.map(&:to_s),
@@ -100,7 +112,9 @@ class Tab < OpenStruct
:poured_from_bottle => poured_from_bottle,
:tapped_from => tapped_from,
:time => time,
- :HEAD => send("HEAD")})
+ :HEAD => send("HEAD"),
+ :stdlib => (stdlib.to_s if stdlib),
+ :compiler => (compiler.to_s if compiler)})
end
def write