X-Git-Url: http://git.pk910.de/?p=TransparentIRC.git;a=blobdiff_plain;f=src%2Fversion.sh;fp=src%2Fversion.sh;h=6cfa2a02fd35b5c85158076e248025eec045c789;hp=0000000000000000000000000000000000000000;hb=1f2baa2e7b90ea83c5a0c93598e22e5063fc6d95;hpb=0e2ac9360b71a7d054d7e945be575c0d21fa880c diff --git a/src/version.sh b/src/version.sh new file mode 100644 index 0000000..6cfa2a0 --- /dev/null +++ b/src/version.sh @@ -0,0 +1,86 @@ +#! /bin/sh +echo "Extracting version.c ..." + +if test -r version.c +then + compilation=`sed -n 's/^const char \*compilation = \"\(.*\)\";/\1/p' < version.c` + if test ! "$compilation" ; then compilation=0; fi +else + compilation=0 +fi + +compilation=`expr $compilation + 1` + +creation=`date | \ +awk '{if (NF == 6) \ + { print $1 " " $2 " " $3 " " $6 " at " $4 " " $5 } \ +else \ + { print $1 " " $2 " " $3 " " $7 " at " $4 " " $5 " " $6 }}'` + +codelines=`find . -type f -regex '\./.*\.h' -or -regex '\./.*\.c' |xargs cat|wc -l` + +svn_revision=`svn info | grep Revision | grep -o -E '[0-9]+'` +git_commitcount=0 +if test "x$svn_revision" = "x" ; then + svn_revision=`git log -n 1 --pretty="format:%h"` + if test "x$svn_revision" = "x" ; then + svn_revision="0" + else + git_commitcount=`git log --pretty=oneline --no-merges --first-parent | wc -l | sed "s/[ \t]//g"` + svn_revision="git-$git_commitcount-$svn_revision" + fi +else + svn_revision="svn-$svn_revision" +fi + + +/bin/cat > version.c <. + */ +//Auto generated file! + +#include "version.h" + +const char *compilation = "$compilation"; +const char *creation = "$creation"; +const char *revision = "$svn_revision"; +const char *codelines = "$codelines"; + +const int patchlevel = ($git_commitcount ? ($git_commitcount - VERSION_PATCHLEVEL) : 0); + +const char *get_compilation() { + return compilation; +} + +const char *get_creation() { + return creation; +} + +const char *get_revision() { + return revision; +} + +const char *get_codelines() { + return codelines; +} + +const int get_patchlevel() { + return patchlevel; +} + +!SUB!THIS! +