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 BUILD=`/usr/bin/git log -1 --pretty=%H . `
30 echo "This code base git-revision: $BUILD"
31 CAN_BUILD_SVN_REVISION="yes"
33 if test -f $C_FILE; then
39 if [ "$CAN_BUILD_SVN_REVISION" = "yes" ] ; then
43 * Subversion / GIT revision functions
45 * Autogenerated at make/release time
47 * Do not modify this file
51 const char *svn_revision (void)
53 const char *SVN_Version = "$BUILD";
58 elif test ! -f $C_FILE ; then
62 * Subversion / GIT revision functions
64 * Autogenerated at make time
66 * There should have been one with your source distribution
68 * Do not modify this file
72 const char *svn_revision (void)
74 const char *SVN_Version = "**UNKNOWN** Built from source without svn and no $C_FILE accompanying";