]> git.pld-linux.org Git - packages/kdelibs.git/blame - kdelibs-lib_loader.patch
- release 24
[packages/kdelibs.git] / kdelibs-lib_loader.patch
CommitLineData
cf24eb0d
PS
1
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(-)
7
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
10@@ -115,8 +115,10 @@
11 kuser.cpp kconfigskeleton.cpp kconfigdialogmanager.cpp klockfile.cpp \
12 kqiodevicegzip_p.cpp ktimezones.cpp
13
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
23@@ -270,7 +270,7 @@
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
30 */
31 static QString findLibrary( const char * name, const KInstance * instance = KGlobal::instance() );
e9a1f444 32--- kdelibs-3.5.5/kdecore/klibloader.cpp.orig 2006-01-19 17:06:18.000000000 +0000
cf24eb0d
PS
33+++ kdelibs-3.5.5/kdecore/klibloader.cpp 2007-01-05 00:08:39.215039750 +0000
34@@ -331,43 +331,59 @@
35 d = 0L;
36 }
37
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>
43+
44+QCString makeSharedLibraryName( char const* name, QString const& dir )
45 {
46- QCString libname(name);
47- // only append ".la" if there is no extension
48- // this allows to load non-libtool libraries as well
49- // (mhk, 20000228)
50- int pos = libname.findRev('/');
51- if (pos < 0)
52- pos = 0;
53- if (libname.find('.', pos) < 0)
e9a1f444 54- libname += ".la";
cf24eb0d
PS
55- return libname;
56+ try
57+ {
58+ boost::filesystem::path d( dir.ascii() );
b3d2dda0 59+ std::string p = d.string() + "/" + name + ".so";
cf24eb0d
PS
60+ if ( boost::filesystem::exists( p ) )
61+ return p.c_str();
62+ boost::regex re( p + "\\..+", boost::regex::extended );
63+ for ( boost::filesystem::directory_iterator i( d );
64+ i != boost::filesystem::directory_iterator(); ++i )
65+ {
66+ boost::smatch m;
67+ if ( boost::regex_match( i->string(), m, re ) )
68+ return m.str().c_str();
69+ }
70+ }
71+ catch ( boost::filesystem::filesystem_error const& )
72+ {
73+ }
74+ return QCString();
e9a1f444
PS
75 }
76
cf24eb0d
PS
77-//static
78 QString KLibLoader::findLibrary( const char * name, const KInstance * instance )
79 {
80- QCString libname = makeLibName( name );
81-
82- // only look up the file if it is not an absolute filename
83- // (mhk, 20000228)
84- QString libfile;
85- if (!QDir::isRelativePath(libname))
86- libfile = QFile::decodeName( libname );
87- else
88- {
89- libfile = instance->dirs()->findResource( "module", libname );
90- if ( libfile.isEmpty() )
91- {
92- libfile = instance->dirs()->findResource( "lib", libname );
93-#ifndef NDEBUG
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;
96-#endif
97- }
98- }
99- return libfile;
100+ try
101+ {
102+ if ( boost::filesystem::exists( name ) )
103+ return name;
104+ }
105+ catch ( boost::filesystem::filesystem_error const& )
106+ {
107+ }
108+ QStringList dirs = instance->dirs()->resourceDirs( "module" );
109+ for ( QStringList::ConstIterator i = dirs.begin(); i != dirs.end(); ++i )
110+ {
111+ QCString p = makeSharedLibraryName( name, *i );
112+ if ( !p.isNull() )
113+ return p;
114+ }
115+ dirs = instance->dirs()->resourceDirs( "lib" );
116+ for ( QStringList::ConstIterator i = dirs.begin(); i != dirs.end(); ++i )
117+ {
118+ QCString p = makeSharedLibraryName( name, *i );
119+ if ( !p.isNull() )
120+ return p;
121+ }
122+ return QString::null;
123 }
124
125
126@@ -418,11 +434,7 @@
127 QString libfile = findLibrary( name );
128 if ( libfile.isEmpty() )
129 {
130- const QCString libname = makeLibName( name );
131-#ifndef NDEBUG
132- kdDebug(150) << "library=" << name << ": No file named " << libname << " found in paths." << endl;
133-#endif
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);
136 return 0;
137 }
138
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
e9a1f444
PS
141@@ -447,7 +447,7 @@
142 {
143 /* Relative name without '.la' */
144 name = _name;
145- lib = name + ".la";
cf24eb0d 146+ lib = name;
e9a1f444
PS
147 exec = name;
148 libpath = QFile::encodeName(KLibLoader::findLibrary( lib, s_instance ));
149 execpath = execpath_avoid_loops( exec, envc, envs, avoid_loops );
cf24eb0d 150@@ -458,9 +458,7 @@
e9a1f444
PS
151 name = _name;
152 name = name.mid( name.findRev('/') + 1);
153 exec = _name;
154- if (lib.right(3) == ".la")
cf24eb0d
PS
155- libpath = lib;
156- else
157+ if ( libpath.findRev( ".so" ) == -1 )
e9a1f444 158 execpath = exec;
cf24eb0d
PS
159 }
160 if (!args)
161@@ -1807,7 +1805,7 @@
e9a1f444
PS
162 #ifndef __CYGWIN__
163 if (!d.suicide && !getenv("KDE_IS_PRELINKED"))
164 {
165- QString konq = locate("lib", "libkonq.la", s_instance);
cf24eb0d 166+ QString konq = KLibLoader::findLibrary( "libkonq", s_instance );
e9a1f444
PS
167 if (!konq.isEmpty())
168 (void) lt_dlopen(QFile::encodeName(konq).data());
169 }
This page took 0.097306 seconds and 4 git commands to generate.