mesa: Include GIT SHA1 in GL version string
Reviewed-by: Corbin Simpson <MostAwesomeDude@gmail.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
This commit is contained in:
4
Makefile
4
Makefile
@@ -5,7 +5,10 @@ TOP = .
|
|||||||
SUBDIRS = src
|
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
|
default: $(TOP)/configs/current
|
||||||
|
@$(TOP)/bin/extract_git_sha1
|
||||||
@for dir in $(SUBDIRS) ; do \
|
@for dir in $(SUBDIRS) ; do \
|
||||||
if [ -d $$dir ] ; then \
|
if [ -d $$dir ] ; then \
|
||||||
(cd $$dir && $(MAKE)) || exit 1 ; \
|
(cd $$dir && $(MAKE)) || exit 1 ; \
|
||||||
@@ -199,6 +202,7 @@ MAIN_FILES = \
|
|||||||
$(DIRECTORY)/aclocal.m4 \
|
$(DIRECTORY)/aclocal.m4 \
|
||||||
$(DIRECTORY)/bin/config.guess \
|
$(DIRECTORY)/bin/config.guess \
|
||||||
$(DIRECTORY)/bin/config.sub \
|
$(DIRECTORY)/bin/config.sub \
|
||||||
|
$(DIRECTORY)/bin/extract_git_sha1 \
|
||||||
$(DIRECTORY)/bin/install-sh \
|
$(DIRECTORY)/bin/install-sh \
|
||||||
$(DIRECTORY)/bin/mklib \
|
$(DIRECTORY)/bin/mklib \
|
||||||
$(DIRECTORY)/bin/minstall \
|
$(DIRECTORY)/bin/minstall \
|
||||||
|
10
bin/extract_git_sha1
Executable file
10
bin/extract_git_sha1
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
touch src/mesa/main/git_sha1.h
|
||||||
|
if which git > /dev/null; then
|
||||||
|
# Extract the 7-digit "short" SHA1 for the current HEAD, convert
|
||||||
|
# it to a string, and wrap it in a #define. This is used in
|
||||||
|
# src/mesa/main/version.c to put the GIT SHA1 in the GL_VERSION string.
|
||||||
|
git log -n 1 --oneline |\
|
||||||
|
sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
|
||||||
|
> src/mesa/main/git_sha1.h
|
||||||
|
fi
|
@@ -25,6 +25,7 @@
|
|||||||
#include "imports.h"
|
#include "imports.h"
|
||||||
#include "mtypes.h"
|
#include "mtypes.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "git_sha1.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -185,7 +186,11 @@ compute_version(struct gl_context *ctx)
|
|||||||
ctx->VersionString = (char *) malloc(max);
|
ctx->VersionString = (char *) malloc(max);
|
||||||
if (ctx->VersionString) {
|
if (ctx->VersionString) {
|
||||||
_mesa_snprintf(ctx->VersionString, max,
|
_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);
|
ctx->VersionMajor, ctx->VersionMinor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user