diff options
| author | Drew DeVault <sir@cmpwn.com> | 2019-02-12 23:27:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-12 23:27:26 +0100 |
| commit | 6b3be42264b9eaa8524ea4f0d93fbd1d82495d90 (patch) | |
| tree | ec5dc56872f793ef50cda36bb92aa310f70c0c95 | |
| parent | ec78bb121f3bdf580ee97261e29f327cf57c0abb (diff) | |
| parent | 076d442c035a6b04837ce30c6e9ec256f80fedb5 (diff) | |
Merge pull request #53 from swaywm/fix-meson-version
Fix --version when building from tarball
| -rw-r--r-- | meson.build | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/meson.build b/meson.build index 6fffcff..5483d9a 100644 --- a/meson.build +++ b/meson.build @@ -48,12 +48,13 @@ git = find_program('git', required: false) scdoc = find_program('scdoc', required: get_option('man-pages')) wayland_scanner = find_program('wayland-scanner') +version = '"@0@"'.format(meson.project_version()) if git.found() - git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip() - git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip() - version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch) -else - version = '"@0@"'.format(meson.project_version()) + git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']) + git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']) + if git_commit_hash.returncode() == 0 and git_branch.returncode() == 0 + version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash.stdout().strip(), git_branch.stdout().strip()) + endif endif add_project_arguments('-DSWAYLOCK_VERSION=@0@'.format(version), language: 'c') |
