e571710d801c00db5d5a306c65939c025df14456
[platform/upstream/rpm.git] / autodeps / darwin.req
1 #!/bin/sh
2 # ----------------------------------------------------------------
3 #       find-requires for Darwin/MacOSX
4 # ----------------------------------------------------------------
5 ulimit -c 0
6
7 filelist=`sed "s/['\"]/\\\&/g"`
8 exelist=`echo $filelist | xargs file | grep -F Mach-O | cut -d: -f1 `
9 scriptlist=`echo $filelist | xargs file | grep -E ":.* (commands|script) " | cut -d: -f1 `
10
11 for f in $exelist; do
12     if [ -x $f ]; then
13         otool -L $f  \
14         | awk '/^\t/ { print }' \
15         | sed -n -e '/ (compatibility version .* current version .*)/p' \
16         | sed -e 's/ (compatibility version .* current version .*)//'
17     fi
18 done | sort -u | sed "s/['\"]/\\\&/g" | xargs -n 1 basename | sort -u
19
20 for f in $scriptlist; do
21     if [ -x $f ]; then
22         head -1 $f | sed -e 's/^\#\![   ]*//' \
23         | sed -n -e '/^\/bin/!p' | sed -n -e '/^\/usr\/bin/!p' | uniq \
24         | cut -d" " -f1
25     fi
26 done