# # # patch "osx_bundle.sh" # from [45d574075f5cfaa843ff8a76240a16d5af8adcd2] # to [8ff21773cbd796df474fb452dc80397a8e081b00] # ============================================================ --- osx_bundle.sh 45d574075f5cfaa843ff8a76240a16d5af8adcd2 +++ osx_bundle.sh 8ff21773cbd796df474fb452dc80397a8e081b00 @@ -1,55 +1,69 @@ #!/bin/bash # -# This script should create a distributable application package which already -# contains the needed Qt4 libraries, however there seem to be problems during -# the identifier change of the copied libraries... whoever picks this up and -# fixes it deserves a cake! +# This script creates a distributable application package which already +# contains the needed Qt4 libraries. # -APP_BUNDLE="bin/guitone.app" +APP_BUNDLE="guitone/bin/guitone.app" +APP_FRAMEW="$APP_BUNDLE/Contents/Frameworks" APP_BINARY="guitone" -declare -a NEEDED_LIBS=( "QtCore" "QtGui" ) +declare -a NEEDED_LIBS=( "QtCore" "QtGui" "QtXml" ) +# +# configuration end, nothing should be edited from here on +# + if [ -z $QTDIR ]; then echo "\$QTDIR environment variable not found... exiting." exit 1 fi +# canonicalize QtDir, unfortunately this bash has no realpath() implementation +# so we need to use perl for this +QTDIR=`perl -e "use Cwd 'realpath'; print realpath('$QTDIR');"` + if [ ! -d $APP_BUNDLE ]; then echo "Application bundle not found in bin... exiting." exit 1 fi echo "Creating Frameworks directory in application bundle..." -mkdir -p "$APP_BUNDLE/Contents/Frameworks" +mkdir -p "$APP_FRAMEW" -echo "Copying needed libraries and changing executable path..." - address@hidden -for (( i = 0 ; i < cnt ; i++ )) address@hidden +for (( i = 0 ; i < libcount ; i++ )) do lib=${NEEDED_LIBS[$i]} + echo "Processing $lib..." + if [ ! -d "$QTDIR/lib/$lib.framework" ]; then echo "Couldn't find $lib.framework in $QTDIR." exit 1 fi - - cp -fR "$QTDIR/lib/$lib.framework" "$APP_BUNDLE/Contents/Frameworks" + + rm -rf "$APP_FRAMEW/$lib.framework" + cp -fR "$QTDIR/lib/$lib.framework" "$APP_FRAMEW" echo "...$lib copied." - + install_name_tool \ - -id "@executable_path/../Frameworks/$lib.framework/Versions/Current/$lib" \ - "$APP_BUNDLE/Contents/Frameworks/$lib.framework/Versions/Current/$lib" + -id "@executable_path/../Frameworks/$lib.framework/Versions/4/$lib" \ + "$APP_FRAMEW/$lib.framework/Versions/4/$lib" + # other Qt libs depend at least on QtCore + if [ "$lib" != "QtCore" ]; then + install_name_tool -change "$QTDIR/lib/QtCore.framework/Versions/4/QtCore" \ + "@executable_path/../Frameworks/QtCore.framework/Versions/4/QtCore" \ + "$APP_FRAMEW/$lib.framework/Versions/Current/$lib" + fi + install_name_tool -change "$QTDIR/lib/$lib.framework/Versions/4/$lib" \ - "@executable_path/../Frameworks/$lib.framework/Versions/Current/$lib" \ + "@executable_path/../Frameworks/$lib.framework/Versions/4/$lib" \ "$APP_BUNDLE/Contents/MacOS/$APP_BINARY" + echo "...$lib done." done -echo "Changing executable path for dependent libraries..." -install_name_tool -change "$QTDIR/lib/QtCore.framework/Versions/4/QtCore" \ - "@executable_path/../Frameworks/QtCore.framework/Versions/Current/QtCore" \ - "$APP_BUNDLE/Contents/Frameworks//QtGui.framework/Versions/Current/QtGui" -echo "...QtDir done." +echo "Removing any debug libraries and headers..." +find "$APP_FRAMEW" | egrep "debug|Headers" | xargs rm -rf +