[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kinit
From:       Kevin Ottens <ervin () kde ! org>
Date:       2010-02-24 17:06:03
Message-ID: 1267031163.784987.23370.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1095611 by ervin:

Dynamic kdeinit4, which needs to link only on kdecore and kdeui. The
rest is dlopened depending what it finds installed.


 M  +3 -3      CMakeLists.txt  
 M  +29 -21    kinit.cpp  


--- trunk/KDE/kdelibs/kinit/CMakeLists.txt #1095610:1095611
@@ -30,10 +30,10 @@
 ########### kdeinit4 ###############
 if (WIN32)
   set(kdeinit_SRCS kinit_win.cpp klauncher_cmds.cpp )
-  set(kdeinit_LIBS kparts psapi)
+  set(kdeinit_LIBS psapi)
 else (WIN32)
   set(kdeinit_SRCS kinit.cpp proctitle.cpp klauncher_cmds.cpp )
-  set(kdeinit_LIBS kparts)
+  set(kdeinit_LIBS "")
 endif (WIN32)
 
 if (APPLE OR WIN32)
@@ -44,7 +44,7 @@
   kde4_add_executable(kdeinit4 NOGUI ${kdeinit_SRCS})
 endif (APPLE OR WIN32)
 
-target_link_libraries(kdeinit4 ${KDE4_KDECORE_LIBS} ${kdeinit_LIBS} ${KINIT_SOCKET_LIBRARY} )
+target_link_libraries(kdeinit4 ${KDE4_KDEUI_LIBS} ${kdeinit_LIBS} ${KINIT_SOCKET_LIBRARY} )
 if (Q_WS_X11)
   target_link_libraries(kdeinit4 ${X11_X11_LIB})
 endif(Q_WS_X11)
--- trunk/KDE/kdelibs/kinit/kinit.cpp #1095610:1095611
@@ -87,6 +87,16 @@
 #include <kstartupinfo.h>
 #endif
 
+#ifdef Q_WS_X11
+static const char *extra_libs[] = {
+    "libkio.so.5",
+    "libkparts.so.4",
+#ifdef __KDE_HAVE_GCC_VISIBILITY
+    "libplasma.so.3"
+#endif
+};
+#endif
+
 // #define SKIP_PROCTITLE 1
 
 extern char **environ;
@@ -153,13 +163,6 @@
 }
 #endif
 
-/* These are to link libkparts even if 'smart' linker is used */
-#include <kparts/plugin.h>
-extern "C" KParts::Plugin* _kinit_init_kparts() { return new KParts::Plugin(); }
-/* These are to link libkio even if 'smart' linker is used */
-#include <kio/authinfo.h>
-extern "C" KIO::AuthInfo* _kioslave_init_kio() { return new KIO::AuthInfo(); }
-
 #ifdef KDEINIT_OOM_PROTECT
 static int oom_pipe = -1;
 #endif
@@ -1743,21 +1746,26 @@
       init_kdeinit_socket();
    }
 #ifdef Q_WS_X11
-   if (!d.suicide && qgetenv("KDE_IS_PRELINKED").isEmpty())
-   {
-#ifdef __KDE_HAVE_GCC_VISIBILITY
-       QString extra = KStandardDirs::locate("lib", QLatin1String("libplasma.so.3"), *s_instance);
-#else
-       QString extra;
+    if (!d.suicide && qgetenv("KDE_IS_PRELINKED").isEmpty()) {
+        const int extrasCount = sizeof(extra_libs)/sizeof(extra_libs[0]);
+        for (int i=0; i<extrasCount; i++) {
+            QString extra = KStandardDirs::locate("lib", QLatin1String(extra_libs[i]), *s_instance);
+
+            // can't use KLibLoader here as it would unload the library
+            // again
+            if (!extra.isEmpty()) {
+                QLibrary l(extra);
+                l.setLoadHints(QLibrary::ExportExternalSymbolsHint);
+                l.load();
+            }
+#ifndef NDEBUG
+            else {
+                fprintf( stderr, "%s was not found.\n", extra_libs[i] );
+            }
 #endif
-       // can't use KLibLoader here as it would unload the library
-       // again
-       if (!extra.isEmpty()) {
-           QLibrary l(extra);
-           l.setLoadHints(QLibrary::ExportExternalSymbolsHint);
-           l.load();
-       }
-   }
+
+        }
+    }
 #endif
    if (launch_klauncher)
    {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic