Include commit hash if possible in versioning script, if a non-stable tree is compiled
This commit is contained in:
parent
7e383c395e
commit
abdb1aeff9
1 changed files with 16 additions and 10 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
SCRIPT_DIR=$(dirname "$0")
|
SCRIPT_DIR=$(dirname "$0")
|
||||||
DIRTY=""
|
DIRTY=""
|
||||||
|
VERSION=""
|
||||||
|
|
||||||
if [ -d ${SCRIPT_DIR}/.git ] && git status 1>/dev/null 2>/dev/null
|
if [ -d ${SCRIPT_DIR}/.git ] && git status 1>/dev/null 2>/dev/null
|
||||||
then
|
then
|
||||||
|
@ -31,8 +32,10 @@ then
|
||||||
DIRTY="-dirty"
|
DIRTY="-dirty"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if git describe 1>/dev/null 2>/dev/null
|
||||||
|
then
|
||||||
VERSION=$(git describe 2>/dev/null)$DIRTY
|
VERSION=$(git describe 2>/dev/null)$DIRTY
|
||||||
elif [ -d ${SCRIPT_DIR}/.git ] && git log -n 1 1>/dev/null 2>/dev/null
|
elif git log -n 1 1>/dev/null 2>/dev/null
|
||||||
then
|
then
|
||||||
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
|
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
|
||||||
if [ "$VERSION" = "master" ]
|
if [ "$VERSION" = "master" ]
|
||||||
|
@ -41,7 +44,11 @@ then
|
||||||
HASH=$(git log -n 1 --pretty=format:"%h" 2>/dev/null)
|
HASH=$(git log -n 1 --pretty=format:"%h" 2>/dev/null)
|
||||||
VERSION=$PREVIOUS-$HASH
|
VERSION=$PREVIOUS-$HASH
|
||||||
fi
|
fi
|
||||||
else
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$VERSION" ]
|
||||||
|
then
|
||||||
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
|
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
|
||||||
if [ "$VERSION" = "master" ]
|
if [ "$VERSION" = "master" ]
|
||||||
then
|
then
|
||||||
|
@ -49,7 +56,6 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
VERSION=$(echo "$VERSION" | sed 's/^v//')
|
VERSION=$(echo "$VERSION" | sed 's/^v//')
|
||||||
|
|
||||||
echo '#define VERSION_STRING "'$VERSION'"' > version.h
|
echo '#define VERSION_STRING "'$VERSION'"' > version.h
|
||||||
|
|
Loading…
Reference in a new issue