Commit e26eeebd authored by Tollef Fog Heen's avatar Tollef Fog Heen

Reinstate svn_version code

Reinstate code to embed the svn version (or git commit id) in the
output given by varnishd -V.

Also, make sure we don't overwrite version.c when the tree is
exported, but generate it if it's completely missing.  (This should
only happen if somebody does svn export rather than make dist, but
some people might do that.)

git-svn-id: http://www.varnish-cache.org/svn/trunk@4175 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent cbdd9f13
......@@ -15,6 +15,7 @@ libvarnish_la_SOURCES = \
cli_common.c \
flopen.c \
num.c \
svn_version.c \
time.c \
tcp.c \
vct.c \
......@@ -29,6 +30,24 @@ libvarnish_la_SOURCES = \
libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM}
DISTCLEANFILES = svn_version.c
svn_version.c: FORCE
V="$$(git log -n 1 --pretty=format:%h 2>/dev/null || LANG=C svnversion -n $(top_srcdir))" \
H="$$(head -n 1 svn_version.c 2>/dev/null || true)"; \
[ "$$V" = "exported" ] && [ -e svn_version.c ] && exit 0 ; \
if [ "/* $$V */" != "$$H" ]; then \
( \
echo "/* $$V */" ;\
echo "#include <libvarnish.h>" ;\
echo "const char* svn_version(void)" ;\
echo "{" ;\
echo " const char* SVN_Version = \"$$V\";" ;\
echo " return SVN_Version;" ;\
echo "}" ;\
) > svn_version.c ; \
fi
FORCE:
if ENABLE_TESTS
TESTS = num_c_test
......
......@@ -41,8 +41,8 @@ SVNID("$Id$")
void
varnish_version(const char *progname)
{
fprintf(stderr, "%s (%s-%s)\n", progname,
PACKAGE_TARNAME, PACKAGE_VERSION);
fprintf(stderr, "%s (%s-%s SVN %s)\n", progname,
PACKAGE_TARNAME, PACKAGE_VERSION, svn_version());
fprintf(stderr,
"Copyright (c) 2006-2009 Linpro AS / Verdens Gang AS\n");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment