/
fix_names.sh
executable file
·191 lines (176 loc) · 9.68 KB
/
fix_names.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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#!/bin/bash
#
# @date 22-mar-17
# @author Tobias Weber <tobias.weber@tum.de>
# @license GPLv2
#
# makes the framework libraries locally usable
#
PRG="takin.app"
OS_BIN="$BIN_DIR" # set accordingly
TOOL=install_name_tool
STRIP=strip
QT_VER="5.12.0"
# files whose linkage is to be changed
declare -a filestochange=(
"${PRG}/Contents/Frameworks/QtCore.framework/Versions/5/QtCore"
"${PRG}/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets"
"${PRG}/Contents/Frameworks/QtGui.framework/Versions/5/QtGui"
"${PRG}/Contents/Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent"
"${PRG}/Contents/Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL"
"${PRG}/Contents/Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport"
"${PRG}/Contents/Frameworks/QtDBus.framework/Versions/5/QtDBus"
"${PRG}/Contents/Frameworks/QtSvg.framework/Versions/5/QtSvg"
"${PRG}/Contents/Frameworks/QtXml.framework/Versions/5/QtXml"
"${PRG}/Contents/Frameworks/QtXmlPatterns.framework/Versions/5/QtXmlPatterns"
"${PRG}/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib"
"${PRG}/Contents/PlugIns/imageformats/libqsvg.dylib"
"${PRG}/Contents/PlugIns/imageformats/libqicns.dylib"
"${PRG}/Contents/PlugIns/imageformats/libqjpeg.dylib"
"${PRG}/Contents/PlugIns/iconengines/libqsvgicon.dylib"
"${PRG}/Contents/PlugIns/styles/libqmacstyle.dylib"
"${PRG}/Contents/PlugIns/platforms/libqcocoa.dylib"
"${PRG}/Contents/PlugIns/platforms/libqminimal.dylib"
"${PRG}/Contents/Frameworks/qwt.framework/Versions/6/qwt"
"${PRG}/Contents/Frameworks/libfreetype.6.dylib"
"${PRG}/Contents/Frameworks/libpng16.16.dylib"
"${PRG}/Contents/Frameworks/libjpeg.9.dylib"
"${PRG}/Contents/Frameworks/libtiff.5.dylib"
"${PRG}/Contents/Frameworks/libboost_iostreams.dylib"
"${PRG}/Contents/Frameworks/libboost_filesystem.dylib"
"${PRG}/Contents/Frameworks/libboost_python27.dylib"
"${PRG}/Contents/Frameworks/libboost_regex.dylib"
"${PRG}/Contents/Frameworks/libboost_system.dylib"
"${PRG}/Contents/Frameworks/libboost_program_options.dylib"
"${PRG}/Contents/${OS_BIN}/takin"
"${PRG}/Contents/${OS_BIN}/convofit"
"${PRG}/Contents/${OS_BIN}/convoseries"
"${PRG}/Contents/${OS_BIN}/sfact"
"${PRG}/Contents/${OS_BIN}/polextract"
)
# original symbols
declare -a changefrom=(
"/usr/local/Cellar/qt/${QT_VER}/lib/QtCore.framework/Versions/5/QtCore"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtCore.framework/Versions/5/QtCore"
"/usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore"
"/usr/local/opt/qt5/lib/QtCore.framework/Versions/5/QtCore"
"/usr/local/Cellar/qt/${QT_VER}/lib/QtGui.framework/Versions/5/QtGui"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtGui.framework/Versions/5/QtGui"
"/usr/local/opt/qt/lib/QtGui.framework/Versions/5/QtGui"
"/usr/local/opt/qt5/lib/QtGui.framework/Versions/5/QtGui"
"/usr/local/Cellar/qt/${QT_VER}/lib/QtWidgets.framework/Versions/5/QtWidgets"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtWidgets.framework/Versions/5/QtWidgets"
"/usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets"
"/usr/local/opt/qt5/lib/QtWidgets.framework/Versions/5/QtWidgets"
"/usr/local/Cellar/qt/${QT_VER}/lib/QtOpenGL.framework/Versions/5/QtOpenGL"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtOpenGL.framework/Versions/5/QtOpenGL"
"/usr/local/opt/qt/lib/QtOpenGL.framework/Versions/5/QtOpenGL"
"/usr/local/opt/qt5/lib/QtOpenGL.framework/Versions/5/QtOpenGL"
"/usr/local/Cellar/qt/${QT_VER}/lib/QtConcurrent.framework/Versions/5/QtConcurrent"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtConcurrent.framework/Versions/5/QtConcurrent"
"/usr/local/opt/qt/lib/QtConcurrent.framework/Versions/5/QtConcurrent"
"/usr/local/opt/qt5/lib/QtConcurrent.framework/Versions/5/QtConcurrent"
"/usr/local/Cellar/qt/${QT_VER}/lib/QtXml.framework/Versions/5/QtXml"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtXml.framework/Versions/5/QtXml"
"/usr/local/opt/qt/lib/QtXml.framework/Versions/5/QtXml"
"/usr/local/opt/qt5/lib/QtXml.framework/Versions/5/QtXml"
"/usr/local/Cellar/qt/${QT_VER}/lib/QtXmlPatterns.framework/Versions/5/QtXmlPatterns"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtXmlPatterns.framework/Versions/5/QtXmlPatterns"
"/usr/local/opt/qt/lib/QtXmlPatterns.framework/Versions/5/QtXmlPatterns"
"/usr/local/opt/qt5/lib/QtXmlPatterns.framework/Versions/5/QtXmlPatterns"
"/usr/local/Cellar/qt/${QT_VER}/lib/QtSvg.framework/Versions/5/QtSvg"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtSvg.framework/Versions/5/QtSvg"
"/usr/local/opt/qt/lib/QtSvg.framework/Versions/5/QtSvg"
"/usr/local/opt/qt5/lib/QtSvg.framework/Versions/5/QtSvg"
"/usr/local/Cellar/qt/${QT_VER}/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport"
"/usr/local/opt/qt/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport"
"/usr/local/opt/qt5/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport"
"/usr/local/Cellar/qt/${QT_VER}/lib/QtDBus.framework/Versions/5/QtDBus"
"/usr/local/Cellar/qt5/${QT_VER}/lib/QtDBus.framework/Versions/5/QtDBus"
"/usr/local/opt/qt/lib/QtDBus.framework/Versions/5/QtDBus"
"/usr/local/opt/qt5/lib/QtDBus.framework/Versions/5/QtDBus"
"/usr/local/opt/qwt/lib/qwt.framework/Versions/6/qwt"
"/usr/local/opt/minuit2/lib/libMinuit2.0.dylib"
"/usr/local/opt/boost/lib/libboost_system.dylib"
"/usr/local/opt/boost/lib/libboost_filesystem.dylib"
"/usr/local/opt/boost/lib/libboost_iostreams.dylib"
"/usr/local/opt/boost/lib/libboost_regex.dylib"
"/usr/local/opt/boost/lib/libboost_program_options.dylib"
"/usr/local/opt/boost-python/lib/libboost_python27.dylib"
"/usr/local/opt/freetype/lib/libfreetype.6.dylib"
"/usr/local/opt/libpng/lib/libpng16.16.dylib"
"/usr/local/opt/libjpeg/lib/libjpeg.9.dylib"
"/usr/local/opt/jpeg/lib/libjpeg.9.dylib"
"/usr/local/opt/libtiff/lib/libtiff.5.dylib"
)
# symbols to change into
declare -a changeto=(
"@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore"
"@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore"
"@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore"
"@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore"
"@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui"
"@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui"
"@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui"
"@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui"
"@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets"
"@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets"
"@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets"
"@executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets"
"@executable_path/../Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL"
"@executable_path/../Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL"
"@executable_path/../Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL"
"@executable_path/../Frameworks/QtOpenGL.framework/Versions/5/QtOpenGL"
"@executable_path/../Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent"
"@executable_path/../Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent"
"@executable_path/../Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent"
"@executable_path/../Frameworks/QtConcurrent.framework/Versions/5/QtConcurrent"
"@executable_path/../Frameworks/QtXml.framework/Versions/5/QtXml"
"@executable_path/../Frameworks/QtXml.framework/Versions/5/QtXml"
"@executable_path/../Frameworks/QtXml.framework/Versions/5/QtXml"
"@executable_path/../Frameworks/QtXml.framework/Versions/5/QtXml"
"@executable_path/../Frameworks/QtXmlPatterns.framework/Versions/5/QtXmlPatterns"
"@executable_path/../Frameworks/QtXmlPatterns.framework/Versions/5/QtXmlPatterns"
"@executable_path/../Frameworks/QtXmlPatterns.framework/Versions/5/QtXmlPatterns"
"@executable_path/../Frameworks/QtXmlPatterns.framework/Versions/5/QtXmlPatterns"
"@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg"
"@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg"
"@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg"
"@executable_path/../Frameworks/QtSvg.framework/Versions/5/QtSvg"
"@executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport"
"@executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport"
"@executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport"
"@executable_path/../Frameworks/QtPrintSupport.framework/Versions/5/QtPrintSupport"
"@executable_path/../Frameworks/QtDBus.framework/Versions/5/QtDBus"
"@executable_path/../Frameworks/QtDBus.framework/Versions/5/QtDBus"
"@executable_path/../Frameworks/QtDBus.framework/Versions/5/QtDBus"
"@executable_path/../Frameworks/QtDBus.framework/Versions/5/QtDBus"
"@executable_path/../Frameworks/qwt.framework/Versions/6/qwt"
"@executable_path/../Frameworks/libMinuit2.0.dylib"
"@executable_path/../Frameworks/libboost_system.dylib"
"@executable_path/../Frameworks/libboost_filesystem.dylib"
"@executable_path/../Frameworks/libboost_iostreams.dylib"
"@executable_path/../Frameworks/libboost_regex.dylib"
"@executable_path/../Frameworks/libboost_program_options.dylib"
"@executable_path/../Frameworks/libboost_python27.dylib"
"@executable_path/../Frameworks/libfreetype.6.dylib"
"@executable_path/../Frameworks/libpng16.16.dylib"
"@executable_path/../Frameworks/libjpeg.9.dylib"
"@executable_path/../Frameworks/libjpeg.9.dylib"
"@executable_path/../Frameworks/libtiff.5.dylib"
)
CNT=$(expr ${#changefrom[*]} - 1)
for cfile in ${filestochange[@]}; do
echo -e "Processing binary \"${cfile}\"..."
chmod a+rx ${cfile}
for idx in $(seq 0 ${CNT}); do
cfrom=${changefrom[$idx]}
cto=${changeto[$idx]}
echo -e "\tChanging \"${cfrom}\"\n\t -> \"${cto}\"."
chmod u+w ${cfile}
${TOOL} -change ${cfrom} ${cto} ${cfile}
done
${STRIP} ${cfile}
echo -e ""
done