aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/mach.rb
diff options
context:
space:
mode:
authorJack Nagel2013-12-14 09:35:58 -0600
committerJack Nagel2013-12-14 09:35:58 -0600
commit1ed7284548d6e242667ece2d94f4da0b997ebc09 (patch)
tree833fb47af21386d09dba9db4ef601ff4ecad654d /Library/Homebrew/mach.rb
parent38ab6dbd7ecbe733dbfbbb4d4d281e89a5ce7967 (diff)
downloadhomebrew-1ed7284548d6e242667ece2d94f4da0b997ebc09.tar.bz2
Move Pathname#dynamically_linked_libraries to mach module
Diffstat (limited to 'Library/Homebrew/mach.rb')
-rw-r--r--Library/Homebrew/mach.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/Library/Homebrew/mach.rb b/Library/Homebrew/mach.rb
index 6729e36fc..e943bd134 100644
--- a/Library/Homebrew/mach.rb
+++ b/Library/Homebrew/mach.rb
@@ -141,4 +141,15 @@ module MachO
def mach_o_bundle?
mach_data.any? { |m| m.fetch(:type) == :bundle }
end
+
+ # Returns an array containing all dynamically-linked libraries, based on the
+ # output of otool. This returns the install names, so these are not guaranteed
+ # to be absolute paths.
+ # Returns an empty array both for software that links against no libraries,
+ # and for non-mach objects.
+ def dynamically_linked_libraries
+ `#{MacOS.locate("otool")} -L "#{expand_path}"`.chomp.split("\n")[1..-1].map do |line|
+ line[/\t(.+) \([^(]+\)/, 1]
+ end
+ end
end