[PATCH 13/13] cache: Move cache for its own library.



Actually GrlMediaCache is not an essential part of core, but rather an utility
to be used by clients and plugins.

Therefore moving the cache system to its own library.

Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>
---
 Makefile.am                                 |    4 ++
 configure.ac                                |   14 +++++-
 grilo-media-cache-0.1.pc.in                 |   15 ++++++
 grilo-media-cache-uninstalled.pc.in         |   15 ++++++
 libs/Makefile.am                            |    6 ++-
 libs/media-cache/Makefile.am                |   71 +++++++++++++++++++++++++++
 {src => libs/media-cache}/grl-media-cache.c |    3 -
 {src => libs/media-cache}/grl-media-cache.h |    8 +---
 src/Makefile.am                             |    4 +-
 src/grilo.h                                 |    1 -
 10 files changed, 124 insertions(+), 17 deletions(-)
 create mode 100644 grilo-media-cache-0.1.pc.in
 create mode 100644 grilo-media-cache-uninstalled.pc.in
 create mode 100644 libs/media-cache/Makefile.am
 rename {src => libs/media-cache}/grl-media-cache.c (99%)
 rename {src => libs/media-cache}/grl-media-cache.h (95%)

diff --git a/Makefile.am b/Makefile.am
index a802535..40f2dba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,6 +24,10 @@ if BUILD_GRILO_NET
 pkgconfig_DATA += grilo-net-0.1.pc
 endif
 
+if BUILD_GRILO_MEDIA_CACHE
+pkgconfig_DATA += grilo-media-cache-0.1.pc
+endif
+
 MAINTAINERCLEANFILES = \
         aclocal.m4 \
         compile \
diff --git a/configure.ac b/configure.ac
index 8cfa20c..074e1b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,8 +93,7 @@ PKG_CHECK_MODULES(DEPS, glib-2.0 >= 2.22 \
 			gobject-2.0 \
 			gmodule-2.0 \
 			gio-2.0 \
-			libxml-2.0 \
-                        sqlite3)
+			libxml-2.0)
 
 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
 GLIB_MKENUMS=`pkg-config --variable=glib_mkenums glib-2.0`
@@ -118,6 +117,14 @@ PKG_CHECK_MODULES(NET, libsoup-2.4,
 
 AM_CONDITIONAL(BUILD_GRILO_NET, test "x$HAVE_LIBSOUP" = "xyes")
 
+# media cache library
+
+PKG_CHECK_MODULES(MEDIA_CACHE, sqlite3,
+                         HAVE_SQLITE3=yes,
+                         HAVE_SQLITE3=no)
+
+AM_CONDITIONAL(BUILD_GRILO_MEDIA_CACHE, test "x$HAVE_SQLITE3" = "xyes")
+
 # ----------------------------------------------------------
 # DEBUG SUPPORT
 # ----------------------------------------------------------
@@ -235,12 +242,15 @@ AC_CONFIG_FILES([
   grilo-0.1.pc
   grilo-net-uninstalled.pc
   grilo-net-0.1.pc
+  grilo-media-cache-uninstalled.pc
+  grilo-media-cache-0.1.pc
   src/Makefile
   tests/Makefile
   tests/python/Makefile
   tests/python/util.py
   libs/Makefile
   libs/net/Makefile
+  libs/media-cache/Makefile
   tools/Makefile
   tools/grilo-test-ui/Makefile
   tools/grilo-inspect/Makefile
diff --git a/grilo-media-cache-0.1.pc.in b/grilo-media-cache-0.1.pc.in
new file mode 100644
index 0000000..5206fc4
--- /dev/null
+++ b/grilo-media-cache-0.1.pc.in
@@ -0,0 +1,15 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/@GRL_NAME@
+datarootdir=${prefix}/share
+datadir=${datarootdir}
+girdir=${datadir}/gir-1.0
+typelibdir=${libdir}/girepository-1.0
+
+Name: Grilo cache library
+Description: Grilo cache for GrlMedia
+Requires: @GRL_NAME@
+Version: @VERSION@
+Libs: -L${libdir} -lgrlcache-@GRL_MAJORMINOR@
+Cflags: -I${includedir}
diff --git a/grilo-media-cache-uninstalled.pc.in b/grilo-media-cache-uninstalled.pc.in
new file mode 100644
index 0000000..0339d52
--- /dev/null
+++ b/grilo-media-cache-uninstalled.pc.in
@@ -0,0 +1,15 @@
+# the standard variables don't make sense for an uninstalled copy
+prefix=
+exec_prefix=
+libdir=
+includedir=
+girdir=@abs_top_builddir@/libs/
+typelibdir=@abs_top_builddir@/libs
+
+Name: Grilo cache library
+Description: Grilo cache for GrlMedia
+Requires: @GRL_NAME@
+Version: @VERSION@
+
+Libs: @abs_top_builddir@/libs/cache/libgrlcache-@GRL_MAJORMINOR@.la
+Cflags: -I@abs_top_srcdir@/libs -I@abs_top_builddir@/libs
diff --git a/libs/Makefile.am b/libs/Makefile.am
index 4f4da5f..a16e181 100644
--- a/libs/Makefile.am
+++ b/libs/Makefile.am
@@ -11,7 +11,11 @@ if BUILD_GRILO_NET
 SUBDIRS += net
 endif
 
-DIST_SUBDIRS = net
+if BUILD_GRILO_MEDIA_CACHE
+SUBDIRS += media-cache
+endif
+
+DIST_SUBDIRS = net media-cache
 
 MAINTAINERCLEANFILES = \
 	*.in \
diff --git a/libs/media-cache/Makefile.am b/libs/media-cache/Makefile.am
new file mode 100644
index 0000000..19eff56
--- /dev/null
+++ b/libs/media-cache/Makefile.am
@@ -0,0 +1,71 @@
+#
+# Makefile.am
+#
+# Author: Juan A. Suarez Romero <jasuarez igalia com>
+#
+# Copyright (C) 2011 Igalia S.L. All rights reserved.
+
+lib_LTLIBRARIES = libgrlmediacache-@GRL_MAJORMINOR@.la
+
+libgrlmediacache_@GRL_MAJORMINOR@_la_DEPENDENCIES =	\
+	$(top_builddir)/src/lib@GRL_NAME@.la
+
+libgrlmediacache_@GRL_MAJORMINOR@_la_SOURCES = \
+	grl-media-cache.c
+
+libgrlmediacache_@GRL_MAJORMINOR@_la_CFLAGS =	\
+	-I $(top_srcdir)/src		\
+	-I $(top_srcdir)/src/data	\
+	$(DEPS_CFLAGS)			\
+	$(MEDIA_CACHE_CFLAGS)
+
+libgrlmediacache_@GRL_MAJORMINOR@_la_LIBADD =	\
+	$(top_builddir)/src/lib@GRL_NAME@.la	\
+	$(DEPS_LIBS)				\
+	$(MEDIA_CACHE_LIBS)
+
+libgrlmediacache_@GRL_MAJORMINOR@includedir =	\
+	$(includedir)/@GRL_NAME@/media-cache
+
+libgrlmediacache_@GRL_MAJORMINOR@include_HEADERS =	\
+	grl-media-cache.h
+
+MAINTAINERCLEANFILES =	\
+	*.in		\
+	*~
+
+DISTCLEANFILES = $(MAINTAINERCLEANFILES)
+CLEANFILES =
+
+# introspection support
+if HAVE_INTROSPECTION
+-include $(INTROSPECTION_MAKEFILE)
+gir_headers = $(patsubst %,$(srcdir)/%, $(libgrlmediacache_@GRL_MAJORMINOR@include_HEADERS))
+gir_sources = $(patsubst %,$(srcdir)/%, $(libgrlmediacache_@GRL_MAJORMINOR@_la_SOURCES))
+
+INTROSPECTION_GIRS =
+
+introspection_sources =	\
+	$(gir_headers)	\
+	$(gir_sources)
+
+GrlMediaCache-@GRL_MAJORMINOR@.gir: libgrlmediacache-@GRL_MAJORMINOR@.la
+GrlMediaCache_@GRL_MAJORMINOR_NORM@_gir_INCLUDES = Grl-0.1
+GrlMediaCache_@GRL_MAJORMINOR_NORM@_gir_CFLAGS =	\
+	--add-include-path=$(top_srcdir)/src		\
+	-I$(top_srcdir)/libs $(libgrlmediacache_@GRL_MAJORMINOR@_la_CFLAGS)
+GrlMediaCache_@GRL_MAJORMINOR_NORM@_gir_LIBS =	\
+	libgrlmediacache-@GRL_MAJORMINOR@.la
+GrlMediaCache_@GRL_MAJORMINOR_NORM@_gir_FILES = $(introspection_sources)
+GrlMediaCache_@GRL_MAJORMINOR_NORM@_gir_SCANNERFLAGS = --identifier-prefix=Grl
+INTROSPECTION_GIRS += GrlMediaCache-@GRL_MAJORMINOR@.gir
+INTROSPECTION_COMPILER_ARGS = --includedir=. --includedir=$(top_srcdir)/src
+
+girdir = $(datadir)/gir-1.0
+dist_gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(dist_gir_DATA) $(typelib_DATA)
+endif
diff --git a/src/grl-media-cache.c b/libs/media-cache/grl-media-cache.c
similarity index 99%
rename from src/grl-media-cache.c
rename to libs/media-cache/grl-media-cache.c
index fd30d7e..a118b4d 100644
--- a/src/grl-media-cache.c
+++ b/libs/media-cache/grl-media-cache.c
@@ -33,10 +33,7 @@
 #include <sqlite3.h>
 #include <string.h>
 
-#include "grl-error.h"
-#include "grl-log.h"
 #include "grl-media-cache.h"
-#include "grl-plugin-registry.h"
 
 #define GRL_LOG_DOMAIN_DEFAULT media_cache_log_domain
 GRL_LOG_DOMAIN(media_cache_log_domain);
diff --git a/src/grl-media-cache.h b/libs/media-cache/grl-media-cache.h
similarity index 95%
rename from src/grl-media-cache.h
rename to libs/media-cache/grl-media-cache.h
index 31736ca..68a06a5 100644
--- a/src/grl-media-cache.h
+++ b/libs/media-cache/grl-media-cache.h
@@ -20,18 +20,12 @@
  *
  */
 
-#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
-#error "Only <grilo.h> can be included directly."
-#endif
-
 #ifndef _GRL_MEDIA_CACHE_H_
 #define _GRL_MEDIA_CACHE_H_
 
 #include <glib.h>
 #include <glib-object.h>
-
-#include "grl-definitions.h"
-#include "grl-media.h"
+#include <grilo.h>
 
 /* Macros */
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 3a5183b..e5b82cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,7 +47,6 @@ lib@GRL_NAME@_la_SOURCES =					\
 	grl-multiple.c						\
 	grl-log.c grl-log-priv.h				\
 	grl-sync.c						\
-	grl-media-cache.c						\
 	grilo.c
 
 data_c_sources =		\
@@ -75,8 +74,7 @@ lib@GRL_NAME@inc_HEADERS =	\
 	grl-log.h 		\
 	grl-multiple.h		\
 	grl-util.h		\
-	grl-definitions.h	\
-	grl-media-cache.h
+	grl-definitions.h
 
 data_h_headers =		\
 	data/grl-data.h		\
diff --git a/src/grilo.h b/src/grilo.h
index e659ec4..cff47a0 100644
--- a/src/grilo.h
+++ b/src/grilo.h
@@ -32,7 +32,6 @@
 #include <grl-plugin-registry.h>
 #include <grl-media-plugin.h>
 #include <grl-media-source.h>
-#include <grl-media-cache.h>
 #include <grl-metadata-source.h>
 #include <grl-metadata-key.h>
 #include <grl-data.h>
-- 
1.7.4



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