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