meson: Warn when git is missing in non-dist builds

8b5060349a 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.
This commit is contained in:
Jan Tojnar 2019-11-21 14:10:34 +01:00
parent 8b5060349a
commit 4b8bb5e057
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4
1 changed files with 7 additions and 3 deletions

View File

@ -1456,15 +1456,19 @@ if is_git_repository or not has_version_h
replace_string: '@GIMP_GIT_LAST_COMMIT_YEAR@', replace_string: '@GIMP_GIT_LAST_COMMIT_YEAR@',
fallback: 'unknown (unsupported)', 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 # We create git-version.h but know it will be useless because we are
# not in a git repository. Output a warning. # not in a git repository. Output a warning.
git_warning = ''' git_warning = '''
UNSUPPORTED BUILD! UNSUPPORTED BUILD!
This is not a distribution tarball (git-version.h missing) nor is it This is not a distribution tarball (git-version.h missing) and
a git repository. Therefore we have no reference for debugging. 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. Please either use release tarballs or build from the repository.
''' '''
warning(git_warning) warning(git_warning)