[Soprano] 56992b9 Use SOPRANO_LIB_SUFFIX (=LIB_SUFFIX) to decide whe

Michael Jansen kde at michael-jansen.biz
Tue Oct 26 14:02:21 CEST 2010


commit 56992b934d2add35fdf3a4f0ae9389ddc39bb228
branch 2.4
Author: Michael Jansen <kde at michael-jansen.biz>
Date:   Mon Oct 19 20:15:55 2009 +0000

    Use SOPRANO_LIB_SUFFIX (=LIB_SUFFIX) to decide where to look for plugins and
    libraries. It makes no sense to look into 'lib' and 'lib64'. A system needing
    that is broken.
    
    CCMAIL:kde-buildsystem at kde.org
    CCMAIL:sebastian at trueg.de
    
    svn path=/trunk/kdesupport/soprano/; revision=1037699

diff --git a/soprano/pluginmanager.cpp b/soprano/pluginmanager.cpp
index 8c21786..f82e671 100644
--- a/soprano/pluginmanager.cpp
+++ b/soprano/pluginmanager.cpp
@@ -40,10 +40,10 @@ namespace {
     QString findPluginLib( const Soprano::SopranoPluginFile& file ) {
         QStringList fileSearchPaths;
         // the folder the plugin file is in
-        fileSearchPaths << file.fileName().section( '/', 0, -2, QString::SectionIncludeTrailingSep );
+        fileSearchPaths << file.fileName().section( '/', 0, -2 );
 #ifndef Q_OS_WIN
         // the lib folder in the same prefix
-        fileSearchPaths << file.fileName().section( "/", 0, -5, QString::SectionIncludeTrailingSep ) + QLatin1String( "lib" );
+        fileSearchPaths << file.fileName().section( "/", 0, -5, QString::SectionIncludeTrailingSep ) + QLatin1String( "lib"SOPRANO_LIB_SUFFIX );
 #endif
         return Soprano::findLibraryPath( file.library(), fileSearchPaths, QStringList() << QLatin1String( "soprano" ) );
     }
@@ -287,6 +287,7 @@ void Soprano::PluginManager::loadAllPlugins()
 void Soprano::PluginManager::loadPlugin( const QString& path )
 {
     SopranoPluginFile f;
+//    qDebug() << path;
     if ( f.open( path ) ) {
 //        qDebug() << "(Soprano::PluginManager) found plugin file" << path;
         if ( f.sopranoVersion().left( f.sopranoVersion().indexOf( '.' ) ).toUInt() == Soprano::versionMajor() ) {
diff --git a/soprano/sopranodirs.cpp b/soprano/sopranodirs.cpp
index c26e158..d1fcbac 100644
--- a/soprano/sopranodirs.cpp
+++ b/soprano/sopranodirs.cpp
@@ -70,11 +70,11 @@ QString Soprano::findLibraryPath( const QString& libName, const QStringList& ext
     // paths to search for libs
     QStringList dirs = libDirs() + extraDirs;
 
-    // suffixes to search
-    QStringList suffixes;
-    suffixes << QLatin1String( SOPRANO_LIB_SUFFIX"/" )
-             << QString( '/' )
-             << QLatin1String( "64/" );
+#ifndef NDEBUG
+    foreach( const QString& dir, dirs ) {
+        Q_ASSERT(!dir.endsWith('/'));
+    }
+#endif
 
     // subdirs to search
     QStringList subDirs;
@@ -87,6 +87,15 @@ QString Soprano::findLibraryPath( const QString& libName, const QStringList& ext
     // we add the empty string to be able to handle all in one loop below
     subDirs << QString();
 
+#ifndef NDEBUG
+    foreach( const QString& dir, subDirs ) {
+        if (!dir.isEmpty()) {
+            Q_ASSERT(dir.endsWith('/'));
+            Q_ASSERT(!dir.startsWith('/'));
+        }
+    }
+#endif
+
     QStringList libs = makeLibNames( libName );
     Q_FOREACH( const QString& lib, libs ) {
         if ( lib.startsWith( '/' ) ) {
@@ -97,11 +106,9 @@ QString Soprano::findLibraryPath( const QString& libName, const QStringList& ext
         else {
             foreach( const QString& dir, dirs ) {
                 foreach( const QString& subDir, subDirs ) {
-                    foreach( const QString& suffix, suffixes ) {
-                        QFileInfo fi( dir + suffix + subDir + lib );
-                        if ( fi.isFile() ) {
-                            return fi.absoluteFilePath();
-                        }
+                    QFileInfo fi( dir + '/' + subDir + lib );
+                    if ( fi.isFile() ) {
+                        return fi.absoluteFilePath();
                     }
                 }
             }
@@ -128,12 +135,12 @@ QStringList Soprano::envDirList( const char* var )
 QStringList Soprano::libDirs()
 {
     QStringList paths = QCoreApplication::libraryPaths();
-    paths << QLatin1String( SOPRANO_PREFIX"/lib" );
+    paths << QLatin1String( SOPRANO_PREFIX"/lib"SOPRANO_LIB_SUFFIX );
 #ifdef Q_OS_WIN
     paths << QLatin1String( SOPRANO_PREFIX"/bin" );
 #else
-    paths << QLatin1String( "/usr/lib" );
-    paths << QLatin1String( "/usr/local/lib" );
+    paths << QLatin1String( "/usr/lib"SOPRANO_LIB_SUFFIX );
+    paths << QLatin1String( "/usr/local/lib"SOPRANO_LIB_SUFFIX );
     paths += Soprano::envDirList( "LD_LIBRARY_PATH" );
 #endif
     return paths;


More information about the Kde-buildsystem mailing list