diff options
author | Alessandro Ghedini <alessandro@ghedini.me> | 2013-08-24 23:04:04 +0200 |
---|---|---|
committer | Alessandro Ghedini <alessandro@ghedini.me> | 2013-08-24 23:04:04 +0200 |
commit | 7bb2b73a154261ab59e6354dbf478695208b116d (patch) | |
tree | bc8739427fd7fb0d18e042620f2356dd12e3ccdb /version.sh | |
parent | faced26fd02c02e4af301fcab8e56667963f5340 (diff) |
Imported Upstream version 0.1.3
Diffstat (limited to 'version.sh')
-rwxr-xr-x | version.sh | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -2,20 +2,41 @@ export LC_ALL=C -test "$1" && extra="-$1" +for ac_option do + case "$ac_option" in + --extra=*) + extra="-$option" + ;; + --print) + print=yes + ;; + *) + echo "Unknown parameter: $option" >&2 + exit 1 + ;; + + esac +done # Extract revision number from file used by daily tarball snapshots # or from "git describe" output git_revision=$(cat snapshot_version 2> /dev/null) -test $git_revision || test ! -e .git || git_revision=`git rev-parse --short HEAD` +test $git_revision || test ! -e .git || git_revision=`git describe --match "v[0-9]*" --always --tags --long` git_revision=$(expr "$git_revision" : v*'\(.*\)') test $git_revision || git_revision=UNKNOWN # releases extract the version number from the VERSION file version=$(cat VERSION 2> /dev/null) -test $version || version=git-$git_revision +test $version || version=$git_revision + +VERSION="${version}${extra}" + +if test "$print" = yes ; then + echo "$VERSION" + exit 0 +fi -NEW_REVISION="#define VERSION \"${version}${extra}\"" +NEW_REVISION="#define VERSION \"${VERSION}\"" OLD_REVISION=$(head -n 1 version.h 2> /dev/null) BUILDDATE="#define BUILDDATE \"$(date)\"" |