aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-02-05 14:32:05 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-02-05 14:32:05 +0100
commit77587ee632db2f047e5e0b7979b0319ed2257405 (patch)
tree7ee293bf255b7778629c268f382689739a607981
parent478b128c26057dcd7c97aaf5f91aa08dfce7d38f (diff)
Set version in project file
Let's set the version in the meson file instead of declaring it outside. In case git is installed we use the git hash as version. Instead it isn't (like on a clean build system), let's use the version defined in the project.
-rw-r--r--meson.build12
-rw-r--r--meson_options.txt1
2 files changed, 4 insertions, 9 deletions
diff --git a/meson.build b/meson.build
index 766bf012..c50fab17 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,7 @@
project(
'sway',
'c',
+ version: '1.0',
license: 'MIT',
meson_version: '>=0.48.0',
default_options: [
@@ -127,17 +128,12 @@ endif
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c')
-version = get_option('sway-version')
-if version != ''
- version = '"@0@"'.format(version)
-else
- if not git.found()
- error('git is required to make the version string')
- endif
-
+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())
endif
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
diff --git a/meson_options.txt b/meson_options.txt
index 04b29e17..d3667acf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,4 +1,3 @@
-option('sway-version', type : 'string', description: 'The version string reported in `sway --version`.')
option('default-wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.')
option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')