summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer-Pf4JEFdB4epeoWH0uzbU5w@public.gmane.org>2010-04-16 16:04:21 +1000
committerJon TURNEY <jon.turney@dronecode.org.uk>2010-07-19 01:20:43 +0100
commitbcec46d3026b9bf8a1ce4d7b1dd66a9aea1ce203 (patch)
tree94ca8fa26465796cbbbd881082ddfa0a91cce6b2
parenta2c13f0d6548310e3cd115cf486d3e43edf23dcc (diff)
Print git describe output into the log file.
Run git describe on build and push the output into xorg-git-version.h. Then print that out in the logfile. Signed-off-by: Peter Hutterer <peter.hutterer-Pf4JEFdB4epeoWH0uzbU5w@public.gmane.org>
-rwxr-xr-xGIT-GENERATE-VERSION26
-rw-r--r--Makefile.am2
-rw-r--r--hw/xfree86/common/xf86Init.c5
-rw-r--r--include/Makefile.am9
4 files changed, 41 insertions, 1 deletions
diff --git a/GIT-GENERATE-VERSION b/GIT-GENERATE-VERSION
new file mode 100755
index 000000000..84896bdff
--- /dev/null
+++ b/GIT-GENERATE-VERSION
@@ -0,0 +1,26 @@
+#!/bin/sh
+# Get the git version if possible and store it in $GITFILE if it differs to
+# the one contained already.
+
+GITFILE="xorg-git-version.h"
+VER=""
+OUTSTR=""
+
+if which git > /dev/null; then
+ VER=`git describe HEAD 2>/dev/null`
+fi
+
+if test -z "$VER"; then
+ OUTSTR="#undef XORG_GIT_VERSION"
+else
+ OUTSTR="#define XORG_GIT_VERSION \"$VER\""
+fi
+
+if test -e "$GITFILE"; then
+ FILE_VER=`cat $GITFILE`
+ if test "$FILE_VER" = "$VER"; then
+ exit 0
+ fi
+fi
+
+echo "$OUTSTR" > $GITFILE
diff --git a/Makefile.am b/Makefile.am
index 8b7a2c8b4..cce5f2365 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,7 +49,7 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xorg-server.pc
endif
-EXTRA_DIST = xorg-server.pc.in xorg-server.m4 autogen.sh
+EXTRA_DIST = xorg-server.pc.in xorg-server.m4 autogen.sh GIT-GENERATE-VERSION
DISTCHECK_CONFIGURE_FLAGS=\
--with-xkb-path=$(XKB_BASE_DIRECTORY) \
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index ca532ee81..8f72c10cf 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -34,6 +34,8 @@
#include <xorg-config.h>
#endif
+#include <xorg-git-version.h>
+
#include <stdlib.h>
#include <errno.h>
@@ -228,6 +230,9 @@ xf86PrintBanner(void)
xf86ErrorFVerb(0, "\tBefore reporting problems, check "
""__VENDORDWEBSUPPORT__"\n"
"\tto make sure that you have the latest version.\n");
+#ifdef XORG_GIT_VERSION
+ xf86ErrorFVerb(0, "git version: " XORG_GIT_VERSION "\n");
+#endif
}
static void
diff --git a/include/Makefile.am b/include/Makefile.am
index e76de05c3..b5940f095 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -63,6 +63,13 @@ sdk_HEADERS = \
nodist_sdk_HEADERS = xorg-server.h
endif
+BUILT_SOURCES = xorg-git-version.h
+
+xorg-git-version.h:
+ sh $(top_srcdir)/GIT-GENERATE-VERSION
+
+.PHONY: xorg-git-version.h
+
AM_CFLAGS = $(DIX_CFLAGS)
EXTRA_DIST = \
@@ -70,3 +77,5 @@ EXTRA_DIST = \
eventconvert.h eventstr.h \
protocol-versions.h \
xsha1.h
+
+DISTCLEANFILES = xorg-git-version.h