diff deploy/osx/paths.sh @ 667:0f3e086066fc qt5

Start reworking deployment scripts
author Chris Cannam
date Fri, 27 May 2016 09:56:22 +0100
parents 2d3f1e5d8638
children 8f3075eeaac2
line wrap: on
line diff
--- a/deploy/osx/paths.sh	Fri May 27 09:55:56 2016 +0100
+++ b/deploy/osx/paths.sh	Fri May 27 09:56:22 2016 +0100
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+set -e
+
 app="$1"
 if [ -z "$app" ]; then
 	echo "Usage: $0 <appname>"
@@ -7,21 +9,29 @@
 	exit 2
 fi
 
+set -u
+
+frameworks="QtCore QtNetwork QtGui QtWidgets QtPrintSupport QtDBus"
+
 echo
-echo "I expect you to have already copied QtCore, QtNetwork and QtGui to "
-echo "$app.app/Contents/Frameworks and PyQt4/QtCore.so and PyQt4/QtGui.so to "
-echo "$app.app/Contents/MacOS -- expect errors to follow if they're missing"
+echo "I expect you to have already copied these frameworks from the Qt installation to"
+echo "$app.app/Contents/Frameworks -- expect errors to follow if they're missing:"
+echo "$frameworks"
 echo
 
 echo "Fixing up loader paths in binaries..."
 
-install_name_tool -id QtCore "$app.app/Contents/Frameworks/QtCore"
-install_name_tool -id QtGui "$app.app/Contents/Frameworks/QtGui"
-install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork"
+for fwk in $frameworks; do
+    install_name_tool -id $fwk "$app.app/Contents/Frameworks/$fwk"
+done
 
-for fwk in QtCore QtGui QtNetwork; do
+find "$app.app" -name \*.dylib -print | while read x; do
+    install_name_tool -id "`basename \"$x\"`" "$x"
+done
+
+for fwk in $frameworks; do
         find "$app.app" -type f -print | while read x; do
-                current=$(otool -L "$x" | grep "$fwk" | grep ramework | awk '{ print $1; }')
+                current=$(otool -L "$x" | grep "$fwk" | grep amework | grep -v ':$' | awk '{ print $1; }')
                 [ -z "$current" ] && continue
                 echo "$x has $current"
                 relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \
@@ -31,6 +41,16 @@
         done
 done
 
+find "$app.app" -type f -print | while read x; do
+    qtdep=$(otool -L "$x" | grep Qt | grep amework | grep -v ':$' | grep -v '@loader_path' | awk '{ print $1; }')
+    if [ -n "$qtdep" ]; then
+	echo
+	echo "ERROR: File $x depends on Qt framework(s) not apparently present in the bundle:"
+	echo $qtdep
+	exit 1
+    fi
+done
+
 echo "Done: be sure to run the app and see that it works!"