Package: gtkpod
Version: 2.1.1-1
Severity: wishlist
Tags: patch

Am 10.02.2012 14:42, schrieb Fabian Greffrath:
What was the purpose of this plugin? I mean, isn't gtkpod able to
dlopen() libmp4v2 anyway and thus use it when it is there without
explicit linking? Was the reveerted plugin explicitely linked against
libmp4v2 and thus caused the infamous MPL<->GPL license clash?

It seems that when filetype support got refactored into individual plugins, an "if HAVE_MP4" conditional was added around the relevant code in the plugins/filetype_{m4a,mp4}/Makefile.am files. This caused the filetype support plugin to only get compiled when libmp4v2 was detected at configure time, instead of the unconditional attempt to try loading the library that was carried out when the code was still in libgtkpod/mp4file.c.

I have applied the attached patch to the gtkpod 2.1.1 Debian package (please note that I added just another SONAME, because the libmp4v2 Debian package is already at 2), ran autoreconf and rebuilt it, all without libmp4v2-dev installed. The m4a and mp4 plugins were built fine and got installed into the resulting binary package:

$ dpkg -c ../gtkpod_2.1.1-1_i386.deb | egrep 'm4a|mp4'
-rw-r--r-- root/root 21108 2012-02-10 15:23 ./usr/lib/gtkpod/libfiletype_m4a.so -rw-r--r-- root/root 20032 2012-02-10 15:23 ./usr/lib/gtkpod/libfiletype_mp4.so -rw-r--r-- root/root 395 2012-02-10 15:23 ./usr/lib/gtkpod/filetype_m4a.plugin -rw-r--r-- root/root 400 2012-02-10 15:23 ./usr/lib/gtkpod/filetype_mp4.plugin

I could install the gtkpod packages, start the application and explicitely activate the plugins in the corresponding preferences menu. I didn't test any further, though.

Please note that dh_shlibdeps gave warnings like "dpkg-shlibdeps: warning: debian/gtkpod/usr/lib/gtkpod/libfiletype_m4a.so contains an unresolvable reference to symbol dlopen: it's probably a plugin." for both plugins, so maybe a line like "libfiletype_{m4a,mp4}_la_LIBADD = -ldl" should get added to the appropriate Makefile.am files.

Hope that helps,
Fabian

--- gtkpod-2.1.1.orig/plugins/filetype_m4a/Makefile.am
+++ gtkpod-2.1.1/plugins/filetype_m4a/Makefile.am
@@ -19,7 +19,7 @@ filetype_m4a_plugin_DATA =
 
 SUBDIRS =
 
-if HAVE_M4A
+#if HAVE_M4A
 
 include ../plugins.mk
 filetype_m4a.plugin: build-plugin-file
@@ -40,7 +40,7 @@ libfiletype_m4a_la_LIBADD = \
     $(GTKPOD_LIBS) \
     $(LIBANJUTA_LIBS)
 
-endif
+#endif
 
 EXTRA_DIST = \
 	$(plugin_file).in \
--- gtkpod-2.1.1.orig/plugins/filetype_m4a/mp4file.c
+++ gtkpod-2.1.1/plugins/filetype_m4a/mp4file.c
@@ -317,13 +317,17 @@ static MP4TagsFree_t MP4TagsFreeFunc = N
 /* mp4v2 initialization code */
 
 void mp4_init() {
-    mp4v2_handle = dlopen("libmp4v2.so.1", RTLD_LAZY);
+    mp4v2_handle = dlopen("libmp4v2.so.2", RTLD_LAZY);
 
     if (!mp4v2_handle) {
-        mp4v2_handle = dlopen("libmp4v2.so.0", RTLD_LAZY);
+        mp4v2_handle = dlopen("libmp4v2.so.1", RTLD_LAZY);
 
         if (!mp4v2_handle) {
-            return;
+            mp4v2_handle = dlopen("libmp4v2.so.0", RTLD_LAZY);
+
+            if (!mp4v2_handle) {
+                return;
+            }
         }
     }
 
--- gtkpod-2.1.1.orig/plugins/filetype_mp4/Makefile.am
+++ gtkpod-2.1.1/plugins/filetype_mp4/Makefile.am
@@ -19,7 +19,7 @@ filetype_mp4_plugin_DATA =
 
 SUBDIRS =
 
-if HAVE_MP4
+#if HAVE_MP4
 
 include ../plugins.mk
 filetype_mp4.plugin: build-plugin-file
@@ -39,7 +39,7 @@ libfiletype_mp4_la_LIBADD = \
     $(GTKPOD_LIBS) \
     $(LIBANJUTA_LIBS)
 
-endif
+#endif
 
 EXTRA_DIST = \
 	$(plugin_file).in \
--- gtkpod-2.1.1.orig/plugins/filetype_mp4/mp4file.c
+++ gtkpod-2.1.1/plugins/filetype_mp4/mp4file.c
@@ -317,13 +317,17 @@ static MP4TagsFree_t MP4TagsFreeFunc = N
 /* mp4v2 initialization code */
 
 void mp4_init() {
-    mp4v2_handle = dlopen("libmp4v2.so.1", RTLD_LAZY);
+    mp4v2_handle = dlopen("libmp4v2.so.2", RTLD_LAZY);
 
     if (!mp4v2_handle) {
-        mp4v2_handle = dlopen("libmp4v2.so.0", RTLD_LAZY);
+        mp4v2_handle = dlopen("libmp4v2.so.1", RTLD_LAZY);
 
         if (!mp4v2_handle) {
-            return;
+            mp4v2_handle = dlopen("libmp4v2.so.0", RTLD_LAZY);
+
+            if (!mp4v2_handle) {
+                return;
+            }
         }
     }
 

Reply via email to