]> granicus.if.org Git - neomutt/commitdiff
Provide timestamp expansion and fix man pages date
authorFloyd Anderson <f.a@31c0.net>
Fri, 23 Mar 2018 03:55:31 +0000 (04:55 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 25 Apr 2018 02:02:17 +0000 (03:02 +0100)
Makefile.autosetup
auto.def
doc/Makefile.autosetup
doc/neomutt.man
doc/neomuttrc.man.head

index 6c30f0f16fa29645d186eb6620075f0fd2444cb9..5a3016344fde2d2f28d9326902c755198951ad94 100644 (file)
@@ -56,6 +56,10 @@ VPATH=               $(SRCDIR)
 
 ALL_FILES!=    (cd $(SRCDIR) && git ls-files 2>/dev/null) || true
 
+# timestamps
+TS_MAN_CONF=   @TS_MAN_CONF@
+TS_MAN_MAIN=   @TS_MAN_MAIN@
+
 ###############################################################################
 # neomutt
 NEOMUTT=       neomutt$(EXEEXT)
index 2f0fa74d0d9295c96bbd85abcc8416077153b591..f21eb75c91b49df0fad466a81f59586983bc388d 100644 (file)
--- a/auto.def
+++ b/auto.def
@@ -177,6 +177,29 @@ if {1} {
   proc yesno val {
     expr {$val ? "yes" : "no"}
   }
+
+  # Recent author timestamp of file(s) as UTC, use PACKAGE_VERSION as fallback
+  proc get-author-date {format args} {
+    set oldpwd [pwd]
+    cd $::autosetup(srcdir)
+
+    if {$args eq "" || [catch {
+        set fd [open "|git log -1 --format=%at master -- $args" r]
+        gets $fd epoch
+        close $fd}] || $epoch eq ""
+    } {
+      #user-notice "No author timestamp found, falling back to PACKAGE_VERSION..."
+      if {![set pkgdate [get-define PACKAGE_VERSION]] || [catch {
+          set epoch [clock scan $pkgdate -format {%Y%m%d} -timezone :UTC]}]
+      } {
+        autosetup-error "Cannot get or parse PACKAGE_VERSION as date!"
+      }
+    }
+    cd $oldpwd
+
+
+    return [clock format $epoch -format $format -timezone :UTC]
+  }
 }
 ###############################################################################
 
@@ -917,6 +940,12 @@ foreach dir $subdirs {
   make-template $dir/Makefile.autosetup $dir/Makefile
 }
 
+###############################################################################
+# Provide timestamps (UTC) based on most recent author date or PACKAGE_VERSION
+# doc/neomuttrc.man, doc/neomutt.1
+define TS_MAN_CONF [get-author-date "%Y-%m-%d" init.h doc/neomuttrc.man.head doc/neomuttrc.man.tail]
+define TS_MAN_MAIN [get-author-date "%Y-%m-%d" doc/neomutt.man]
+
 ###############################################################################
 # Generate Makefile and config.h
 define PWD [pwd]
index 745d016a87049651c276ded0583cc3692c243bc7..0229b3179c8bbef1bb0548cde36cee668c53eef7 100644 (file)
@@ -67,9 +67,11 @@ doc/neomuttrc.man:   doc/makedoc$(EXEEXT) \
                $(SRCDIR)/init.h \
                $(SRCDIR)/doc/neomuttrc.man.head \
                $(SRCDIR)/doc/neomuttrc.man.tail
-       $(MAKEDOC_CPP) $(SRCDIR)/init.h | doc/makedoc$(EXEEXT) -m | \
-               cat $(SRCDIR)/doc/neomuttrc.man.head - \
-               $(SRCDIR)/doc/neomuttrc.man.tail > $@
+       ( sed -e "/^\.TH/s/@TS_MAN_CONF@/$(TS_MAN_CONF)/" \
+           $(SRCDIR)/doc/neomuttrc.man.head && \
+           $(MAKEDOC_CPP) $(SRCDIR)/init.h | doc/makedoc$(EXEEXT) -m | \
+           cat - $(SRCDIR)/doc/neomuttrc.man.tail \
+       ) > $@
 
 doc/manual.xml:        doc/makedoc$(EXEEXT) $(SRCDIR)/init.h $(SRCDIR)/opcodes.h \
                $(SRCDIR)/doc/manual.xml.head $(SRCDIR)/functions.h \
index 6352632136f6bbc7527aaebcf6afcb08b548dbea..8c9adcb0325840ce98d018148e292c4161f1b2cb 100644 (file)
@@ -17,7 +17,7 @@
 .\"     along with this program; if not, write to the Free Software
 .\"     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 .\"
-.TH neomutt 1 "January 2009" Unix "User Manuals"
+.TH neomutt 1 "@TS_MAN_MAIN@" Unix "User Manuals"
 .SH NAME
 neomutt \- The NeoMutt Mail User Agent
 .SH SYNTAX
index db0c15620d7f0258d2b9a1a3b8bd8be9711fe504..7ee37769d3c43eefde61f62a8997aa0ec0fa5ac8 100644 (file)
@@ -26,7 +26,7 @@
 .ft
 .fi
 ..
-.TH neomuttrc 5 "September 2002" Unix "User Manuals"
+.TH neomuttrc 5 "@TS_MAN_CONF@" Unix "User Manuals"
 .SH NAME
 neomuttrc \- Configuration file for the NeoMutt Mail User Agent
 .SH DESCRIPTION