Группа :: Графические оболочки/KDE
Пакет: kdelibs
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: kdelibs-3.1.4-alt-no_ltdl.patch
diff -uNr kdelibs-3.1.4.old/kdecore/klibloader.cpp kdelibs-3.1.4/kdecore/klibloader.cpp
--- kdelibs-3.1.4.old/kdecore/klibloader.cpp 2003-12-03 14:43:39 +0300
+++ kdelibs-3.1.4/kdecore/klibloader.cpp 2003-12-03 15:29:02 +0300
@@ -30,7 +30,6 @@
#include "kdebug.h"
#include "klocale.h"
-#include "ltdl.h"
#ifdef Q_WS_X11
#include <X11/Xlib.h>
@@ -41,7 +40,8 @@
#include <stdlib.h> //getenv
-
+#include <dlfcn.h>
+#if 0 /* cut */
#if HAVE_DLFCN_H
# include <dlfcn.h>
#endif
@@ -56,7 +56,7 @@
#ifndef LT_GLOBAL
# define LT_GLOBAL 0
#endif /* !LT_GLOBAL */
-
+#endif /* cut */
extern "C" {
extern int lt_dlopen_flag;
@@ -170,10 +170,10 @@
void* KLibrary::symbol( const char* symname ) const
{
- void* sym = lt_dlsym( (lt_dlhandle) m_handle, symname );
+ void* sym = dlsym( (void*) m_handle, symname );
if ( !sym )
{
- kdWarning(150) << "KLibrary: " << lt_dlerror() << endl;
+ kdWarning(150) << "KLibrary: " << dlerror() << endl;
return 0;
}
@@ -182,7 +182,7 @@
bool KLibrary::hasSymbol( const char* symname ) const
{
- void* sym = lt_dlsym( (lt_dlhandle) m_handle, symname );
+ void* sym = dlsym( (void*) m_handle, symname );
return (sym != 0L );
}
@@ -252,24 +252,24 @@
class KLibWrapPrivate
{
public:
- KLibWrapPrivate(KLibrary *l, lt_dlhandle h);
+ KLibWrapPrivate(KLibrary *l, void *h);
KLibrary *lib;
enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode;
int ref_count;
- lt_dlhandle handle;
+ void *handle;
QString name;
QString filename;
};
-KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, lt_dlhandle h)
+KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, void *h)
: lib(l), ref_count(1), handle(h), name(l->name()), filename(l->fileName())
{
unload_mode = UNKNOWN;
- if (lt_dlsym(handle, "__kde_do_not_unload") != 0) {
+ if (dlsym(handle, "__kde_do_not_unload") != 0) {
// kdDebug(150) << "Will not unload " << name << endl;
unload_mode = DONT_UNLOAD;
- } else if (lt_dlsym(handle, "__kde_do_unload") != 0) {
+ } else if (dlsym(handle, "__kde_do_unload") != 0) {
unload_mode = UNLOAD;
}
}
@@ -307,7 +307,6 @@
{
s_self = this;
d = new KLibLoaderPrivate;
- lt_dlinit();
d->unload_mode = KLibLoaderPrivate::UNKNOWN;
if (getenv("KDE_NOUNLOAD") != 0)
d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD;
@@ -384,7 +383,7 @@
KLibrary *tmp;
int olt_dlopen_flag = lt_dlopen_flag;
- lt_dlopen_flag |= LT_GLOBAL;
+ lt_dlopen_flag |= RTLD_GLOBAL;
kdDebug(150) << "Loading the next library global with flag "
<< lt_dlopen_flag
<< "." << endl;
@@ -427,10 +426,10 @@
if ( libfile.isEmpty() )
return 0;
- lt_dlhandle handle = lt_dlopen( libfile.latin1() );
+ void *handle = dlopen( libfile.latin1(), lt_dlopen_flag );
if ( !handle )
{
- const char* errmsg = lt_dlerror();
+ const char* errmsg = dlerror();
if(errmsg)
d->errorMessage = QString::fromLatin1(errmsg);
else
@@ -571,7 +570,7 @@
#endif
deleted_one = true;
- lt_dlclose(wrap->handle);
+ dlclose(wrap->handle);
d->pending_close.removeRef(wrap);
/* loaded_stack is AutoDelete, so wrap is freed */
d->loaded_stack.remove();
diff -uNr kdelibs-3.1.4.old/kinit/kinit.cpp kdelibs-3.1.4/kinit/kinit.cpp
--- kdelibs-3.1.4.old/kinit/kinit.cpp 2003-12-03 14:43:39 +0300
+++ kdelibs-3.1.4/kinit/kinit.cpp 2003-12-03 15:28:46 +0300
@@ -59,7 +59,6 @@
#include <klocale.h>
#include <kstartupinfo.h>
-#include "ltdl.h"
#include "klauncher_cmds.h"
#ifdef Q_WS_X11
@@ -67,6 +66,8 @@
#include <X11/Xatom.h>
#endif
+#include <dlfcn.h>
+#if 0 /* cut */
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
@@ -80,6 +81,7 @@
# define LTDL_GLOBAL 0
# endif
#endif
+#endif /* cut */
#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
# include <crt_externs.h>
@@ -121,8 +123,8 @@
pid_t launcher_pid;
pid_t my_pid;
int n;
- lt_dlhandle handle;
- lt_ptr sym;
+ void* handle;
+ void* sym;
char **argv;
int (*func)(int, char *[]);
int (*launcher_func)(int);
@@ -478,10 +480,10 @@
if ( !libpath.isEmpty())
{
- d.handle = lt_dlopen( QFile::encodeName(libpath) );
+ d.handle = dlopen( QFile::encodeName(libpath), lt_dlopen_flag );
if (!d.handle )
{
- const char * ltdlError = lt_dlerror();
+ const char * ltdlError = dlerror();
if (execpath.isEmpty())
{
// Error
@@ -517,13 +519,13 @@
if (!launcher)
{
- d.sym = lt_dlsym( d.handle, "kdemain");
+ d.sym = dlsym( d.handle, "kdemain");
if (!d.sym )
{
- d.sym = lt_dlsym( d.handle, "main");
+ d.sym = dlsym( d.handle, "main");
if (!d.sym )
{
- const char * ltdlError = lt_dlerror();
+ const char * ltdlError = dlerror();
fprintf(stderr, "Could not find main: %s\n", ltdlError != 0 ? ltdlError : "(null)" );
QString errorMsg = i18n("Could not find 'main' in '%1'.\n%2").arg(libpath)
.arg(ltdlError ? QFile::decodeName(ltdlError) : i18n("Unknown error"));
@@ -551,10 +553,10 @@
}
else
{
- d.sym = lt_dlsym( d.handle, "start_launcher");
+ d.sym = dlsym( d.handle, "start_launcher");
if (!d.sym )
{
- const char * ltdlError = lt_dlerror();
+ const char * ltdlError = dlerror();
fprintf(stderr, "Could not find start_launcher: %s\n", ltdlError != 0 ? ltdlError : "(null)" );
d.result = 1; // Error
write(d.fd[1], &d.result, 1);
@@ -1290,13 +1292,15 @@
extra_path += dir;
}
+#if 0
if (lt_dlinit())
{
const char * ltdlError = lt_dlerror();
fprintf(stderr, "can't initialize dynamic loading: %s\n", ltdlError != 0 ? ltdlError : "(null)" );
}
+#endif
if (!extra_path.isEmpty())
- lt_dlsetsearchpath(extra_path.data());
+ setenv("LD_LIBRARY_PATH", extra_path.data(), true);
QCString display = getenv(DISPLAY);
if (display.isEmpty())
@@ -1520,7 +1524,7 @@
d.debug_wait = false;
d.launcher_ok = false;
d.lt_dlopen_flag = lt_dlopen_flag;
- lt_dlopen_flag |= LTDL_GLOBAL;
+ lt_dlopen_flag |= RTLD_GLOBAL;
init_signals();
if (keep_running)
@@ -1554,7 +1558,7 @@
QString konq = locate("lib", "libkonq.so", s_instance);
if (!konq.isEmpty())
{
- lt_dlhandle result = lt_dlopen(QFile::encodeName(konq).data());
+ void* result = dlopen(QFile::encodeName(konq).data(), lt_dlopen_flag);
}
}
diff -uNr kdelibs-3.1.4.old/kinit/kioslave.cpp kdelibs-3.1.4/kinit/kioslave.cpp
--- kdelibs-3.1.4.old/kinit/kioslave.cpp 2002-01-23 09:28:28 +0300
+++ kdelibs-3.1.4/kinit/kioslave.cpp 2003-12-03 15:28:57 +0300
@@ -31,8 +31,8 @@
#include <qstring.h>
-#include "ltdl.h"
-
+#include <dlfcn.h>
+#if 0 /* cut */
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
@@ -46,6 +46,7 @@
# define LTDL_GLOBAL 0
# endif
#endif
+#endif /* cut */
int main(int argc, char **argv)
{
@@ -61,23 +62,22 @@
fprintf(stderr, "library path is empty.\n");
exit(1);
}
- lt_dlinit();
- lt_dlhandle handle = lt_dlopen( libpath.data() );
+ void* handle = dlopen( libpath.data(), RTLD_LAZY );
if (!handle )
{
- const char * ltdlError = lt_dlerror();
+ const char * ltdlError = dlerror();
fprintf(stderr, "could not open %s: %s", libpath.data(), ltdlError != 0 ? ltdlError : "(null)" );
exit(1);
}
- lt_ptr sym = lt_dlsym( handle, "kdemain");
+ void* sym = dlsym( handle, "kdemain");
if (!sym )
{
- sym = lt_dlsym( handle, "main");
+ sym = dlsym( handle, "main");
if (!sym )
{
- const char * ltdlError = lt_dlerror();
+ const char * ltdlError = dlerror();
fprintf(stderr, "Could not find main: %s\n", ltdlError != 0 ? ltdlError : "(null)" );
exit(1);
}
diff -uNr kdelibs-3.1.4.old/kio/kio/kimageio.cpp kdelibs-3.1.4/kio/kio/kimageio.cpp
--- kdelibs-3.1.4.old/kio/kio/kimageio.cpp 2003-07-01 13:15:38 +0400
+++ kdelibs-3.1.4/kio/kio/kimageio.cpp 2003-12-03 15:03:28 +0300
@@ -17,7 +17,7 @@
#include <qregexp.h>
#include <qvaluelist.h>
-#include <ltdl.h>
+#include <dlfcn.h>
#include "kimageio.h"
#include "kimageiofactory.h"
#include <klocale.h>
@@ -109,10 +109,10 @@
iio->setStatus(1); // Error
return;
}
- lt_dlhandle libhandle = lt_dlopen( libpath.ascii() );
+ void *libhandle = dlopen( libpath.ascii(), RTLD_LAZY );
if (libhandle == 0) {
iio->setStatus(1); // error
- kdWarning() << "KImageIOFormat::callLibFunc: couldn't dlopen " << mLib << "(" << lt_dlerror() << ")" << endl;
+ kdWarning() << "KImageIOFormat::callLibFunc: couldn't dlopen " << mLib << "(" << dlerror() << ")" << endl;
return;
}
bLibLoaded = true;
@@ -120,22 +120,22 @@
if (bRead)
{
funcName = "kimgio_"+mType.lower()+"_read";
- lt_ptr func = lt_dlsym(libhandle, funcName.ascii());
+ void *func = dlsym(libhandle, funcName.ascii());
if (func == NULL) {
iio->setStatus(1); // error
- kdWarning() << "couln't find " << funcName << " (" << lt_dlerror() << ")" << endl;
+ kdWarning() << "couln't find " << funcName << " (" << dlerror() << ")" << endl;
}
mReadFunc = (void (*)(QImageIO *))func;
}
if (bWrite)
{
funcName = "kimgio_"+mType.lower()+"_write";
- lt_ptr func = lt_dlsym(libhandle, funcName.ascii());
+ void *func = dlsym(libhandle, funcName.ascii());
if (func == NULL) {
iio->setStatus(1); // error
- kdWarning() << "couln't find " << funcName << " (" << lt_dlerror() << ")" << endl;
+ kdWarning() << "couln't find " << funcName << " (" << dlerror() << ")" << endl;
}
mWriteFunc = (void (*)(QImageIO *))func;
}
@@ -171,11 +171,19 @@
if (!formatList)
{
kiioflsd.setObject( formatList, new KImageIOFormatList());
- lt_dlinit(); // Do this only once!
// Add rPaths.
+ QString ld_library_path(getenv("LD_LIBRARY_PATH"));
+ if ( ! ld_library_path.isEmpty() )
+ ld_library_path.append( ':' );
for(QStringList::Iterator it = rPath.begin();
it != rPath.end(); ++it)
- lt_dladdsearchdir( (*it).ascii());
+ {
+ ld_library_path.append( *it );
+ ld_library_path.append( ':' );
+ }
+ if ( ld_library_path.right(1) == ":" )
+ ld_library_path.truncate( ld_library_path.length()-1 );
+ setenv("LD_LIBRARY_PATH", ld_library_path.ascii(), true );
}
load();
}