Be slightly more forgiving about the nature of SVN_REV; bob will be
[u/mdw/putty] / Buildscr
CommitLineData
1e07e676 1# -*- sh -*-
2# Build script to construct a full distribution directory of PuTTY.
3
4# Set up the arguments for the main make command.
d09222ba 5set Makever -DSVN_REV=$(revision)
6ifneq "$(RELEASE)" "" set Makever $(Makever) -DRELEASE=$(RELEASE)
7ifneq "$(date)" "" set Makever $(Makever) -DSNAPSHOT=$(date)
8set Makeargs VER="$(Makever)"
1e07e676 9ifneq "$(XFLAGS)" "" set Makeargs $(makeargs) XFLAGS="$(XFLAGS)"
10ifneq "$(MAKEARGS)" "" set Makeargs $(makeargs) $(MAKEARGS)
11
12# Set up the version string for the docs build.
30ea5678 13set Docmakeargs VERSION="PuTTY revision $(revision)"
1e07e676 14ifneq "$(RELEASE)" "" set Docmakeargs VERSION="PuTTY release $(RELEASE)"
30ea5678 15ifneq "$(date)" "" set Docmakeaargs VERSION="PuTTY development snapshot $(date)"
16
17# Set up the various version strings for the installer.
18set Iversion r$(revision)
19set Iname PuTTY revision $(revision)
20set Ivertext Revision $(revision)
21set Irev $(revision)
22ifneq "$(RELEASE)" "" set Iversion $(RELEASE)
23ifneq "$(RELEASE)" "" set Iname PuTTY version $(RELEASE)
24ifneq "$(RELEASE)" "" set Ivertext Release $(RELEASE)
25ifneq "$(RELEASE)" "" set Irev
26ifneq "$(date)" "" set Iversion $(date):r$(revision)
27ifneq "$(date)" "" set Iname PuTTY development snapshot $(date):r$(revision)
28ifneq "$(date)" "" set Ivertext Development snapshot $(date):r$(revision)
1e07e676 29
30# Set up the version string for the installer.
30ea5678 31set Iversion r$(revision)
1e07e676 32ifneq "$(RELEASE)" "" set Iversion $(RELEASE)
30ea5678 33ifneq "$(date)" "" set Iversion $(date):r$(revision)
1e07e676 34
35in putty do ./mksrcarc.sh
36in putty do ./mkunxarc.sh $(RELEASE)
37in putty do perl mkfiles.pl
38in putty/doc do make $(Docmakeargs) putty.hlp
39in putty/doc do make $(Docmakeargs) chm
30ea5678 40
41# Munge the installer script locally so that it reports the version
42# we're really building.
43in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(AppVerName=).*$$/$$1$$a/' '$(Iname)' putty.iss
44in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(VersionInfoTextVersion=).*$$/$$1$$a/' '$(Ivertext)' putty.iss
45in putty/windows do perl -i~ -pe 'BEGIN{$$a=shift@ARGV;}s/^(AppVersion=).*$$/$$1$$a/' '$(Iversion)' putty.iss
46in 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
47
1e07e676 48delegate windows
49 # FIXME: Cygwin alternative?
d09222ba 50 in putty/windows do cmd /c vcvars32 \& nmake -f Makefile.vc $(Makeargs)
1e07e676 51 # Ignore exit code from hhc, in favour of seeing whether the .chm
52 # file was created. (Yuck; but hhc appears to return non-zero
53 # exit codes on whim.)
54 in putty/doc do hhc putty.hhp; test -f putty.chm
55 in putty/windows do iscc putty.iss
56 return putty/windows/*.exe
7d89ce50 57 return putty/windows/*.map
1e07e676 58 return putty/doc/putty.chm
59 return putty/windows/Output/setup.exe
60enddelegate
61in putty/doc do make mostlyclean
62in putty/doc do make $(Docmakeargs)
63in putty/windows do zip -k -j putty.zip `ls *.exe | grep -v puttytel` ../doc/putty.chm ../doc/putty.hlp ../doc/putty.cnt
64in putty/doc do zip puttydoc.zip *.html
65
66deliver putty/windows/*.exe x86/$@
7d89ce50 67deliver putty/windows/*.map maps-x86/$@
1e07e676 68deliver putty/windows/putty.zip x86/$@
69deliver putty/windows/Output/setup.exe x86/putty-$(Iversion)-installer.exe
70deliver putty/doc/puttydoc.zip $@
71deliver putty/doc/putty.chm $@
72deliver putty/doc/putty.hlp $@
73deliver putty/doc/putty.cnt $@
74deliver putty/doc/puttydoc.txt $@
75deliver putty/doc/*.html htmldoc/$@
76deliver putty/putty-src.zip $@
77deliver putty/*.tar.gz $@
78
79# Building the md5sums file is most easily done in the destination
80# directory.
81in-dest . do md5sum `\find * -type f -print` > md5sums