diff --git a/meson.build b/meson.build index a8afa0dd2f..99d203d145 100644 --- a/meson.build +++ b/meson.build @@ -555,15 +555,24 @@ endif ##################################################################### -vcs_tagger = [project_source_root + '/tools/meson-vcs-tag.sh', - project_source_root, - get_option('version-tag'), - meson.project_version()] +version_tag = get_option('version-tag') +if version_tag != '' + vcs_data = configuration_data() + vcs_data.set('VCS_TAG', version_tag) + version_h = configure_file(configuration : vcs_data, + input : 'src/version/version.h.in', + output : 'version.h') +else + vcs_tagger = [ + project_source_root + '/tools/meson-vcs-tag.sh', + project_source_root, + meson.project_version()] -version_h = vcs_tag( - input : 'src/version/version.h.in', - output : 'version.h', - command: vcs_tagger) + version_h = vcs_tag( + input : 'src/version/version.h.in', + output : 'version.h', + command: vcs_tagger) +endif versiondep = declare_dependency(sources: version_h) diff --git a/tools/meson-vcs-tag.sh b/tools/meson-vcs-tag.sh index 1c3814d483..a285210f96 100755 --- a/tools/meson-vcs-tag.sh +++ b/tools/meson-vcs-tag.sh @@ -4,13 +4,7 @@ set -eu set -o pipefail dir="$1" -tag="$2" -fallback="$3" - -if [ -n "$tag" ]; then - echo "$tag" - exit 0 -fi +fallback="$2" # Apparently git describe has a bug where it always considers the work-tree # dirty when invoked with --git-dir (even though 'git status' is happy). Work