diff options
| -rwxr-xr-x | Library/Homebrew/build.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/keg_fix_install_names.rb | 3 |
3 files changed, 13 insertions, 1 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index 7db2235ed..83dbe15cb 100755 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -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 diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 9b2ccce2c..6d9e1f911 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -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 diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index 3fc827bf5..cdbab97a9 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -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? |
