[gimp/meson: 34/805] Add gimpversion.h, git-version.h. Fix missing debug_sources.



commit 21e22df14c7e489c13bb0728bad4cd1a8fed8828
Author: Félix Piédallu <felix piedallu me>
Date:   Thu Nov 9 11:28:59 2017 +0100

    Add gimpversion.h, git-version.h. Fix missing debug_sources.

 app/core/meson.build         |   59 +++++++++++++++++++++++++++++++++----
 app/git-version.h.in         |    5 +++
 app/meson.build              |   42 +++++++++++++++++++++++++-
 libgimpbase/gimpversion.h.in |   65 ++++++++++++++++++++++++++++++++++++++++++
 libgimpbase/meson.build      |   16 +++++++++-
 5 files changed, 177 insertions(+), 10 deletions(-)
---
diff --git a/app/core/meson.build b/app/core/meson.build
index 1c3760b..cbc76ca 100644
--- a/app/core/meson.build
+++ b/app/core/meson.build
@@ -1,3 +1,53 @@
+
+appcoreenums = custom_target('core-enums',
+  input : [ 'core-enums.h', ],
+  output: [ 'core-enums.c', ],
+  command: [
+    gimp_mkenums,
+    '--fhead','#include "config.h"\n'+
+              '#include <gio/gio.h>\n'+
+              '#include "libgimpbase/gimpbase.h"\n'+
+              '#include "core-enums.h"\n'+
+              '#include "gimp-intl.h"\n',
+    '--fprod','/* enumerations from "@basename@" */\n',
+    '--vhead','GType\n'+
+              '@enum_name@_get_type (void)\n'+
+              '{\n'+
+              '  static const G@Type@Value values[] =\n'+
+              '  {',
+    '--vprod','    { @VALUENAME@, "@VALUENAME@", "@valuenick@" },',
+    '--vtail','    { 0, NULL, NULL }\n'+
+              '  };\n',
+    '--dhead','  static const Gimp@Type@Desc descs[] =\n'+
+              '  {',
+    '--dprod','    { @VALUENAME@, @valuedesc@, @valuehelp@ },',
+    '--dtail','    { 0, NULL, NULL }\n'+
+              '  };\n'+
+              '\n'+
+              '  static GType type = 0;\n'+
+              '\n'+
+              '  if (G_UNLIKELY (! type))\n'+
+              '    {\n'+
+              '      type = g_@type@_register_static ("@EnumName@", values);\n'+
+              '      gimp_type_set_translation_context (type, "@enumnick@");\n'+
+              '      gimp_@type@_set_value_descriptions (type, descs);\n'+
+              '    }\n'+
+              '\n'+
+              '  return type;\n'+
+              '}\n',
+    '@INPUT@',
+  ],
+  capture: true,
+)
+
+appcoremarshal = gnome.genmarshal('gimpmarshal',
+  prefix: 'gimp_marshal',
+  sources: 'gimpmarshal.list',
+  install_header: false,
+)
+
+
+
 libappcore_sources = [
   'gimp-batch.c',
   'gimp-cairo.c',
@@ -141,7 +191,6 @@ libappcore_sources = [
   'gimplayerstack.c',
   'gimplayerundo.c',
   'gimplist.c',
-  'gimpmarshal.c',
   'gimpmaskundo.c',
   'gimpmybrush-load.c',
   'gimpmybrush.c',
@@ -194,12 +243,8 @@ libappcore_sources = [
   'gimpundostack.c',
   'gimpunit.c',
   'gimpviewable.c',
-]
-
-# TODO mkenums
-libappcore_sources += [
-  'core-enums.c',
-  # 'gimpmarshall.c',
+  appcoreenums,
+  appcoremarshal,
 ]
 
 libappcore = static_library('appcore',
diff --git a/app/git-version.h.in b/app/git-version.h.in
new file mode 100644
index 0000000..2adb447
--- /dev/null
+++ b/app/git-version.h.in
@@ -0,0 +1,5 @@
+#pragma once
+
+#define GIMP_GIT_VERSION          "@GIMP_GIT_VERSION@"
+#define GIMP_GIT_VERSION_ABBREV   "@GIMP_GIT_VERSION_ABBREV@"
+#define GIMP_GIT_LAST_COMMIT_YEAR "@GIMP_GIT_LAST_COMMIT_YEAR@"
diff --git a/app/meson.build b/app/meson.build
index ffe8ef9..956baf5 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -1,7 +1,5 @@
-
 rootAppInclude = include_directories('.')
 
-
 subdir('actions')
 subdir('core')
 subdir('dialogs')
@@ -22,6 +20,46 @@ subdir('widgets')
 subdir('xcf')
 
 
+app_debug_files = files(
+  'gimp-debug.c',
+  'gimp-log.c',
+)
+
+gitversion_h1 = vcs_tag(
+  input : 'git-version.h.in',
+  output: 'git-version.h.in.1',
+  command: [ 'git', 'describe', '--always', ],
+  replace_string: '@GIMP_GIT_VERSION@',
+  fallback: '',
+)
+gitversion_h2 = vcs_tag(
+  input : gitversion_h1,
+  output: 'git-version.h.in.2',
+  command: [ 'git', 'rev-parse', '--short', 'HEAD', ],
+  replace_string: '@GIMP_GIT_VERSION_ABBREV@',
+  fallback: '',
+)
+gitversion_h = vcs_tag(
+  input : gitversion_h2,
+  output: 'git-version.h',
+  command: [ 'git', 'log', '-n1', '--date=format:%Y', '--pretty=%cd', ],
+  replace_string: '@GIMP_GIT_LAST_COMMIT_YEAR@',
+  fallback: '',
+)
+
+libapp_sources = [
+  'app.c',
+  'errors.c',
+  'gimp-debug.c',
+  'gimp-log.c',
+  'language.c',
+  'sanity.c',
+  'signals.c',
+  'tests.c',
+  'unique.c',
+  'version.c',
+  gitversion_h,
+]
 # Those subdirs need to link againts the first ones
 # subdir('config')
 # subdir('tests')
diff --git a/libgimpbase/gimpversion.h.in b/libgimpbase/gimpversion.h.in
new file mode 100644
index 0000000..3dd9b95
--- /dev/null
+++ b/libgimpbase/gimpversion.h.in
@@ -0,0 +1,65 @@
+#pragma once
+
+// gimpversion.h.in -> gimpversion.h
+// This file is configured by Meson. Please modify meson.build files.
+
+#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
+#error "Only <libgimpbase/gimpbase.h> can be included directly."
+#endif
+
+G_BEGIN_DECLS
+
+
+/**
+ * SECTION: gimpversion
+ * @title: gimpversion
+ * @short_description: Macros and constants useful for determining
+ *                     GIMP's version number and capabilities.
+ *
+ * Macros and constants useful for determining GIMP's version number and
+ * capabilities.
+ **/
+
+/**
+ * GIMP_MAJOR_VERSION:
+ *
+ * The major GIMP version number.
+ **/
+#define GIMP_MAJOR_VERSION                              (@GIMP_MAJOR_VERSION@)
+
+/**
+ * GIMP_MINOR_VERSION:
+ *
+ * The minor GIMP version number.
+ **/
+#define GIMP_MINOR_VERSION                              (@GIMP_MINOR_VERSION@)
+
+/**
+ * GIMP_MICRO_VERSION:
+ *
+ * The micro GIMP version number.
+ **/
+#define GIMP_MICRO_VERSION                              (@GIMP_MICRO_VERSION@)
+
+/**
+ * GIMP_VERSION:
+ *
+ * The GIMP version as a string.
+ **/
+#define GIMP_VERSION                                    "@GIMP_VERSION@"
+
+/**
+ * GIMP_API_VERSION:
+ *
+ * Since: 2.2
+ **/
+#define GIMP_API_VERSION                                "@GIMP_API_VERSION@"
+
+#define GIMP_CHECK_VERSION(major, minor, micro) \
+    (GIMP_MAJOR_VERSION > (major) || \
+     (GIMP_MAJOR_VERSION == (major) && GIMP_MINOR_VERSION > (minor)) || \
+     (GIMP_MAJOR_VERSION == (major) && GIMP_MINOR_VERSION == (minor) && \
+      GIMP_MICRO_VERSION >= (micro)))
+
+
+G_END_DECLS
diff --git a/libgimpbase/meson.build b/libgimpbase/meson.build
index 383c7c0..e628dbf 100644
--- a/libgimpbase/meson.build
+++ b/libgimpbase/meson.build
@@ -1,4 +1,17 @@
 
+versionconfig = configuration_data()
+versionconfig.set('GIMP_MAJOR_VERSION', major_version)
+versionconfig.set('GIMP_MINOR_VERSION', minor_version)
+versionconfig.set('GIMP_MICRO_VERSION', micro_version)
+versionconfig.set('GIMP_VERSION',       meson.project_version())
+versionconfig.set('GIMP_API_VERSION',   api_version)
+gimpversion = configure_file(
+  input : 'gimpversion.h.in',
+  output: 'gimpversion.h',
+  configuration: versionconfig,
+)
+
+
 gimpbaseenums = custom_target('gimpbaseenums.c',
   input : [ 'gimpbaseenums.h', ],
   output: [ 'gimpbaseenums.c', ],
@@ -103,6 +116,7 @@ libgimpbase_sources = [
   'gimpwire.c',
   gimpbaseenums,
   gimpcompatenums,
+  gimpversion,
 ]
 
 libgimpbase_headers = [
@@ -112,7 +126,6 @@ libgimpbase_headers = [
   'gimpcpuaccel.h',
   'gimplimits.h',
   'gimpparam.h',
-  'gimpversion.h',
   'gimpchecks.h',
   'gimpdatafiles.h',
   'gimpenv.h',
@@ -125,6 +138,7 @@ libgimpbase_headers = [
   'gimpunit.h',
   'gimputils.h',
   'gimpvaluearray.h',
+  gimpversion,
 ]
 
 libgimpbase_cflags = [


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