2 kdecore/Makefile.am | 2 +
3 kdecore/klibloader.cpp | 86 +++++++++++++++++++++++++++----------------------
4 kdecore/klibloader.h | 2 -
5 kinit/kinit.cpp | 8 +---
6 4 files changed, 55 insertions(+), 43 deletions(-)
8 --- kdelibs-3.5.5/kdecore/Makefile.am.orig 2006-10-01 19:33:38.000000000 +0200
9 +++ kdelibs-3.5.5/kdecore/Makefile.am 2007-01-05 00:17:27.235678750 +0100
11 kuser.cpp kconfigskeleton.cpp kconfigdialogmanager.cpp klockfile.cpp \
12 kqiodevicegzip_p.cpp ktimezones.cpp
14 +CXXFLAGS += -fexceptions
15 libkdecore_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) -version-info 6:0:2 -no-undefined
16 libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) $(LIB_IDN) ../kdefx/libkdefx.la
17 +libkdecore_la_LIBADD += -lboost_filesystem -lboost_regex
18 libkdecore_la_NMCHECK = $(srcdir)/libkdecore.nmcheck
19 libkdecore_la_NMCHECKWEAK = $(srcdir)/libkdecore_weak.nmcheck $(srcdir)/libqt-mt_weak.nmcheck \
20 $(top_srcdir)/dcop/libDCOP_weak.nmcheck $(top_srcdir)/kdecore/standard_weak.nmcheck
21 --- kdelibs-3.5.5/kdecore/klibloader.h.orig 2005-10-10 17:06:03.000000000 +0200
22 +++ kdelibs-3.5.5/kdecore/klibloader.h 2007-01-04 23:19:39.868039250 +0100
24 * wants to open modules.
25 * @param name of the library. If it is not a path, the function searches in
26 * the "module" and "lib" resources. If there is no extension,
27 - * ".la" will be appended.
28 + * ".so*" will be appended.
29 * @param instance a KInstance used to get the standard paths
31 static QString findLibrary( const char * name, const KInstance * instance = KGlobal::instance() );
32 --- kdelibs-3.5.5/kdecore/klibloader.cpp.orig 2006-01-19 17:06:18.000000000 +0000
33 +++ kdelibs-3.5.5/kdecore/klibloader.cpp 2007-01-05 00:08:39.215039750 +0000
38 -static inline QCString makeLibName( const char* name )
39 +#include <boost/filesystem/exception.hpp>
40 +#include <boost/filesystem/operations.hpp>
41 +#include <boost/filesystem/path.hpp>
42 +#include <boost/regex.hpp>
44 +QCString makeSharedLibraryName( char const* name, QString const& dir )
46 - QCString libname(name);
47 - // only append ".la" if there is no extension
48 - // this allows to load non-libtool libraries as well
50 - int pos = libname.findRev('/');
53 - if (libname.find('.', pos) < 0)
58 + boost::filesystem::path d( dir.ascii() );
59 + std::string p = d.string() + "/" + name + ".so";
60 + if ( boost::filesystem::exists( p ) )
62 + boost::regex re( p + "\\..+", boost::regex::extended );
63 + for ( boost::filesystem::directory_iterator i( d );
64 + i != boost::filesystem::directory_iterator(); ++i )
67 + if ( boost::regex_match( i->string(), m, re ) )
68 + return m.str().c_str();
71 + catch ( boost::filesystem::filesystem_error const& )
78 QString KLibLoader::findLibrary( const char * name, const KInstance * instance )
80 - QCString libname = makeLibName( name );
82 - // only look up the file if it is not an absolute filename
85 - if (!QDir::isRelativePath(libname))
86 - libfile = QFile::decodeName( libname );
89 - libfile = instance->dirs()->findResource( "module", libname );
90 - if ( libfile.isEmpty() )
92 - libfile = instance->dirs()->findResource( "lib", libname );
94 - if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules
95 - kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl;
102 + if ( boost::filesystem::exists( name ) )
105 + catch ( boost::filesystem::filesystem_error const& )
108 + QStringList dirs = instance->dirs()->resourceDirs( "module" );
109 + for ( QStringList::ConstIterator i = dirs.begin(); i != dirs.end(); ++i )
111 + QCString p = makeSharedLibraryName( name, *i );
115 + dirs = instance->dirs()->resourceDirs( "lib" );
116 + for ( QStringList::ConstIterator i = dirs.begin(); i != dirs.end(); ++i )
118 + QCString p = makeSharedLibraryName( name, *i );
122 + return QString::null;
127 QString libfile = findLibrary( name );
128 if ( libfile.isEmpty() )
130 - const QCString libname = makeLibName( name );
132 - kdDebug(150) << "library=" << name << ": No file named " << libname << " found in paths." << endl;
134 - d->errorMessage = i18n("Library files for \"%1\" not found in paths.").arg(libname);
135 + d->errorMessage = i18n("Library files for \"%1\" not found in paths.").arg(name);
139 --- kdelibs-3.5.5/kinit/kinit.cpp.orig 2006-10-01 19:33:32.000000000 +0200
140 +++ kdelibs-3.5.5/kinit/kinit.cpp 2007-01-04 23:39:00.780591750 +0100
143 /* Relative name without '.la' */
145 - lib = name + ".la";
148 libpath = QFile::encodeName(KLibLoader::findLibrary( lib, s_instance ));
149 execpath = execpath_avoid_loops( exec, envc, envs, avoid_loops );
152 name = name.mid( name.findRev('/') + 1);
154 - if (lib.right(3) == ".la")
157 + if ( libpath.findRev( ".so" ) == -1 )
161 @@ -1807,7 +1805,7 @@
163 if (!d.suicide && !getenv("KDE_IS_PRELINKED"))
165 - QString konq = locate("lib", "libkonq.la", s_instance);
166 + QString konq = KLibLoader::findLibrary( "libkonq", s_instance );
168 (void) lt_dlopen(QFile::encodeName(konq).data());