[recipes/meson2] meson: Compute and set LIBGD_INFO in config.h



commit 32cd57df249ca50a1e98fde73aba203ee1fca433
Author: Nirbheek Chauhan <nirbheek centricular com>
Date:   Sat Feb 18 22:53:13 2017 +0530

    meson: Compute and set LIBGD_INFO in config.h

 meson.build |   42 ++++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/meson.build b/meson.build
index b20a2cd..86727d9 100644
--- a/meson.build
+++ b/meson.build
@@ -5,22 +5,6 @@ i18n = import('i18n')
 
 conf = configuration_data()
 
-pkgdatadir = join_paths([ get_option('prefix'),
-                          get_option('datadir'),
-                          'gnome-recipes' ])
-conf.set_quoted('G_LOG_DOMAIN', 'org.gnome.Recipes')
-conf.set_quoted('PACKAGE_NAME', 'gnome-recipes')
-conf.set_quoted('PACKAGE_VERSION', meson.project_version())
-conf.set_quoted('GETTEXT_PACKAGE', 'gnome-recipes')
-conf.set_quoted('PKGDATADIR', pkgdatadir)
-conf.set_quoted('LOCALEDIR', join_paths([ get_option('prefix'),
-                                          get_option('datadir'),
-                                          'locale' ]))
-# Used while generating cuisine.css
-conf.set('pkgdatadir', pkgdatadir)
-
-configure_file(output : 'config.h', configuration : conf)
-
 # Needed to find config.h
 top_inc = include_directories('.')
 
@@ -32,10 +16,36 @@ libgd = subproject('libgd',
            ])
 libgd_dep = libgd.get_variable('libgd_dep')
 
+# Extract LIBGD_INFO
+libgd_path = join_paths([meson.source_root(), 'subprojects', 'libgd'])
+git_run = run_command('git', ['-C', libgd_path, 'log', '-1', '--pretty=%h'])
+if git_run.returncode() == 0
+  conf.set_quoted('LIBGD_INFO', git_run.stdout().strip())
+else
+  message('Failed to extract git commit hash for libgd:\n' + git_run.stderr())
+  conf.set_quoted('LIBGD_INFO', 'unknown')
+endif
+
 deps = [ dependency('gtk+-3.0'),
          dependency('gnome-autoar-0'),
          dependency('gspell-1'),
          dependency('libcanberra'),
          libgd_dep ]
 
+pkgdatadir = join_paths([ get_option('prefix'),
+                          get_option('datadir'),
+                          'gnome-recipes' ])
+conf.set_quoted('G_LOG_DOMAIN', 'org.gnome.Recipes')
+conf.set_quoted('PACKAGE_NAME', 'gnome-recipes')
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('GETTEXT_PACKAGE', 'gnome-recipes')
+conf.set_quoted('PKGDATADIR', pkgdatadir)
+conf.set_quoted('LOCALEDIR', join_paths([ get_option('prefix'),
+                                          get_option('datadir'),
+                                          'locale' ]))
+# Used while generating cuisine.css
+conf.set('pkgdatadir', pkgdatadir)
+
+configure_file(output : 'config.h', configuration : conf)
+
 subdir('src')


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