diff options
author | Simon Ser <contact@emersion.fr> | 2019-10-14 15:03:28 +0300 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-10-16 09:42:28 -0400 |
commit | 72ba9bef4b538279b13f9e5abfcca93010688607 (patch) | |
tree | b30ce0632d8cd212ed42b6cfe4217692e2387ca3 /meson.build | |
parent | sway(5): move workspace_layout to config only (diff) | |
download | sway-72ba9bef4b538279b13f9e5abfcca93010688607.tar.gz sway-72ba9bef4b538279b13f9e5abfcca93010688607.tar.zst sway-72ba9bef4b538279b13f9e5abfcca93010688607.zip |
build: always use the project version
Don't use the latest tag, always use the project version for the version
string. Because of version branches, getting the version from Git can be
unreliable.
Closes: https://github.com/swaywm/sway/issues/4631
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/meson.build b/meson.build index cb0715f6..d74861f1 100644 --- a/meson.build +++ b/meson.build | |||
@@ -54,7 +54,6 @@ elogind = dependency('libelogind', version: '>=239', required: false) | |||
54 | xcb = dependency('xcb', required: get_option('xwayland')) | 54 | xcb = dependency('xcb', required: get_option('xwayland')) |
55 | math = cc.find_library('m') | 55 | math = cc.find_library('m') |
56 | rt = cc.find_library('rt') | 56 | rt = cc.find_library('rt') |
57 | git = find_program('git', native: true, required: false) | ||
58 | 57 | ||
59 | # Try first to find wlroots as a subproject, then as a system dependency | 58 | # Try first to find wlroots as a subproject, then as a system dependency |
60 | wlroots_version = ['>=0.8.1', '<0.9.0'] | 59 | wlroots_version = ['>=0.8.1', '<0.9.0'] |
@@ -130,11 +129,16 @@ endif | |||
130 | 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') |
131 | 130 | ||
132 | version = '"@0@"'.format(meson.project_version()) | 131 | version = '"@0@"'.format(meson.project_version()) |
132 | git = find_program('git', native: true, required: false) | ||
133 | if git.found() | 133 | if git.found() |
134 | git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']) | 134 | git_commit = run_command([git, 'rev-parse', '--short', 'HEAD']) |
135 | git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']) | 135 | git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD']) |
136 | if git_commit_hash.returncode() == 0 and git_branch.returncode() == 0 | 136 | if git_commit.returncode() == 0 and git_branch.returncode() == 0 |
137 | version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash.stdout().strip(), git_branch.stdout().strip()) | 137 | version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format( |
138 | meson.project_version(), | ||
139 | git_commit.stdout().strip(), | ||
140 | git_branch.stdout().strip(), | ||
141 | ) | ||
138 | endif | 142 | endif |
139 | endif | 143 | endif |
140 | add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') | 144 | add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') |