diff --git a/src/find_year.sh b/src/find_year.sh deleted file mode 100755 index cbab4768530ebdb2e9091d21b75d0395b402ba00..0000000000000000000000000000000000000000 --- a/src/find_year.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# SPDX-FileCopyrightText: 2018-2020 Bruce Cowan <bruce@bcowan.me.uk> -# -# SPDX-License-Identifier: CC0-1.0 - -git log -1 --format=%cd --date=format:%Y diff --git a/src/main.c b/src/main.c index 52342e5e23a43a9f3374b498036550d09d468b1e..7f2d0a10632f632618d43bfbe3863b5f58ec42e0 100644 --- a/src/main.c +++ b/src/main.c @@ -35,6 +35,7 @@ about_activated (GSimpleAction *simple, "license-type", GTK_LICENSE_LGPL_3_0, "authors", authors, "comments", "Rugby scores possiblities program", + "version", PACKAGE_VERSION, NULL); } diff --git a/src/meson.build b/src/meson.build index 6f16b3f2159249586faef745bb05e889c3640e28..10a5d0c0249d97a0bd02d17ba1cc601ae1bb4b0f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2016-2018 Bruce Cowan <bruce@bcowan.me.uk> +# SPDX-FileCopyrightText: 2016-2020 Bruce Cowan <bruce@bcowan.me.uk> # # SPDX-License-Identifier: CC0-1.0 @@ -9,8 +9,17 @@ conf.set('TRY_POINTS', get_option('try_points')) conf.set('UTRY_POINTS', get_option('utry_points')) conf.set('KICK_POINTS', get_option('kick_points')) -year = run_command('find_year.sh').stdout().strip() -conf.set_quoted('COPYRIGHT_YEAR', year) +VCS_TAG = '' +COPYRIGHT_YEAR = '?' + +git = find_program('git', required: false) +if git.found() + VCS_TAG = run_command('git', 'rev-parse', '--short', 'HEAD').stdout().strip() + COPYRIGHT_YEAR = run_command('git', 'log', '-1', '--format=%cd', '--date=format:%Y').stdout().strip() +endif + +conf.set_quoted('PACKAGE_VERSION', VCS_TAG) +conf.set_quoted('COPYRIGHT_YEAR', COPYRIGHT_YEAR) config_h = configure_file(configuration: conf, output: 'config.h')