-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathappnames.sh
executable file
·53 lines (41 loc) · 1.37 KB
/
appnames.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
# appnames.sh - fix install names for all apps (Mac only)
CDIR=`pwd`
BDIR=`dirname $0`
if [ -z "${BDIR}" -o "${BDIR}" = "." ]; then
BDIR=${CDIR}
fi
BDIR=`echo ${BDIR} | sed -e 's@/bin$@@'`
# insure we work from the ~/ultrascan3/bin directory
cd ${BDIR}/bin
# fix the application in each bundle
for BUND in `ls -d *.app|grep -v 'us3_'`;do
FILE=`echo ${BUND} | sed -e 's/.app//'`
APPP=${BUND}/Contents/MacOS/${FILE}
# get list of library names to change
LIBL=`otool -L ${APPP} \
| egrep '_utils|us_gui|qwt|qca|mysql|crypto|openssl|framework' \
| grep -v executable \
| grep -v Library \
| awk '{print $1}'`
# change each of the library names
for NAMI in ${LIBL}; do
if [ `echo ${NAMI} | egrep -ci 'mysql|crypto|openssl'` -ne 0 ]; then
BASF=`basename ${NAMI}`
NAMO=@executable_path/../../../../lib/${BASF}
else
if [ `echo ${NAMI} | grep -ci framework` -eq 0 ]; then
# use relative path to library
NAMO=@executable_path/../../../../lib/${NAMI}
else
# use relative path to Qt framework
NAMJ=`echo ${NAMI} | sed -e 's#@rpath/##'`
NAMO=@executable_path/../../../../Frameworks/${NAMJ}
fi
fi
# report and do the install name change
echo "install_name_tool -change ${NAMI} ${NAMO} ${APPP}"
install_name_tool -change ${NAMI} ${NAMO} ${APPP}
done
done
cd ${CDIR}