kdesupport/soprano/soprano

Michael Jansen kde at michael-jansen.biz
Mon Oct 19 22:15:56 CEST 2009


SVN commit 1037699 by mjansen:

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

 M  +3 -2      pluginmanager.cpp  
 M  +20 -13    sopranodirs.cpp  


--- trunk/kdesupport/soprano/soprano/pluginmanager.cpp #1037698:1037699
@@ -40,10 +40,10 @@
     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::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() ) {
--- trunk/kdesupport/soprano/soprano/sopranodirs.cpp #1037698:1037699
@@ -70,11 +70,11 @@
     // 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 @@
     // 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 @@
         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::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