version: Strip SOF_FW_XXX_ prefix from version number

The version information is generated using git tags and needs to be
numerical for version.h usage.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
Liam Girdwood 2018-03-21 09:42:02 +00:00
parent ffd9093267
commit 856f768e3a
1 changed files with 13 additions and 2 deletions

View File

@ -10,11 +10,22 @@ else
DIR=$1
fi
# get version from git tag
GIT_TAG=`git describe --abbrev=4`
# Some releases have a SOF_FW_XXX_ prefix on the tag and this prefix
# must be stripped for usage in version.h. i.e. we just need the number.
if [ $(expr match $GIT_TAG 'SOF_FW_[A-Z][A-Z][A-Z]_' ) -eq 11 ]; then
VER=`echo $GIT_TAG | cut -d_ -f4`
else
VER=$GIT_TAG
fi
# create git version if we are a git repo or git worktree
if [ -e $DIR/.git -o -d $DIR/.git ]; then
# version for make dist
git describe --abbrev=4 > $DIR/.version
git describe --abbrev=4 > $DIR/.tarball-version
echo $VER > $DIR/.version
echo $VER > $DIR/.tarball-version
# git commit for IPC
echo "#define REEF_TAG \"`git log --pretty=format:\"%h\" -1 | cut -c1-5`\"" > $DIR/src/include/version.h