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.
This commit is contained in:
parent
effdea5231
commit
3515c4b453
12
meson.build
12
meson.build
@ -1,6 +1,7 @@
|
|||||||
project(
|
project(
|
||||||
'swaylock',
|
'swaylock',
|
||||||
'c',
|
'c',
|
||||||
|
version: '1.3',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=0.48.0',
|
meson_version: '>=0.48.0',
|
||||||
default_options: [
|
default_options: [
|
||||||
@ -47,17 +48,12 @@ git = find_program('git', required: false)
|
|||||||
scdoc = find_program('scdoc', required: get_option('man-pages'))
|
scdoc = find_program('scdoc', required: get_option('man-pages'))
|
||||||
wayland_scanner = find_program('wayland-scanner')
|
wayland_scanner = find_program('wayland-scanner')
|
||||||
|
|
||||||
version = get_option('swaylock-version')
|
if git.found()
|
||||||
if version != ''
|
|
||||||
version = '"@0@"'.format(version)
|
|
||||||
else
|
|
||||||
if not git.found()
|
|
||||||
error('git is required to make the version string')
|
|
||||||
endif
|
|
||||||
|
|
||||||
git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
|
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()
|
git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
|
||||||
version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
|
version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
|
||||||
|
else
|
||||||
|
version = '"@0@"'.format(meson.project_version())
|
||||||
endif
|
endif
|
||||||
add_project_arguments('-DSWAYLOCK_VERSION=@0@'.format(version), language: 'c')
|
add_project_arguments('-DSWAYLOCK_VERSION=@0@'.format(version), language: 'c')
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
option('swaylock-version', type : 'string', description: 'The version string reported in `swaylock --version`')
|
|
||||||
option('pam', type: 'feature', value: 'auto', description: 'Use PAM instead of shadow')
|
option('pam', type: 'feature', value: 'auto', description: 'Use PAM instead of shadow')
|
||||||
option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats')
|
option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats')
|
||||||
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
|
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
|
||||||
|
Loading…
Reference in New Issue
Block a user