In the effort to reduce the pidgin dependencies, I wrote a patch to
dynamically load libfarstream only if it is installed. I never coded
with GObjects and so only during the testing to finish the patch I
realized that there is no need to modify the code. Only the package
dependencies should be reworked. In fact libpurple depends on
libfarstream (855kB), that depends on the gstreamer plugins (65,5MB),
but they are dynamically loaded only if installed[1] and they are needed
only to make voice and video calls with Gtalk (only voice with finch).

I patched the libfarsteram package and tested it with pidgin on a Gtalk
account. No crash or errors reported and the voice/video calls menu
entries are disabled but visible. The farstream transmitters plugins
are loaded dynamically too, so there is no need to install gssdp,
gupnp, nice and soup libraries if they are not used.

I also patched the pidgin package to remove the gconf dependency, as it
is needed only with Gnome (that installs it) to get the automatic
configuration[2] for audio, video and url-handlers. Also the finch
package uses gconf for audio configuration, while the libpurple package
uses gconf for the proxy one. Finally finch does not require
pidgin-data (25,7MB), but it is used only if installed for sounds,
translations and the /etc/purple/prefs.xml file (that should go instead
in the libpurple package).

The patch attached should fix the bug, reducing by 2/3 the disk space
requirements for pidgin (36,9MB / 10 packages instead of 102,4MB / 78
packages) and by 9/10 for finch (9,1MB / 8 packages instead of
100,3MB / 77 packages). The depends fields are replaced with recommends
or suggests for the optional packages, conforming to the policy manual
rule 7.2. No breakage is excepted because since the 0.7.17 version of
Apt, the recommended packages are installed by default.

There are other packages that depend on libfarstream and that may need
to add the gstreamer plugins in the dependency fields (like empathy and
gajim) according to the changes, but I will provide patches later.

All the patches applies on the wheezy version, but the jessie packages
are affected too.

ciao

References:
1. http://lists.freedesktop.org/archives/farstream-devel/2012-April/000015.html
2. https://developer.pidgin.im/ticket/11191

Patches:
1. nogst: to be applied to the wheezy debian packages i386
2. backend_module: not useful, but included as reference (ver. 2.10.7)
diff -urN libfarstream/DEBIAN/control libfarstream-nogst/DEBIAN/control
--- libfarstream/DEBIAN/control	2012-04-08 01:48:13.000000000 +0200
+++ libfarstream-nogst/DEBIAN/control	2013-12-03 17:25:03.484908105 +0100
@@ -1,11 +1,13 @@
 Package: libfarstream-0.1-0
 Source: farstream
-Version: 0.1.2-1
+Version: 0.1.2-1+nogst
 Architecture: i386
 Maintainer: Debian Telepathy maintainers <pkg-telepathy-maintain...@lists.alioth.debian.org>
 Installed-Size: 855
 Pre-Depends: multiarch-support
-Depends: libc6 (>= 2.7), libglib2.0-0 (>= 2.31.8), libgssdp-1.0-3 (>= 0.12.0), libgstreamer-plugins-base0.10-0 (>= 0.10.33), libgstreamer0.10-0 (>= 0.10.33), libgupnp-1.0-4 (>= 0.18.0), libgupnp-igd-1.0-4 (>= 0.1.8), libnice10 (>= 0.1.0), libsoup2.4-1 (>= 2.4.0), libxml2 (>= 2.6.27), gstreamer0.10-plugins-base (>= 0.10.33), gstreamer0.10-plugins-good (>= 0.10.29), gstreamer0.10-plugins-bad (>= 0.10.17), gstreamer0.10-nice (>= 0.1.0)
+Depends: libc6 (>= 2.7), libglib2.0-0 (>= 2.31.8), libgstreamer-plugins-base0.10-0 (>= 0.10.33), libgstreamer0.10-0 (>= 0.10.33), libxml2 (>= 2.6.27)
+Recommends: libgssdp-1.0-3 (>= 0.12.0), libgupnp-1.0-4 (>= 0.18.0), libgupnp-igd-1.0-4 (>= 0.1.8), libnice10 (>= 0.1.0), libsoup2.4-1 (>= 2.4.0)
+Suggests: gstreamer0.10-plugins-base (>= 0.10.33), gstreamer0.10-plugins-good (>= 0.10.29), gstreamer0.10-plugins-bad (>= 0.10.17), gstreamer0.10-nice (>= 0.1.0)
 Conflicts: libgstfarsight0.10-0
 Replaces: libgstfarsight0.10-0
 Section: libs
@@ -20,3 +22,10 @@
  plugins.
  .
  This package provides the core Farstream library.
+ .
+ libnice10 is needed to use the nice and the raw udp transmitters and the
+ MSN Webcam plugin.
+ libgssdp-1.0-3, libgupnp-1.0-4, libgupnp-igd-1.0-4 and libsoup2.4-1 are needed
+ to use the raw udp transmitter.
+ GStreamer plugins are optional components that may be needed by the software
+ built with Farsteram.
diff -urN pidgin/DEBIAN/control pidgin-nogst/DEBIAN/control
--- pidgin/DEBIAN/control	2013-02-13 21:57:39.000000000 +0100
+++ pidgin-nogst/DEBIAN/control	2013-12-06 09:19:20.582410040 +0100
@@ -1,11 +1,11 @@
 Package: pidgin
-Version: 2.10.6-3
+Version: 2.10.6-3+nogst
 Architecture: i386
 Maintainer: Ari Pollak <a...@debian.org>
 Installed-Size: 2206
-Depends: pidgin-data (>= 2.10.6), pidgin-data (<< 2.10.6-z), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.7), libcairo2 (>= 1.2.4), libdbus-1-3 (>= 1.0.2), libdbus-glib-1-2 (>= 0.78), libfontconfig1 (>= 2.9.0), libfreetype6 (>= 2.2.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.24.0), libgstreamer0.10-0 (>= 0.10.10), libgtk2.0-0 (>= 2.24.0), libgtkspell0 (>= 2.0.10), libice6 (>= 1:1.0.0), libpango1.0-0 (>= 1.18.0), libpurple0 (>= 2.8.0), libsm6, libx11-6, libxml2 (>= 2.6.27), libxss1, gconf2 (>= 2.28.1-2), perl-base (>= 5.14.2-18), perlapi-5.14.2
-Recommends: gstreamer0.10-plugins-base, gstreamer0.10-plugins-good
-Suggests: libsqlite3-0 (>= 3.5.9)
+Depends: pidgin-data (>= 2.10.6), pidgin-data (<< 2.10.6-z), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.7), libcairo2 (>= 1.2.4), libdbus-1-3 (>= 1.0.2), libdbus-glib-1-2 (>= 0.78), libfontconfig1 (>= 2.9.0), libfreetype6 (>= 2.2.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.24.0), libgstreamer0.10-0 (>= 0.10.10), libgtk2.0-0 (>= 2.24.0), libgtkspell0 (>= 2.0.10), libice6 (>= 1:1.0.0), libpango1.0-0 (>= 1.18.0), libpurple0 (>= 2.8.0), libsm6, libx11-6, libxml2 (>= 2.6.27), libxss1, perl-base (>= 5.14.2-18), perlapi-5.14.2
+Recommends: gstreamer0.10-plugins-base, gstreamer0.10-plugins-bad, gstreamer0.10-plugins-good
+Suggests: gconf2 (>= 2.28.1-2), libsqlite3-0 (>= 3.5.9)
 Section: net
 Priority: optional
 Homepage: http://www.pidgin.im
@@ -18,3 +18,11 @@
  Some extra packages are suggested to use increased functionality:
   * libsqlite3-0:
     - To use Contact Availability Prediction plugin
+  * gstreamer0.10-plugins-base:
+    - To get sounds instead of the console beep
+  * gstreamer0.10-plugins-good:
+    - To make voice calls with Google Talk
+  * gstreamer0.10-plugins-bad:
+    - To make video calls with Google Talk
+  * gconf2:
+    - GNOME integration for the audio, video and browser settings
diff -urN finch/DEBIAN/control finch-nogst/DEBIAN/control
--- finch/DEBIAN/control	2013-02-13 21:58:02.000000000 +0100
+++ finch-nogst/DEBIAN/control	2013-12-06 09:19:35.906410444 +0100
@@ -4,8 +4,9 @@
 Architecture: i386
 Maintainer: Ari Pollak <a...@debian.org>
 Installed-Size: 784
-Depends: pidgin-data (>= 2.10.6), pidgin-data (<< 2.10.6-z), libc6 (>= 2.7), libglib2.0-0 (>= 2.24.0), libgstreamer0.10-0 (>= 0.10.10), libncursesw5 (>= 5.6+20070908), libpurple0 (>= 2.8.0), libtinfo5, libxml2 (>= 2.7.4)
-Suggests: libx11-6
+Depends: libc6 (>= 2.7), libglib2.0-0 (>= 2.24.0), libgstreamer0.10-0 (>= 0.10.10), libncursesw5 (>= 5.6+20070908), libpurple0 (>= 2.8.0), libtinfo5, libxml2 (>= 2.7.4)
+Recommends: pidgin-data (>= 2.10.6), pidgin-data (<< 2.10.6-z)
+Suggests: libx11-6, gstreamer0.10-plugins-base, gstreamer0.10-plugins-good
 Section: net
 Priority: optional
 Homepage: http://www.pidgin.im
@@ -16,5 +17,11 @@
  Bonjour, Groupwise, Sametime, SIMPLE, MySpaceIM, and MXit.
  .
  Some extra packages are suggested to use increased functionality:
+  * pidgin-data
+    - To get translated messages and sounds
   * libx11-6
-    - To use the Clipboard and/or Toaster plugins.
+    - To use the Clipboard and/or Toaster plugins
+  * gstreamer0.10-plugins-base:
+    - To get sounds instead of the console beep
+  * gstreamer0.10-plugins-good:
+    - To make voice calls with Google Talk
diff -ur ./libpurple/Makefile.am ./libpurple/Makefile.am
--- ./libpurple/Makefile.am	2013-02-11 10:16:51.000000000 +0100
+++ ./libpurple/Makefile.am	2013-11-29 08:39:14.000000000 +0100
@@ -53,7 +53,6 @@
 	idle.c \
 	imgstore.c \
 	log.c \
-	media/backend-fs2.c \
 	media/backend-iface.c \
 	media/candidate.c \
 	media/codec.c \
@@ -313,6 +312,12 @@
 	ciphers/libpurple-ciphers.la \
 	-lm
 
+fs2dir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION)/backends
+fs2_LTLIBRARIES = fs2.la
+fs2_la_SOURCES = media/backend-fs2.c
+fs2_la_LDFLAGS = -module -avoid-version
+fs2_la_LIBADD = $(GLIB_LIBS) $(FARSTREAM_LIBS) $(GSTREAMER_LIBS) $(GSTINTERFACES_LIBS)
+
 AM_CPPFLAGS = \
 	-DDATADIR=\"$(datadir)\" \
 	-DLIBDIR=\"$(libdir)/purple-$(PURPLE_MAJOR_VERSION)/\" \
diff -ur ./libpurple/media.c ./libpurple/media.c
--- ./libpurple/media.c	2013-02-11 10:16:51.000000000 +0100
+++ ./libpurple/media.c	2013-11-29 08:52:43.053959562 +0100
@@ -33,7 +33,9 @@
 #include "debug.h"
 
 #ifdef USE_GSTREAMER
+#ifdef BACKEND_DEBUG
 #include "media/backend-fs2.h"
+#endif
 #include "marshallers.h"
 #include "media-gst.h"
 #endif
@@ -578,7 +580,7 @@
 GstElement *
 purple_media_get_src(PurpleMedia *media, const gchar *sess_id)
 {
-#ifdef USE_VV
+#if defined(USE_VV) && defined(BACKEND_DEBUG)
 	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
 
 	if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend))
@@ -1357,7 +1359,7 @@
 void purple_media_set_input_volume(PurpleMedia *media,
 		const gchar *session_id, double level)
 {
-#ifdef USE_VV
+#if defined(USE_VV) && defined(BACKEND_DEBUG)
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
 	g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend));
 
@@ -1372,7 +1374,7 @@
 		const gchar *session_id, const gchar *participant,
 		double level)
 {
-#ifdef USE_VV
+#if defined(USE_VV) && defined(BACKEND_DEBUG)
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
 	g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend));
 
@@ -1424,7 +1426,7 @@
 purple_media_get_tee(PurpleMedia *media,
 		const gchar *session_id, const gchar *participant)
 {
-#ifdef USE_VV
+#if defined(USE_VV) && defined(BACKEND_DEBUG)
 	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
 
 	if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend))
diff -ur ./libpurple/mediamanager.c ./libpurple/mediamanager.c
--- ./libpurple/mediamanager.c	2013-02-11 10:16:51.000000000 +0100
+++ ./libpurple/mediamanager.c	2013-11-26 05:42:44.810280574 +0100
@@ -84,6 +84,7 @@
 	GList *elements;
 	GList *output_windows;
 	gulong next_output_window_id;
+	GModule *backend_module;
 	GType backend_type;
 	GstCaps *video_caps;
 
@@ -170,12 +171,26 @@
 static void
 purple_media_manager_init (PurpleMediaManager *media)
 {
+#define MODULE_FS2_FILENAME	LIBDIR "backends/fs2.so"
+	GType (*purple_media_backend_fs2_get_type)(void);
+
 	media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media);
 	media->priv->medias = NULL;
 	media->priv->next_output_window_id = 1;
-#ifdef USE_VV
-	media->priv->backend_type = PURPLE_TYPE_MEDIA_BACKEND_FS2;
-#endif
+
+	/* dynamically load the media backend */
+	media->priv->backend_module = g_module_open (MODULE_FS2_FILENAME, 0);
+
+	if (media->priv->backend_module) {
+		/* get the gobject public methods */
+		if (!g_module_symbol (media->priv->backend_module,
+				"purple_media_backend_fs2_get_type",
+				(gpointer *) &
+				purple_media_backend_fs2_get_type))
+			g_error ("error: %s", g_module_error ());
+		media->priv->backend_type = PURPLE_TYPE_MEDIA_BACKEND_FS2;
+	} else
+		media->priv->backend_type = G_TYPE_NONE;
 
 	purple_prefs_add_none("/purple/media");
 	purple_prefs_add_none("/purple/media/audio");
@@ -197,6 +212,8 @@
 			g_list_delete_link(priv->elements, priv->elements)) {
 		g_object_unref(priv->elements->data);
 	}
+	if (priv->backend_module)
+		g_module_close (priv->backend_module);
 	if (priv->video_caps)
 		gst_caps_unref(priv->video_caps);
 	parent_class->finalize(media);

Reply via email to