It turns out that HH_INITIALIZE and HH_UNINITIALIZE are optional, and are for
[u/mdw/putty] / Buildscr
CommitLineData
1e07e676 1# -*- sh -*-
2# Build script to construct a full distribution directory of PuTTY.
3
6cac7502 4module putty
5
1e07e676 6# Set up the arguments for the main make command.
d09222ba 7set Makever -DSVN_REV=$(revision)
13651937 8ifneq "$(!numeric $(revision))" "yes" set Makever $(Makever) -DMODIFIED
d09222ba 9ifneq "$(RELEASE)" "" set Makever $(Makever) -DRELEASE=$(RELEASE)
10ifneq "$(date)" "" set Makever $(Makever) -DSNAPSHOT=$(date)
11set Makeargs VER="$(Makever)"
1e07e676 12ifneq "$(XFLAGS)" "" set Makeargs $(makeargs) XFLAGS="$(XFLAGS)"
13ifneq "$(MAKEARGS)" "" set Makeargs $(makeargs) $(MAKEARGS)
14
15# Set up the version string for the docs build.
30ea5678 16set Docmakeargs VERSION="PuTTY revision $(revision)"
1e07e676 17ifneq "$(RELEASE)" "" set Docmakeargs VERSION="PuTTY release $(RELEASE)"
8a8d1aa1 18ifneq "$(date)" "" set Docmakeargs VERSION="PuTTY development snapshot $(date)"
30ea5678 19
6cac7502 20# Set up the version string for the Unix source archive.
21set Unxver r$(revision)
22ifneq "$(RELEASE)" "" set Unxver $(RELEASE)
23ifneq "$(date)" "" set Unxver $(date)
24
30ea5678 25# Set up the various version strings for the installer.
26set Iversion r$(revision)
27set Iname PuTTY revision $(revision)
28set Ivertext Revision $(revision)
29set Irev $(revision)
6cac7502 30set Ifilename putty-$(Iversion)-installer.exe
30ea5678 31ifneq "$(RELEASE)" "" set Iversion $(RELEASE)
32ifneq "$(RELEASE)" "" set Iname PuTTY version $(RELEASE)
33ifneq "$(RELEASE)" "" set Ivertext Release $(RELEASE)
6cac7502 34ifneq "$(RELEASE)" "" set Irev 0
35ifneq "$(RELEASE)" "" set Ifilename putty-$(RELEASE)-installer.exe
30ea5678 36ifneq "$(date)" "" set Iversion $(date):r$(revision)
37ifneq "$(date)" "" set Iname PuTTY development snapshot $(date):r$(revision)
38ifneq "$(date)" "" set Ivertext Development snapshot $(date):r$(revision)
6cac7502 39ifneq "$(date)" "" set Ifilename putty-$(date)-installer.exe
1e07e676 40
41# Set up the version string for the installer.
30ea5678 42set Iversion r$(revision)
1e07e676 43ifneq "$(RELEASE)" "" set Iversion $(RELEASE)
30ea5678 44ifneq "$(date)" "" set Iversion $(date):r$(revision)
1e07e676 45
46in putty do ./mksrcarc.sh
6cac7502 47in putty do ./mkunxarc.sh $(Unxver)
1e07e676 48in putty do perl mkfiles.pl
49in putty/doc do make $(Docmakeargs) putty.hlp
50in putty/doc do make $(Docmakeargs) chm
30ea5678 51
52# Munge the installer script locally so that it reports the version
53# we're really building.
54in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(AppVerName=).*$$/$$1$$a/' '$(Iname)' putty.iss
55in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(VersionInfoTextVersion=).*$$/$$1$$a/' '$(Ivertext)' putty.iss
56in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(AppVersion=).*$$/$$1$$a/' '$(Iversion)' putty.iss
57in 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
58
1e07e676 59delegate windows
60 # FIXME: Cygwin alternative?
d09222ba 61 in putty/windows do cmd /c vcvars32 \& nmake -f Makefile.vc $(Makeargs)
1e07e676 62 # Ignore exit code from hhc, in favour of seeing whether the .chm
63 # file was created. (Yuck; but hhc appears to return non-zero
64 # exit codes on whim.)
65 in putty/doc do hhc putty.hhp; test -f putty.chm
66 in putty/windows do iscc putty.iss
67 return putty/windows/*.exe
7d89ce50 68 return putty/windows/*.map
1e07e676 69 return putty/doc/putty.chm
70 return putty/windows/Output/setup.exe
71enddelegate
72in putty/doc do make mostlyclean
73in putty/doc do make $(Docmakeargs)
74in putty/windows do zip -k -j putty.zip `ls *.exe | grep -v puttytel` ../doc/putty.chm ../doc/putty.hlp ../doc/putty.cnt
75in putty/doc do zip puttydoc.zip *.html
76
edb6ace9 77# Deliver the actual PuTTY release directory into a subdir `putty'.
78deliver putty/windows/*.exe putty/x86/$@
79deliver putty/windows/putty.zip putty/x86/$@
80deliver putty/windows/Output/setup.exe putty/x86/$(Ifilename)
81deliver putty/doc/puttydoc.zip putty/$@
82deliver putty/doc/putty.chm putty/$@
83deliver putty/doc/putty.hlp putty/$@
84deliver putty/doc/putty.cnt putty/$@
85deliver putty/doc/puttydoc.txt putty/$@
86deliver putty/doc/*.html putty/htmldoc/$@
87deliver putty/putty-src.zip putty/$@
88deliver putty/*.tar.gz putty/$@
89
90# Deliver the map files alongside the `proper' release deliverables.
91deliver putty/windows/*.map maps-x86/$@
92
93# Deliver sign.sh, so that whoever has just built PuTTY (the
94# snapshot scripts or me, depending) can conveniently sign it with
95# whatever key they want.
96deliver putty/sign.sh $@
1e07e676 97
98# Building the md5sums file is most easily done in the destination
99# directory.
edb6ace9 100in-dest putty do md5sum `\find * -type f -print` > md5sums
6cac7502 101
102# And construct .htaccess files. One in the top-level directory,
103# setting the MIME types for Windows help files and providing an
104# appropriate link to the source archive:
edb6ace9 105in-dest putty do echo "AddType application/octet-stream .chm" >> .htaccess
106in-dest putty do echo "AddType application/octet-stream .hlp" >> .htaccess
107in-dest putty do echo "AddType application/octet-stream .cnt" >> .htaccess
108in-dest putty do set -- putty*.tar.gz; for k in '' .DSA .RSA; do echo RedirectMatch temp '(.*/)'putty.tar.gz$$k\$$ '$$1'"$$1$$k" >> .htaccess; done
6cac7502 109# And one in the x86 directory, providing a link for the installer.
edb6ace9 110in-dest putty/x86 do set -- putty*installer.exe; for k in '' .DSA .RSA; do echo RedirectMatch temp '(.*/)'putty-installer.exe$$k\$$ '$$1'"$$1$$k" >> .htaccess; done