]> granicus.if.org Git - mutt/commitdiff
Use git to generate the release date if available.
authorKevin McCarthy <kevin@8t8.us>
Tue, 6 Feb 2018 02:43:12 +0000 (18:43 -0800)
committerKevin McCarthy <kevin@8t8.us>
Tue, 6 Feb 2018 02:43:12 +0000 (18:43 -0800)
For now, fall back to the ChangeLog.  Perhaps the release date should
be generated from a file, similar to VERSION, for those cases instead.

Makefile.am
mkreldate.sh [new file with mode: 0755]

index cd547d78c1595fe682ba32e5768a0dd9eac28585..77bda4bb8be458f68ed6f428df9363d1b5a5455b 100644 (file)
@@ -75,7 +75,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
        mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h \
        README.SSL smime.h group.h \
        muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
-       ChangeLog mkchangelog.sh mutt_idna.h sidebar.h OPS.SIDEBAR \
+       ChangeLog mkchangelog.sh mkreldate.sh mutt_idna.h sidebar.h OPS.SIDEBAR \
        snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \
        txt2c.c txt2c.sh version.sh check_sec.sh
 
@@ -139,10 +139,8 @@ keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.SIDEBAR $(srcdir)/OPS.PGP $(srcdir
                $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \
                        > keymap_alldefs.h
 
-reldate.h: $(srcdir)/ChangeLog
-       echo 'const char *ReleaseDate = "'`head -n 1 $(srcdir)/ChangeLog | LC_ALL=C cut -d ' ' -f 1`'";' > reldate.h.tmp; \
-       cmp -s reldate.h.tmp reldate.h || cp reldate.h.tmp reldate.h; \
-       rm reldate.h.tmp
+reldate.h: $(srcdir)/mkreldate.sh $(srcdir)/ChangeLog
+       (cd $(srcdir) && ./mkreldate.sh) > reldate.h
 
 # The '#undef ENABLE_NLS' is to work around an automake ordering issue:
 # BUILT_SOURCES are processed before SUBDIRS.
diff --git a/mkreldate.sh b/mkreldate.sh
new file mode 100755 (executable)
index 0000000..bdbffdb
--- /dev/null
@@ -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'";'