diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index cc58bf4b08..8a4267bac1 100755 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -141,17 +141,6 @@ class Build end end - # TODO Track user-selected stdlibs, such as boost in C++11 mode - stdlib = ENV.compiler == :clang ? MacOS.default_cxx_stdlib : :libstdcxx - stdlib_in_use = CxxStdlib.new(stdlib, ENV.compiler) - - # This is a bad place for this check, but we don't have access to - # compiler selection within the formula installer, only inside the - # build instance. - # This is also awkward because we don't actually know yet if this package - # will link against a C++ stdlib, but we don't want to test after the build. - stdlib_in_use.check_dependencies(f, deps) - f.brew do if ARGV.flag? '--git' system "git init" @@ -174,7 +163,17 @@ class Build begin f.install - Tab.create(f, ENV.compiler, + + stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs + # It's technically possible for the same lib to link to multiple + # C++ stdlibs, but very bad news. Right now we don't track this + # woeful scenario. + stdlib_in_use = CxxStdlib.new(stdlibs.first, ENV.compiler) + # This will raise and fail the build if there's an + # incompatibility. + stdlib_in_use.check_dependencies(f, deps) + + Tab.create(f, ENV.compiler, stdlibs.first, Options.coerce(ARGV.options_only)).write rescue Exception => e if ARGV.debug? diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 7e5101f869..b83189bec4 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -386,8 +386,6 @@ class FormulaInstaller fix_install_names if OS.mac? - record_cxx_stdlib - ohai "Summary" if ARGV.verbose? or show_summary_heading unless ENV['HOMEBREW_NO_EMOJI'] print "\xf0\x9f\x8d\xba " if MacOS.version >= :lion @@ -529,18 +527,6 @@ class FormulaInstaller @show_summary_heading = true end - def record_cxx_stdlib - stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs - return if stdlibs.empty? - - tab = Tab.for_keg f.prefix - tab.tabfile.delete if tab.tabfile - # It's technically possible for the same lib to link to multiple C++ stdlibs, - # but very bad news. Right now we don't track this woeful scenario. - tab.stdlib = stdlibs.first - tab.write - end - def clean ohai "Cleaning" if ARGV.verbose? if f.class.skip_clean_all? diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 708e103463..5e4d246937 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -10,7 +10,7 @@ require 'utils/json' class Tab < OpenStruct FILENAME = 'INSTALL_RECEIPT.json' - def self.create f, compiler, args + def self.create f, compiler, stdlib, args f.build.args = args sha = HOMEBREW_REPOSITORY.cd do @@ -25,7 +25,8 @@ class Tab < OpenStruct :tapped_from => f.tap, :time => Time.now.to_i, # to_s would be better but Ruby has no from_s function :P :HEAD => sha, - :compiler => compiler + :compiler => compiler, + :stdlib => stdlib end def self.from_file path