summaryrefslogtreecommitdiffstats
path: root/git_sha1_gen.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git_sha1_gen.sh')
-rwxr-xr-xgit_sha1_gen.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/git_sha1_gen.sh b/git_sha1_gen.sh
new file mode 100755
index 00000000000..20ab8df8eae
--- /dev/null
+++ b/git_sha1_gen.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# run git from the sources directory
+cd "$(dirname "$0")"
+
+# don't print anything if git fails
+if ! git_sha1=$(git --git-dir=.git rev-parse --short=10 HEAD 2>/dev/null)
+then
+ exit
+fi
+
+printf '#define MESA_GIT_SHA1 "git-%s"\n' "$git_sha1"