C++ stdlib check: don't check executables for deps

This avoids some possible false positives, as happens with, e.g., qt4.
This commit is contained in:
Misty De Meo 2014-01-20 10:04:27 -08:00
parent 8b969e981c
commit edf474cb63
3 changed files with 13 additions and 1 deletions

View File

@ -164,6 +164,9 @@ class Build
begin
f.install
# This first test includes executables because we still
# want to record the stdlib for something that installs no
# dylibs.
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
@ -173,6 +176,13 @@ class Build
# incompatibility.
stdlib_in_use.check_dependencies(f, deps)
# This second check is recorded for checking dependencies,
# so executable are irrelevant at this point. If a piece
# of software installs an executable that links against libstdc++
# and dylibs against libc++, libc++-only dependencies can safely
# link against it.
stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs :skip_executables => true
Tab.create(f, ENV.compiler, stdlibs.first,
Options.coerce(ARGV.options_only)).write
rescue Exception => e

View File

@ -125,6 +125,7 @@ class FormulaInstaller
stdlib_in_use = CxxStdlib.new(stdlibs.first, MacOS.default_compiler)
stdlib_in_use.check_dependencies(f, f.recursive_dependencies)
stdlibs = Keg.new(f.prefix).detect_cxx_stdlibs :skip_executables => true
tab = Tab.for_keg f.prefix
tab.poured_from_bottle = true
tab.tabfile.delete if tab.tabfile

View File

@ -66,10 +66,11 @@ class Keg
# lib/, and ignores binaries and other mach-o objects
# Note that this doesn't attempt to distinguish between libstdc++ versions,
# for instance between Apple libstdc++ and GNU libstdc++
def detect_cxx_stdlibs
def detect_cxx_stdlibs(opts={:skip_executables => false})
results = Set.new
mach_o_files.each do |file|
next if file.mach_o_executable? && opts[:skip_executables]
dylibs = file.dynamically_linked_libraries
results << :libcxx unless dylibs.grep(/libc\+\+.+\.dylib/).empty?
results << :libstdcxx unless dylibs.grep(/libstdc\+\+.+\.dylib/).empty?