TortoiseHg and Mercurial installer builder for Windows
The most up to date version of this information can be found on this repository's wiki: http://bitbucket.org/tortoisehg/thg-winbuild/wiki/Home
asciidoc - for Mercurial man pages, up to release 1.3 hg-main - Mercurial repository hg-stable - Mercurial stable repository tortoisehg - TortoiseHg repository hgfold - case folding conflict detection and resolution extension
contrib/ - Bundled libraries and utilities external to (T)HG misc/ - Miscellaneous files used to build packages gtk-dist/ - directory where you copy GTK+ redistribution files
=== Prerequisites ===
GTK+ for Windows
Get latest package requirements from: http://bitbucket.org/tortoisehg/stable/wiki/developers/installer
Read gtk-distREADME.txt for instruction on how to copy the redistribution files into gtk-dist.
If you are only building Mercurial packages, you only need to find msgfmt.exe somewhere and place it in your path.
Python 2.5 (0.6 and 0.7 were built with 2.5.1)
C:PythonNN and C:PythonNNScripts must be in your path.
iniparse (TortoiseHg only, not used by Mercurial)
Download iniparse-0.3.1.tar.gz and install. http://code.google.com/p/iniparse/ See instructions below for using easy_install to install iniparse
See instructions below for using easy_install to install pygments
MinGW gcc installed and in your path
The MinGW compiler must be installed, as the build script uses it to build Mercurial.
Inno Setup 5 installed
Install ispack-5.3.4.exe, which includes Inno Setup Preprocessor, which is required for building packages with this script.
=== Mercurial Man Pages ===
On the 1.3 stable branch, asciidoc is used to build HTML man pages. On the 1.4 unstable branch, rst2html (from docutils) is used to build HTML man pages.
rst2html is a recent addition to docutils and has not yet been released as a packaged tool. If you install docutils from my mirror:
rst2html.py will be installed in your PythonNNScripts folder.
=== TortoiseHg Doc Prerequisites ===
To build documentation, you need sphinx and it's ken. These commands should do the trick.
> hg clone http://bitbucket.org/birkenfeld/sphinx/ > cd sphinx > python setup.py install
This will install any missing sphinx prereqs setuptools, docutils 0.5, jinja2, and pygments. Once this is done, you can use easy_install to install iniparse. The always-unzip argument is important, because py2exe cannot read into egg files.
> easy_install --always-unzip iniparse
To build PDFs you need miktex installed: http://miktex.org/2.7/setup After install, you must place %ProgramFiles%MikTex NNNmiktexbin in your path.
The build scripts assume sphinx, miktex, and HTML Help compiler are all installed. You will have to modify the iss file of TortoiseHg if you do not want to build the documentation. The details of this are left as an excercise to the reader.
== Compiling shell extensions ==
If you do not have an x86 windows machine or you have a version of visual Ctudion other than VC8 (2005), you will need to edit misc/build_extensions.bat anc change the vcvarsall variable to point at your vcvarsall.bat.
Support for x64 compiler targets is not installed by default by Visual Studio, even on x64 machines, so may have to re-run the Visual Studio setup tool to add support for x64 targets.
If you do not have Visual Studio at all, you should be able to compile the shell extensions with MinGW. The Makefile in the win32/shellext directory of the TortoiseHg repository can build the 32-bit shellext. I leave 64-bit compilation as an excercise for the reader. Copy the compiled DLLs into the misc folder at the root of thg-winbuild, named as ThgShellx86.dll and ThgShellx64.dll.
Once those two files are present in the misc/ directory, no matter how they were compiled, the setup script will not overwrite them. Pre- built extensions are available under misc/prebuilt-extensions. You have the option of copying those DLLs into misc/. The prebuilt extensions will be statically linked.
== DLL dependencies ==
Your python DLL will have C runtime library dependencies. To be safe you should open your pythonXX.dll in the "dependency walker" tool to be absolutely sure you know which DLL it needs, then copy that DLL into the contrib folder in the root of thg-winbuild.
Also be aware of dependencies reported by py2exe. At least once you should run 'python setup.py py2exe -b2' manually inside build-thg and look at the library depdendencies. You'll want to copy into contrib/ any DLL whose name begins with "msvcr".
== Build Steps ==
It's mostly automated. For help, use
python setup.py --help
If you are doing automated builds, it is recommend you use the -fF flags to force the scripts to re-clone the build targets each time. If you are building by hand, you should use the -fF flags or --clean anytime you switch between stable and unstable targets, or just to get a clean start.
Note that setup.py assumes that .py files are registered with Windows so that they can execute directly. That is, entering
(without "python") in the Windows command prompt should start the setup script (see the section "Registering .py files with Windows" for how to fix this if it doesn't).
== Default Paths ==
Subrepo clones do not setup default paths in .hg/hgrc files like normal clones do. As a result, you will not be be able to pull or push from the subrepos yourself until you create .hg/hgrc files in each subrepo.
As a convenience, the setup.py script has a --pull command that pulls the TortoiseHg repository and hg-stable. Any command that builds a nightly or unstable package will also pull the source repositories.
== Registering .py files with Windows ==
In Explorer go to Tools->Folder Options...->File Types. Scroll to the registered file type of PY and then click on the Change... button to choose the program to associate (e.g. "C:Python25python.exe"). Including ".py" in the PATHEXT environment variable might be needed in addition, so that the command prompt will attempt to execute .py files, using the registry associations to find the executable.