From b71682bdc79e49e43bfc4f9652f613a2ed398ed2 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Sat, 27 Jul 2013 00:11:45 -0700 Subject: 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. --- Library/Homebrew/tab.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/tab.rb') 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 -- cgit v1.2.3