[Pkg-kde-talk] kopete and xmms for Sarge

Adeodato Simó asp16@alu.ua.es
Mon, 28 Mar 2005 13:08:23 +0200


--mP3DRpeJDSE+ciuQ
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

* Christopher Martin [Sun, 27 Mar 2005 18:41:27 -0500]:
> Hello team,

  Hi!

> By adding a copy of disable_no_undefined.diff, I got kdenetwork 3.3.2 to 
> build with the xmms/dlopen patch written by dato, and which is currently in 
> use as part of the 3.4 packages. I've made the necessary modifications to 
> the control, rules, changelog files, etc., but wanted feedback on whether 
> this should be committed to trunk.
  
  Curiously, when I first prepared the dlopen patch, I did it against 3.3.2,
  which resulted in me becoming a little frustrated with the build failures
  until I realized that it would work out of the box on 3.4 precisely because
  of disable_no_undefined.

  At the time I added the 'TODO: backport ...' to kdenetwork's changelog,
  I tried some Makefile tricks to get it to compile without having to apply
  disable_no_undefined to all of kdenetwork, which didn't feel appropriate 
  to me (in a "just fix important stuff" upload, that is).

  If others _really_ feel that a global disable_no_undefined is the way
  to go, fine with me; it's cleaner. I've nonetheless struggled another bit
  with Makefiles, and I attach a second solution that only changes the linker
  flags for kopete_nowlistening.la (sort of a "local disable_no_undefined").
  Patch attached, is basically the one in r712 with an extra hack in the
  Makefile.am hunk.
  
  So, one of the two solutions can be committed, and the upload happen.

  Cheers,

-- 
Adeodato Simó
    EM: asp16 [ykwim] alu.ua.es | PK: DA6AE621
    Listening to: Placebo - Bulletproof Cupid
 
Hanlon's Razor: Never attribute to malice that which is adequately
explained by stupidity.

--mP3DRpeJDSE+ciuQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="kopete_dlopen_3.3.diff"

--- a/kopete/plugins/nowlistening/Makefile.am
+++ b/kopete/plugins/nowlistening/Makefile.am
@@ -5,8 +5,9 @@
 kde_module_LTLIBRARIES = kopete_nowlistening.la kcm_kopete_nowlistening.la

 kopete_nowlistening_la_SOURCES = nowlisteningconfig.cpp nowlisteningplugin.cpp nlkscd.cpp nlnoatun.cpp nlxmms.cpp nowlisteningguiclient.cpp nljuk.cpp nlamarok.cpp nlkaffeine.cpp
-kopete_nowlistening_la_LDFLAGS     = -module $(KDE_PLUGIN)
-kopete_nowlistening_la_LIBADD      = ../../libkopete/libkopete.la $(XMMS_LIBS)
+coma = ,
+kopete_nowlistening_la_LDFLAGS     = -module $(subst $(KDE_NO_UNDEFINED),,$(KDE_PLUGIN))
+kopete_nowlistening_la_LIBADD      = ../../libkopete/libkopete.la

 kcm_kopete_nowlistening_la_SOURCES = nowlisteningprefs.ui nowlisteningpreferences.cpp nowlisteningconfig.cpp
 kcm_kopete_nowlistening_la_LDFLAGS = -module -no-undefined $(KDE_PLUGIN) $(all_libraries)
--- a/kopete/plugins/nowlistening/nlxmms.h~
+++ b/kopete/plugins/nowlistening/nlxmms.h
@@ -31,7 +31,11 @@
 {
 	public:
 		NLXmms();
+		~NLXmms();
 		virtual void update();
+
+	private:
+		void *xmmslib;
 };
 
 #endif
--- a/kopete/plugins/nowlistening/nlxmms.cpp~
+++ b/kopete/plugins/nowlistening/nlxmms.cpp
@@ -26,19 +26,28 @@
 
+#include <dlfcn.h>
 #include <kdebug.h>
 #include <xmmsctrl.h> // need to fix Makefile.am for this?
 #include "nlmediaplayer.h"
 #include "nlxmms.h"
 
 NLXmms::NLXmms() : NLMediaPlayer()
 {
 	m_name = "Xmms";
+
+	xmmslib = dlopen("libxmms.so.1", RTLD_LAZY | RTLD_GLOBAL);
 }
 
+NLXmms::~NLXmms()
+{
+	if (xmmslib)
+		dlclose(xmmslib);
+}
 
 void NLXmms::update()
 {
 	//look for running xmms
-	if ( xmms_remote_get_version( 0 ) )
+	if ( xmmslib &&
+		 xmms_remote_get_version( 0 ) )
 	{
 		QString newTrack;
 		// see if it's playing

--mP3DRpeJDSE+ciuQ--