# HG changeset patch # User Chris Cannam # Date 1342430978 -3600 # Node ID 451d3c087112d94e9ed32513bef36c57b2d47e2b # Parent 26ebbe098bce4943d917c35336e68c5e24511331 Override Qt library path on OS/X to avoid dependencies on unknown versions from outside the app bundle diff -r 26ebbe098bce -r 451d3c087112 deploy/osx/paths.sh --- a/deploy/osx/paths.sh Mon Jul 02 12:46:25 2012 +0100 +++ b/deploy/osx/paths.sh Mon Jul 16 10:29:38 2012 +0100 @@ -19,9 +19,13 @@ install_name_tool -id QtNetwork "$app.app/Contents/Frameworks/QtNetwork" install_name_tool -id QtXml "$app.app/Contents/Frameworks/QtXml" -for fwk in QtCore QtGui QtNetwork QtXml; do +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 QtSvg; 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 | awk '{ print $1; }') [ -z "$current" ] && continue echo "$x has $current" relative=$(echo "$x" | sed -e "s,$app.app/Contents/,," \ diff -r 26ebbe098bce -r 451d3c087112 main/main.cpp --- a/main/main.cpp Mon Jul 02 12:46:25 2012 +0100 +++ b/main/main.cpp Mon Jul 16 10:29:38 2012 +0100 @@ -192,7 +192,24 @@ m_readyForFiles(false), m_filepathQueue(QStringList()), m_mainWindow(0) - { } + { +#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()); + } +#endif + } virtual ~SVApplication() { } void setMainWindow(MainWindow *mw) { m_mainWindow = mw; }