summaryrefslogtreecommitdiffstats
path: root/bin/git_sha1_gen.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/git_sha1_gen.sh')
-rwxr-xr-xbin/git_sha1_gen.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/git_sha1_gen.sh b/bin/git_sha1_gen.sh
new file mode 100755
index 00000000000..898e5907587
--- /dev/null
+++ b/bin/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"