Code

object.h: Added SC_OBJECT_WRAPPER_STATIC().
[sysdb.git] / version-gen.sh
1 #! /bin/sh
3 DEFAULT_VERSION="0.0.0.git"
5 VERSION="$( git describe --tags 2> /dev/null \
6         | sed -e 's/syscollector-//' || true )"
8 if test -z "$VERSION"; then
9         VERSION="$DEFAULT_VERSION"
10 else
11         git update-index -q --refresh || true
12         if test -n "$( git diff-index --name-only HEAD || true )"; then
13                 VERSION="$VERSION-dirty"
14         fi
15 fi
17 VERSION="$( echo "$VERSION" | sed -e 's/-/./g' )"
18 if test "x`uname -s`" = "xAIX" || test "x`uname -s`" = "xSunOS" ; then
19         echo "$VERSION\c"
20 else
21         echo -n "$VERSION"
22 fi
24 OLD_VERSION=""
25 if test -e version; then
26         OLD_VERSION=$( sed -ne 's/^VERSION="\(.*\)"/\1/p' version )
27 fi
29 if test "$OLD_VERSION" != "$VERSION"; then
30         VERSION_MAJOR=$( echo $VERSION | cut -d'.' -f1 )
31         VERSION_MINOR=$( echo $VERSION | cut -d'.' -f2 )
32         VERSION_PATCH=$( echo $VERSION | cut -d'.' -f3 )
33         VERSION_EXTRA="\"$( echo $VERSION | cut -d'.' -f4- )\""
34         test -z "$VERSION_EXTRA" || VERSION_EXTRA=".$VERSION_EXTRA"
35         (
36          echo "VERSION=\"$VERSION\""
37          echo "VERSION_MAJOR=$VERSION_MAJOR"
38          echo "VERSION_MINOR=$VERSION_MINOR"
39          echo "VERSION_PATCH=$VERSION_PATCH"
40          echo "VERSION_EXTRA=\"$VERSION_EXTRA\""
41          echo "VERSION_STRING=\"$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH\""
42         ) > version
43 fi