3 # Script to generate svn_revision.c
9 SCRIPT_DIR=`dirname $0`
10 SRC_DIR=`dirname $SCRIPT_DIR`
12 C_FILE="$CUR_DIR/svn_revision.c"
13 H_FILE="$CUR_DIR/svn_revision.h"
16 # determine if this code base came from subversion.
17 if test -d $SRC_DIR/.svn ; then
18 echo "have subversion repository"
19 SVNVERSION=`which svnversion`
20 if test -x $SVNVERSION ; then
21 echo "have svnversion at $SVNVERSION"
22 BUILD=`svnversion -n .`
23 echo "This code base svn-revision: $BUILD"
24 CAN_BUILD_SVN_REVISION="yes"
27 if git status> /dev/null 2>&1; then
28 echo "have Git repository."
29 TAG=`git rev-parse HEAD`
30 BRANCH="`git show-branch |sed 's;\[\(.*\)\].*;\1;'`"
31 BUILD="GIT: $BRANCH : $TAG"
32 echo "This code base git-revision: $BUILD"
33 CAN_BUILD_SVN_REVISION="yes"
35 if test -f $C_FILE; then
41 if [ "$CAN_BUILD_SVN_REVISION" = "yes" ] ; then
45 * Subversion / GIT revision functions
47 * Autogenerated at make/release time
49 * Do not modify this file
53 const char *svn_revision (void)
55 const char *SVN_Version = "$BUILD";
60 elif test ! -f $C_FILE ; then
64 * Subversion / GIT revision functions
66 * Autogenerated at make time
68 * There should have been one with your source distribution
70 * Do not modify this file
74 const char *svn_revision (void)
76 const char *SVN_Version = "**UNKNOWN** Built from source without svn and no $C_FILE accompanying";