forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dll_osx.sh
48 lines (42 loc) · 1.16 KB
/
dll_osx.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
function fix_qt_path() {
local EXE=$1
local QTEXE=`otool -L $EXE |grep Qt |grep -v ':'`
for Q in $QTEXE
do
if [ -n "`echo $Q |grep framework`" ]; then
echo Q=$Q
OLD=`echo $Q |cut -d ' ' -f 1`
echo OLD=$OLD
REL=`echo $OLD |sed 's,.*\/\(.*\)\(\.framework\/.*\),\1\2,'`
REL_DIR=${REL%/*}
NEW="@rpath/Frameworks/$REL"
#NEW="@rpath/Frameworks/$REL"
install_name_tool -change $OLD $NEW $EXE #$REL
echo install_name_tool -change $OLD $NEW $EXE
fi
done
}
function copy_qt() {
local EXE=$1
local QTEXE=`otool -L $EXE |grep Qt |grep -v ':'`
for Q in $QTEXE
do
if [ -n "`echo $Q |grep framework`" ]; then
echo Q=$Q
OLD=`echo $Q |cut -d ' ' -f 1`
echo OLD=$OLD
REL=`echo $OLD |sed 's,.*\/\(.*\)\(\.framework\/.*\),\1\2,'`
REL_DIR=${REL%/*}
mkdir -p $REL_DIR
if [ -f $REL ]; then
echo "already exists. skip copy. $REL"
else
cp -L $Q $REL
fi
NEW="@rpath/Frameworks/$REL"
install_name_tool -change $OLD $NEW $REL
echo install_name_tool -change $OLD $NEW $EXE
fi
done
}
[ "$1" = "-c" ] && copy_qt $2 || fix_qt_path $1