annotate deploy/osx/paths.sh @ 366:ce4d06d87a39

Update deployment to handle the even more complicated situation in which we have to produce separate binaries for python 2.5 and 2.6-based systems (because we can't determine which extension to load otherwise, and they aren't compatible)
author Chris Cannam
date Wed, 23 Mar 2011 14:49:43 +0000
parents aa852b477e4d
children 2d3f1e5d8638
rev   line source
Chris@335 1 #!/bin/bash
Chris@335 2
Chris@335 3 app="$1"
Chris@335 4 if [ -z "$app" ]; then
Chris@335 5 echo "Usage: $0 <appname>"
Chris@335 6 echo "Provide appname without the .app extension, please"
Chris@335 7 exit 2
Chris@335 8 fi
Chris@335 9
Chris@335 10 echo
Chris@335 11 echo "I expect you to have already copied QtCore, QtNetwork and QtGui to "
Chris@335 12 echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to "
Chris@335 13 echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing"
Chris@335 14 echo
Chris@335 15
Chris@335 16 echo "Fixing up loader paths in binaries..."
Chris@335 17
Chris@335 18 install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore"
Chris@335 19 install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui"
Chris@335 20 install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork"
Chris@335 21
Chris@335 22 for fwk in QtCore QtGui QtNetwork; do
Chris@335 23 find "$app.app" -type f -print | while read x; do
Chris@335 24 current=$(otool -L "$x" | grep "$fwk.framework/" | awk '{ print $1; }')
Chris@335 25 [ -z "$current" ] && continue
Chris@335 26 echo "$x has $current"
Chris@335 27 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
Chris@335 28 -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' )
Chris@335 29 echo "replacing with relative path $relative"
Chris@335 30 install_name_tool -change "$current" "@loader_path/$relative" "$x"
Chris@335 31 done
Chris@335 32 done
Chris@335 33
Chris@335 34 echo "Done: be sure to run the app and see that it works!"
Chris@335 35
Chris@335 36