summaryrefslogtreecommitdiffstats
path: root/mkreldate.sh
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2018-02-05 18:43:12 -0800
committerKevin McCarthy <kevin@8t8.us>2018-02-05 18:43:12 -0800
commitfefbd81f7339573ade08d29af2bf2e8e07349da7 (patch)
tree966498a605081c1e25666cc935ae528a6278cdcf /mkreldate.sh
parent65e1f5c8f427632544bad6da22d9c80f484067f5 (diff)
Use git to generate the release date if available.
For now, fall back to the ChangeLog. Perhaps the release date should be generated from a file, similar to VERSION, for those cases instead.
Diffstat (limited to 'mkreldate.sh')
-rwxr-xr-xmkreldate.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/mkreldate.sh b/mkreldate.sh
new file mode 100755
index 00000000..bdbffdb8
--- /dev/null
+++ b/mkreldate.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Generates the reldate.h contents from either git or the ChangeLog file
+
+if [ -e ".git" ] && command -v git >/dev/null 2>&1; then
+ reldate=$(git log -1 --date=short --pretty=format:"%cd")
+else
+ reldate=$(head -n 1 ChangeLog | LC_ALL=C cut -d ' ' -f 1)
+fi
+
+echo 'const char *ReleaseDate = "'$reldate'";'