WiX Installer
=============

The files in this directory are used to produce an MSI installer using
the WiX Toolset (http://wixtoolset.org/).

Requirements
============

Building the WiX installer requires a Windows machine.

The following system dependencies must be installed:

* Python 3.7+ (to run the ``packaging.py`` script)
* Visual Studio 2017 or later Build Tools
* HTML Help Workshop 1.3 or later
* Mercurial on ``%PATH%``

The simplest way to install the requirements is to run the
``contrib/install-windows-dependencies.ps1`` [1]_ script in the Mercurial
repository from an elevated PowerShell.  This will also allow Mercurial
itself to be built from the Mercurial repository.  The HTML Help Workshop [2]_
package needs to be installed separately.

Building
========

The ``packaging.py`` script automates the process of producing an MSI
installer. It manages fetching and configuring non-system dependencies
(such as gettext, and various Python packages).  It can be run from a
basic cmd.exe Window (i.e. activating the MSBuildTools environment is
not required).

From the prompt, change to the TortoiseHg source directory. e.g.
``cd c:\src\thg``.

Next, invoke ``packaging.py`` to stage Mercurial and other dependencies.  The
version of Mercurial and the Evolve extension can be changed with this command.
The version of TortoiseHg built is whatever is currently checked out, including
uncommitted changes::

   $ py -3 contrib\packaging\packaging.py \
       stage --hg-version 6.1.2 --evolve-version 10.5.1

Finally, invoke ``packaging.py`` to produce an MSI installer.::

   $ py -3 contrib\packaging\packaging.py wix

If everything runs as intended, dependencies will be fetched and
configured into the ``build`` sub-directory, TortoiseHg will be built,
and an installer placed in the ``dist`` sub-directory. The final line
of output should print the name of the generated installer.

Additional options may be configured. Run ``packaging.py wix --help``
to see a list of program flags.

.. [1] https://www.mercurial-scm.org/repo/hg/raw-file/6.1.2/contrib/install-windows-dependencies.ps1
.. [2] https://download.microsoft.com/download/OfficeXPProf/Install/4.71.1015.0/W98NT42KMe/EN-US/HTMLHELP.EXE
