From 4b8bb5e057c4ba3abb88c0d8c86b12f72b7ca208 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 21 Nov 2019 14:10:34 +0100 Subject: [PATCH] meson: Warn when git is missing in non-dist builds 8b5060349a95ca552cc1afa9f9c6f4becc2fe7f6 fixes the issue of version headers not being available when building out of VCS tarball (without .git directory) but we were getting `unknown (unsupported)` version still. Turns out the version silently fell back to `unknown` when git was not available. Let's warn the user when this is the case. --- meson.build | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 2a0191bcba..c28bf08eab 100644 --- a/meson.build +++ b/meson.build @@ -1456,15 +1456,19 @@ if is_git_repository or not has_version_h replace_string: '@GIMP_GIT_LAST_COMMIT_YEAR@', fallback: 'unknown (unsupported)', ) - if not is_git_repository + + git = find_program('git', required: false) + if not is_git_repository or not git.found() # We create git-version.h but know it will be useless because we are # not in a git repository. Output a warning. git_warning = ''' UNSUPPORTED BUILD! - This is not a distribution tarball (git-version.h missing) nor is it - a git repository. Therefore we have no reference for debugging. + This is not a distribution tarball (git-version.h missing) and + we could not establish the corresponding commit (either this is + not a git repository or git command is missing). Therefore + we have no reference for debugging. Please either use release tarballs or build from the repository. ''' warning(git_warning)