totem-pl-parser r251 - in trunk: . plparse



Author: hadess
Date: Wed Nov  5 17:15:39 2008
New Revision: 251
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=251&view=rev

Log:
2008-11-05  Bastien Nocera  <hadess hadess net>

	* configure.in:
	* plparse/totem-pl-parser-podcast.c (totem_pl_parser_add_rss),
	(totem_pl_parser_add_itpc), (totem_pl_parser_add_zune),
	(totem_pl_parser_add_atom), (totem_pl_parser_add_xml_feed),
	(totem_pl_parser_add_itms), (totem_pl_parser_add_opml):
	* plparse/totem-pl-parser-podcast.h:
	* plparse/totem-pl-parser.c (totem_pl_parser_parse_date):
	* totem-plparser.pc.in: Adapt patch from Ivan Frade
	<ivan frade nokia com> to make libcamel optional for some
	"embedded" platforms. This is absolutely unsupported and
	any general purpose distribution shipping with libcamel
	disabled will be kicked in the knackers
	forcefully (Closes: #522639)



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/plparse/totem-pl-parser-podcast.c
   trunk/plparse/totem-pl-parser-podcast.h
   trunk/plparse/totem-pl-parser.c
   trunk/totem-plparser.pc.in

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Wed Nov  5 17:15:39 2008
@@ -36,6 +36,7 @@
 
 # Requirements
 GLIB_REQS=2.16.3
+GIO_REQS=2.17.3
 DBUS_REQS=0.61
 
 # Before making a release, the PLPARSER_LT_VERSION string should be modified.
@@ -55,8 +56,46 @@
 AC_SUBST(TOTEM_PL_PARSER_VERSION_MINOR)
 AC_SUBST(TOTEM_PL_PARSER_VERSION_MICRO)
 
+pkg_modules="glib-2.0 >= $GLIB_REQS gtk+-2.0 libxml-2.0 gthread-2.0 gio-2.0 >= $GIO_REQS"
+
+##################################
+# Checking libcamel dependency
+##################################
+camel_message=""
+
+AC_ARG_ENABLE(camel-i-know-what-im-doing,
+	      AS_HELP_STRING([--disable-camel-i-know-what-im-doing],
+			     [Disable libcamel (Unsupported, breaks Podcast support).]),
+			     [enable_camel=no],
+			     [enable_camel=yes])
+
+if test "x$enable_camel" = "xyes" ; then
+   PKG_CHECK_MODULES(LIBCAMEL,  
+		     camel-1.2,
+                     [have_camel=yes], 
+                     [have_camel=no])
+
+   if test "x$have_camel" = "xyes" ; then
+      AC_SUBST(LIBCAMEL, camel-1.2)
+      AC_SUBST(USELIBCAMEL, yes)
+      AC_DEFINE(HAVE_CAMEL, 1, [Camel available in the system])
+      pkg_modules="$pkg_modules camel-1.2"
+   else
+      AC_MSG_ERROR([libcamel is required to compile totem-pl-parser.])
+   fi
+else
+   AC_SUBST(USELIBCAMEL, no)
+   camel_message="
+ **************************************************************
+ Compiling totem-pl-parser without libcamel.
+ This will break podcast support and is completely unsupported.
+ **************************************************************"
+fi
+
 dnl Check for packages for building libtotem-plparser.la
-PKG_CHECK_MODULES(TOTEM_PLPARSER, [glib-2.0 >= $GLIB_REQS gtk+-2.0 libxml-2.0 camel-1.2 gio-2.0 >= 2.17.5])
+PKG_CHECK_MODULES(TOTEM_PLPARSER, [$pkg_modules])
+AC_SUBST(TOTEM_PLPARSER_CFLAGS)
+AC_SUBST(TOTEM_PLPARSER_LIBS)
 
 PKG_CHECK_MODULES([TOTEM_PLPARSER_MINI], [gio-2.0])
 
@@ -83,7 +122,7 @@
 
 GTK_DOC_CHECK(1.0)
 
-AC_OUTPUT([
+AC_CONFIG_FILES([
 Makefile
 totem-plparser.pc
 totem-plparser-uninstalled.pc
@@ -99,3 +138,9 @@
 docs/reference/version.xml
 ])
 
+
+AC_OUTPUT
+
+echo "
+$camel_message
+"

Modified: trunk/plparse/totem-pl-parser-podcast.c
==============================================================================
--- trunk/plparse/totem-pl-parser-podcast.c	(original)
+++ trunk/plparse/totem-pl-parser-podcast.c	Wed Nov  5 17:15:39 2008
@@ -235,6 +235,9 @@
 			 GFile *base_file,
 			 gpointer data)
 {
+#ifndef HAVE_CAMEL
+	WARN_NO_CAMEL;
+#else
 	xml_node_t* doc, *channel;
 	char *contents;
 	gsize size;
@@ -274,6 +277,7 @@
 	xml_parser_free_tree (doc);
 
 	return TOTEM_PL_PARSER_RESULT_SUCCESS;
+#endif /* !HAVE_CAMEL */
 }
 
 /* http://www.apple.com/itunes/store/podcaststechspecs.html */
@@ -283,6 +287,9 @@
 			  GFile *base_file,
 			  gpointer data)
 {
+#ifndef HAVE_CAMEL
+	WARN_NO_CAMEL;
+#else
 	TotemPlParserResult ret;
 	char *url, *new_url, *uri_scheme;
 	GFile *new_file;
@@ -301,6 +308,7 @@
 	g_object_unref (new_file);
 
 	return ret;
+#endif /* !HAVE_CAMEL */
 }
 
 TotemPlParserResult
@@ -309,6 +317,9 @@
 			  GFile *base_file,
 			  gpointer data)
 {
+#ifndef HAVE_CAMEL
+	WARN_NO_CAMEL;
+#else
 	TotemPlParserResult ret;
 	char *url, *new_url;
 	GFile *new_file;
@@ -335,6 +346,7 @@
 	g_object_unref (new_file);
 
 	return ret;
+#endif /* !HAVE_CAMEL */
 }
 
 /* Atom docs:
@@ -473,6 +485,9 @@
 			  GFile *base_file,
 			  gpointer data)
 {
+#ifdef HAVE_CAMEL
+	WARN_NO_CAMEL;
+#else
 	xml_node_t* doc;
 	char *contents, *url;
 	gsize size;
@@ -501,6 +516,7 @@
 	xml_parser_free_tree (doc);
 
 	return TOTEM_PL_PARSER_RESULT_SUCCESS;
+#endif /* !HAVE_CAMEL */
 }
 
 TotemPlParserResult
@@ -509,6 +525,9 @@
 			      GFile *base_file,
 			      gpointer data)
 {
+#ifndef HAVE_CAMEL
+	WARN_NO_CAMEL;
+#else
 	guint len;
 
 	if (data == NULL)
@@ -524,6 +543,7 @@
 		return totem_pl_parser_add_opml (parser, file, base_file, data);
 
 	return TOTEM_PL_PARSER_RESULT_UNHANDLED;
+#endif /* !HAVE_CAMEL */
 }
 
 /* From libgsf's gsf-utils.h */
@@ -694,6 +714,9 @@
 			  GFile *base_file,
 			  gpointer data)
 {
+#ifndef HAVE_CAMEL
+	WARN_NO_CAMEL;
+#else
 	char *contents, *uncompressed, *itms_url;
 	GFile *itms_file, *feed_url;
 	TotemPlParserResult ret;
@@ -741,6 +764,7 @@
 	g_object_unref (feed_url);
 
 	return ret;
+#endif /* !HAVE_CAMEL */
 }
 
 gboolean
@@ -836,6 +860,9 @@
 			  GFile *base_file,
 			  gpointer data)
 {
+#ifndef HAVE_CAMEL
+	WARN_NO_CAMEL;
+#else
 	xml_node_t* doc;
 	char *contents, *url;
 	gsize size;
@@ -864,6 +891,7 @@
 	xml_parser_free_tree (doc);
 
 	return TOTEM_PL_PARSER_RESULT_SUCCESS;
+#endif /* !HAVE_CAMEL */
 }
 
 #endif /* !TOTEM_PL_PARSER_MINI */

Modified: trunk/plparse/totem-pl-parser-podcast.h
==============================================================================
--- trunk/plparse/totem-pl-parser-podcast.h	(original)
+++ trunk/plparse/totem-pl-parser-podcast.h	Wed Nov  5 17:15:39 2008
@@ -37,6 +37,14 @@
 const char * totem_pl_parser_is_xml_feed (const char *data, gsize len);
 
 #ifndef TOTEM_PL_PARSER_MINI
+
+#ifndef HAVE_CAMEL
+#define WARN_NO_CAMEL { \
+	g_warning("Trying to parse a podcast, but totem-pl-parser built without libcamel support. Please contact your distribution provider."); \
+	return TOTEM_PL_PARSER_RESULT_ERROR; \
+}
+#endif /* !HAVE_CAMEL */
+
 gboolean totem_pl_parser_is_itms_feed (GFile *file);
 
 TotemPlParserResult totem_pl_parser_add_xml_feed (TotemPlParser *parser,

Modified: trunk/plparse/totem-pl-parser.c
==============================================================================
--- trunk/plparse/totem-pl-parser.c	(original)
+++ trunk/plparse/totem-pl-parser.c	Wed Nov  5 17:15:39 2008
@@ -104,7 +104,10 @@
 #ifndef TOTEM_PL_PARSER_MINI
 #include <gobject/gvaluecollector.h>
 #include <gtk/gtk.h>
+
+#ifdef HAVE_CAMEL
 #include <camel/camel-mime-utils.h>
+#endif
 
 #include "totem-pl-parser.h"
 #include "totemplparser-marshal.h"
@@ -1756,6 +1759,7 @@
 	return -1;
 }
 
+
 /**
  * totem_pl_parser_parse_date:
  * @date_str: the date string to parse
@@ -1769,6 +1773,7 @@
 guint64
 totem_pl_parser_parse_date (const char *date_str, gboolean debug)
 {
+#ifdef HAVE_CAMEL
 	GTimeVal val;
 
 	g_return_val_if_fail (date_str != NULL, -1);
@@ -1780,11 +1785,12 @@
 		return val.tv_sec;
 	}
 	D(g_message ("Failed to parse duration '%s' using the ISO8601 parser", date_str));
-
 	/* Fall back to RFC 2822 date parsing */
 	return camel_header_decode_date (date_str, NULL);
+#else
+	WARN_NO_CAMEL;
+#endif /* HAVE_CAMEL */
 }
-
 #endif /* !TOTEM_PL_PARSER_MINI */
 
 static char *

Modified: trunk/totem-plparser.pc.in
==============================================================================
--- trunk/totem-plparser.pc.in	(original)
+++ trunk/totem-plparser.pc.in	Wed Nov  5 17:15:39 2008
@@ -9,6 +9,7 @@
 Description: Totem Playlist Parser library
 Version: @VERSION@
 Requires: gtk+-2.0
-Requires.private: libxml-2.0 camel-1.2
+Requires.private: libxml-2.0 @LIBCAMEL@
 Libs: -L${libdir} -ltotem-plparser
 Cflags: -I${includedir}/totem-pl-parser/1/plparser
+uselibcamel= USELIBCAMEL@



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]