[gnome-builder] library-template: Automatically include API version in build system



commit 8287551499b85dcb82cc343d56791a4ed10176a1
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Sun Jan 31 11:30:05 2016 +0100

    library-template: Automatically include API version in build system
    
    Rather than hard-coding version 1.0 everywhere, use the api_version
    (formerly interface_age) variable to do it magically.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761356

 .../library_template/shared-library/configure.ac   |   10 ++++++----
 .../shared-library/data/Makefile.am                |   10 +++++++---
 .../shared-library/src/Makefile.am                 |    8 ++++----
 3 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/plugins/library-template/library_template/shared-library/configure.ac 
b/plugins/library-template/library_template/shared-library/configure.ac
index 5f6bb0b..ca5318a 100644
--- a/plugins/library-template/library_template/shared-library/configure.ac
+++ b/plugins/library-template/library_template/shared-library/configure.ac
@@ -9,7 +9,7 @@ m4_define([minor_version],[{{minor_version}}])
 m4_define([micro_version],[{{micro_version}}])
 m4_define([package_version],[major_version.minor_version.micro_version])
 m4_define([bug_report_url],[https://bugzilla.gnome.org/enter_bug.cgi?product={{name}}])
-m4_define([interface_age],[0])
+m4_define([api_version],[0])
 
 
 dnl ***********************************************************************
@@ -17,7 +17,7 @@ dnl Initialize autoconf
 dnl ***********************************************************************
 AC_INIT([{{name}}],[package_version],[bug_report_url])
 AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_SRCDIR([data/{{name}}-1.0.pc.in])
+AC_CONFIG_SRCDIR([data/{{name}}.pc.in])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_SUBST([ACLOCAL_AMFLAGS], "-I m4")
@@ -33,6 +33,7 @@ MICRO_VERSION=micro_version
 AC_SUBST([MAJOR_VERSION])
 AC_SUBST([MINOR_VERSION])
 AC_SUBST([MICRO_VERSION])
+AC_SUBST([API_VERSION],api_version)
 
 
 dnl ***********************************************************************
@@ -124,12 +125,13 @@ AC_CONFIG_FILES([
        src/{{prefix}}-version.h
 
        data/Makefile
-       data/{{name}}-1.0.pc
+       data/{{name}}-$API_VERSION.pc:data/{{name}}.pc.in
 
 {{if enable_i18n}}
        po/Makefile.in
 {{end}}
-])
+],[],
+[API_VERSION='$API_VERSION'])
 AC_OUTPUT
 
 
diff --git a/plugins/library-template/library_template/shared-library/data/Makefile.am 
b/plugins/library-template/library_template/shared-library/data/Makefile.am
index 98cc8c2..810691d 100644
--- a/plugins/library-template/library_template/shared-library/data/Makefile.am
+++ b/plugins/library-template/library_template/shared-library/data/Makefile.am
@@ -1,6 +1,10 @@
+# pkg-config data
+# Note that the template file is called {{name}}.pc.in, but generates a
+# versioned .pc file using some magic in AC_CONFIG_FILES.
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = {{name}}-$(API_VERSION).pc
 
-GITIGNOREFILES = \
-       *.pc \
-       $(NULL)
+DISTCLEANFILES = $(pkgconfig_DATA)
+EXTRA_DIST = {{name}}.pc.in
 
 -include $(top_srcdir)/git.mk
diff --git a/plugins/library-template/library_template/shared-library/src/Makefile.am 
b/plugins/library-template/library_template/shared-library/src/Makefile.am
index 39d61b2..bb5c38e 100644
--- a/plugins/library-template/library_template/shared-library/src/Makefile.am
+++ b/plugins/library-template/library_template/shared-library/src/Makefile.am
@@ -1,11 +1,11 @@
-lib_LTLIBRARIES = lib{{name}}-1.0.la
+lib_LTLIBRARIES = lib{{name}}- API_VERSION@.la
 
-lib{{name_}}_1_0_la_SOURCES = \
+lib{{name_}}_ API_VERSION@_la_SOURCES = \
        {{prefix}}-version.h \
        {{name}}.h \
        $(NULL)
 
-lib{{name_}}_1_0_la_CFLAGS = $\{{{NAME}}_CFLAGS}
-lib{{name_}}_1_0_la_LIBADD = $\{{{NAME}}_LIBS}
+lib{{name_}}_ API_VERSION@_la_CFLAGS = $\{{{NAME}}_CFLAGS}
+lib{{name_}}_ API_VERSION@_la_LIBADD = $\{{{NAME}}_LIBS}
 
 -include $(top_srcdir)/git.mk


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