Allow using things that were deprecated in gtk+-3.22.
[freeciv.git] / bootstrap / generate_svnrev.sh
blob38fa72693c05fbab10e12fc33c369d76b0fb9069
1 #!/bin/sh
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
9 # $2 - top builddir
12 # Absolete paths
13 SRCROOT="$(cd "$1" ; pwd)"
14 INPUTDIR="$(cd "$1/bootstrap" ; pwd)"
15 OUTPUTDIR="$(cd "$2/common" ; pwd)"
17 REVSTATE="OFF"
18 REV1=""
19 REV2="dist"
21 (cd "$INPUTDIR"
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
30 REVSTATE=ON
31 REV2="$REVTMP"
32 else
33 REVSTATE=MOD
34 REV1="modified "
35 REV2="$REVTMP"
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"
43 then
44 mv "$OUTPUTDIR/fc_svnrev_gen.h.tmp" "$OUTPUTDIR/fc_svnrev_gen.h"
46 rm -f "$OUTPUTDIR/fc_svnrev_gen.h.tmp"
47 ) > /dev/null