File: include-frameworks.sh

package info (click to toggle)
massxpert 2.3.6-1squeeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 20,736 kB
  • ctags: 3,541
  • sloc: cpp: 44,108; xml: 7,381; sh: 604; makefile: 108; ansic: 7
file content (236 lines) | stat: -rwxr-xr-x 6,656 bytes parent folder | download | duplicates (4)
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#!/bin/sh 

set -e

usage ()
{
    echo "" 
    echo "Usage:"
    echo "$0 <Absolute path to the bundle>"
    echo ""
    echo "If the bundle.app full path is  /the/dir/bundle.app,"
    echo "then the parameter is \"/the/dir/bundle.app\""
    echo "" 
    exit 1
}

if [ "$#" != "1" ]
    then
    usage
fi

if [ ! -d "$1" ]
    then
    echo ""
    echo "The directory does not exist."
    usage
fi

# At this point we have a bundle directory. Check that it
# has a Contents/MacOS subdirectory.

if [ ! -d "$1/Contents/MacOS" ]
    then
    echo ""
    echo "The directory does not seem to have"
    echo "a canonical bundle structure"
    usage
fi

echo ${1} | grep ^/ > /dev/null 2>&1

if [ "$?" = "1" ]
then 
    echo "Path is not absolute"
    usage
fi

absolutePath=$1;
echo "Parameter = ${absolutePath}"

bundleDir=$(basename ${absolutePath});

echo "bundleDir = ${bundleDir}";

pwd=$(pwd);

cd ${absolutePath}/../

workingDir=$(pwd)
echo "workingDir = ${workingDir}"


echo "Running command otool -L ${bundleDir}/Contents/MacOS/massXpert"
otool -L ${bundleDir}/Contents/MacOS/massXpert

mkdir -p ${bundleDir}/Contents/Frameworks;
rm -rf ${bundleDir}/Contents/Frameworks/Qt*

printf "Now copying the Frameworks... "

for lib in Core Gui Svg Network Xml 
do 
#    cp -R /Library/Frameworks/Qt${lib}.framework ${bundleDir}/Contents/Frameworks
    cp  /Library/Frameworks/Qt${lib}.framework/Versions/4/Qt${lib} ${bundleDir}/Contents/Frameworks
done

printf "Done copying the Frameworks into the bundle\n"

sleep 2

Printf "Performing the install_name_tool -id for the frameworks"

for lib in Core Gui Svg Network Xml
do
    install_name_tool -id @executable_path/../Frameworks/Qt${lib} \
         ${bundleDir}/Contents/Frameworks/Qt${lib}
done

printf "Done install_name_tool -id\n"

sleep 2


printf "Performing the install_name_tool -change for the frameworks"

for lib in Core Gui Svg Network Xml
do
    install_name_tool -change Qt${lib}.framework/Versions/4/Qt${lib} \
         @executable_path/../Frameworks/Qt${lib} \
         ${bundleDir}/Contents/MacOS/massXpert
done

printf "Done install_name_tool -change\n"

sleep 2


printf "Dealing with the frameworks' inter-dependencies\n"

printf "QtGui <--> QtCore..."
install_name_tool -change QtCore.framework/Versions/4/QtCore \
@executable_path/../Frameworks/QtCore \
${bundleDir}/Contents/Frameworks/QtGui
printf "Done\n"

printf "QtSvg <--> QtCore && QtSvg <--> QtGui..."
install_name_tool -change QtCore.framework/Versions/4/QtCore \
@executable_path/../Frameworks/QtCore \
${bundleDir}/Contents/Frameworks/QtSvg

install_name_tool -change QtGui.framework/Versions/4/QtGui \
@executable_path/../Frameworks/QtGui \
${bundleDir}/Contents/Frameworks/QtSvg
printf "Done\n"

printf "QtXml <--> QtCore..."
install_name_tool -change QtCore.framework/Versions/4/QtCore \
@executable_path/../Frameworks/QtCore \
${bundleDir}/Contents/Frameworks/QtXml
printf "Done\n"

printf "QtNetwork <--> QtCore..."
install_name_tool -change QtCore.framework/Versions/4/QtCore \
@executable_path/../Frameworks/QtCore \
${bundleDir}/Contents/Frameworks/QtNetwork
printf "Done\n"

printf "Done dealing with the frameworks' inter-dependencies\n"

printf "Treating the plugins in the save way as above\n"

for lib in Core Gui Svg Xml Network
do
    for plugin in massListSorter numeralsLocaleConverter seqTools
    do
	install_name_tool -change Qt${lib}.framework/Versions/4/Qt${lib} \
            @executable_path/../Frameworks/Qt${lib} \
            ${bundleDir}/Contents/Plugins/lib${plugin}Plugin.so
    done
done

printf "Done treating the plugins\n"

sleep 2

echo "Running command otool -L ${bundleDir}/Contents/MacOS/massXpert"
otool -L ${bundleDir}/Contents/MacOS/massXpert

echo "Running command otool -L for each inter-dependent Qt framework:"

for lib in Core Gui Svg Xml Network
do 
    otool -L ${bundleDir}/Contents/Frameworks/Qt${lib} | grep Qt
done


echo "Running command otool -L on each plugin"
for plugin in massListSorter numeralsLocaleConverter seqTools
    do
    otool -L ${bundleDir}/Contents/Plugins/lib${plugin}Plugin.so
done

printf "Copying bundle to Desktop..."
dateString=$(date "+%Y%m%d-%H%M")
cp -rpf ${bundleDir} /Users/rusconi/Desktop/massXpert-${dateString}.app
printf "as /Users/rusconi/Desktop/massXpert-${dateString}.app"


exit

Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. 
Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. 
Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. Notes. 

Build the program, it goes in 

~/devel/build-work/Release/${bundleDir}

Then go to ~/devel/build-work/Release/${bundleDir}/Contents/MacOS

and run

otool -L massXpert 
massXpert:
	QtSvg.framework/Versions/4/QtSvg (compatibility version 4.4.0, current version 4.4.0)
	QtXml.framework/Versions/4/QtXml (compatibility version 4.4.0, current version 4.4.0)
	QtGui.framework/Versions/4/QtGui (compatibility version 4.4.0, current version 4.4.0)
	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 824.42.0)
	QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.4.0, current version 4.4.0)
	QtCore.framework/Versions/4/QtCore (compatibility version 4.4.0, current version 4.4.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.6)
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 368.28.0)


We see that the Qt frameworks are known in the form

QtSvg.framework/Versions/4/QtSvg *and not*

QtSvg.framework/Versions/4.0/QtSvg.


OK, now get to know the internal dependencies:

* QtCore does not depend on any Qt framework.

* QtGui depends on QtCore

* QtSvg depends on both QtCore and QtGui

*QtXml depends on QtCore

*QtNetwork depends on QtCore.

This means that we'll have to perform a number of steps on the bundled-incorporated frameworks...


Further, the plugins need the same kind of treatment.

libmassListSorterPlugin.dylib depends on QtCore and QtGui
libnumeralsLocaleConverterPlugin.dylib depends on QtCore and QtGui
libseqToolsPlugin.dylib depends on QtCore and QtGui