move the "meat" into the wiki, this file just contains pointers now
[ghc.git] / mk / fix_install_names.sh
1 # Darwin / Mac OS X only
2 # sh fix_install_names.sh directory binary
3 #
4 # Changes 'binary' to assume that all libHS*_dyn.dylib libraries
5 # are to be found in 'directory'.
6
7 prefix=$1
8 file=$2
9
10 type=`file "$file"`
11
12 if `test "${type/Mach-O}" == "$type"`
13 then
14 exit
15 fi
16
17 if `test x${prefix%/} != x"" `
18 then
19 prefix=${prefix%/}/
20 fi
21
22 for i in `otool -L $file \
23 | grep 'libHS.*_dyn.dylib' \
24 | sed 's/.\(.*libHS.*_dyn.dylib\).*/\1/'`
25 do
26 install_name_tool -change $i "$prefix`basename $i`" $file
27 done
28
29 if `test "${file%.dylib}" != "${file}"`
30 then
31 install_name_tool -id "$prefix`basename $file`" $file
32 fi