Be slightly more forgiving about the nature of SVN_REV; bob will be
[sgt/putty] / Buildscr
index 4681dc5..6c01b2e 100644 (file)
--- a/Buildscr
+++ b/Buildscr
@@ -2,37 +2,59 @@
 # Build script to construct a full distribution directory of PuTTY.
 
 # Set up the arguments for the main make command.
-set Makeargs
-ifneq "$(RELEASE)" "" set Makeargs VER="-DRELEASE=$(RELEASE)"
-ifneq "$(SNAPSHOT)" "" set Makeargs VER="-DSNAPSHOT=$(SNAPSHOT)"
+set Makever -DSVN_REV=$(revision)
+ifneq "$(RELEASE)" "" set Makever $(Makever) -DRELEASE=$(RELEASE)
+ifneq "$(date)" "" set Makever $(Makever) -DSNAPSHOT=$(date)
+set Makeargs VER="$(Makever)"
 ifneq "$(XFLAGS)" "" set Makeargs $(makeargs) XFLAGS="$(XFLAGS)"
 ifneq "$(MAKEARGS)" "" set Makeargs $(makeargs) $(MAKEARGS)
 
 # Set up the version string for the docs build.
-set Docmakeargs
+set Docmakeargs VERSION="PuTTY revision $(revision)"
 ifneq "$(RELEASE)" "" set Docmakeargs VERSION="PuTTY release $(RELEASE)"
-ifneq "$(SNAPSHOT)" "" set Docmakeaargs VERSION="PuTTY development snapshot $(SNAPSHOT)"
+ifneq "$(date)" "" set Docmakeaargs VERSION="PuTTY development snapshot $(date)"
+
+# Set up the various version strings for the installer.
+set Iversion r$(revision)
+set Iname PuTTY revision $(revision)
+set Ivertext Revision $(revision)
+set Irev $(revision)
+ifneq "$(RELEASE)" "" set Iversion $(RELEASE)
+ifneq "$(RELEASE)" "" set Iname PuTTY version $(RELEASE)
+ifneq "$(RELEASE)" "" set Ivertext Release $(RELEASE)
+ifneq "$(RELEASE)" "" set Irev
+ifneq "$(date)" "" set Iversion $(date):r$(revision)
+ifneq "$(date)" "" set Iname PuTTY development snapshot $(date):r$(revision)
+ifneq "$(date)" "" set Ivertext Development snapshot $(date):r$(revision)
 
 # Set up the version string for the installer.
-set Iversion
+set Iversion r$(revision)
 ifneq "$(RELEASE)" "" set Iversion $(RELEASE)
-ifneq "$(SNAPSHOT)" "" set Iversion $(SNAPSHOT)
-# FIXME: what about the static version numbers in putty.iss?
+ifneq "$(date)" "" set Iversion $(date):r$(revision)
 
 in putty do ./mksrcarc.sh
 in putty do ./mkunxarc.sh $(RELEASE)
 in putty do perl mkfiles.pl
 in putty/doc do make $(Docmakeargs) putty.hlp
 in putty/doc do make $(Docmakeargs) chm
+
+# Munge the installer script locally so that it reports the version
+# we're really building.
+in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(AppVerName=).*$$/$$1$$a/' '$(Iname)' putty.iss
+in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(VersionInfoTextVersion=).*$$/$$1$$a/' '$(Ivertext)' putty.iss
+in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(AppVersion=).*$$/$$1$$a/' '$(Iversion)' putty.iss
+in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;$$a=~s/M//;}s/^(VersionInfoVersion=\d+\.\d+\.)\d+(\.\d+)\r?$$/$$1$$a$$2/' '$(Irev)' putty.iss
+
 delegate windows
   # FIXME: Cygwin alternative?
-  in putty/windows do cmd /c 'vcvars32 & nmake -f Makefile.vc $(Makeargs)'
+  in putty/windows do cmd /c vcvars32 \& nmake -f Makefile.vc $(Makeargs)
   # Ignore exit code from hhc, in favour of seeing whether the .chm
   # file was created. (Yuck; but hhc appears to return non-zero
   # exit codes on whim.)
   in putty/doc do hhc putty.hhp; test -f putty.chm
   in putty/windows do iscc putty.iss
   return putty/windows/*.exe
+  return putty/windows/*.map
   return putty/doc/putty.chm
   return putty/windows/Output/setup.exe
 enddelegate
@@ -42,6 +64,7 @@ in putty/windows do zip -k -j putty.zip `ls *.exe | grep -v puttytel` ../doc/put
 in putty/doc do zip puttydoc.zip *.html
 
 deliver putty/windows/*.exe x86/$@
+deliver putty/windows/*.map maps-x86/$@
 deliver putty/windows/putty.zip x86/$@
 deliver putty/windows/Output/setup.exe x86/putty-$(Iversion)-installer.exe
 deliver putty/doc/puttydoc.zip $@