aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Michael Vetter <jubalh@iodoru.org>2019-02-05 14:32:05 +0100
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-02-11 10:15:00 -0500
commit9346ed1805dab798fe9f6edcb47e003081722d79 (patch)
treea8dccb095e9c53a413fb15764f9777a8ef1884bf
parentIPC_COMMAND: split on newline (diff)
downloadsway-9346ed1805dab798fe9f6edcb47e003081722d79.tar.gz
sway-9346ed1805dab798fe9f6edcb47e003081722d79.tar.zst
sway-9346ed1805dab798fe9f6edcb47e003081722d79.zip
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 @@
1project( 1project(
2 'sway', 2 'sway',
3 'c', 3 'c',
4 version: '1.0',
4 license: 'MIT', 5 license: 'MIT',
5 meson_version: '>=0.48.0', 6 meson_version: '>=0.48.0',
6 default_options: [ 7 default_options: [
@@ -127,17 +128,12 @@ endif
127 128
128add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') 129add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c')
129 130
130version = get_option('sway-version') 131if git.found()
131if version != ''
132 version = '"@0@"'.format(version)
133else
134 if not git.found()
135 error('git is required to make the version string')
136 endif
137
138 git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip() 132 git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
139 git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip() 133 git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
140 version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch) 134 version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
135else
136 version = '"@0@"'.format(meson.project_version())
141endif 137endif
142add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') 138add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
143 139
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 @@
1option('sway-version', type : 'string', description: 'The version string reported in `sway --version`.')
2option('default-wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.') 1option('default-wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.')
3option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.') 2option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.')
4option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.') 3option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.')