Ticket #47708: depsearch.sh

File depsearch.sh, 759 bytes (added by dbevans (David B. Evans), 10 years ago)
Line 
1#!/bin/bash
2if test -z "$1"; then
3  echo "usage: $0 <libname>"
4  exit 1
5fi
6for file in `find /opt/local/lib /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages -name *.dylib -o  -name *.so ; find /opt/local/bin ; find /opt/local/libexec ; find /opt/local/lib/gimp/2.0/plug-ins | grep -v .py ; find /Applications/MacPorts `; do
7  # Skip this match if it's a symbolic link
8  if test -f $file -a ! -L $file; then
9    # Look for references to the missing library
10    otool -L $file | grep --silent $1
11    if test "$?" = "0"; then
12      port provides `echo $file`
13    fi
14  fi
15# Grab the name of the port and make sure to list each port just once
16done | awk -F: ' { print $2 " (" $1 } ' | sed -e "s| is provided.*|\)|" | sort -u