[shotwell/shotwell-0.30] Use meson's vcs_tag() for the git hash
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/shotwell-0.30] Use meson's vcs_tag() for the git hash
- Date: Sun, 27 Mar 2022 15:59:16 +0000 (UTC)
commit e23dc6b4e2aed95aab2de886960ff30007e57ded
Author: Jens Georg <mail jensge org>
Date: Sun Sep 23 12:13:34 2018 +0200
Use meson's vcs_tag() for the git hash
git-hash | 4 ----
meson.build | 10 +++-------
src/Resources.vala | 4 ----
src/main.vala | 4 ++--
version.h.in | 3 +++
5 files changed, 8 insertions(+), 17 deletions(-)
---
diff --git a/meson.build b/meson.build
index 0ad87042..11aa7fa1 100644
--- a/meson.build
+++ b/meson.build
@@ -20,7 +20,8 @@ vapi_incdir = include_directories('vapi')
shotwell_plugin_dir = join_paths(get_option('libdir'), 'shotwell', 'plugins', 'builtin')
add_global_arguments(['-DHAVE_CONFIG_H=1'],
- ['-include'], ['config.h'], language : 'c')
+ ['-include'], ['config.h'],
+ ['-include'], ['version.h'], language : 'c')
add_global_arguments(['--target-glib=2.40',
'--vapidir=@0@'.format(join_paths(meson.current_source_dir(),
'vapi')),
@@ -28,6 +29,7 @@ add_global_arguments(['--target-glib=2.40',
'--enable-experimental',
'--enable-deprecated'], language : 'vala')
+vcs_tag(command: ['git', 'rev-parse', 'HEAD'], input: 'version.h.in', output: 'version.h', fallback: '')
if get_option('fatal_warnings')
add_global_arguments(
[
@@ -37,12 +39,6 @@ if get_option('fatal_warnings')
)
endif
-gitver = run_command(find_program('git-hash'))
-if gitver.returncode() == 0
- add_global_arguments(['-D_GIT_VERSION="@0@"'.format(gitver.stdout().strip())],
- language : 'c')
- add_global_arguments(['--define=_GITVERSION'], language : 'vala')
-endif
gtk = dependency('gtk+-3.0', version : '>= 3.22')
gio = dependency('gio-2.0', version: '>= 2.40')
diff --git a/src/Resources.vala b/src/Resources.vala
index 801305ce..1449bf4e 100644
--- a/src/Resources.vala
+++ b/src/Resources.vala
@@ -18,11 +18,7 @@ namespace Resources {
public const string APP_DIRECT_ROLE = _("Photo Viewer");
public const string APP_VERSION = _VERSION;
-#if _GITVERSION
public const string? GIT_VERSION = _GIT_VERSION;
-#else
- public const string? GIT_VERSION = null;
-#endif
public const string COPYRIGHT = _("Copyright 2016 Software Freedom Conservancy Inc.");
public const string APP_GETTEXT_PACKAGE = GETTEXT_PACKAGE;
diff --git a/src/main.vala b/src/main.vala
index 8313ba18..a971f157 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -383,7 +383,7 @@ void main(string[] args) {
}
if (CommandlineOptions.show_version) {
- if (Resources.GIT_VERSION != null)
+ if (Resources.GIT_VERSION != "")
print("%s %s (%s)\n", Resources.APP_TITLE, Resources.APP_VERSION, Resources.GIT_VERSION);
else
print("%s %s\n", Resources.APP_TITLE, Resources.APP_VERSION);
@@ -415,7 +415,7 @@ void main(string[] args) {
Debug.init(is_string_empty(filename) ? Debug.LIBRARY_PREFIX : Debug.VIEWER_PREFIX);
- if (Resources.GIT_VERSION != null)
+ if (Resources.GIT_VERSION != "")
message("Shotwell %s %s (%s)",
is_string_empty(filename) ? Resources.APP_LIBRARY_ROLE : Resources.APP_DIRECT_ROLE,
Resources.APP_VERSION, Resources.GIT_VERSION);
diff --git a/version.h.in b/version.h.in
new file mode 100644
index 00000000..fe25b696
--- /dev/null
+++ b/version.h.in
@@ -0,0 +1,3 @@
+#pragma once
+
+#define _GIT_VERSION "@VCS_TAG@"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]