aboutsummaryrefslogtreecommitdiff
path: root/devel/llvm-cheri/files/gen-Makefile.snapshot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'devel/llvm-cheri/files/gen-Makefile.snapshot.sh')
-rw-r--r--devel/llvm-cheri/files/gen-Makefile.snapshot.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/devel/llvm-cheri/files/gen-Makefile.snapshot.sh b/devel/llvm-cheri/files/gen-Makefile.snapshot.sh
new file mode 100644
index 000000000000..cbc8d643891a
--- /dev/null
+++ b/devel/llvm-cheri/files/gen-Makefile.snapshot.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Simple script to fetch the latest commits via the github API. Requires
+# curl and jq. Uses unauthenticated access which is ratelimited to 60
+# queries per hour.
+
+get_repo_sha()
+{
+ curl https://api.github.com/repos/CTSRD-CHERI/$1/branches/master | \
+ jq -r '.commit.sha'
+}
+
+cat <<EOF > Makefile.snapshot
+# \$FreeBSD\$
+#
+# Generated file! Do not edit!
+#
+# Generated by: files/gen-Makefile.snapshot.sh.
+#
+LLVM_MAJOR= 3.8
+LLVM_RELEASE= \${LLVM_MAJOR}.0
+SNAPDATE= $(date +%Y%m%d)
+
+LLVM_COMMIT= $(get_repo_sha llvm)
+CLANG_COMMIT= $(get_repo_sha clang)
+LLDB_COMMIT= $(get_repo_sha lldb)
+EOF