[vala/0.36: 31/212] compiler: Use API_VERSION instead of stripping PACKAGE_SUFFIX



commit 80b65a9d43e5e20b218a22710a7d1d6dc8313794
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Jun 21 14:53:04 2017 +0200

    compiler: Use API_VERSION instead of stripping PACKAGE_SUFFIX

 compiler/valacompiler.vala |    4 ++--
 configure.ac               |    1 +
 vapi/config.vapi           |    1 +
 3 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 4c4b5fd..38d2422 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -514,7 +514,7 @@ class Vala.Compiler {
                        stdout.printf ("Vala %s\n", Config.BUILD_VERSION);
                        return 0;
                } else if (api_version) {
-                       stdout.printf ("%s\n", Config.PACKAGE_SUFFIX.substring (1));
+                       stdout.printf ("%s\n", Config.API_VERSION);
                        return 0;
                }
                
@@ -597,7 +597,7 @@ class Vala.Compiler {
                        stdout.printf ("Vala %s\n", Config.BUILD_VERSION);
                        return 0;
                } else if (api_version) {
-                       stdout.printf ("%s\n", Config.PACKAGE_SUFFIX.substring (1));
+                       stdout.printf ("%s\n", Config.API_VERSION);
                        return 0;
                }
                
diff --git a/configure.ac b/configure.ac
index e68e9be..3d7ddce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,7 @@ dnl We don't support separate builddir when building from git
 echo \#buildapi-variable-no-builddir >/dev/null
 
 AC_SUBST(API_VERSION)
+AC_DEFINE_UNQUOTED(API_VERSION, "$API_VERSION", [Define to the api-version of this package])
 AC_SUBST(PACKAGE_SUFFIX)
 AC_DEFINE_UNQUOTED(PACKAGE_SUFFIX, "$PACKAGE_SUFFIX", [Define to the suffix of this package])
 
diff --git a/vapi/config.vapi b/vapi/config.vapi
index 2c6df9e..49797b8 100644
--- a/vapi/config.vapi
+++ b/vapi/config.vapi
@@ -22,6 +22,7 @@
 
 [CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
 namespace Config {
+       public const string API_VERSION;
        [CCode (cheader_filename = "version.h")]
        public const string BUILD_VERSION;
        public const string PACKAGE_DATADIR;


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