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