-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtool.sh
More file actions
executable file
·134 lines (112 loc) · 5.43 KB
/
tool.sh
File metadata and controls
executable file
·134 lines (112 loc) · 5.43 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash -e
BINARY="./SimpleView.app/Contents/MacOS/SimpleView"
FRAMEW_FOLDER="SimpleView.app/Contents/Frameworks/"
LIBSNDFILE_DIR="/usr/local/lib"
if [ -d "$FRAMEW_FOLDER" ]
then
echo ${FRAMEW_FOLDER} exists
else
mkdir ${FRAMEW_FOLDER}
fi
function DoInstallNameTool {
xLIB="$1"
xLIB_NAME="$2"
xBINARY="$3"
echo install_name_tool -change \"${xLIB}\" \"@executable_path/../Frameworks/${xLIB_NAME}\" \"${xBINARY}\"
install_name_tool -id "@executable_path/../Frameworks/${xLIB_NAME}" "${FRAMEW_FOLDER}${xLIB_NAME}"
install_name_tool -change ${xLIB} "@executable_path/../Frameworks/${xLIB_NAME}" "${xBINARY}"
}
for LIBout in $(otool -L "${BINARY}"| tail -n +2 | grep libvtk| grep -v executable | cut -d '(' -f -1)
do
echo "Handling Lib: $LIBout"
#LIB_NAME=$(basename "$LIBout")
LIB_NAME=$(basename "$LIBout" | rev | cut -d '/' -f 1 | rev)
#echo " Adding ${LIB_NAME}"
LIBnew=$(echo "${LIBSNDFILE_DIR}/${LIB_NAME}")
cp -Rf "${LIBnew}" "${FRAMEW_FOLDER}"
DoInstallNameTool "$LIBout" "$LIB_NAME" "$BINARY"
LIBnew=$(echo "${FRAMEW_FOLDER}${LIB_NAME}")
echo "${LIBnew}"
#DoInstallNameTool "$LIBnew" "$LIB_NAME" "$LIBnew"
for LIB in $(otool -L "${LIBnew}" | tail -n +2 | grep libvtk| grep -v executable | cut -d '(' -f -1)
do
#echo "Handling Lib: $LIB"
LIB_NAME=$(basename "$LIB" | rev | cut -d '/' -f 1 | rev )
#echo " Adding ${LIB_NAME}"
cp -Rf "${LIBSNDFILE_DIR}/${LIB_NAME}" "${FRAMEW_FOLDER}"
DoInstallNameTool "$LIB" "$LIB_NAME" "$LIBnew"
done
done
echo "Second part---------------------------------------------------------------"
for LIBnew in $(ls ${FRAMEW_FOLDER}| grep libvtk)
do
echo "Handling Lib: $LIBnew"
for LIB in $(otool -L "${FRAMEW_FOLDER}${LIBnew}" | tail -n +2 | grep libvtk| grep -v executable | cut -d '(' -f -1)
do
LIB_NAME=$(basename "$LIB" | rev | cut -d '/' -f 1 | rev )
#echo " Adding ${LIB_NAME}"
#cp -Rf "${LIBSNDFILE_DIR}/${LIB_NAME}" "${FRAMEW_FOLDER}"
DoInstallNameTool "$LIB" "$LIB_NAME" "${FRAMEW_FOLDER}$LIBnew"
done
done
LIBSNDFILE_DIR="/Users/cxx/Qt/5.5/clang_64/lib"
for LIB in $(otool -L "${BINARY}"|grep Qt|grep -v 'vtk' |cut -d '(' -f -1 )
do
echo "Handling Lib: $LIB"
LIB_NAME=$(echo $LIB | rev | cut -d '/' -f 1 | rev)
echo " Adding ${LIB_NAME}"
if [ -d "${FRAMEW_FOLDER}${LIB_NAME}.framework" ]
then
echo "${FRAMEW_FOLDER}/${LIB_NAME}.framework" exists
else
cp -Rf "${LIBSNDFILE_DIR}/${LIB_NAME}.framework" "${FRAMEW_FOLDER}"
fi
DoInstallNameTool "$LIB" "$LIB_NAME.framework/Versions/5/$LIB_NAME" "$BINARY"
for LIB in $(otool -L "${FRAMEW_FOLDER}${LIB_NAME}.framework/Versions/5/${LIB_NAME}"|grep rpath|grep -v 'vtk' |cut -d '(' -f -1 )
do
#echo "Handling Lib: $LIB"
LIB_NAME2=$(echo $LIB | rev | cut -d '/' -f 1 | rev)
#echo " Adding ${LIB_NAME}"
if [ -d "${FRAMEW_FOLDER}${LIB_NAME2}.framework" ]
then
echo "${FRAMEW_FOLDER}/${LIB_NAME2}.framework" exists
else
cp -Rf "${LIBSNDFILE_DIR}/${LIB_NAME2}.framework" "${FRAMEW_FOLDER}"
fi
DoInstallNameTool "$LIB" "$LIB_NAME2.framework/Versions/5/$LIB_NAME2" "${FRAMEW_FOLDER}${LIB_NAME}.framework/Versions/5/${LIB_NAME}"
done
done
LIB_NAME="QtDBus"
if [ -d "${FRAMEW_FOLDER}${LIB_NAME}.framework" ]
then
echo "${FRAMEW_FOLDER}/${LIB_NAME}.framework" exists
else
cp -Rf "${LIBSNDFILE_DIR}/${LIB_NAME}.framework" "${FRAMEW_FOLDER}"
fi
DoInstallNameTool "$LIB" "$LIB_NAME.framework/Versions/5/$LIB_NAME" "${FRAMEW_FOLDER}${LIB_NAME}.framework/Versions/5/${LIB_NAME}"
for LIB in $(otool -L "${FRAMEW_FOLDER}${LIB_NAME}.framework/Versions/5/${LIB_NAME}"|grep rpath|grep -v 'vtk' |cut -d '(' -f -1 )
do
#echo "Handling Lib: $LIB"
LIB_NAME2=$(echo $LIB | rev | cut -d '/' -f 1 | rev)
#echo " Adding ${LIB_NAME}"
if [ -d "${FRAMEW_FOLDER}${LIB_NAME2}.framework" ]
then
echo "${FRAMEW_FOLDER}/${LIB_NAME2}.framework" exists
else
cp -Rf "${LIBSNDFILE_DIR}/${LIB_NAME2}.framework" "${FRAMEW_FOLDER}"
fi
DoInstallNameTool "$LIB" "$LIB_NAME2.framework/Versions/5/$LIB_NAME2" "${FRAMEW_FOLDER}${LIB_NAME}.framework/Versions/5/${LIB_NAME}"
done
# for LIBnew in $(ls ${FRAMEW_FOLDER}| grep vtkViewsQt)
# do
# echo "Handling Lib: $LIBnew"
# for LIB in $(otool -L "${FRAMEW_FOLDER}${LIBnew}" | tail -n +2 | grep Qt | grep -v 'vtk'|cut -d '(' -f -1)
# do
# LIB_NAME=$(basename "$LIB" | rev | cut -d '/' -f 1 | rev )
# #echo " Adding ${LIB_NAME}"
# #cp -Rf "${LIBSNDFILE_DIR}/${LIB_NAME}" "${FRAMEW_FOLDER}"
#
# DoInstallNameTool "$LIB" "$LIB_NAME.framework/Versions/5/${LIB_NAME}" "${FRAMEW_FOLDER}$LIBnew"
# done
# done
#