# # # add_file "osx_bundle.sh" # content [45d574075f5cfaa843ff8a76240a16d5af8adcd2] # # set "osx_bundle.sh" # attr "mtn:execute" # value "true" # ============================================================ --- osx_bundle.sh 45d574075f5cfaa843ff8a76240a16d5af8adcd2 +++ osx_bundle.sh 45d574075f5cfaa843ff8a76240a16d5af8adcd2 @@ -0,0 +1,55 @@ +#!/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! +# + +APP_BUNDLE="bin/guitone.app" +APP_BINARY="guitone" +declare -a NEEDED_LIBS=( "QtCore" "QtGui" ) + +if [ -z $QTDIR ]; then + echo "\$QTDIR environment variable not found... exiting." + exit 1 +fi + +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" + +echo "Copying needed libraries and changing executable path..." + address@hidden +for (( i = 0 ; i < cnt ; i++ )) +do + lib=${NEEDED_LIBS[$i]} + 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" + echo "...$lib copied." + + install_name_tool \ + -id "@executable_path/../Frameworks/$lib.framework/Versions/Current/$lib" \ + "$APP_BUNDLE/Contents/Frameworks/$lib.framework/Versions/Current/$lib" + + install_name_tool -change "$QTDIR/lib/$lib.framework/Versions/4/$lib" \ + "@executable_path/../Frameworks/$lib.framework/Versions/Current/$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." +