Fix some quotation marks. Thanks to Alexander Levin for pointing it out.
[Rockbox.git] / rbutil / rbutilqt / osx_deploy.sh
blobf40516aabe61e54c79d9fdcb6aaad08b02b5ee0a
1 #!/bin/sh
2 # __________ __ ___.
3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # \/ \/ \/ \/ \/
8 # $Id$
10 # Copyright (c) 2007 Barry Wardell
12 # All files in this archive are subject to the GNU General Public License.
13 # See the file COPYING in the source tree root for full license agreement.
15 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 # KIND, either express or implied.
19 # Purpose of this script: Prepare Mac OS X version of rbutil for distribution.
21 # Inputs: None
23 # Action: Copy necessary Qt frameworks into the rbutilqt application bundle.
24 # Update the linking of rbutilqt and the frameworks to refer to the new
25 # new location of the framework files (inside the app bundle).
26 # Create a compressed disk image from rbutilqt.app.
28 # Output: A compressed disk image called rbutilqt.dmg
30 # Requirement: This script assumes that you have rbutilqt.app in the current
31 # directory and a framework build of Qt in your $PATH
33 # See http://doc.trolltech.com/4.3/deployment-mac.html for an explanation of
34 # what we're doing here.
36 # scan the $PATH for the given command
37 findtool(){
38 file="$1"
40 IFS=":"
41 for path in $PATH
43 # echo "checks for $file in $path" >&2
44 if test -f "$path/$file"; then
45 echo "$path/$file"
46 return
48 done
51 # Try to find Qt
52 QTDIR=`findtool qmake`
53 if test -z "$QTDIR"; then
54 # not in path
55 echo "Error: Couldn't find Qt. Make sure it is in your \$PATH"
56 exit
57 else
58 QTDIR=`dirname \`dirname $QTDIR\``
59 echo "Found Qt: $QTDIR"
62 # Check Qt was built as frameworks
63 if test ! -d "$QTDIR/lib/QtCore.framework"; then
64 echo "Error: Unable to find Qt frameworks in $QTDIR"
65 echo " Make sure you built Qt as frameworks and not statically."
66 exit
69 mkdir -p rbutilqt.app/Contents/Frameworks/{QtCore,QtGui,QtNetwork}.framework/Versions/4
71 echo "Copying frameworks"
72 cp $QTDIR/lib/QtCore.framework/Versions/4/QtCore rbutilqt.app/Contents/Frameworks/QtCore.framework/Versions/4/
73 cp $QTDIR/lib/QtGui.framework/Versions/4/QtGui rbutilqt.app/Contents/Frameworks/QtGui.framework/Versions/4/
74 cp $QTDIR/lib/QtNetwork.framework/Versions/4/QtNetwork rbutilqt.app/Contents/Frameworks/QtNetwork.framework/Versions/4/
76 echo "Fixing framework linking"
77 install_name_tool -id @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore rbutilqt.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore
78 install_name_tool -id @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui rbutilqt.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui
79 install_name_tool -id @executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork rbutilqt.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork
80 install_name_tool -change $QTDIR/lib/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore rbutilqt.app/Contents/MacOS/rbutilqt
81 install_name_tool -change $QTDIR/lib/QtGui.framework/Versions/4/QtGui @executable_path/../Frameworks/QtGui.framework/Versions/4/QtGui rbutilqt.app/Contents/MacOS/rbutilqt
82 install_name_tool -change $QTDIR/lib/QtNetwork.framework/Versions/4/QtNetwork @executable_path/../Frameworks/QtNetwork.framework/Versions/4/QtNetwork rbutilqt.app/Contents/MacOS/rbutilqt
83 install_name_tool -change $QTDIR/lib/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore rbutilqt.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui
84 install_name_tool -change $QTDIR/lib/QtCore.framework/Versions/4/QtCore @executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore rbutilqt.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork
86 echo "Creating disk image"
87 hdiutil create -srcfolder rbutilqt.app -ov rbutilqt.dmg