Source

thg-winbuild / README.txt

Full commit
TortoiseHg and Mercurial installer builder for Windows

Contents:

contrib/   - Bundled libraries and utilities external to (T)HG
misc/      - Miscellaneous files used to build packages

=== Mercurial Prerequisites ===

- Python 2.7.3

  http://www.python.org/
  C:\Python27 must be in your PATH

  You will need the x86 Python interpreter to generate x86 MSI packages
  and the x64 Python interpreter to generate x64 MSI packages.  You'll
  need to install the Python package pre-reqs for each interpreter.
 
- C++ Compiler

  Get the gratis "Microsoft Windows SDK for Windows 7 and .NET
  Framework 3.5 SP1" from microsoft.com.

  See the win32/shellext/README.txt file in the TortoiseHg source
  for details on installing this package.

  If you already have Visual Studio 2008, installing the SDK will
  confuse DISTUTILS when it tries to build Mercurial's C extensions.
  Simply comment out the line in setup.py that sets the
  DISTUTILS_USE_SDK environment variable, and distutils will use VC2008
  to build Mercurial and our build scripts will use SDK's compiler to
  build the THG shell extension.  These are supposedly the same
  compiler, so it should be ok.

  Following the advice in http://bugs.python.org/issue7511#msg124556
  might be needed for x64 builds ("copy VC\bin\vcvars64.bat into
  VC\bin\amd64\vcvarsamd64.bat")

- gettext

  We recommend the 'Setup program' from
  http://gnuwin32.sourceforge.net/packages/gettext.htm
  
- py2exe

  Get the latest version for your Python release
  http://sourceforge.net/projects/py2exe/

- Windows Installer XML

  Get the latest stable 3.0 package from
  http://wix.codeplex.com/releases/view/60102

- Docutils

  Building HTML man pages for Mercurial requires the rst2html.py
  script from docutils.  The easiest way to get docutils is to
  install setuptools (below), then:
  C:\Python27\Scripts\easy_install.exe docutils

=== Building TortoiseHg documentation ===

To build just the TortoiseHg docs, install the packages below then:

python setup.py --thg-doc

- setuptools (provides easy_install.exe)

  Get the latest version for your Python release
  http://pypi.python.org/pypi/setuptools
  We're using:
    setuptools-0.6c11.win32-py2.7

- sphinx, docutils, jinja2, pygments, etc

  (requires easy_install from setuptools)
  The sphinx package has dependencies for docutils, jinja, etc,
  so installing sphinx pulls in all the other prerequisites.

  easy_install sphinx

- MiKTeX (to build PDF docs)

  http://miktex.org/2.8/setup
  You can chose for it to automatically download packages when
  it needs them, else the first time it builds PDF docs it will
  require much user interaction.
  We're using:
    setup-2.8.3553

- HTML Help Workshop (to build CHM docs)

  This should come with the Windows SDK, but also available here:
  http://msdn.microsoft.com/en-us/library/ms669985%28VS.85%29.aspx

=== Building TortoiseHg Installer Packages ===

To build TortoiseHg MSI packages, you need the Mercurial prerequisites,
TortoiseHg documentation prerequisites, and these packages:

- PyQt 4.8 or later

  Riverbank Computing

- pywin32

  Get the latest version for your Python release
  http://sourceforge.net/projects/pywin32/
  pywin32-218.win32-py2.7.exe

- SVN

  TortoiseSVN is needed in order to complete comtypes installation. Get
  the lastest version from
  http://tortoisesvn.net/downloads.html

- comtypes (no longer optional)

  comtypes-0.6.2.win32.exe from
  http://sourceforge.net/projects/comtypes/files/

  For x64 Python, you must download the 0.6.2 zip file from sourceforge
  and then apply the one-line fix specified for this bug:

  http://sourceforge.net/tracker/?func=detail&aid=3036368&group_id=115265&atid=692940

  Then run \Python27-x64\python.exe setup.py install

  Do not use a newer version of comtypes because the tip currently
  implicitly requires numpy, which we do not want to ship.  The current
  easy_install package is thus broken.

- Subversion Python bindings (no longer optional)

  Download the svn_1.7.5_py27_xYY.zip file for your arch from
  https://bitbucket.org/tortoisehg/thg-winbuild/downloads/svn_1.7.5_py27_x86.zip
  https://bitbucket.org/tortoisehg/thg-winbuild/downloads/svn_1.7.5_py27_x64.zip
  
  extract the svn and libsvn folders under Python27*\lib\site-packages

== Build Steps ==

It's entirely automated.  Ensure C:\Python27 is in your path, then run:

python setup.py --help

To build x64 packages, you use:

C:\python27-x64\python.exe setup.py --help


== Example for preparing a working build machine from scratch ==

Below is a detailed journal of steps that worked for setting up a
TortoiseHg build machine from scratch.

   1)  Windows 7 x64 SP1 installed, logged in as <user>
   2a) Installed python-2.7.3.amd64.msi in C:\Python27-x64, added this dir to PATH
   2b) Installed python-2.7.3.msi in C:\Python27, deselected "Register Extensions"
       on feature selection during install to *not* have this Python as default
   3)  Installed "Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1"
   4)  Installed gettext-0.14.4
   5a) Installed py2exe-0.6.9.win64-py2.7.amd64.exe in C:\Python27-x64
   5b) Installed py2exe-0.6.9.win32-py2.7.exe in C:\Python27
   6a) Installed setuptools-0.6c11.win32-py2.7.exe in C:\Python27
   6b) Downloaded ez_setup.py as explained on http://pypi.python.org/pypi/setuptools
       and ran "C:\Python27-x64\python.exe ez_setup.py"
   7a) Ran "C:\Python27\Scripts\easy_install.exe docutils"
   7b) Ran "C:\Python27-x64\Scripts\easy_install.exe docutils"
   8a) Ran "C:\Python27\Scripts\easy_install.exe sphinx"
   8b) Ran "C:\Python27-x64\Scripts\easy_install.exe sphinx"
   9)  Installed "Basic MiKTeX 2.9" Installer, setting "Install missing packages
       on the fly" to "Yes"
  10a) Installed PyQt-Py2.7-x64-gpl-4.9.6-1.exe in C:\Python27-x64
  10b) Installed PyQt-Py2.7-x86-gpl-4.9.6-1.exe in C:\Python27
  11a) Installed pywin32-218.win-amd64-py2.7.exe in C:\Python27-x64
  11b) Installed pywin32-218.win32-py2.7.exe in C:\Python27
  12)  Installed Wix37.msi from http://wix.codeplex.com/releases/view/99514
  13)  Installed htmlhelp.exe from
       http://www.microsoft.com/download/en/details.aspx?id=21138
  14a) Installed comtypes-0.6.2.win32.exe
  14b) Installed TortoiseSVN with command line client tools selected.
  14c) Ran "C:\Python27-x64\Scripts\easy_install.exe comtypes"
  14d) Ran "C:\Python27\Scripts\easy_install.exe comtypes"
  15)  Downloaded svn_py27_x64.zip and svn_py27_x86.zip from
       https://bitbucket.org/tortoisehg/thg-winbuild/downloads and extracted the
       svn and libsvn folders under C:\Python*\lib\site-packages
  16)  Installed tortoisehg-2.1.2-hg-1.9.1-x64.msi, then logoff/logon
  17)  Created empty folder C:\Users\<user>\hgrepos, opened cmd.exe in that folder
  18)  Ran "hg clone https://bitbucket.org/tortoisehg/thg-build"
  19)  cd thg-build/winbuild
  20)  Ran "C:\Python27\python.exe setup.py --thg-dev" -> built a x86 msi
  21)  Ran "C:\Python27-x64\python.exe setup.py --thg-dev" -> built a x64 msi