[folks] build: Allow backend libraries to have individual API versions



commit 69b04cd358e4833f8087948f78deb2ef05867dcf
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Nov 28 16:21:47 2013 +0000

    build: Allow backend libraries to have individual API versions
    
    The API version is included in the GIR file name, and only changes when
    API is broken or removed. If new backends, such as the dummy backend,
    are to have unstable APIs, having individual versions for each backend
    library is necessary to allow backend API breaks without breaking the
    whole of the folks API.
    
    The API version has not been added to the VAPI file name, though it
    should, because that would be a backwards-incompatible change. It can be
    added when folks next breaks API compatibility.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711544

 backends/backend-library.mk                  |   19 ++++++++++++++-
 backends/eds/lib/Makefile.am                 |    4 ++-
 backends/eds/lib/edsf-namespace.vala         |   30 --------------------------
 backends/libsocialweb/lib/Makefile.am        |    4 ++-
 backends/libsocialweb/lib/swf-namespace.vala |   30 --------------------------
 backends/telepathy/lib/Makefile.am           |    4 ++-
 backends/telepathy/lib/tpf-namespace.vala    |   30 --------------------------
 backends/tracker/lib/Makefile.am             |    4 ++-
 backends/tracker/lib/trf-namespace.vala      |   30 --------------------------
 configure.ac                                 |    9 +++++++
 10 files changed, 38 insertions(+), 126 deletions(-)
---
diff --git a/backends/backend-library.mk b/backends/backend-library.mk
index ea504ff..7db9ae5 100644
--- a/backends/backend-library.mk
+++ b/backends/backend-library.mk
@@ -6,14 +6,17 @@
 #    (this must be the same as the source directory and the backend's type ID)
 #  - BACKEND_NAME_C = NameOfBackend
 #    (BACKEND_NAME in CamelCase for the GIR filename)
+#  - BACKEND_API_VERSION = $(FOLKS_something_API_VERSION)
 #  - BACKEND_LT_VERSION = $(FOLKS_something_LT_VERSION)
 #    (from configure.ac)
 #  - BACKEND_SYMBOLS_REGEX = something
 #    (regex to pass to -export-symbols-regex to determine the backend’s public
 #     symbols)
+#  - BACKEND_NAMESPACE = Something
+#    (Vala namespace used in the backend code)
 # Required targets:
 #  - libfolks-$(BACKEND_NAME).la
-# Defined helper variables (these may be overridden for weird backends):
+# Derived helper variables (these may be overridden for weird backends):
 #  - BACKEND_LIBRARY_NAME
 #  - BACKEND_LA_FILE
 #  - BACKEND_PC_FILE
@@ -48,7 +51,7 @@
 BACKEND_LIBRARY_NAME = folks-$(BACKEND_NAME)
 BACKEND_LA_FILE = lib$(BACKEND_LIBRARY_NAME).la
 BACKEND_PC_FILE = $(BACKEND_LIBRARY_NAME).pc.in
-BACKEND_GIR_FILE = Folks$(BACKEND_NAME_C)-$(API_VERSION_DOT).gir
+BACKEND_GIR_FILE = Folks$(BACKEND_NAME_C)-$(BACKEND_API_VERSION).gir
 BACKEND_VAPI_FILE = $(BACKEND_LIBRARY_NAME).vapi
 BACKEND_DEPS_FILE = $(BACKEND_LIBRARY_NAME).deps
 BACKEND_HEADER_FILE = folks/$(BACKEND_LIBRARY_NAME).h
@@ -56,6 +59,7 @@ BACKEND_HEADER_FILE = folks/$(BACKEND_LIBRARY_NAME).h
 
 # Added in case it's needed in the future.
 backend_library_sources = \
+       namespace.vala \
        $(NULL)
 
 backend_library_cppflags_generic = \
@@ -126,6 +130,17 @@ backend_library_ldflags = \
        $(NULL)
 
 
+# Namespace Vala file
+#
+# FIXME: This can be removed once the backend namespaces have been sanitised.
+# https://bugzilla.gnome.org/show_bug.cgi?id=711544
+#
+# This file sets namespace and version attributes for GIR.
+namespace.vala:
+       $(AM_V_GEN)echo -e "[CCode (gir_namespace = \"Folks$(BACKEND_NAME_C)\", gir_version = 
\"$(BACKEND_API_VERSION)\")]\nnamespace $(BACKEND_NAMESPACE) {}" > $@
+
+MAINTAINERCLEANFILES += namespace.vala
+
 # Installed headers
 folks_includedir = $(includedir)/folks
 folks_include_HEADERS = $(BACKEND_HEADER_FILE)
diff --git a/backends/eds/lib/Makefile.am b/backends/eds/lib/Makefile.am
index 868cf7a..1c9d5cc 100644
--- a/backends/eds/lib/Makefile.am
+++ b/backends/eds/lib/Makefile.am
@@ -7,12 +7,14 @@ include $(top_srcdir)/backends/backend-library.mk
 BACKEND_NAME = eds
 BACKEND_NAME_C = Eds
 BACKEND_LT_VERSION = $(FOLKS_EDS_LT_VERSION)
+BACKEND_API_VERSION = $(FOLKS_EDS_API_VERSION)
 BACKEND_SYMBOLS_REGEX = "^(EDSF|edsf)_.*|"
+BACKEND_NAMESPACE = Edsf
 
 lib_LTLIBRARIES = libfolks-eds.la
 
 libfolks_eds_la_SOURCES = \
-       edsf-namespace.vala \
+       $(backend_library_sources) \
        edsf-persona.vala \
        edsf-persona-store.vala \
        $(NULL)
diff --git a/backends/libsocialweb/lib/Makefile.am b/backends/libsocialweb/lib/Makefile.am
index 1e16286..9a43ee6 100644
--- a/backends/libsocialweb/lib/Makefile.am
+++ b/backends/libsocialweb/lib/Makefile.am
@@ -7,12 +7,14 @@ include $(top_srcdir)/backends/backend-library.mk
 BACKEND_NAME = libsocialweb
 BACKEND_NAME_C = Libsocialweb
 BACKEND_LT_VERSION = $(FOLKS_LIBSOCIALWEB_LT_VERSION)
+BACKEND_API_VERSION = $(FOLKS_LIBSOCIALWEB_API_VERSION)
 BACKEND_SYMBOLS_REGEX = "^swf_.*"
+BACKEND_NAMESPACE = Swf
 
 lib_LTLIBRARIES = libfolks-libsocialweb.la
 
 libfolks_libsocialweb_la_SOURCES = \
-       swf-namespace.vala \
+       $(backend_library_sources) \
        swf-persona.vala \
        swf-persona-store.vala \
        $(NULL)
diff --git a/backends/telepathy/lib/Makefile.am b/backends/telepathy/lib/Makefile.am
index d9f7fce..d034672 100644
--- a/backends/telepathy/lib/Makefile.am
+++ b/backends/telepathy/lib/Makefile.am
@@ -7,7 +7,9 @@ include $(top_srcdir)/backends/backend-library.mk
 BACKEND_NAME = telepathy
 BACKEND_NAME_C = Telepathy
 BACKEND_LT_VERSION = $(FOLKS_TELEPATHY_LT_VERSION)
+BACKEND_API_VERSION = $(FOLKS_TELEPATHY_API_VERSION)
 BACKEND_SYMBOLS_REGEX = "^tpf_.*"
+BACKEND_NAMESPACE = Tpf
 
 VAPIGENFLAGS = \
        --vapidir=$(abs_builddir) \
@@ -159,7 +161,7 @@ endif
 $(builddir)/libfolks_telepathy_la_vala.stamp: $(FOLKS_TP_VALA_DEPS)
 
 libfolks_telepathy_la_SOURCES = \
-       tpf-namespace.vala \
+       $(backend_library_sources) \
        tpf-persona.vala \
        tpf-persona-store.vala \
        tpf-logger.vala \
diff --git a/backends/tracker/lib/Makefile.am b/backends/tracker/lib/Makefile.am
index 5b23b07..ef20734 100644
--- a/backends/tracker/lib/Makefile.am
+++ b/backends/tracker/lib/Makefile.am
@@ -7,12 +7,14 @@ include $(top_srcdir)/backends/backend-library.mk
 BACKEND_NAME = tracker
 BACKEND_NAME_C = Tracker
 BACKEND_LT_VERSION = $(FOLKS_TRACKER_LT_VERSION)
+BACKEND_API_VERSION = $(FOLKS_TRACKER_API_VERSION)
 BACKEND_SYMBOLS_REGEX = "^(TRF|trf)_.*|"
+BACKEND_NAMESPACE = Trf
 
 lib_LTLIBRARIES = libfolks-tracker.la
 
 libfolks_tracker_la_SOURCES = \
-       trf-namespace.vala \
+       $(backend_library_sources) \
        trf-persona.vala \
        trf-persona-store.vala \
        trf-util.vala \
diff --git a/configure.ac b/configure.ac
index 9012fd5..79914c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,8 @@ FOLKS_TRACKER_LT_VERSION=folks_tracker_lt_current:folks_tracker_lt_revision:folk
 AC_SUBST([FOLKS_TRACKER_LT_VERSION])
 
 # Core library API version (potentially used for parallel installation)
+# When updating this, don’t forget to update the backend library API versions
+# below.
 API_VERSION_MAJOR=0
 AC_SUBST([API_VERSION_MAJOR])
 API_VERSION_MINOR=6
@@ -119,6 +121,13 @@ AC_SUBST([API_VERSION_MINOR])
 API_VERSION_DOT=$API_VERSION_MAJOR.$API_VERSION_MINOR
 AC_SUBST([API_VERSION_DOT])
 
+# Backend library API versions
+AC_SUBST([FOLKS_EDS_API_VERSION], [0.6])
+AC_SUBST([FOLKS_LIBSOCIALWEB_API_VERSION], [0.6])
+AC_SUBST([FOLKS_TELEPATHY_API_VERSION], [0.6])
+AC_SUBST([FOLKS_TRACKER_API_VERSION], [0.6])
+
+# Backend configuration
 AC_ARG_ENABLE(tracker-backend,
         AS_HELP_STRING([--enable-tracker-backend],
                        [ build the Tracker backend]),


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