It is not as nice as Windows “depends” but does the job:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/usr/bin/env ruby paths = [ARGV[0]] libs = { ARGV[0] => 1 } while paths.size > 0 do path = paths.pop lines = `otool -L '#{path}'`.split("\n")[2..-1] new_libs = lines.collect do |line| line =~ /\s+(.*)\s+\(.*\)\s*/ $1 end new_libs.each do |lib| if libs[lib] then libs[lib] += 1 else libs[lib] = 1 paths < < lib end end end puts libs.keys.sort.join("\n") |
Tópicos (RSS)