Commit e04e37f6 authored by Jens Georg's avatar Jens Georg

Use meson's vcs_tag() for the git hash

parent 904c9723
#!/bin/sh
cd $MESON_SOURCE_ROOT
exec git rev-parse HEAD 2>/dev/null
......@@ -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')),
......@@ -29,12 +30,7 @@ add_global_arguments(['--target-glib=2.40',
'--enable-experimental',
'--enable-deprecated'], language : 'vala')
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
vcs_tag(command: ['git', 'rev-parse', 'HEAD'], input: 'version.h.in', output: 'version.h', fallback: '')
gtk = dependency('gtk+-3.0', version : '>= 3.22')
gio = dependency('gio-2.0', version: '>= 2.40')
......
......@@ -594,7 +594,7 @@ public abstract class AppWindow : PageWindow {
protected void on_about() {
const string[] artists = { "Braunschweiger Löwe created by Magnus Manske., CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=109735", null };
Gtk.show_about_dialog(this,
"version", Resources.APP_VERSION,
"version", Resources.APP_VERSION + (Resources.GIT_VERSION != "" ? " — " + Resources.GIT_VERSION : ""),
"comments", get_app_role(),
"copyright", Resources.COPYRIGHT,
"website", Resources.HOME_URL,
......
......@@ -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;
......
......@@ -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);
......
#pragma once
#define _GIT_VERSION "@VCS_TAG@"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment