[gnome-builder/gnome-builder-3-20] Autools-templates: Adding support for library's VAPI and header installation



commit 2a60048d8d2d01d8a9636bdedd963c10a2f67683
Author: Daniel Espinosa <daniel espinosa pwmc mx>
Date:   Fri May 27 13:28:34 2016 -0500

    Autools-templates: Adding support for library's VAPI and header installation
    
    * Adds missing file for namespace information, to help generated GIR
    * Install VAPI and deps file
    * Install header file for parallel installation of API versions

 .buildconfig                                       |    2 +-
 contrib/tmpl/tmpl-branch-node.c                    |    4 +-
 plugins/autotools-templates/Makefile.am            |    2 +
 .../autotools_templates/__init__.py                |    3 +-
 .../autotools_templates/resources/configure.ac     |    5 +++-
 .../resources/data/package.pc.in                   |   13 ++++++++++++
 .../resources/src/Makefile.shared-library-vala     |   21 ++++++++++++++++++++
 .../resources/src/package-namespace.vala.in        |    4 +++
 .../resources/src/package.deps.in                  |    1 +
 .../autotools_templates/resources/src/package.vala |    4 ++-
 10 files changed, 53 insertions(+), 6 deletions(-)
---
diff --git a/.buildconfig b/.buildconfig
index 8c12c77..15de113 100644
--- a/.buildconfig
+++ b/.buildconfig
@@ -28,7 +28,7 @@ name=Builder (Host)
 device=local
 runtime=host
 config-opts=--enable-tracing --enable-debug --enable-tests
-prefix=/opt/gnome
+prefix=/home/despinosa/.cache/gnome-builder/install/Builder/host
 
 
 default=true
diff --git a/contrib/tmpl/tmpl-branch-node.c b/contrib/tmpl/tmpl-branch-node.c
index 10994ad..c4058a0 100644
--- a/contrib/tmpl/tmpl-branch-node.c
+++ b/contrib/tmpl/tmpl-branch-node.c
@@ -71,7 +71,7 @@ tmpl_branch_node_accept (TmplNode      *node,
           g_set_error (error,
                        TMPL_ERROR,
                        TMPL_ERROR_SYNTAX_ERROR,
-                       "Unexpected end-of-file reached");
+                       "Template: Syntax error: Unexpected end-of-file reached");
           TMPL_RETURN (FALSE);
 
         case TMPL_TOKEN_END:
@@ -120,7 +120,7 @@ tmpl_branch_node_accept (TmplNode      *node,
           g_set_error (error,
                        TMPL_ERROR,
                        TMPL_ERROR_SYNTAX_ERROR,
-                       "Invalid token, expected else if, else, or end.");
+                       "Template: Syntax error: Invalid token, expected else if, else, or end.");
           TMPL_RETURN (FALSE);
         }
     }
diff --git a/plugins/autotools-templates/Makefile.am b/plugins/autotools-templates/Makefile.am
index bf2fb1d..aa06b89 100644
--- a/plugins/autotools-templates/Makefile.am
+++ b/plugins/autotools-templates/Makefile.am
@@ -44,6 +44,8 @@ nobase_resource_DATA = \
        autotools_templates/resources/src/package-version.h.in \
        autotools_templates/resources/src/package.h \
        autotools_templates/resources/src/package.vala \
+       autotools_templates/resources/src/package.deps.in \
+       autotools_templates/resources/src/package-namespace.vala.in \
        $(NULL)
 
 EXTRA_DIST = $(nobase_resource_DATA)
diff --git a/plugins/autotools-templates/autotools_templates/__init__.py 
b/plugins/autotools-templates/autotools_templates/__init__.py
index b832516..4838e64 100644
--- a/plugins/autotools-templates/autotools_templates/__init__.py
+++ b/plugins/autotools-templates/autotools_templates/__init__.py
@@ -248,7 +248,6 @@ class LibraryProjectTemplate(AutotoolsTemplate):
 
     def prepare_files(self, files):
         files['resources/data/package.pc.in'] = 'data/%(name)s.pc.in'
-
         if self.language in ('c', 'c++'):
             files['resources/src/Makefile.shared-library-c'] = 'src/Makefile.am'
             files['resources/src/package.h'] = 'src/%(name)s.h'
@@ -257,6 +256,8 @@ class LibraryProjectTemplate(AutotoolsTemplate):
         elif self.language == 'vala':
             files['resources/src/Makefile.shared-library-vala'] = 'src/Makefile.am'
             files['resources/src/package.vala'] = 'src/%(prefix)s.vala'
+            files['resources/src/package.deps.in'] = 'src/%(prefix)s.deps.in'
+            files['resources/src/package-namespace.vala.in'] = 'src/%(prefix)s-namespace.vala.in'
 
 
 class EmptyProjectTemplate(AutotoolsTemplate):
diff --git a/plugins/autotools-templates/autotools_templates/resources/configure.ac 
b/plugins/autotools-templates/autotools_templates/resources/configure.ac
index 084072d..56d18eb 100644
--- a/plugins/autotools-templates/autotools_templates/resources/configure.ac
+++ b/plugins/autotools-templates/autotools_templates/resources/configure.ac
@@ -136,8 +136,11 @@ AC_CONFIG_FILES([
 {{if language != "vala"}}
        src/{{prefix}}-version.h
 {{end}}
+{{if language == "vala"}}
+       src/{{name}}-namespace.vala
+       src/{{name}}-$API_VERSION.deps:src/{{name}}.deps.in
+{{end}}
 {{end}}
-
        data/Makefile
 {{if template == "shared-library"}}
        data/{{name}}-$API_VERSION.pc:data/{{name}}.pc.in
diff --git a/plugins/autotools-templates/autotools_templates/resources/data/package.pc.in 
b/plugins/autotools-templates/autotools_templates/resources/data/package.pc.in
index e69de29..6c34a9b 100644
--- a/plugins/autotools-templates/autotools_templates/resources/data/package.pc.in
+++ b/plugins/autotools-templates/autotools_templates/resources/data/package.pc.in
@@ -0,0 +1,13 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+datarootdir=@datarootdir@
+datadir=@datadir@
+includedir=@includedir@
+
+Name: {{prefix}}-@API_VERSION@
+Description: {{prefix}} library
+Version: @VERSION@
+Requires: glib-2.0 gobject-2.0
+Libs: -L${libdir} -l{{prefix}}-@API_VERSION@
+Cflags: -I${includedir}/{{prefix}}-@API_VERSION@
diff --git a/plugins/autotools-templates/autotools_templates/resources/src/Makefile.shared-library-vala 
b/plugins/autotools-templates/autotools_templates/resources/src/Makefile.shared-library-vala
index 628a877..fc6159c 100644
--- a/plugins/autotools-templates/autotools_templates/resources/src/Makefile.shared-library-vala
+++ b/plugins/autotools-templates/autotools_templates/resources/src/Makefile.shared-library-vala
@@ -18,9 +18,30 @@ lib{{name_}}_@API_VERSION@_la_LDFLAGS = \
        $(NULL)
 
 lib{{name_}}_@API_VERSION@_la_VALAFLAGS = \
+       --vapidir=$(VAPIDIR) \
        --thread \
        --target-glib=2.44 \
        --pkg glib-2.0 \
+       -H {{prefix}}.h \
+       --library {{prefix}}-@API_VERSION@ \
+       $(NULL)
+
+{{prefix}}.h : lib{{name_}}-@API_VERSION@.la
+header_DATA={{prefix}}.h
+headerdir=$(includedir)/{{prefix}}-@API_VERSION@/{{prefix}}
+
+{{prefix}}-@API_VERSION@.vapi : lib{{name_}}-@API_VERSION@.la
+
+{{prefix}}-@API_VERSION@.deps:
+       cp {{prefix}}.deps {{prefix}}-@API_VERSION@.deps
+
+vapi_DATA={{prefix}}-@API_VERSION@.vapi {{prefix}}-@API_VERSION@.deps
+vapidir=$(VAPIDIR)
+
+CLEANFILES=\
+       {{prefix}}-@API_VERSION@.vapi \
+       {{prefix}}-@API_VERSION@.deps \
+       {{prefix}}.h \
        $(NULL)
 
 -include $(top_srcdir)/git.mk
diff --git a/plugins/autotools-templates/autotools_templates/resources/src/package-namespace.vala.in 
b/plugins/autotools-templates/autotools_templates/resources/src/package-namespace.vala.in
new file mode 100644
index 0000000..77bc682
--- /dev/null
+++ b/plugins/autotools-templates/autotools_templates/resources/src/package-namespace.vala.in
@@ -0,0 +1,4 @@
+{{include "license.vala"}}
+
+[CCode (gir_namespace = "{{Prefix}}", gir_version = "@API_VERSION@", cheader_filename = 
"{{prefix}}/{{prefix}}.h")]
+namespace {{Prefix}} {}
diff --git a/plugins/autotools-templates/autotools_templates/resources/src/package.deps.in 
b/plugins/autotools-templates/autotools_templates/resources/src/package.deps.in
new file mode 100644
index 0000000..2bb8574
--- /dev/null
+++ b/plugins/autotools-templates/autotools_templates/resources/src/package.deps.in
@@ -0,0 +1 @@
+glib-2.0
diff --git a/plugins/autotools-templates/autotools_templates/resources/src/package.vala 
b/plugins/autotools-templates/autotools_templates/resources/src/package.vala
index 106d6ec..ee63008 100644
--- a/plugins/autotools-templates/autotools_templates/resources/src/package.vala
+++ b/plugins/autotools-templates/autotools_templates/resources/src/package.vala
@@ -3,5 +3,7 @@
 using GLib;
 
 namespace {{Prefix}} {
-
+       public class A {
+               public bool foo() { return false; }
+       }
 }


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