[Spice-commits] src/meson.build
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat May 23 09:29:06 UTC 2020
src/meson.build | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
New commits:
commit c5e2ab432253df08881abe720253027ae5733f4f
Author: Kevin Pouget <kpouget at redhat.com>
Date: Tue May 19 09:52:06 2020 +0200
src/meson.build: fix bug when project version is unknown
When `build-aux/git-version-gen` is not able to find the project
version (no git tags and no `.tarball-version`), it returns 'UNKNOWN'
or 'UNKNOWN-dirty' (instead of the project version like
`0.38.28-d79b`).
This `UNKNOWN` value fails `meson build` command:
src/meson.build:9:0: ERROR: Index 1 out of bounds of array of size 1.
With this patch, we set a default major/minor/micro value when the
actual version is unknown. This is the same as the `autoconf`
historical behavior.
See spice#41.
Signed-off-by: Kevin Pouget <kpouget at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/src/meson.build b/src/meson.build
index 6efe411..34c7a44 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -5,13 +5,20 @@ spice_gtk_include += [include_directories('.')]
#
# generate spice-version.h
-version_info = meson.project_version().split('.')
-major = '@0@'.format(version_info[0])
-minor = '@0@'.format(version_info[1])
-micro = '0'
-if version_info.length() > 2
- micro = version_info[2].split('-')[0]
+if meson.project_version().startswith('UNKNOWN')
+ major = '0'
+ minor = '0'
+ micro = '1'
+else
+ version_info = meson.project_version().split('.')
+ major = '@0@'.format(version_info[0])
+ minor = '@0@'.format(version_info[1])
+ micro = '0'
+ if version_info.length() > 2
+ micro = version_info[2].split('-')[0]
+ endif
endif
+
version_data = configuration_data()
version_data.set('SPICE_GTK_MAJOR_VERSION', major)
version_data.set('SPICE_GTK_MINOR_VERSION', minor)
More information about the Spice-commits
mailing list