[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] build-sys: Fix meson version detection logic

Arun Raghavan gitlab at gitlab.freedesktop.org
Thu Oct 11 15:14:11 UTC 2018


Arun Raghavan pushed to branch master at PulseAudio / pulseaudio


Commits:
56c1e7c6 by Arun Raghavan at 2018-10-11T14:56:09Z
build-sys: Fix meson version detection logic

This sync the meson version detection to match what we do in the
autotools build, which is to use git-version-gen, which in turn looks
for <topdir>/.tarball-version, or generates the version based on a git
tag or environment variable.

- - - - -


1 changed file:

- meson.build


Changes:

=====================================
meson.build
=====================================
@@ -1,14 +1,21 @@
 project('pulseaudio', 'c', 'cpp',
-        version : '10.99.1',
+        version : run_command(find_program('git-version-gen'), join_paths(meson.current_source_dir(), '.tarball-version')).stdout().strip(),
         meson_version : '>= 0.44.0',
         default_options : [ 'c_std=gnu11', 'cpp_std=c++11' ]
         )
 
-pa_version = meson.project_version()
-version_split = pa_version.split('.')
-pa_version_major = version_split[0]
+pa_version_str = meson.project_version()
+# For tarballs, the first split will do nothing, but for builds in git, we
+# split out suffixes when there are commits since the last tag
+# (e.g.: v11.99.1-3-gad14bdb24 -> v11.99.1)
+version_split = pa_version_str.split('-')[0].split('.')
+pa_version_major = version_split[0].split('v')[0]
 pa_version_minor = version_split[1]
-pa_version_micro = version_split[2]
+if version_split.length() > 2
+  pa_version_micro = version_split[2]
+else
+  pa_version_micro = '0'
+endif
 pa_version_major_minor = pa_version_major + '.' + pa_version_minor
 
 pa_api_version = 12
@@ -31,7 +38,7 @@ cc = meson.get_compiler('c')
 cdata = configuration_data()
 cdata.set_quoted('PACKAGE', 'pulseaudio')
 cdata.set_quoted('PACKAGE_NAME', 'pulseaudio')
-cdata.set_quoted('PACKAGE_VERSION', pa_version)
+cdata.set_quoted('PACKAGE_VERSION', pa_version_str)
 cdata.set_quoted('CANONICAL_HOST', host_machine.cpu())
 cdata.set('PA_MAJOR', pa_version_major)
 cdata.set('PA_MINOR', pa_version_minor)



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/56c1e7c61528c5cf2b66b6193ac348046b3ca285

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/56c1e7c61528c5cf2b66b6193ac348046b3ca285
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20181011/9f15e5a1/attachment-0001.html>


More information about the pulseaudio-commits mailing list