Allow building from either SVN or SVK

- create gnc-svnversion script that builds the revision number
  from either SVN or SVK.  The script should fail gracefully if
  you don't have SVK installed
- convert the configure script to use the new gnc-svnversion script
- convert the splash-screen Makefile to use the gnc-svnversions script

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14427 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2006-06-24 18:34:35 +00:00
parent 1572a5fbef
commit d86d61e227
5 changed files with 70 additions and 18 deletions

View File

@ -75,7 +75,8 @@ EXTRA_DIST = \
po/glossary/zh_TW.po \
intltool-extract.in \
intltool-merge.in \
intltool-update.in
intltool-update.in \
util/gnc-svnversion
bin_SCRIPTS = gnucash-config

View File

@ -2024,19 +2024,15 @@ then
#warnFLAGS="${warnFLAGS} -Werror-implicit-function-declaration" # In -Wall
# error-on-warning should not be active in (stable) release tarballs
if test -h ${srcdir}/Makefile.am
then
tmp_srcdir=`readlink ${srcdir}/Makefile.am`
real_srcdir="${srcdir}/`dirname ${tmp_srcdir}`"
else
real_srcdir=${srcdir}
fi
if test -d ${real_srcdir}/.svn
${srcdir}/util/gnc-svnversion ${srcdir} >/dev/null 2>&1
if test $? = 0
then
# This code is from SVN, so enable error-on-warning
# This code is from SVN/SVK, so enable error-on-warning
AC_MSG_WARN([SVN Build: error-on-warning defaults to yes])
error_on_warning_as_default="yes"
else
# This is from a tarball, so disable error-on-warning
AC_MSG_WARN([Tarball Build: error-on-warning defaults to no])
error_on_warning_as_default="no"
fi

View File

@ -264,15 +264,10 @@ gnc-svninfo.h: _gnc-svninfo.h
-rm -f _gnc-svninfo.h
_gnc-svninfo.h: Makefile
@s=${srcdir} ; \
if [ -h ${srcdir}/Makefile.am ] ; then \
d=`readlink $(srcdir)/Makefile.am` ; \
s="${srcdir}/`dirname $$d`" ; \
fi ; \
if [ -d $$s/.svn ] ; then \
svninfo=`svnversion $$s` ; \
@svninfo=`${top_srcdir}/util/gnc-svnversion ${srcdir}` ; \
if [ $$? = 0 ] ; then \
if [ -z "$$svninfo" ] ; then \
echo "svnversion failed. figure out why." ; \
echo "gnc-svnversion failed. figure out why." ; \
echo "can't determine svn revision from $$s." ; \
exit 1 ; \
fi ; \

60
util/gnc-svnversion Executable file
View File

@ -0,0 +1,60 @@
#!/bin/sh
#
# Usage:
# gnc-svnversion <srcdir>
#
# Prints the revision number to stdout and exits 0 on success
# exits with errorcode 1 if we're not in an svn or svk checkout
#
# Written By: Derek Atkins <derek@ihtfp.com>
#
# $Id$
# Print an error message and then exit
my_die()
{
echo "$1"
exit 1
}
# Make sure we have a srcdir
[ -n "$1" ] || my_die "Usage: $0 <srcdir>"
[ -d "$1" ] || my_die "$0: $1: not a directory"
# Find the real srcdir.
# This handles the case of a symlink (lndir) tree
# $real_srcdir will hold the actual source dir
if test -h "$1"/Makefile.am
then
tmp_srcdir=`readlink "$1"/Makefile.am`
real_srcdir="$1/`dirname ${tmp_srcdir}`"
else
real_srcdir="$1"
fi
# Test if this code is an SVN Checkout
# If this is an svn checkout we assume you have svnversion!
if test -d "${real_srcdir}"/.svn
then
svnversion "$real_srcdir"
exit $?
fi
# If we get here then this is NOT an svn checkout. Maybe it's
# SVK? First, check if we've got 'svk' in the path. If not,
# then exit with an error code of 1..
which svk >/dev/null 2>&1
if test $? != 0 ; then exit 1 ; fi
# Okay, we have 'svk'. Now see if $real_srcdir is an svk checkout
svkinfo=`svk info "$real_srcdir" 2>&1`
if test $? != 0 ; then exit 1 ; fi
# If we got here, then $real_srcdir is an svk checkout. Parse out
# the revision info, print it out, and then output 0. Just combine
# all the revision numbers into a single string by combining them
# with periods.
svkinfo=`svk info "$real_srcdir" | grep Rev | sed -e 's/^.* \([0-9:]*\)$/\1/'`
echo $svkinfo | sed -e 's/\s/./g'
exit 0