From a5f68bb874bdf06decdae38ddde776e7c2cb31c7 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Tue, 8 Oct 2013 09:03:17 -0700 Subject: [PATCH] detect_cxx_stdlibs: Only detect for dylibs Fixes Homebrew/homebrew#23115. --- Library/Homebrew/keg_fix_install_names.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index 3b37ccf26e..c9ff7b4bc9 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -43,12 +43,18 @@ class Keg end # Detects the C++ dynamic libraries in place, scanning the dynamic links - # of the files within the keg. + # of the files within the keg. This searches only libs contained within + # 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 + return [] unless lib.exist? + results = Set.new - mach_o_files.each do |file| + lib.find do |file| + next if file.symlink? || file.directory? + next unless file.dylib? + dylibs = file.dynamically_linked_libraries results << :libcxx unless dylibs.grep(/libc\+\+.+\.dylib/).empty? results << :libstdcxx unless dylibs.grep(/libstdc\+\+.+\.dylib/).empty?