summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2019-02-12 23:13:24 +0100
committerFurkan Sahin <furkan-dev@proton.me>2019-02-12 23:13:24 +0100
commit9ab50a7c1cf4562d5ee098a2d9430078ccb64f6e (patch)
tree241c7e66f4fcb4d48377ee0a396039a70dacab34 /meson.build
parent251fcdcf5fe6b91e80c6e4509463ec8cc8fa03f8 (diff)
Fix --version when building from tarball
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build11
1 files changed, 6 insertions, 5 deletions
diff --git a/meson.build b/meson.build
index c50fab17..2336a148 100644
--- a/meson.build
+++ b/meson.build
@@ -128,12 +128,13 @@ endif
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c')
+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('-DSWAY_VERSION=@0@'.format(version), language: 'c')