I've been using this in my personal build for a long time, according to the author date on the commit it's been at least since 2012. I've submitted it once before as part of a series to support getting the version information from git back when the official version control was still in mercurial. I figure that it's pays to resend it.
--------8<------ Switch to generating the version string during make process rather than at configure time. This makes it easier to keep the detailed version string accurate when doing development which doesn't require that the configure script be rerun. --- .gitignore | 1 + Makefile.am | 7 ++++++- commands.c | 1 + compose.c | 1 + configure.ac | 3 --- dotlock.c | 1 + init.c | 1 + muttlib.c | 1 + sendlib.c | 1 + status.c | 1 + 10 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2cec7439c..ee5a93606 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ /smime_keys /txt2c /stamp-doc-rc +/version.h /doc/instdoc /doc/manual.txt /doc/manual.xml diff --git a/Makefile.am b/Makefile.am index c95c21a2a..92edce221 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,7 +22,7 @@ if BUILD_HCACHE HCVERSION = hcversion.h endif -BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h conststrings.c $(HCVERSION) +BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h conststrings.c version.h $(HCVERSION) bin_PROGRAMS = mutt $(DOTLOCK_TARGET) $(PGPAUX_TARGET) mutt_SOURCES = \ @@ -140,6 +140,11 @@ keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.SIDEBAR $(srcdir)/OPS.PGP $(srcdir $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \ > keymap_alldefs.h +version.h: FORCE + echo '#define MUTT_VERSION "'`sh "$(srcdir)/version.sh"`'"' > $@.tmp + cmp -s $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@ +FORCE: + reldate.h: $(srcdir)/mkreldate.sh $(srcdir)/ChangeLog echo 'const char *ReleaseDate = "'`(cd $(srcdir) && ./mkreldate.sh)`'";' > reldate.h diff --git a/commands.c b/commands.c index cd65a0d21..a94962ad2 100644 --- a/commands.c +++ b/commands.c @@ -21,6 +21,7 @@ # include "config.h" #endif +#include "version.h" #include "mutt.h" #include "mutt_curses.h" #include "mutt_menu.h" diff --git a/compose.c b/compose.c index 6ca9c5a12..367c25588 100644 --- a/compose.c +++ b/compose.c @@ -21,6 +21,7 @@ # include "config.h" #endif +#include "version.h" #include "mutt.h" #include "mutt_curses.h" #include "mutt_idna.h" diff --git a/configure.ac b/configure.ac index d8aebe336..59d25207c 100644 --- a/configure.ac +++ b/configure.ac @@ -10,9 +10,6 @@ AC_CONFIG_HEADERS([config.h]) AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/VERSION']) -MUTT_VERSION=`env sh "$srcdir/version.sh"` -AC_DEFINE_UNQUOTED(MUTT_VERSION,"$MUTT_VERSION", [Full textual version string.]) - AC_USE_SYSTEM_EXTENSIONS ALL_LINGUAS="de eu ru it es uk fr pl nl cs id sk ko el zh_TW zh_CN pt_BR eo gl sv da lt tr ja hu et ca bg ga fi" diff --git a/dotlock.c b/dotlock.c index 5bf03480a..9dd958ad2 100644 --- a/dotlock.c +++ b/dotlock.c @@ -46,6 +46,7 @@ #include <limits.h> #endif +#include "version.h" #include "dotlock.h" #ifdef HAVE_GETOPT_H diff --git a/init.c b/init.c index e5c78961c..a9cb2821f 100644 --- a/init.c +++ b/init.c @@ -20,6 +20,7 @@ # include "config.h" #endif +#include "version.h" #include "mutt.h" #include "mapping.h" #include "mutt_curses.h" diff --git a/muttlib.c b/muttlib.c index 7789479c0..5e25c10d9 100644 --- a/muttlib.c +++ b/muttlib.c @@ -21,6 +21,7 @@ # include "config.h" #endif +#include "version.h" #include "mutt.h" #include "mutt_curses.h" #include "mime.h" diff --git a/sendlib.c b/sendlib.c index 2128c94ef..28da96403 100644 --- a/sendlib.c +++ b/sendlib.c @@ -22,6 +22,7 @@ # include "config.h" #endif +#include "version.h" #include "mutt.h" #include "mutt_curses.h" #include "rfc2047.h" diff --git a/status.c b/status.c index a069072fe..1c6b0353f 100644 --- a/status.c +++ b/status.c @@ -20,6 +20,7 @@ # include "config.h" #endif +#include "version.h" #include "mutt.h" #include "mutt_menu.h" #include "mutt_curses.h" -- 2.20.1.613.g9968bcf4fb