annotate deploy/osx/paths.sh @ 693:c764dd0df6ec

Add script to fix a few things in dpkg pkg that lintian complains about
author Chris Cannam
date Fri, 13 Dec 2013 09:39:04 +0000
parents 4481a2ca375d
children 5462ac97d28f
rev   line source
Chris@409 1 #!/bin/bash
Chris@409 2
Chris@409 3 app="$1"
Chris@409 4 if [ -z "$app" ]; then
Chris@409 5 echo "Usage: $0 <appname>"
Chris@409 6 echo "Provide appname without the .app extension, please"
Chris@409 7 exit 2
Chris@409 8 fi
Chris@409 9
Chris@409 10 echo
Chris@562 11 echo "I expect you to have already copied QtCore, QtNetwork, QtGui, QtXml and QtWidgets to "
Chris@409 12 echo "$app.app/Contents/Frameworks -- expect errors to follow if they're missing"
Chris@409 13 echo
Chris@409 14
Chris@409 15 echo "Fixing up loader paths in binaries..."
Chris@409 16
Chris@409 17 install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore"
Chris@409 18 install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui"
Chris@409 19 install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork"
Chris@409 20 install_name_tool -id QtXml "$app.app/Contents/Frameworks/QtXml"
Chris@562 21 install_name_tool -id QtWidgets "$app.app/Contents/Frameworks/QtWidgets"
Chris@409 22
Chris@509 23 find "$app.app" -name \*.dylib -print | while read x; do
Chris@509 24 install_name_tool -id "`basename \"$x\"`" "$x"
Chris@509 25 done
Chris@509 26
Chris@562 27 for fwk in QtCore QtGui QtNetwork QtXml QtWidgets; do
Chris@409 28 find "$app.app" -type f -print | while read x; do
Chris@509 29 current=$(otool -L "$x" | grep "$fwk" | grep amework | awk '{ print $1; }')
Chris@409 30 [ -z "$current" ] && continue
Chris@409 31 echo "$x has $current"
Chris@409 32 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
Chris@409 33 -e 's,[^/]*/,../,g' -e 's,/[^/]*$,/Frameworks/'"$fwk"',' )
Chris@409 34 echo "replacing with relative path $relative"
Chris@409 35 install_name_tool -change "$current" "@loader_path/$relative" "$x"
Chris@409 36 done
Chris@409 37 done
Chris@409 38
Chris@409 39 echo "Done: be sure to run the app and see that it works!"
Chris@409 40
Chris@409 41