changeset 207:a3e9ddb7bb8b

OS/X deployment: include plugins in bundle, use qt.conf instead of programmatic means of finding them. Now that the accessibility plugin is found, the toolbars are being rendered correctly
author Chris Cannam
date Thu, 06 Mar 2014 12:42:25 +0000
parents 40e6ba379f2c
children cf03cc84f2cc
files deploy/osx/Tony.sh deploy/osx/deploy.sh deploy/osx/paths.sh deploy/osx/qt.conf deploy/osx/sign.sh src/main.cpp
diffstat 6 files changed, 26 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/deploy/osx/Tony.sh	Thu Mar 06 11:02:53 2014 +0000
+++ b/deploy/osx/Tony.sh	Thu Mar 06 12:42:25 2014 +0000
@@ -1,4 +1,4 @@
 #!/bin/sh
 MYPATH=`dirname "$0"`
-VAMP_PATH="$MYPATH/../Resources" "$MYPATH/../Resources/Tony"
+VAMP_PATH="$MYPATH/../Resources" "$MYPATH/Tony.bin"
 
--- a/deploy/osx/deploy.sh	Thu Mar 06 11:02:53 2014 +0000
+++ b/deploy/osx/deploy.sh	Thu Mar 06 12:42:25 2014 +0000
@@ -30,13 +30,14 @@
     echo
     echo "Moving aside executable, adding script."
 
-    mv "$source/Contents/MacOS/$app" "$source/Contents/Resources/" || exit 1
+    mv "$source/Contents/MacOS/$app" "$source/Contents/MacOS/$app.bin" || exit 1
     cp "deploy/osx/$app.sh" "$source/Contents/MacOS/$app" || exit 1
     chmod +x "$source/Contents/MacOS/$app"
 fi
 
 echo
-echo "Copying in plugin."
+echo "Copying in plugin from ../pyin/pyin.dylib."
+echo "(make sure it's present, up-to-date and compiled with suitable optimisations!)"
 
 cp ../pyin/pyin.{dylib,cat,n3} "$source/Contents/Resources/"
 
@@ -60,6 +61,13 @@
 
 echo "Done"
 
+echo
+echo "Copying in qt.conf to set local-only plugin paths."
+echo "Make sure all necessary Qt plugins are in $target/Contents/plugins/*"
+echo "You probably want platforms/, accessible/ and imageformats/ subdirectories."
+cp deploy/osx/qt.conf "$target"/Contents/Resources/qt.conf
+
+echo
 echo "Writing version $bundleVersion in to bundle."
 echo "(This should be a three-part number: major.minor.point)"
 
--- a/deploy/osx/paths.sh	Thu Mar 06 11:02:53 2014 +0000
+++ b/deploy/osx/paths.sh	Thu Mar 06 12:42:25 2014 +0000
@@ -7,24 +7,25 @@
 	exit 2
 fi
 
+frameworks="QtCore QtNetwork QtGui QtXml QtWidgets QtPrintSupport"
+
 echo
-echo "I expect you to have already copied QtCore, QtNetwork, QtGui, QtXml and QtWidgets to "
-echo "$app.app/Contents/Frameworks -- 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"
-install_name_tool -id QtXml "$app.app/Contents/Frameworks/QtXml"
-install_name_tool -id QtWidgets "$app.app/Contents/Frameworks/QtWidgets"
+for fwk in $frameworks; do
+    install_name_tool -id $fwk "$app.app/Contents/Frameworks/$fwk"
+done
 
 find "$app.app" -name \*.dylib -print | while read x; do
     install_name_tool -id "`basename \"$x\"`" "$x"
 done
 
-for fwk in QtCore QtGui QtNetwork QtXml QtWidgets; do
+for fwk in $frameworks; do
         find "$app.app" -type f -print | while read x; do
                 current=$(otool -L "$x" | grep "$fwk" | grep amework | awk '{ print $1; }')
                 [ -z "$current" ] && continue
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/osx/qt.conf	Thu Mar 06 12:42:25 2014 +0000
@@ -0,0 +1,2 @@
+[Paths]
+Plugins = plugins
--- a/deploy/osx/sign.sh	Thu Mar 06 11:02:53 2014 +0000
+++ b/deploy/osx/sign.sh	Thu Mar 06 12:42:25 2014 +0000
@@ -17,7 +17,7 @@
     find "$app" -name \*.dylib -print | while read fr; do
 	codesign -s "Developer ID Application: Chris Cannam" -fv "$fr"
     done
-    codesign -s "Developer ID Application: Chris Cannam" -fv "$app/Contents/Resources/Tony"
+    codesign -s "Developer ID Application: Chris Cannam" -fv "$app/Contents/MacOS/Tony.bin"
     codesign -s "Developer ID Application: Chris Cannam" -fv \
          --requirements '=designated =>  identifier "uk.ac.qmul.eecs.c4dm.Tony" and ( (anchor apple generic and    certificate leaf[field.1.2.840.113635.100.6.1.9] ) or (anchor apple generic and    certificate 1[field.1.2.840.113635.100.6.2.6]  and    certificate leaf[field.1.2.840.113635.100.6.1.13] and    certificate leaf[subject.OU] = "M2H8666U82"))' \
          "$app"
--- a/src/main.cpp	Thu Mar 06 11:02:53 2014 +0000
+++ b/src/main.cpp	Thu Mar 06 12:42:25 2014 +0000
@@ -65,22 +65,10 @@
         m_mainWindow(0),
         m_readyForFiles(false)
     {
-#ifdef Q_OS_MAC
-        // Override the Qt plugin load path. The default contains the
-        // Qt installation location as well as the application
-        // directory, but we don't ever want to load plugins from
-        // outside the app bundle because we don't know for sure what
-        // (potentially different) versions of the Qt framework
-        // libraries they may have dyld dependencies on.
-        QString apploc(applicationFilePath());
-        apploc.truncate(apploc.lastIndexOf(QLatin1Char('/')));
-        apploc = QDir(apploc).canonicalPath();
-        if (QFile::exists(apploc)) {
-            setLibraryPaths(QStringList() << apploc);
-        } else {
-            setLibraryPaths(QStringList());
+        cerr << "Library paths:" << endl;
+        foreach (QString s, libraryPaths()) {
+            cerr << s << endl;
         }
-#endif
     }
     virtual ~TonyApplication() {
     }