[gnome-builder] vala: fix building with pre-0.36 in git



commit b56f3f001ebf8da851920279a543c64654ecb773
Author: Christian Hergert <chergert redhat com>
Date:   Thu Oct 13 13:59:55 2016 -0700

    vala: fix building with pre-0.36 in git
    
    The CodeContext.thread property has been removed. This checks the verison
    installed to see if we can use that property similar to what we do for
    the deprecated symbol.

 plugins/vala-pack/Makefile.am         |    4 ++++
 plugins/vala-pack/configure.ac        |   29 +++++++++++++++++++++++++++--
 plugins/vala-pack/ide-vala-index.vala |    6 +++++-
 3 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/plugins/vala-pack/Makefile.am b/plugins/vala-pack/Makefile.am
index ff22c0f..187b7cc 100644
--- a/plugins/vala-pack/Makefile.am
+++ b/plugins/vala-pack/Makefile.am
@@ -76,6 +76,10 @@ if ENABLE_VALA_SYMBOL_GET_DEPRECATED
 libvala_pack_plugin_la_VALAFLAGS += -D ENABLE_VALA_SYMBOL_GET_DEPRECATED
 endif
 
+if ENABLE_VALA_CODE_CONTEXT_SET_THREAD
+libvala_pack_plugin_la_VALAFLAGS += -D ENABLE_VALA_CODE_CONTEXT_SET_THREAD
+endif
+
 libvala_pack_plugin_la_CFLAGS = \
        -DVALA_VERSION=\""$(VALA_VERSION)"\" \
        -DPACKAGE_DATADIR=\""$(datadir)/gnome-builder"\" \
diff --git a/plugins/vala-pack/configure.ac b/plugins/vala-pack/configure.ac
index fc6dd06..ae92e11 100644
--- a/plugins/vala-pack/configure.ac
+++ b/plugins/vala-pack/configure.ac
@@ -1,6 +1,10 @@
 VAPIGEN_CHECK
-PKG_CHECK_MODULES(VALA, [libvala-0.34],[have_libvala=yes],[have_libvala=no])
-VALA_VERSION=0.34
+PKG_CHECK_MODULES(VALA, [libvala-0.36],[have_libvala=yes],[have_libvala=no])
+VALA_VERSION=0.36
+AS_IF([test x$have_libvala = xno],[
+       PKG_CHECK_MODULES(VALA, [libvala-0.34],[have_libvala=yes],[have_libvala=no])
+       VALA_VERSION=0.34
+])
 AS_IF([test x$have_libvala = xno],[
        PKG_CHECK_MODULES(VALA, [libvala-0.32],[have_libvala=yes],[have_libvala=no])
        VALA_VERSION=0.32
@@ -29,6 +33,7 @@ AS_IF([test x$enable_vala_pack_plugin = xyes],[
                AC_MSG_ERROR([Please install both the vala compiler and vapigen. vapigen may be part of your 
systems vala-tools package.])
        ])
 
+       # Check for deprecated symbol support
        AS_IF([test x$have_libvala = xyes],[
                cflags_save="${CFLAGS}"
                libs_save="${LIBS}"
@@ -44,11 +49,31 @@ AS_IF([test x$enable_vala_pack_plugin = xyes],[
                LIBS="${libs_save}"
        ])
        AC_MSG_RESULT([$have_vala_symbol_get_deprecated])
+
+       # Check for deprecated threading support
+       AS_IF([test x$have_libvala = xyes],[
+               cflags_save="${CFLAGS}"
+               libs_save="${LIBS}"
+               CFLAGS="${CFLAGS} ${VALA_CFLAGS}"
+               LIBS="${LIBS} ${VALA_LIBS}"
+               AC_MSG_CHECKING([if vala CodeContext supports thread property])
+               AC_TRY_LINK([#include <vala.h>],[
+                       vala_code_context_set_thread (NULL, TRUE);
+               ],
+               [have_vala_code_context_set_thread=yes],
+               [have_vala_code_context_set_thread=no])
+               CFLAGS="${cflags_save}"
+               LIBS="${libs_save}"
+       ])
+       AC_MSG_RESULT([$have_vala_code_context_set_thread])
 ])
 
 # for if ENABLE_VALA_SYMBOL_GET_DEPRECATED in .vala files
 AM_CONDITIONAL(ENABLE_VALA_SYMBOL_GET_DEPRECATED, test x$have_vala_symbol_get_deprecated = xyes)
 
+# for if ENABLE_VALA_CODE_CONTEXT_SET_THREAD in .vala files
+AM_CONDITIONAL(ENABLE_VALA_CODE_CONTEXT_SET_THREAD, test x$have_vala_code_context_set_thread = xyes)
+
 # for if ENABLE_VALA_PACK_PLUGIN in Makefile.am
 AM_CONDITIONAL(ENABLE_VALA_PACK_PLUGIN, test x$enable_vala_pack_plugin = xyes)
 
diff --git a/plugins/vala-pack/ide-vala-index.vala b/plugins/vala-pack/ide-vala-index.vala
index a3412eb..1931d5b 100644
--- a/plugins/vala-pack/ide-vala-index.vala
+++ b/plugins/vala-pack/ide-vala-index.vala
@@ -73,7 +73,9 @@ namespace Ide
                        this.code_context.basedir = workdir.get_path ();
                        this.code_context.directory = GLib.Environment.get_current_dir ();
                        this.code_context.debug = false;
+#if ENABLE_VALA_CODE_CONTEXT_SET_THREAD
                        this.code_context.thread = true;
+#endif
                        this.code_context.mem_profiler = false;
                        this.code_context.save_temps = false;
 
@@ -84,7 +86,7 @@ namespace Ide
 
                        this.code_context.run_output = false;
 
-                       int minor = 34;
+                       int minor = 36;
                        var tokens = Config.VALA_VERSION.split(".", 2);
                        if (tokens[1] != null) {
                                minor = int.parse(tokens[1]);
@@ -256,7 +258,9 @@ namespace Ide
                                                }
                                        }
                                        else if (param == "--thread") {
+#if ENABLE_VALA_CODE_CONTEXT_SET_THREAD
                                                this.code_context.thread = true;
+#endif
                                        }
                                }
 


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