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
|
#!/bin/bash
#
# Link application bundle to QT as framework
#
# written by Uwe Drechsel (c) 2006
#
# License GPL 2
#
APPNAME=vym
BUNDLE=$APPNAME.app
FWORKS=$BUNDLE/Contents/Frameworks
QTDIR=/usr/local/Trolltech/Qt-4.2.0
QTLIB=$QTDIR/lib
declare -a FWLIST
function cleanup
{
echo ***Cleaning up...
rm -rf $BUNDLE
make clean
}
function compile
{
echo ***Compiling...
qmake -config release
make
}
function fixLinking
{
echo ***Setting identification names...
for i in ${FWLIST[@]}
do
COM="install_name_tool -id @executable_path/../Frameworks/$i.framework/Versions/4/$i $BUNDLE/Contents/Frameworks/$i.framework/Versions/4/$i"
done
echo " $COM"
`$COM`
echo ***Tell dynamic linker where to look for frameworks...
for i in ${FWLIST[@]}
do
COM="install_name_tool -change $QTLIB/$i.framework/Versions/4/$i @executable_path/../Frameworks/$i.framework/Versions/4/$i $BUNDLE/Contents/MacOs/$APPNAME"
echo " $COM"
`$COM`
done
for fw in ${FWLIST[@]}
do
echo ***Adjust dynamic linking in $fw
for i in ` otool -L vym.app/Contents/Frameworks/$fw.framework/$fw | grep Trolltech | sed "s/^.*\///" | sed "s/ .*$//"`
do
COM="install_name_tool -change $QTLIB/$i.framework/Versions/4/$i @executable_path/../Frameworks/$i.framework/Versions/4/$i $FWORKS/$fw.framework/$fw"
echo " $COM"
`$COM`
done
done
}
function copyFrameworks
{
# Copy found frameworks into bundle, preserve symbolic links with -R
mkdir -p $FWORKS
for i in ${FWLIST[@]}
do
echo ***Copying $QTLIB/$i.framework
#cp -R $QTLIB/$i.framework $FWORKS
rsync -avz $QTLIB/$i.framework $FWORKS --exclude 'Qt*_debug'
done
}
function copyRessources
{
echo ***Copying ressources
mkdir -p $BUNDLE/Contents/Resources
cp -r icons flags scripts styles vym.app/Contents/Resources/
cp icons/vym.icns $BUNDLE/Contents/Resources
}
function findFrameworks
{
FWLIST=`otool -L $BUNDLE/Contents/MacOS/$APPNAME | grep Trolltech | sed "s/^.*\///" | sed "s/ .*$//"`
#FWLIST=( Qt3Support QtSql QtNetwork QtXml QtGui QtCore )
echo ***The following Qt frameworks are needed:
for i in ${FWLIST[@]}
do
echo $i
done
}
#cleanup
#compile
#findFrameworks
#copyFrameworks
#fixLinking
copyRessources
|