Commit abdb1aef by o9000

Include commit hash if possible in versioning script, if a non-stable tree is compiled

parent 7e383c39
......@@ -2,6 +2,7 @@
SCRIPT_DIR=$(dirname "$0")
DIRTY=""
VERSION=""
if [ -d ${SCRIPT_DIR}/.git ] && git status 1>/dev/null 2>/dev/null
then
......@@ -31,17 +32,23 @@ then
DIRTY="-dirty"
fi
fi
VERSION=$(git describe 2>/dev/null)$DIRTY
elif [ -d ${SCRIPT_DIR}/.git ] && git log -n 1 1>/dev/null 2>/dev/null
then
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
if [ "$VERSION" = "master" ]
if git describe 1>/dev/null 2>/dev/null
then
PREVIOUS=$(grep '^2' "${SCRIPT_DIR}/ChangeLog" | head -n 2 | tail -n 1 | cut -d ' ' -f 2)
HASH=$(git log -n 1 --pretty=format:"%h" 2>/dev/null)
VERSION=$PREVIOUS-$HASH
VERSION=$(git describe 2>/dev/null)$DIRTY
elif git log -n 1 1>/dev/null 2>/dev/null
then
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
if [ "$VERSION" = "master" ]
then
PREVIOUS=$(grep '^2' "${SCRIPT_DIR}/ChangeLog" | head -n 2 | tail -n 1 | cut -d ' ' -f 2)
HASH=$(git log -n 1 --pretty=format:"%h" 2>/dev/null)
VERSION=$PREVIOUS-$HASH
fi
fi
else
fi
if [ -z "$VERSION" ]
then
VERSION=$(head -n 1 "${SCRIPT_DIR}/ChangeLog" | cut -d ' ' -f 2)
if [ "$VERSION" = "master" ]
then
......@@ -49,7 +56,6 @@ else
fi
fi
VERSION=$(echo "$VERSION" | sed 's/^v//')
echo '#define VERSION_STRING "'$VERSION'"' > version.h
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment