diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/gen-version.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/utils/gen-version.sh b/utils/gen-version.sh index eb7c7268..e1f7ca7b 100755 --- a/utils/gen-version.sh +++ b/utils/gen-version.sh @@ -5,6 +5,7 @@ build_dir="$1" src_dir="$2" +project_version="$3" # If .tarball-version exists, output the version string from the file and exit. # This file is auto-generated on a 'meson dist' command from the run-dist.sh @@ -43,6 +44,13 @@ then fi git diff-index --quiet HEAD || version="$version-dirty ($(date --iso-8601=seconds))" +# If a project version is provided, use it to replace the version number. +if [ -n "$project_version" ] +then + version=$(echo "$version" | sed -e 's/^[^-]*-//') + version="v$project_version-$version" +fi + # Replace first '-' with a '+' to denote build metadata, strip the 'g' in from # of the git SHA1 and remove the initial 'v'. version=$(echo "$version" | sed -e 's/-/+/' | sed -e 's/-g/-/' | cut -c 2-) |