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

Rename svn_version.c to vcs_version.c, simplify generation

Fix up the generation of vcs_version.c with the assumption that if you
have a .git directory at the top, you have git installed.  Drop logic
for handling svn checkouts.
parent ef058a0c
...@@ -100,7 +100,7 @@ void varnish_version(const char *); ...@@ -100,7 +100,7 @@ void varnish_version(const char *);
int vtmpfile(char *); int vtmpfile(char *);
char *vreadfile(const char *pfx, const char *fn); char *vreadfile(const char *pfx, const char *fn);
const char* svn_version(void); const char* vcs_version(void);
/* Safe printf into a fixed-size buffer */ /* Safe printf into a fixed-size buffer */
#define bprintf(buf, fmt, ...) \ #define bprintf(buf, fmt, ...) \
......
# $Id$
INCLUDES = -I$(top_srcdir)/include @PCRE_CFLAGS@ INCLUDES = -I$(top_srcdir)/include @PCRE_CFLAGS@
lib_LTLIBRARIES = libvarnish.la lib_LTLIBRARIES = libvarnish.la
...@@ -16,7 +14,7 @@ libvarnish_la_SOURCES = \ ...@@ -16,7 +14,7 @@ libvarnish_la_SOURCES = \
cli_serve.c \ cli_serve.c \
flopen.c \ flopen.c \
num.c \ num.c \
svn_version.c \ vcs_version.c \
time.c \ time.c \
tcp.c \ tcp.c \
vct.c \ vct.c \
...@@ -35,12 +33,12 @@ libvarnish_la_SOURCES = \ ...@@ -35,12 +33,12 @@ libvarnish_la_SOURCES = \
libvarnish_la_CFLAGS = -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' libvarnish_la_CFLAGS = -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"'
libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} @PCRE_LIBS@ libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} @PCRE_LIBS@
DISTCLEANFILES = svn_version.c DISTCLEANFILES = vcs_version.c
svn_version.c: FORCE vcs_version.c: FORCE
V="$$(sh -c "git log -n 1 --pretty=format:%h" 2>/dev/null || LANG=C svnversion -n $(top_srcdir))" \ if [ -d "$(top_srcdir)/.git" ]; then \
H="$$(head -n 1 svn_version.c 2>/dev/null || true)"; \ V="$$(git describe --always)" \
[ "$$V" = "exported" ] && [ -e svn_version.c ] && exit 0 ; \ H="$$(head -n 1 vcs_version.c 2>/dev/null || true)"; \
if [ "/* $$V */" != "$$H" ]; then \ if [ "/* $$V */" != "$$H" ]; then \
( \ ( \
echo "/* $$V */" ;\ echo "/* $$V */" ;\
echo '/*' ;\ echo '/*' ;\
...@@ -51,12 +49,13 @@ svn_version.c: FORCE ...@@ -51,12 +49,13 @@ svn_version.c: FORCE
echo ' */' ;\ echo ' */' ;\
echo '' ;\ echo '' ;\
echo "#include <libvarnish.h>" ;\ echo "#include <libvarnish.h>" ;\
echo "const char* svn_version(void)" ;\ echo "const char* vcs_version(void)" ;\
echo "{" ;\ echo "{" ;\
echo " const char* SVN_Version = \"$$V\";" ;\ echo " const char* VCS_Version = \"$$V\";" ;\
echo " return SVN_Version;" ;\ echo " return VCS_Version;" ;\
echo "}" ;\ echo "}" ;\
) > svn_version.c ; \ ) > vcs_version.c ; \
fi \
fi fi
FORCE: FORCE:
......
...@@ -41,8 +41,8 @@ SVNID("$Id$") ...@@ -41,8 +41,8 @@ SVNID("$Id$")
void void
varnish_version(const char *progname) varnish_version(const char *progname)
{ {
fprintf(stderr, "%s (%s-%s SVN %s)\n", progname, fprintf(stderr, "%s (%s-%s revision %s)\n", progname,
PACKAGE_TARNAME, PACKAGE_VERSION, svn_version()); PACKAGE_TARNAME, PACKAGE_VERSION, vcs_version());
fprintf(stderr, fprintf(stderr,
"Copyright (c) 2006-2009 Linpro AS / Verdens Gang AS\n"); "Copyright (c) 2006-2009 Linpro AS / Verdens Gang AS\n");
} }
...@@ -12,7 +12,7 @@ libvarnishapi_la_SOURCES = \ ...@@ -12,7 +12,7 @@ libvarnishapi_la_SOURCES = \
\ \
../libvarnish/assert.c \ ../libvarnish/assert.c \
../libvarnish/argv.c \ ../libvarnish/argv.c \
../libvarnish/svn_version.c \ ../libvarnish/vcs_version.c \
../libvarnish/version.c \ ../libvarnish/version.c \
../libvarnish/vin.c \ ../libvarnish/vin.c \
../libvarnish/vmb.c \ ../libvarnish/vmb.c \
......
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