3 # Freeciv - Copyright (C) 2007 - The Freeciv Project
5 # This script generates fc_svnrev_gen.h from fc_svnrev_gen.h.tmpl.
6 # See fc_svnrev_gen.h.tmpl for details.
8 # Parameters - $1 - top srcdir
13 SRCROOT
="$(cd "$1" ; pwd)"
14 INPUTDIR
="$(cd "$1/bootstrap
" ; pwd)"
15 OUTPUTDIR
="$(cd "$2/common
" ; pwd)"
22 # Check that all commands required by this script are available
23 # If not, we will not claim to know which svn revision this is
24 # (REVSTATE will be OFF)
25 if which svn
&& which tail && which wc ; then
26 REVTMP
="r$(LANG=C svn info 2>/dev/null | grep "^Revision
: " | sed 's/^Revision: //')"
27 if test "$REVTMP" != "r" ; then
28 # This is svn checkout. Check for local modifications
29 if test $
(cd "$SRCROOT" ; svn
diff |
wc -l) -eq 0 ; then
40 sed -e "s,<SVNREV1>,$REV1," -e "s,<SVNREV2>,$REV2," -e "s,<SVNREVSTATE>,$REVSTATE," fc_svnrev_gen.h.tmpl
> "$OUTPUTDIR/fc_svnrev_gen.h.tmp"
41 if ! test -f "$OUTPUTDIR/fc_svnrev_gen.h" ||
42 ! cmp "$OUTPUTDIR/fc_svnrev_gen.h" "$OUTPUTDIR/fc_svnrev_gen.h.tmp"
44 mv "$OUTPUTDIR/fc_svnrev_gen.h.tmp" "$OUTPUTDIR/fc_svnrev_gen.h"
46 rm -f "$OUTPUTDIR/fc_svnrev_gen.h.tmp"