*** VERSION 5.2.0 ***
[NeonServV5.git] / src / version.sh
1 #! /bin/sh
2 echo "Extracting version.c ..."
3
4 if test -r version.c
5 then
6    compilation=`sed -n 's/^const char \*compilation = \"\(.*\)\";/\1/p' < version.c`
7    if test ! "$compilation" ; then compilation=0; fi
8 else
9    compilation=0
10 fi
11
12 compilation=`expr $compilation + 1`
13
14 creation=`date | \
15 awk '{if (NF == 6) \
16          { print $1 " " $2 " " $3 " " $6 " at " $4 " " $5 } \
17 else \
18          { print $1 " " $2 " " $3 " " $7 " at " $4 " " $5 " " $6 }}'`
19
20 codelines=`find . -type f -regex '\./.*\.h' -or -regex '\./.*\.c' |xargs cat|wc -l`
21
22 svn_revision=`svn info | grep Revision | grep -o -E '[0-9]+'`
23 git_commitcount=0
24 if test "x$svn_revision" = "x" ; then
25   svn_revision=`git log -n 1 --pretty="format:%h"`
26   if test "x$svn_revision" = "x" ; then
27     svn_revision="0"
28   else
29     git_commitcount=`git log --pretty=oneline --no-merges --first-parent | wc -l | sed "s/[ \t]//g"`
30     svn_revision="git-$git_commitcount-$svn_revision"
31   fi
32 else
33   svn_revision="svn-$svn_revision"
34 fi
35
36
37 /bin/cat > version.c <<!SUB!THIS!
38 /* version.c - NeonServ v5.2
39  * Copyright (C) 2011  Philipp Kreil (pk910)
40  * 
41  * This program is free software: you can redistribute it and/or modify
42  * it under the terms of the GNU General Public License as published by
43  * the Free Software Foundation, either version 3 of the License, or
44  * (at your option) any later version.
45  * 
46  * This program is distributed in the hope that it will be useful,
47  * but WITHOUT ANY WARRANTY; without even the implied warranty of
48  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
49  * GNU General Public License for more details.
50  * 
51  * You should have received a copy of the GNU General Public License 
52  * along with this program. If not, see <http://www.gnu.org/licenses/>. 
53  */
54 //Auto generated file!
55
56 #include "version.h"
57
58 const char *compilation = "$compilation";
59 const char *creation = "$creation";
60 const char *revision = "$svn_revision";
61 const char *codelines = "$codelines";
62
63 const int patchlevel = ($git_commitcount ? ($git_commitcount - VERSION_PATCHLEVEL) : 0);
64
65 !SUB!THIS!
66