Add version.sh
This commit is contained in:
parent
4bb76fed88
commit
c0132b630e
|
@ -0,0 +1,6 @@
|
|||
#ifudef VERSION_H
|
||||
#define VERSION_H
|
||||
|
||||
#define VERSION_NUMBER $FULL_VERSION
|
||||
|
||||
#endif // VERSION_H
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -f include/version.h
|
||||
|
||||
git rev-list HEAD | sort > config.git-hash
|
||||
|
||||
LOCALVER=`wc -l config.git-hash | awk '{print $1}'`
|
||||
|
||||
if [ $LOCALVER \> 1 ] ; then
|
||||
VER=`git rev-list origin/master | sort | join config.git-hash - | wc -l | awk '{print $1}'`
|
||||
if [ $VER != $LOCALVER ] ; then
|
||||
VER="$VER+$(($LOCALVER-$VER))"
|
||||
fi
|
||||
if git status | grep -q "modified:" ; then
|
||||
VER="${VER}M"
|
||||
fi
|
||||
VER="$VER $(git rev-list HEAD -n 1 | cut -c 1-7)"
|
||||
GIT_VERSION=r$VER
|
||||
else
|
||||
GIT_VERSION=
|
||||
VER="x"
|
||||
fi
|
||||
|
||||
rm -f config.git-hash
|
||||
|
||||
cat version.h.template | sed "s/\$FULL_VERSION/$GIT_VERSION/g" > include/version.h
|
||||
|
||||
echo "Generated version.h"
|
Loading…
Reference in New Issue