summaryrefslogtreecommitdiffstats
path: root/git_sha1_gen.sh
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2017-06-27 12:08:41 +0100
committerEric Engestrom <[email protected]>2017-06-29 16:24:58 +0100
commit3fd425aed764fb771f2f49ddb6b30b389a114504 (patch)
tree8c9b64b199048e823505d8418d170936e70ad49c /git_sha1_gen.sh
parentccfac28835ac67b81182bc5860f1af92fd2d2447 (diff)
build systems: uniformize git_sha1.h generation
Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
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"