annotate deploy/osx/deploy.sh @ 318:124a3ea9fafb easyhg_v0.4

Merge, and add a helpful warning when you try to push before committing your merge (I just did this and the ensuing warning was misleading)
author Chris Cannam
date Wed, 02 Mar 2011 12:38:17 +0000
parents 806e9cb9ce61
children aa852b477e4d
rev   line source
Chris@232 1 #!/bin/bash
Chris@232 2
Chris@232 3 # Execute this from the top-level directory of the project (the one
Chris@232 4 # that contains the .app bundle).
Chris@232 5
Chris@232 6 app=EasyMercurial
Chris@232 7
Chris@232 8 version=`perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h`
Chris@260 9 case "$version" in
Chris@260 10 [0-9].[0-9]) bundleVersion="$version".0 ;;
Chris@260 11 [0-9].[0-9].[0-9]) bundleVersion="$version" ;;
Chris@260 12 *) echo "Error: Version $version is neither two- nor three-part number" ;;
Chris@260 13 esac
Chris@232 14
Chris@232 15 echo
Chris@232 16 echo "Writing version $bundleVersion in to bundle."
Chris@232 17 echo "(This should be a three-part number: major.minor.point)"
Chris@232 18
Chris@232 19 perl -p -e "s/EASYHG_VERSION/$bundleVersion/" deploy/osx/Info.plist \
Chris@232 20 > "$app".app/Contents/Info.plist
Chris@232 21
Chris@232 22 echo "Done: check $app.app for sanity please"
Chris@232 23
Chris@232 24 echo
Chris@256 25 echo "I expect you to have already copied QtCore, QtNetwork and QtGui to "
Chris@256 26 echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to "
Chris@256 27 echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing"
Chris@256 28 echo
Chris@256 29
Chris@256 30 echo "Fixing up loader paths in binaries..."
Chris@256 31
Chris@256 32 install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore"
Chris@256 33 install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui"
Chris@256 34 install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork"
Chris@256 35
Chris@316 36 for fwk in QtCore QtGui QtNetwork; do
Chris@316 37 find "$app.app" -type f -print | while read x; do
Chris@316 38 current=$(otool -L "$x" | grep "$fwk.framework/" | awk '{ print $1; }')
Chris@316 39 [ -z "$current" ] && continue
Chris@316 40 echo "$x has $current"
Chris@316 41 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
Chris@316 42 -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' )
Chris@316 43 echo "replacing with relative path $relative"
Chris@316 44 install_name_tool -change "$current" "@loader_path/$relative" "$x"
Chris@316 45 done
Chris@316 46 done
Chris@256 47
Chris@256 48 echo "Done: be sure to run the app and see that it works!"
Chris@256 49
Chris@256 50 echo
Chris@232 51 echo "Making dmg..."
Chris@232 52
Chris@232 53 hdiutil create -srcfolder "$app".app "$app"-"$version".dmg -volname "$app"-"$version"
Chris@232 54
Chris@232 55 echo "Done"