From fe1e7bbd15340c3921b4f8db2e01c1f70fae4af8 Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Fri, 30 Mar 2018 12:57:06 +0000 Subject: [PATCH] Simplify generation of man date --- Makefile.autosetup | 5 +---- auto.def | 23 ++--------------------- doc/Makefile.autosetup | 16 +++++++++++----- doc/neomutt.man | 2 +- doc/neomuttrc.man.head | 2 +- 5 files changed, 16 insertions(+), 32 deletions(-) diff --git a/Makefile.autosetup b/Makefile.autosetup index c47a1be65..d4d966b23 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -3,6 +3,7 @@ PACKAGE= @PACKAGE@ PACKAGE_VERSION=@PACKAGE_VERSION@ +PACKAGE_DATE= @PACKAGE_DATE@ # Build-time compiler and flags. These are used for building executables that # are only used at build-time, e.g., doc/makedoc. These are different from CC / @@ -56,10 +57,6 @@ 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) diff --git a/auto.def b/auto.def index 998e7b96e..381164fe0 100644 --- a/auto.def +++ b/auto.def @@ -177,24 +177,6 @@ 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 "" - } { - set epoch [clock scan \ - [get-define PACKAGE_VERSION] -format {%Y%m%d} -timezone :UTC] - } - cd $oldpwd - - return [clock format $epoch -format $format -timezone :UTC] - } } ############################################################################### @@ -938,8 +920,8 @@ foreach dir $subdirs { ############################################################################### # 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] +define PACKAGE_DATE \ + [regsub {(....)(..)(..)} [get-define PACKAGE_VERSION] {\1-\2-\3}] ############################################################################### # Generate Makefile and config.h @@ -951,7 +933,6 @@ make-config-header config.h -auto $auto_rep -bare $bare_rep -str $str_rep # Generate doc/neomutt.1 define bindir [get-define BINDIR] define docdir [get-define PKGDOCDIR] -make-template doc/neomutt.man doc/neomutt.1 ############################################################################### # Generate .clang_complete diff --git a/doc/Makefile.autosetup b/doc/Makefile.autosetup index 0229b3179..45372f33e 100644 --- a/doc/Makefile.autosetup +++ b/doc/Makefile.autosetup @@ -40,7 +40,8 @@ all-doc: $(CHUNKED_DOCFILES) \ doc/manual.html \ doc/manual.txt \ doc/neomuttrc \ - doc/neomuttrc.man + doc/neomutt.1 \ + doc/neomuttrc.5 \ doc/manual.html: doc/manual.xml \ $(SRCDIR)/doc/html.xsl \ @@ -63,16 +64,21 @@ doc/index.html: $(SRCDIR)/doc/chunk.xsl \ doc/manual.xml xsltproc --nonet -o doc/ $(SRCDIR)/doc/chunk.xsl doc/manual.xml > /dev/null 2>&1 -doc/neomuttrc.man: doc/makedoc$(EXEEXT) \ +doc/neomuttrc.5: doc/makedoc$(EXEEXT) \ $(SRCDIR)/init.h \ $(SRCDIR)/doc/neomuttrc.man.head \ $(SRCDIR)/doc/neomuttrc.man.tail - ( sed -e "/^\.TH/s/@TS_MAN_CONF@/$(TS_MAN_CONF)/" \ + ( sed -e "/^\.TH/s/@MAN_DATE@/$(PACKAGE_DATE)/" \ $(SRCDIR)/doc/neomuttrc.man.head && \ $(MAKEDOC_CPP) $(SRCDIR)/init.h | doc/makedoc$(EXEEXT) -m | \ cat - $(SRCDIR)/doc/neomuttrc.man.tail \ ) > $@ +doc/neomutt.1: + ( sed -e "/^\.TH/s/@MAN_DATE@/$(PACKAGE_DATE)/" \ + $(SRCDIR)/doc/neomutt.man \ + ) > $@ + doc/manual.xml: doc/makedoc$(EXEEXT) $(SRCDIR)/init.h $(SRCDIR)/opcodes.h \ $(SRCDIR)/doc/manual.xml.head $(SRCDIR)/functions.h \ $(SRCDIR)/doc/manual.xml.tail $(SRCDIR)/doc/gen-map-doc @@ -89,7 +95,7 @@ install-doc: all-doc $(MKDIR_P) $(DESTDIR)$(mandir)/man5 $(MKDIR_P) $(DESTDIR)$(sysconfdir) $(INSTALL) -m 644 doc/neomutt.1 $(DESTDIR)$(mandir)/man1/neomutt.1 - $(INSTALL) -m 644 doc/neomuttrc.man $(DESTDIR)$(mandir)/man5/neomuttrc.5 + $(INSTALL) -m 644 doc/neomuttrc.5 $(DESTDIR)$(mandir)/man5/neomuttrc.5 $(INSTALL) -m 644 $(SRCDIR)/doc/smime_keys.1 $(DESTDIR)$(mandir)/man1/smime_keys_$(PACKAGE).1 $(INSTALL) -m 644 $(SRCDIR)/doc/pgpewrap.1 $(DESTDIR)$(mandir)/man1/pgpewrap_$(PACKAGE).1 $(INSTALL) -m 644 $(SRCDIR)/doc/pgpring.1 $(DESTDIR)$(mandir)/man1/pgpring_$(PACKAGE).1 @@ -123,7 +129,7 @@ uninstall-doc: $(RM) $(DESTDIR)$(docdir)/mime.types clean-doc: - $(RM) doc/*.html doc/neomuttrc.man \ + $(RM) doc/*.html doc/neomuttrc.5 doc/neomutt.1 \ doc/makedoc$(EXEEXT) doc/makedoc.o \ doc/makedoc.Po doc/manual.txt doc/manual.xml \ doc/neomuttrc diff --git a/doc/neomutt.man b/doc/neomutt.man index 8c9adcb03..743a41297 100644 --- a/doc/neomutt.man +++ b/doc/neomutt.man @@ -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 "@TS_MAN_MAIN@" Unix "User Manuals" +.TH neomutt 1 "@MAN_DATE@" Unix "User Manuals" .SH NAME neomutt \- The NeoMutt Mail User Agent .SH SYNTAX diff --git a/doc/neomuttrc.man.head b/doc/neomuttrc.man.head index 7ee37769d..74901d6f4 100644 --- a/doc/neomuttrc.man.head +++ b/doc/neomuttrc.man.head @@ -26,7 +26,7 @@ .ft .fi .. -.TH neomuttrc 5 "@TS_MAN_CONF@" Unix "User Manuals" +.TH neomuttrc 5 "@MAN_DATE@" Unix "User Manuals" .SH NAME neomuttrc \- Configuration file for the NeoMutt Mail User Agent .SH DESCRIPTION -- 2.40.0