<<< Date Index >>>     <<< Thread Index >>>

[PATCH] Autogenerate reldate.h (was: Upgrading and releases)



Hi,

* Thomas Roessler [06-05-17 23:12:32 +0200] wrote:
On 2006-05-17 19:13:10 +0000, Rocco Rutte wrote:

Somewhat related is my second idea (though I don't know if
the ChangeLog file is distributed but if); we could stop
manual maintainance of reldate.h and let Makefile pick the
date from the first line.

+1

Okay. Attached is a first try patch that does that for building sources, building releases and the manual (which now also contains that date) as for the 1.5.x series the date is like a micro version number.

For this, I had to remove the .PHONY targets in Makefile.am which I consider to be legacy from older days... so I hope this doesn't break anything (otherwise GNU make will rebuild reldate.h several times; but not FreeBSD's make?!)...

  bye, Rocco
--
:wq!
diff --git a/Makefile.am b/Makefile.am
index c13ce8c..71d9834 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,7 +13,7 @@ SUBDIRS = m4 po intl doc contrib $(IMAP_
 
 bin_SCRIPTS = muttbug flea @SMIMEAUX_TARGET@
 
-BUILT_SOURCES = keymap_defs.h patchlist.c
+BUILT_SOURCES = keymap_defs.h patchlist.c reldate.h
 
 bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
 mutt_SOURCES = $(BUILT_SOURCES) \
@@ -73,13 +73,13 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP O
        globals.h hash.h history.h init.h keymap.h mutt_crypt.h \
        mailbox.h mapping.h md5.h mime.h mutt.h mutt_curses.h mutt_menu.h \
        mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \
-       mx.h pager.h pgp.h pop.h protos.h reldate.h rfc1524.h rfc2047.h \
+       mx.h pager.h pgp.h pop.h protos.h rfc1524.h rfc2047.h \
        rfc2231.h rfc822.h sha1.h sort.h mime.types VERSION prepare \
        _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
        mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h Muttrc.head 
Muttrc \
        makedoc.c stamp-doc-rc README.SSL smime.h\
        muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
-       ChangeLog.old mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
+       ChangeLog ChangeLog.old mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
        snprintf.c regex.c crypt-gpgme.h
 
 EXTRA_SCRIPTS = smime_keys
@@ -96,7 +96,8 @@ mutt_dotlock.c: dotlock.c
        cp $(srcdir)/dotlock.c mutt_dotlock.c
 
 CLEANFILES = mutt_dotlock.c stamp-doc-rc makedoc \
-       keymap_alldefs.h keymap_defs.h patchlist.c
+       keymap_alldefs.h keymap_defs.h patchlist.c \
+       reldate.h
 
 ACLOCAL_AMFLAGS = -I m4
 
@@ -122,8 +123,8 @@ keymap_alldefs.h: $(srcdir)/OPS $(srcdir
                $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \
                        > $(srcdir)/keymap_alldefs.h
 
-reldate:
-       echo 'const char *ReleaseDate = "'`date +%Y-%m-%d`'";' > 
$(srcdir)/reldate.h
+reldate.h: $(srcdir)/ChangeLog
+       echo 'const char *ReleaseDate = "'`head -n 1 $(srcdir)/ChangeLog | cut 
-d ' ' -f 1`'";' > reldate.h
 
 patchlist.c: $(srcdir)/PATCHES $(srcdir)/patchlist.sh
        $(srcdir)/patchlist.sh < $(srcdir)/PATCHES > patchlist.c
@@ -176,8 +177,6 @@ update-changelog:
        sh ./mkchangelog.sh | fmt -c | cat  - ChangeLog > ChangeLog.$$$$ && mv 
ChangeLog.$$$$ ChangeLog; \
        $${VISUAL:-vi} ChangeLog)
 
-#ChangeLog: changelog
-
 # kluge around automake problems.
 
 dist-hook:
@@ -199,4 +198,3 @@ stamp-doc-rc: $(srcdir)/init.h makedoc M
 
 
 .PHONY: commit pclean check-security commit-real commit-changelog
-.PHONY: changelog ChangeLog
diff --git a/build-release b/build-release
index fa7f085..8f5bac5 100755
--- a/build-release
+++ b/build-release
@@ -44,7 +44,7 @@ echo $OVERSION | awk -F . '{printf("%d.%
 VERSION="`cat VERSION`" 
 TAG="mutt-`echo $VERSION | tr . -`-rel" 
 
-echo 'const char *ReleaseDate = "'`date +%Y-%m-%d`'";' > reldate.h
+#echo 'const char *ReleaseDate = "'`date +%Y-%m-%d`'";' > reldate.h
 
 make update-changelog 
 
diff --git a/doc/Makefile.in b/doc/Makefile.in
index f2cae6a..c906036 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -182,9 +182,11 @@ mutt.1: $(srcdir)/mutt.man
        $(EDIT) $(srcdir)/mutt.man > $@
 
 stamp-doc-xml: $(top_srcdir)/makedoc.c $(top_srcdir)/init.h manual.xml.head 
manual.xml.tail \
-               $(top_srcdir)/VERSION
+               $(top_srcdir)/VERSION $(top_srcdir)/ChangeLog
        $(MAKE) ../makedoc$(EXEEXT)
-       ( sed -e "s/@VERSION\@/`cat $(top_srcdir)/VERSION`/" 
$(srcdir)/manual.xml.head ;\
+       ( vernum=`cat $(top_srcdir)/VERSION` ; \
+         verdate=`head -n 1 $(top_srcdir)/ChangeLog | cut -d ' ' -f 1` ; \
+         sed -e "s/@VERSION\@/$$vernum ($$verdate)/" $(srcdir)/manual.xml.head 
;\
          $(MAKEDOC_CPP) $(top_srcdir)/init.h | ../makedoc -s ) |      \
                cat - $(srcdir)/manual.xml.tail > manual.xml
        touch stamp-doc-xml
diff --git a/reldate.h b/reldate.h
deleted file mode 100644
index 88cba98..0000000
--- a/reldate.h
+++ /dev/null
@@ -1 +0,0 @@
-const char *ReleaseDate = "2005-09-15";