2018-01-11 01:36:41 +08:00
|
|
|
|
|
|
|
# version for configure, make dist and FW etc
|
|
|
|
# usage "version.sh dir"
|
|
|
|
# Where dir is the top level directory path.
|
|
|
|
|
|
|
|
# use pwd is no path argument is given
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
DIR=`pwd`
|
|
|
|
else
|
|
|
|
DIR=$1
|
|
|
|
fi
|
|
|
|
|
2018-01-11 20:10:03 +08:00
|
|
|
# create git version if we are a git repo or git worktree
|
|
|
|
if [ -e $DIR/.git -o -d $DIR/.git ]; then
|
2018-01-11 01:36:41 +08:00
|
|
|
# version for make dist
|
|
|
|
git describe --abbrev=4 > $DIR/.version
|
|
|
|
git describe --abbrev=4 > $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
|
|
|
|
else
|
2018-01-11 20:10:03 +08:00
|
|
|
echo "#define REEF_TAG \"0\"" > $DIR/src/include/version.h
|
2018-01-11 01:36:41 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# build counter
|
|
|
|
if [ -e $DIR/.build ]; then
|
|
|
|
num=$((`cat $DIR/.build` + 1))
|
|
|
|
else
|
|
|
|
num=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# save and insert build counter
|
|
|
|
echo $num > $DIR/.build
|
|
|
|
echo "#define REEF_BUILD $num" >> $DIR/src/include/version.h
|
|
|
|
|
|
|
|
#echo version for AC_INIT
|
|
|
|
if [ -e $DIR/.version ]; then
|
2018-01-11 04:26:08 +08:00
|
|
|
echo -n `cat $DIR/.version | cut -dv -f2 | cut -d. -f1`.`cat $DIR/.version | cut -d. -f2 | cut -d- -f1`.`cat $DIR/.version | cut -d. -f3 | cut -d- -f1`
|
2018-01-11 01:36:41 +08:00
|
|
|
fi
|