OSDN Git Service

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