diff options
author | 2019-02-12 23:22:13 +0100 | |
---|---|---|
committer | 2019-02-12 23:22:13 +0100 | |
commit | f390a6ef8c8956c85409f95b5c70d8b9f0a8f55c (patch) | |
tree | fbb49d4c743f817a6c4668369b62762decf6cbc1 /meson.build | |
parent | workspace_get_initial_output: handle focused layer (diff) | |
parent | Fix --version when building from tarball (diff) | |
download | sway-f390a6ef8c8956c85409f95b5c70d8b9f0a8f55c.tar.gz sway-f390a6ef8c8956c85409f95b5c70d8b9f0a8f55c.tar.zst sway-f390a6ef8c8956c85409f95b5c70d8b9f0a8f55c.zip |
Merge pull request #3667 from emersion/fix-meson-version
Fix --version when building from tarball
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 11 |
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 | |||
128 | 128 | ||
129 | add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') | 129 | add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') |
130 | 130 | ||
131 | version = '"@0@"'.format(meson.project_version()) | ||
131 | if git.found() | 132 | if git.found() |
132 | git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip() | 133 | git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']) |
133 | git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip() | 134 | git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']) |
134 | version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch) | 135 | if git_commit_hash.returncode() == 0 and git_branch.returncode() == 0 |
135 | else | 136 | version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash.stdout().strip(), git_branch.stdout().strip()) |
136 | version = '"@0@"'.format(meson.project_version()) | 137 | endif |
137 | endif | 138 | endif |
138 | add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') | 139 | add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') |
139 | 140 | ||