"Fossies" - the Fresh Open Source Software Archive

Member "putty-0.73/Buildscr" (22 Sep 2019, 18392 Bytes) of package /linux/misc/putty-0.73.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Buildscr": 0.72_vs_0.73.

    1 # -*- sh -*-
    2 # Build script to construct a full distribution directory of PuTTY.
    3 
    4 module putty
    5 
    6 # Start by figuring out what our version information looks like.
    7 #
    8 # There are four classes of PuTTY build:
    9 #  - a release, which just has an X.YY version number
   10 #  - a prerelease, which has an X.YY version number, plus a date and
   11 #    version control commit id (and is considered to be 'almost'
   12 #    version X.YY)
   13 #  - a development snapshot, which just has a date and commit id
   14 #  - a custom build, which also has a date and commit id (but is
   15 #    labelled differently, to stress that development snapshots are
   16 #    built from the checked-in code by the automated nightly script
   17 #    whereas custom builds are made manually, perhaps from uncommitted
   18 #    changes, e.g. to send to a user for diagnostic or testing
   19 #    purposes).
   20 #
   21 # The four classes of build are triggered by invoking bob with
   22 # different command-line variable definitions:
   23 #
   24 #  - RELEASE=X.YY makes a release build
   25 #  - PRERELEASE=X.YY makes a prerelease build (combined with the build
   26 #    date and VCS info)
   27 #  - setting SNAPSHOT to any non-empty string makes a development
   28 #    snapshot
   29 #  - setting none of these makes a custom build.
   30 
   31 # If we need a date for our build, start by computing it in the
   32 # various forms we need. $(Ndate) is the date in purely numeric form
   33 # (YYYYMMDD); $(Date) is separated as YYYY-MM-DD; $(Days) is the
   34 # number of days since the epoch.
   35 ifeq "$(RELEASE)" "" set Ndate $(!builddate)
   36 ifneq "$(Ndate)" "" in . do echo $(Ndate) | perl -pe 's/(....)(..)(..)/$$1-$$2-$$3/' > date
   37 ifneq "$(Ndate)" "" read Date date
   38 set Epoch 17161 # update this at every release
   39 ifneq "$(Ndate)" "" in . do echo $(Ndate) | perl -ne 'use Time::Local; /(....)(..)(..)/ and print timegm(0,0,0,$$3,$$2-1,$$1) / 86400 - $(Epoch)' > days
   40 ifneq "$(Ndate)" "" read Days days
   41 
   42 # For any non-release, we're going to need the number of the prior
   43 # release, for putting in various places so as to get monotonic
   44 # comparisons with the surrounding actual releases.
   45 ifeq "$(RELEASE)" "" read Lastver putty/LATEST.VER
   46 
   47 # Set up the textual version strings for the docs build and installers.
   48 # We have one of these including the word 'PuTTY', and one without,
   49 # which are inconveniently capitalised differently.
   50 ifneq "$(RELEASE)" "" set Puttytextver PuTTY release $(RELEASE)
   51 ifneq "$(RELEASE)" "" set Textver Release $(RELEASE)
   52 ifneq "$(PRERELEASE)" "" set Puttytextver PuTTY pre-release $(PRERELEASE):$(Date).$(vcsid)
   53 ifneq "$(PRERELEASE)" "" set Textver Pre-release $(PRERELEASE):$(Date).$(vcsid)
   54 ifneq "$(SNAPSHOT)" "" set Puttytextver PuTTY development snapshot $(Date).$(vcsid)
   55 ifneq "$(SNAPSHOT)" "" set Textver Development snapshot $(Date).$(vcsid)
   56 ifeq "$(RELEASE)$(PRERELEASE)$(SNAPSHOT)" "" set Puttytextver PuTTY custom build $(Date).$(vcsid)
   57 ifeq "$(RELEASE)$(PRERELEASE)$(SNAPSHOT)" "" set Textver Custom build $(Date).$(vcsid)
   58 set Docmakever VERSION="$(Puttytextver)"
   59 
   60 # Set up the version string for use in the SSH connection greeting.
   61 #
   62 # We use $(Ndate) rather than $(Date) in the pre-release string to
   63 # make sure it's under 40 characters, which is a hard limit in the SSH
   64 # protocol spec (and enforced by a compile-time assertion in
   65 # version.c).
   66 ifneq "$(RELEASE)" "" set Sshver -Release-$(RELEASE)
   67 ifneq "$(PRERELEASE)" "" set Sshver -Prerelease-$(PRERELEASE):$(Ndate).$(vcsid)
   68 ifneq "$(SNAPSHOT)" "" set Sshver -Snapshot-$(Date).$(vcsid)
   69 ifeq "$(RELEASE)$(PRERELEASE)$(SNAPSHOT)" "" set Sshver -Custom-$(Date).$(vcsid)
   70 
   71 # Set up the filename suffix for the Unix source archive.
   72 ifneq "$(RELEASE)" "" set Uxarcsuffix -$(RELEASE)
   73 ifneq "$(PRERELEASE)" "" set Uxarcsuffix -$(PRERELEASE)~pre$(Ndate).$(vcsid)
   74 ifneq "$(SNAPSHOT)" "" set Uxarcsuffix -$(Lastver)-$(Date).$(vcsid)
   75 ifeq "$(RELEASE)$(PRERELEASE)$(SNAPSHOT)" "" set Uxarcsuffix -custom-$(Date).$(vcsid)
   76 
   77 # Set up the version number for the autoconf system.
   78 ifneq "$(RELEASE)" "" set Autoconfver $(RELEASE)
   79 ifneq "$(PRERELEASE)" "" set Autoconfver $(PRERELEASE)~pre$(Ndate).$(vcsid)
   80 ifneq "$(SNAPSHOT)" "" set Autoconfver $(Lastver)-$(Date).$(vcsid)
   81 ifeq "$(RELEASE)$(PRERELEASE)$(SNAPSHOT)" "" set Autoconfver Custom.$(Date).$(vcsid)
   82 
   83 # Set up the filenames for the Windows installers (minus extension,
   84 # which goes on later).
   85 ifneq "$(RELEASE)" "" set Isuffix $(RELEASE)-installer
   86 ifneq "$(PRERELEASE)" "" set Isuffix $(PRERELEASE)-pre$(Ndate)-installer
   87 ifneq "$(SNAPSHOT)" "" set Isuffix $(Date)-installer
   88 ifeq "$(RELEASE)$(PRERELEASE)$(SNAPSHOT)" "" set Isuffix custom-$(Date)-installer
   89 set Ifilename32 putty-$(Isuffix)
   90 set Ifilename64 putty-64bit-$(Isuffix)
   91 set Ifilenamea32 putty-arm32-$(Isuffix)
   92 set Ifilenamea64 putty-arm64-$(Isuffix)
   93 
   94 # Set up the Windows version resource info, for both the installers and
   95 # the individual programs. This must be a sequence of four 16-bit
   96 # integers compared lexicographically, and we define it as follows:
   97 #
   98 #   For release X.YY:                             X.YY.0.0
   99 #   For a prerelease before the X.YY release:     (X.YY-1).(DDDDD + 0x8000).0
  100 #   For a devel snapshot after the X.YY release:  X.YY.DDDDD.0
  101 #   For a custom build:                           X.YY.DDDDD.1
  102 #
  103 # where DDDDD is a representation of the build date, in the form of a
  104 # number of days since an epoch date. The epoch is reset at every
  105 # release (which, with 15 bits, gives us a comfortable 80-odd years
  106 # before it becomes vital to make another release to reset the count
  107 # :-).
  108 
  109 ifneq "$(RELEASE)" "" in . do echo $(RELEASE).0.0 > winver
  110 ifneq "$(PRERELEASE)" "" in . do perl -e 'printf "%s.%d.0", $$ARGV[0], 0x8000+$$ARGV[1]' $(Lastver) $(Days) > winver
  111 ifneq "$(SNAPSHOT)" "" in . do perl -e 'printf "%s.%d.0", $$ARGV[0], $$ARGV[1]' $(Lastver) $(Days) > winver
  112 ifeq "$(RELEASE)$(PRERELEASE)$(SNAPSHOT)" "" in . do perl -e 'printf "%s.%d.1", $$ARGV[0], $$ARGV[1]' $(Lastver) $(Days) > winver
  113 in . do perl -pe 'y!.!,!' winver > winvercommas
  114 read Winver winver
  115 read Winvercommas winvercommas
  116 
  117 # Write out a version.h that contains the real version number.
  118 in putty do echo '/* Generated by automated build script */' > version.h
  119 ifneq "$(RELEASE)" "" in putty do echo '$#define RELEASE $(RELEASE)' >> version.h
  120 ifneq "$(PRERELEASE)" "" in putty do echo '$#define PRERELEASE $(PRERELEASE)' >> version.h
  121 ifneq "$(SNAPSHOT)" "" in putty do echo '$#define SNAPSHOT' >> version.h
  122 in putty do echo '$#define TEXTVER "$(Textver)"' >> version.h
  123 in putty do echo '$#define SSHVER "$(Sshver)"' >> version.h
  124 in putty do echo '$#define BINARY_VERSION $(Winvercommas)' >> version.h
  125 in putty do echo '$#define SOURCE_COMMIT "$(vcsfullid)"' >> version.h
  126 
  127 # Set up the extra arguments for the main Windows nmake command. The
  128 # user can define XFLAGS and MAKEARGS on the bob command line, to pass
  129 # in extra compile and make options respectively (e.g. to do a
  130 # debugging or Minefield build).
  131 set Makeargs
  132 ifneq "$(XFLAGS)" "" set Makeargs $(Makeargs) XFLAGS="$(XFLAGS)"
  133 ifneq "$(MAKEARGS)" "" set Makeargs $(Makeargs) $(MAKEARGS)
  134 
  135 in putty do ./mksrcarc.sh
  136 in putty do ./mkunxarc.sh '$(Autoconfver)' '$(Uxarcsuffix)' $(Docmakever)
  137 in putty do perl mkfiles.pl
  138 in putty/doc do make $(Docmakever) putty.chm -j$(nproc)
  139 
  140 delegate -
  141 # Run the test suite, under self-delegation so that we don't leave any
  142 # cruft lying around. This involves doing a build of the Unix tools
  143 # (which is a useful double-check anyway to pick up any build failures)
  144 in putty do ./mkauto.sh
  145 in putty do ./configure CC=clang CFLAGS="-fsanitize=address -fsanitize=leak"
  146 in putty do make -j$(nproc)
  147 in putty do python test/cryptsuite.py
  148 enddelegate
  149 
  150 # Windowsify LICENCE, since it's going in the Windows installers.
  151 in putty do perl -i~ -pe 'y/\015//d;s/$$/\015/' LICENCE
  152 
  153 # Some gratuitous theming for the MSI installer UI.
  154 in putty/icons do make -j$(nproc)
  155 in putty do convert -size 164x312 'gradient:blue-white' -distort SRT -90 -swirl 180 \( -size 329x312 canvas:white \) +append \( icons/putty-48.png -geometry +28+24 \) -composite \( icons/pscp-48.png -geometry +88+96 \) -composite \( icons/puttygen-48.png -geometry +28+168 \) -composite \( icons/pageant-48.png -geometry +88+240 \) -composite windows/msidialog.bmp
  156 in putty do convert -size 493x58 canvas:white \( icons/putty-48.png -geometry +440+5 \) -composite windows/msibanner.bmp
  157 
  158 mkdir putty/windows/build32
  159 mkdir putty/windows/build64
  160 mkdir putty/windows/buildold
  161 mkdir putty/windows/abuild32
  162 mkdir putty/windows/abuild64
  163 
  164 # Build the binaries to go in the installers, in both 32- and 64-bit
  165 # flavours.
  166 #
  167 # For the 32-bit ones, we set a subsystem version of 5.01, which
  168 # allows the resulting files to still run on Windows XP.
  169 in putty/windows with clangcl32 do Platform=x86 make -f Makefile.clangcl BUILDDIR=build32/ SUBSYSVER=,5.01 $(Makeargs) all -j$(nproc)
  170 in putty/windows with clangcl64 do Platform=x64 make -f Makefile.clangcl BUILDDIR=build64/ $(Makeargs) all -j$(nproc)
  171 
  172 # Build experimental Arm Windows binaries.
  173 in putty/windows with clangcl_a32 do Platform=arm make -f Makefile.clangcl BUILDDIR=abuild32/ SUBSYSVER=,5.01 $(Makeargs) all -j$(nproc)
  174 in putty/windows with clangcl_a64 do Platform=arm64 make -f Makefile.clangcl BUILDDIR=abuild64/ $(Makeargs) all -j$(nproc)
  175 
  176 # Remove Windows binaries for the test programs we don't want to ship,
  177 # like testcrypt.exe. (But we still _built_ them, to ensure the build
  178 # worked.)
  179 in putty/windows do make -f Makefile.clangcl BUILDDIR=build32/ cleantestprogs
  180 in putty/windows do make -f Makefile.clangcl BUILDDIR=build64/ cleantestprogs
  181 in putty/windows do make -f Makefile.clangcl BUILDDIR=abuild32/ cleantestprogs
  182 in putty/windows do make -f Makefile.clangcl BUILDDIR=abuild64/ cleantestprogs
  183 
  184 # Code-sign the Windows binaries, if the local bob config provides a
  185 # script to do so in a cross-compiling way. We assume here that the
  186 # script accepts an -i option to provide a 'more info' URL, an
  187 # optional -n option to provide a program name, and an -N option to
  188 # take the program name from an .exe's version resource, and that it
  189 # can accept multiple .exe or .msi filename arguments and sign them
  190 # all in place.
  191 ifneq "$(cross_winsigncode)" "" in putty/windows do $(cross_winsigncode) -N -i https://www.chiark.greenend.org.uk/~sgtatham/putty/ build*/*.exe abuild*/*.exe
  192 
  193 # Make a preliminary set of cryptographic checksums giving the hashes
  194 # of these versions of the binaries. We'll make the rest below.
  195 in putty do for hash in md5 sha1 sha256 sha512; do for dir_plat in "build32 w32" "build64 w64" "abuild32 wa32" "abuild64 wa64"; do set -- $$dir_plat; (cd windows/$$1 && $${hash}sum *.exe | sed 's!\( \+\)!\1'$$2'/!;s!$$! (installer version)!') >> $${hash}sums.installer; done; done
  196 
  197 # Build a WiX MSI installer, for each build flavour.
  198 in putty/windows with wixonlinux do candle -arch x86 -dRealPlatform=x86 -dDllOk=yes -dBuilddir=build32/ -dWinver="$(Winver)" -dPuttytextver="$(Puttytextver)" installer.wxs && light -ext WixUIExtension -ext WixUtilExtension -sval installer.wixobj -o installer32.msi -spdb
  199 in putty/windows with wixonlinux do candle -arch x64 -dRealPlatform=x64 -dDllOk=yes -dBuilddir=build64/ -dWinver="$(Winver)" -dPuttytextver="$(Puttytextver)" installer.wxs && light -ext WixUIExtension -ext WixUtilExtension -sval installer.wixobj -o installer64.msi -spdb
  200 in putty/windows with wixonlinux do candle -arch x64 -dRealPlatform=Arm -dDllOk=no -dBuilddir=abuild32/ -dWinver="$(Winver)" -dPuttytextver="$(Puttytextver)" installer.wxs && light -ext WixUIExtension -ext WixUtilExtension -sval installer.wixobj -o installera32.msi -spdb
  201 in putty/windows with wixonlinux do candle -arch x64 -dRealPlatform=Arm64 -dDllOk=no -dBuilddir=abuild64/ -dWinver="$(Winver)" -dPuttytextver="$(Puttytextver)" installer.wxs && light -ext WixUIExtension -ext WixUtilExtension -sval installer.wixobj -o installera64.msi -spdb
  202 
  203 # Bodge the platform fields for the Windows on Arm installers, since
  204 # WiX 3 doesn't understand Arm platform names itself.
  205 in putty/windows do ./msiplatform.py installera32.msi Arm
  206 in putty/windows do ./msiplatform.py installera64.msi Arm64
  207 
  208 # Sign the Windows installers.
  209 ifneq "$(cross_winsigncode)" "" in putty/windows do $(cross_winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/putty/ -n "PuTTY Installer" installer32.msi installer64.msi installera32.msi installera64.msi
  210 
  211 # Delete the binaries and resource files from the build directories,
  212 # so that we can rebuild them differently.
  213 in putty/windows/build32 do rm -f *.exe *.res *.rcpp
  214 in putty/windows/build64 do rm -f *.exe *.res *.rcpp
  215 in putty/windows/abuild32 do rm -f *.exe *.res *.rcpp
  216 in putty/windows/abuild64 do rm -f *.exe *.res *.rcpp
  217 
  218 # Build the standalone binaries, in both 32- and 64-bit flavours.
  219 # These differ from the previous set in that they embed the help file.
  220 in putty/windows with clangcl32 do Platform=x86 make -f Makefile.clangcl BUILDDIR=build32/ RCFL=-DEMBED_CHM SUBSYSVER=,5.01 $(Makeargs) all -j$(nproc)
  221 in putty/windows with clangcl64 do Platform=x64 make -f Makefile.clangcl BUILDDIR=build64/ RCFL=-DEMBED_CHM $(Makeargs) all -j$(nproc)
  222 in putty/windows with clangcl_a32 do Platform=arm make -f Makefile.clangcl BUILDDIR=abuild32/ RCFL=-DEMBED_CHM SUBSYSVER=,5.01 $(Makeargs) all -j$(nproc)
  223 in putty/windows with clangcl_a64 do Platform=arm64 make -f Makefile.clangcl BUILDDIR=abuild64/ RCFL=-DEMBED_CHM $(Makeargs) all -j$(nproc)
  224 
  225 # Build the 'old' binaries, which should still run on all 32-bit
  226 # versions of Windows back to Win95 (but not Win32s). These link
  227 # against Visual Studio 2003 libraries (the more modern versions
  228 # assume excessively modern Win32 API calls to be available), specify
  229 # a subsystem version of 4.0, and compile with /arch:IA32 to prevent
  230 # the use of modern CPU features like MMX which older machines also
  231 # might not have.
  232 #
  233 # There's no installer to go with these, so they must also embed the
  234 # help file.
  235 in putty/windows with clangcl32_2003 do Platform=x86 make -f Makefile.clangcl BUILDDIR=buildold/ RCFL=-DEMBED_CHM $(Makeargs) CCTARGET=i386-pc-windows-msvc13.0.0 SUBSYSVER=,4.0 EXTRA_windows=wincrt0.obj EXTRA_console=crt0.obj EXTRA_libs=libcpmt.lib XFLAGS=/arch:IA32 all -j$(nproc)
  236 
  237 # Remove test programs again.
  238 in putty/windows do make -f Makefile.clangcl BUILDDIR=build32/ cleantestprogs
  239 in putty/windows do make -f Makefile.clangcl BUILDDIR=build64/ cleantestprogs
  240 in putty/windows do make -f Makefile.clangcl BUILDDIR=abuild32/ cleantestprogs
  241 in putty/windows do make -f Makefile.clangcl BUILDDIR=abuild64/ cleantestprogs
  242 in putty/windows do make -f Makefile.clangcl BUILDDIR=buildold/ cleantestprogs
  243 
  244 # Code-sign the standalone versions of the binaries.
  245 ifneq "$(cross_winsigncode)" "" in putty/windows do $(cross_winsigncode) -N -i https://www.chiark.greenend.org.uk/~sgtatham/putty/ build*/*.exe abuild*/*.exe
  246 
  247 in putty/doc do make mostlyclean
  248 in putty/doc do make $(Docmakever) -j$(nproc)
  249 in putty/windows/buildold do zip -k -j putty.zip `ls *.exe | grep -v puttytel` ../../doc/putty.chm
  250 in putty/windows/build32 do zip -k -j putty.zip `ls *.exe | grep -v puttytel` ../../doc/putty.chm
  251 in putty/windows/build64 do zip -k -j putty.zip `ls *.exe | grep -v puttytel` ../../doc/putty.chm
  252 in putty/windows/abuild32 do zip -k -j putty.zip `ls *.exe | grep -v puttytel` ../../doc/putty.chm
  253 in putty/windows/abuild64 do zip -k -j putty.zip `ls *.exe | grep -v puttytel` ../../doc/putty.chm
  254 in putty/doc do zip puttydoc.zip *.html
  255 
  256 # Deliver the actual PuTTY release directory into a subdir `putty'.
  257 deliver putty/windows/buildold/*.exe putty/w32old/$@
  258 deliver putty/windows/buildold/putty.zip putty/w32old/$@
  259 deliver putty/windows/build32/*.exe putty/w32/$@
  260 deliver putty/windows/build32/putty.zip putty/w32/$@
  261 deliver putty/windows/build64/*.exe putty/w64/$@
  262 deliver putty/windows/build64/putty.zip putty/w64/$@
  263 deliver putty/windows/installer32.msi putty/w32/$(Ifilename32).msi
  264 deliver putty/windows/installer64.msi putty/w64/$(Ifilename64).msi
  265 deliver putty/windows/installera32.msi putty/wa32/$(Ifilenamea32).msi
  266 deliver putty/windows/installera64.msi putty/wa64/$(Ifilenamea64).msi
  267 deliver putty/windows/abuild32/*.exe putty/wa32/$@
  268 deliver putty/windows/abuild32/putty.zip putty/wa32/$@
  269 deliver putty/windows/abuild64/*.exe putty/wa64/$@
  270 deliver putty/windows/abuild64/putty.zip putty/wa64/$@
  271 deliver putty/doc/puttydoc.zip putty/$@
  272 deliver putty/doc/putty.chm putty/$@
  273 deliver putty/doc/puttydoc.txt putty/$@
  274 deliver putty/doc/*.html putty/htmldoc/$@
  275 deliver putty/putty-src.zip putty/$@
  276 deliver putty/*.tar.gz putty/$@
  277 
  278 # Deliver the map files alongside the `proper' release deliverables.
  279 deliver putty/windows/buildold/*.map maps/w32old/$@
  280 deliver putty/windows/build32/*.map maps/w32/$@
  281 deliver putty/windows/build64/*.map maps/w64/$@
  282 deliver putty/windows/abuild32/*.map maps/wa32/$@
  283 deliver putty/windows/abuild64/*.map maps/wa64/$@
  284 
  285 # Deliver sign.sh, so that whoever has just built PuTTY (the
  286 # snapshot scripts or me, depending) can conveniently sign it with
  287 # whatever key they want.
  288 deliver putty/sign.sh $@
  289 
  290 # Create files of cryptographic checksums, which will be signed along
  291 # with the files they verify. We've provided MD5 checksums for a
  292 # while, but now MD5 is looking iffy, we're expanding our selection.
  293 #
  294 # Creating these files is most easily done in the destination
  295 # directory, where all the files we're delivering are already in their
  296 # final relative layout.
  297 in . do pwd > builddir
  298 read Builddir builddir
  299 in-dest putty do a=`\find * -type f -print`; for hash in md5 sha1 sha256 sha512; do ($${hash}sum $$a; echo; cat $(Builddir)/putty/$${hash}sums.installer) > $${hash}sums; done
  300 
  301 # And construct .htaccess files. One in the top-level directory,
  302 # setting the MIME types for Windows help files and providing an
  303 # appropriate link to the source archive:
  304 in-dest putty do echo "AddType application/octet-stream .chm" >> .htaccess
  305 in-dest putty do set -- putty*.tar.gz; for k in '' .gpg; do echo RedirectMatch temp '(.*/)'putty.tar.gz$$k\$$ '$$1'"$$1$$k" >> .htaccess; done
  306 # And one in each binary directory, providing links for the installers.
  307 in-dest putty do for params in "w32 putty-installer" "w64 putty-64bit-installer" "wa32 putty-arm32-installer" "wa64 putty-arm64-installer"; do (set -- $$params; subdir=$$1; installername=$$2; cd $$subdir && for ext in msi exe; do set -- putty*installer.$$ext; if test -f $$1; then for k in '' .gpg; do echo RedirectMatch temp '(.*/)'$${installername}.$$ext$$k\$$ '$$1'"$$1$$k" >> .htaccess; done; fi; done); done