Building PuTTY

So, you’d like to try building your own binary of PuTTY but don’t know much about compiling, applying patches or Makefiles? It’s actually quite easy, just follow this simple guide:

  1. Install a build environment. You could go for Microsoft Visual C++ 2008/2010 Express, but that would be against our open source beliefs ;) We will rather install GNU gcc which is part of Cygwin – a complete Linux-like environment for Windows.
  2. Go to Cygwin homepage, download and run setup.exe. Follow the wizard and choose one of the Cygwin mirrors near you. When it comes to selecting packages, make sure you include following ones:
    gcc make subversion patch

    These are the essential packages for our build. I would recommend a few other useful packages:

    mc mintty

    To select a particular package, switch to the Full view at the top right, type the package name into the search box and then click where it says “Skip” on the left on the line with the package.

  3. When the installation is finished, run Cygwin using the icon on your desktop
  4. Get the source. Check out the latest PuTTY svn source:
    $ cd /usr/src
    $ svn co svn:// putty-trunk
  5. Apply patches. Copy the patches to Cygwin /usr/src – which is usually C:\cygwin\usr\src (depending on your Cygwin installation directory):
    $ cd putty-trunk
    $ patch -p1 < ../putty-xyz_YYYY-MM-DD.patch

    Note: if you want to apply both of my patches, apply session list one first, then transparency. Some parts of the transparency patch will fail to apply, which is perfectly OK – these are the parts that have already been modified by the previous patch (and should stay like that).

  6. Create the Makefiles:
    $ ./
  7. Build. Change to windows directory and start the build:
    $ cd windows
    $ make -f Makefile.cyg

    Note: if you have a multi-core processor, you can speed up the compile process by running multiple jobs at once:

    $ make -j3 -f Makefile.cyg

    (Usually, the parameter after -j is recommended to be <num of cpu cores>+1)

  8. If all goes well, you should find your new PuTTY binary files in putty-trunk/windows. If it doesn’t – well, Google is always your friend. Or you could drop me a line.

Leave a Reply