]> Dogcows Code - chaz/tint2/blobdiff - get_svnrev.sh
*add* include svn revision in the VERSION_STRING if building with cmake
[chaz/tint2] / get_svnrev.sh
diff --git a/get_svnrev.sh b/get_svnrev.sh
new file mode 100755 (executable)
index 0000000..c6466ab
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+FALLBACK="0.10-svn"
+
+if [[ $# -eq 0 ]]; then
+  DIR=.
+else
+  DIR=$1
+fi
+
+if [[ -f version.h ]]; then
+  REV_OLD=$(cat version.h  | cut -d" " -f3)
+else
+  REV_OLD=""
+fi
+
+if [[ -x "$(which svnversion 2>/dev/null)" && -d "${DIR}/.svn" ]] ; then
+  REV=\"$(svnversion -n ${DIR})\"
+else
+  REV=${FALLBACK}
+fi
+
+if [[ ${REV_OLD} != ${REV} ]]; then
+  echo "Building new version.h"
+  echo "#define VERSION_STRING "${REV}"" > version.h
+fi
+
+
This page took 0.019861 seconds and 4 git commands to generate.