Sebastian Kuschel reports that pfd_closing can be called for a socket
[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)
479fb463 10ifneq "$(PRERELEASE)" "" set Makever $(Makever) -DPRERELEASE=$(PRERELEASE)
d09222ba 11ifneq "$(date)" "" set Makever $(Makever) -DSNAPSHOT=$(date)
12set Makeargs VER="$(Makever)"
83c25801 13ifneq "$(XFLAGS)" "" set Makeargs $(Makeargs) XFLAGS="$(XFLAGS)"
14ifneq "$(MAKEARGS)" "" set Makeargs $(Makeargs) $(MAKEARGS)
1e07e676 15
16# Set up the version string for the docs build.
30ea5678 17set Docmakeargs VERSION="PuTTY revision $(revision)"
1e07e676 18ifneq "$(RELEASE)" "" set Docmakeargs VERSION="PuTTY release $(RELEASE)"
479fb463 19ifneq "$(PRERELEASE)" "" set Docmakeargs VERSION="PuTTY pre-release $(PRERELEASE):r$(revision)"
8a8d1aa1 20ifneq "$(date)" "" set Docmakeargs VERSION="PuTTY development snapshot $(date)"
30ea5678 21
6cac7502 22# Set up the version string for the Unix source archive.
23set Unxver r$(revision)
24ifneq "$(RELEASE)" "" set Unxver $(RELEASE)
479fb463 25ifneq "$(PRERELEASE)" "" set Unxver $(PRERELEASE)pre $(revision)
6cac7502 26ifneq "$(date)" "" set Unxver $(date)
27
30ea5678 28# Set up the various version strings for the installer.
29set Iversion r$(revision)
30set Iname PuTTY revision $(revision)
31set Ivertext Revision $(revision)
32set Irev $(revision)
6cac7502 33set Ifilename putty-$(Iversion)-installer.exe
30ea5678 34ifneq "$(RELEASE)" "" set Iversion $(RELEASE)
35ifneq "$(RELEASE)" "" set Iname PuTTY version $(RELEASE)
36ifneq "$(RELEASE)" "" set Ivertext Release $(RELEASE)
6cac7502 37ifneq "$(RELEASE)" "" set Irev 0
38ifneq "$(RELEASE)" "" set Ifilename putty-$(RELEASE)-installer.exe
479fb463 39ifneq "$(PRERELEASE)" "" set Iversion $(PRERELEASE):r$(revision)
40ifneq "$(PRERELEASE)" "" set Iname PuTTY pre-release $(PRERELEASE):r$(revision)
41ifneq "$(PRERELEASE)" "" set Ivertext Pre-release $(PRERELEASE):r$(revision)
42ifneq "$(PRERELEASE)" "" set Ifilename putty-$(PRERELEASE)-pre$(revision)-installer.exe
30ea5678 43ifneq "$(date)" "" set Iversion $(date):r$(revision)
44ifneq "$(date)" "" set Iname PuTTY development snapshot $(date):r$(revision)
45ifneq "$(date)" "" set Ivertext Development snapshot $(date):r$(revision)
6cac7502 46ifneq "$(date)" "" set Ifilename putty-$(date)-installer.exe
1e07e676 47
1e07e676 48in putty do ./mksrcarc.sh
6cac7502 49in putty do ./mkunxarc.sh $(Unxver)
1e07e676 50in putty do perl mkfiles.pl
51in putty/doc do make $(Docmakeargs) putty.hlp
52in putty/doc do make $(Docmakeargs) chm
30ea5678 53
54# Munge the installer script locally so that it reports the version
55# we're really building.
56in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(AppVerName=).*$$/$$1$$a/' '$(Iname)' putty.iss
57in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(VersionInfoTextVersion=).*$$/$$1$$a/' '$(Ivertext)' putty.iss
58in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(AppVersion=).*$$/$$1$$a/' '$(Iversion)' putty.iss
59in 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
60
5a9b85e7 61# Windowsify LICENCE, since it's going in the Windows installer.
62in putty do perl -i~ -pe 'y/\015//d;s/$$/\015/' LICENCE
63
1e07e676 64delegate windows
65 # FIXME: Cygwin alternative?
d09222ba 66 in putty/windows do cmd /c vcvars32 \& nmake -f Makefile.vc $(Makeargs)
1e07e676 67 # Ignore exit code from hhc, in favour of seeing whether the .chm
68 # file was created. (Yuck; but hhc appears to return non-zero
69 # exit codes on whim.)
70 in putty/doc do hhc putty.hhp; test -f putty.chm
71 in putty/windows do iscc putty.iss
72 return putty/windows/*.exe
7d89ce50 73 return putty/windows/*.map
1e07e676 74 return putty/doc/putty.chm
75 return putty/windows/Output/setup.exe
76enddelegate
77in putty/doc do make mostlyclean
78in putty/doc do make $(Docmakeargs)
79in putty/windows do zip -k -j putty.zip `ls *.exe | grep -v puttytel` ../doc/putty.chm ../doc/putty.hlp ../doc/putty.cnt
80in putty/doc do zip puttydoc.zip *.html
81
edb6ace9 82# Deliver the actual PuTTY release directory into a subdir `putty'.
83deliver putty/windows/*.exe putty/x86/$@
84deliver putty/windows/putty.zip putty/x86/$@
85deliver putty/windows/Output/setup.exe putty/x86/$(Ifilename)
86deliver putty/doc/puttydoc.zip putty/$@
87deliver putty/doc/putty.chm putty/$@
88deliver putty/doc/putty.hlp putty/$@
89deliver putty/doc/putty.cnt putty/$@
90deliver putty/doc/puttydoc.txt putty/$@
91deliver putty/doc/*.html putty/htmldoc/$@
92deliver putty/putty-src.zip putty/$@
93deliver putty/*.tar.gz putty/$@
94
95# Deliver the map files alongside the `proper' release deliverables.
96deliver putty/windows/*.map maps-x86/$@
97
98# Deliver sign.sh, so that whoever has just built PuTTY (the
99# snapshot scripts or me, depending) can conveniently sign it with
100# whatever key they want.
101deliver putty/sign.sh $@
1e07e676 102
0a080c1e 103# Create files of cryptographic checksums, which will be signed along
104# with the files they verify. We've provided MD5 checksums for a
105# while, but now MD5 is looking iffy, we're expanding our selection.
106#
107# Creating these files is most easily done in the destination
108# directory, where all the files we're delivering are already in their
109# final relative layout.
110in-dest putty do a=`\find * -type f -print`; md5sum $$a > md5sums && sha1sum $$a > sha1sums && sha256sum $$a > sha256sums && sha512sum $$a > sha512sums
6cac7502 111
112# And construct .htaccess files. One in the top-level directory,
113# setting the MIME types for Windows help files and providing an
114# appropriate link to the source archive:
edb6ace9 115in-dest putty do echo "AddType application/octet-stream .chm" >> .htaccess
116in-dest putty do echo "AddType application/octet-stream .hlp" >> .htaccess
117in-dest putty do echo "AddType application/octet-stream .cnt" >> .htaccess
118in-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 119# And one in the x86 directory, providing a link for the installer.
edb6ace9 120in-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