summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2011-03-31 11:42:01 -0700
committerIan Romanick <ian.d.romanick@intel.com>2011-03-31 11:50:45 -0700
commit00b28b10f4435e64a5fe37acae8c3da773e5bb8a (patch)
tree2d52cca36d8951a85c4741a3bb8f493b20dc6273
parent571f5e3b079aa043b465ff3e00baa8fdc1862b4c (diff)
downloadmesa-remove-driver-date.tar.gz
mesa: Include GIT SHA1 in GL version stringremove-driver-date
-rw-r--r--Makefile8
-rw-r--r--src/mesa/main/version.c7
2 files changed, 14 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index a1ab65ef0c4..c85b9036a25 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,15 @@ TOP = .
SUBDIRS = src
+# The git command below generates an empty string when we're not
+# building in a GIT tree (i.e., building from a release tarball).
default: $(TOP)/configs/current
+ @touch src/mesa/main/git_sha1.h
+ @if which git > /dev/null; then \
+ git log -n 1 --oneline |\
+ sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "\1"/' \
+ > src/mesa/main/git_sha1.h; \
+ fi
@for dir in $(SUBDIRS) ; do \
if [ -d $$dir ] ; then \
(cd $$dir && $(MAKE)) || exit 1 ; \
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index c7a0d69a4f0..80fa0c244eb 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -25,6 +25,7 @@
#include "imports.h"
#include "mtypes.h"
#include "version.h"
+#include "git_sha1.h"
@@ -185,7 +186,11 @@ compute_version(struct gl_context *ctx)
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
- "%u.%u Mesa " MESA_VERSION_STRING,
+ "%u.%u Mesa " MESA_VERSION_STRING
+#ifdef MESA_GIT_SHA1
+ " (" MESA_GIT_SHA1 ")"
+#endif
+ ,
ctx->VersionMajor, ctx->VersionMinor);
}
}