Description: fix ia32 library path (e.g. skype application) Forwarded: not-needed Origin: kubuntu, http://bazaar.launchpad.net/~kubuntu-members/qt/ubuntu/annotate/head:/debian/patches/kubuntu_04_qt_ia32_library_path.patch Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/ia32-libs/+bug/353704 Author: Bo Thorsen --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -64,6 +64,10 @@ QT_END_NAMESPACE #include "qconfig.cpp" +#if defined(__linux__) && defined (__i386__) + #include +#endif + QT_BEGIN_NAMESPACE #ifndef QT_NO_SETTINGS @@ -211,6 +215,22 @@ QLibraryInfo::buildKey() return QString::fromLatin1(QT_BUILD_KEY); } +static inline QString fixLibraryPath32(const QString& path) +{ +#if defined(__linux__) && defined (__i386__) + struct utsname uts; + + uname(&uts); + if (!strcmp("x86_64", uts.machine) && (path.startsWith(QLatin1String("/usr/lib/")))) + { + QString newPath = QLatin1String("/usr/lib32/") + path.mid(8); + if (QFileInfo(newPath).isDir()) + return newPath; + } +#endif + return path; +} + /*! \since 4.6 Returns the installation date for this build of Qt. The install date will @@ -430,7 +450,7 @@ QLibraryInfo::location(LibraryLocation l if (loc == PrefixPath) { // we make the prefix path absolute to the executable's directory #ifdef BOOTSTRAPPING - return QFileInfo(qmake_libraryInfoFile()).absolutePath(); + return fixLibraryPath32(QFileInfo(qmake_libraryInfoFile()).absolutePath()); #else if (QCoreApplication::instance()) { #ifdef Q_OS_MAC @@ -439,21 +459,21 @@ QLibraryInfo::location(LibraryLocation l QCFType urlRef = CFBundleCopyBundleURL(bundleRef); if (urlRef) { QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle); - return QDir::cleanPath(path + QLatin1String("/Contents/") + ret); + return fixLibraryPath32(QDir::cleanPath(path + QLatin1String("/Contents/") + ret)); } } #endif - return QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(ret); + return fixLibraryPath32(QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(ret)); } else { - return QDir::current().absoluteFilePath(ret); + return fixLibraryPath32(QDir::current().absoluteFilePath(ret)); } #endif } else { // we make any other path absolute to the prefix directory - return QDir(location(PrefixPath)).absoluteFilePath(ret); + return fixLibraryPath32(QDir(location(PrefixPath)).absoluteFilePath(ret)); } } - return ret; + return fixLibraryPath32(ret); } /*!