Differences between revisions 2 and 3
Revision 2 as of 2008-02-12 19:56:19
Size: 3476
Editor: abuehl
Comment:
Revision 3 as of 2008-02-12 20:05:49
Size: 3469
Editor: abuehl
Comment:
Deletions are marked like this. Additions are marked like this.
Line 40: Line 40:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\Python25\include -IC:\Python25\PC /Tcmercurial/m
patch.c /Fobuild\temp.win32-2.5\Release\mercurial/mpatch.obj
mpatch.c
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python25\libs /LIBPATH:C:\Python25\PCBuild /EX
PORT:initmpatch build\temp.win32-2.5\Release\mercurial/mpatch.obj /OUT:build\lib.win32-2.5\mercurial\mpatch.pyd /IMPLIB:build\temp.win32-2.5\Release\mercur
ial\mpatch.lib
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\Python25\include -IC:\Python25\PC /Tcmercurial/mpatch.c /Fobuild\temp.win32-2.5\Release\mercurial/mpatch.obj mpatch.c
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python25\libs /LIBPATH:C:\Python25\PCBuild /EXPORT:initmpatch build\temp.win32-2.5\Release\mercurial/mpatch.obj /OUT:build\lib.win32-2.5\mercurial\mpatch.pyd /IMPLIB:build\temp.win32-2.5\Release\mercurial\mpatch.lib

How to build Mercurial on Windows

This how-to is intended to give some hints about how to build Mercurial on Windows from the Mercurial sources. If you don't intend to fiddle with the sources, then simply use a pre-built binary package for Windows (for example [:TortoiseHg], or http://mercurial.berkwood.com/, see [:BinaryPackages]).

Mercurial is mostly programmed in Python. The Python sources don't need a compilation step, but a few Mercurial modules are programmed in C. Those must be compiled with a C-compiler.

The steps below worked on a Windows XP SP2, that had a Microsoft Visual C++ installed.

Install Python 2.5, available from http://www.python.org/download/windows/

Default install path is C:\Python25. Best leave it at that.

Get the Mercurial sources (assuming you already have a working "hg" installed, see [:TortoiseHg])

>cd C:\tmp\repos
>hg clone http://selenic.com/repo/hg mercurial

See [:DeveloperRepos] for other common repositories (the most other interesting one is the [:CrewRepository]).

Build it:

>cd mercurial
>python setup.py build
running build
running build_py
creating build
creating build\lib.win32-2.5
creating build\lib.win32-2.5\mercurial
copying mercurial\ancestor.py -> build\lib.win32-2.5\mercurial
copying mercurial\archival.py -> build\lib.win32-2.5\mercurial
copying mercurial\bundlerepo.py -> build\lib.win32-2.5\mercurial
...
building 'mercurial.mpatch' extension
creating build\temp.win32-2.5
creating build\temp.win32-2.5\Release
creating build\temp.win32-2.5\Release\mercurial
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\Python25\include -IC:\Python25\PC /Tcmercurial/mpatch.c /Fobuild\temp.win32-2.5\Release\mercurial/mpatch.obj mpatch.c
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python25\libs /LIBPATH:C:\Python25\PCBuild /EXPORT:initmpatch build\temp.win32-2.5\Release\mercurial/mpatch.obj /OUT:build\lib.win32-2.5\mercurial\mpatch.pyd /IMPLIB:build\temp.win32-2.5\Release\mercurial\mpatch.lib
   Creating library build\temp.win32-2.5\Release\mercurial\mpatch.lib and object build\temp.win32-2.5\Release\mercurial\mpatch.exp
...
running build_scripts
creating build\scripts-2.5
copying and adjusting hg -> build\scripts-2.5

In the above example, Python found and used an installed Microsoft C compiler.

Install it:

> python setup.py install
running install
running build
running build_py
running build_ext
running build_scripts
running install_lib
copying build\lib.win32-2.5\hgext\acl.py -> C:\Python25\Lib\site-packages\hgext
...
copying build\lib.win32-2.5\mercurial\ancestor.py -> C:\Python25\Lib\site-packages\mercurial
...
byte-compiling C:\Python25\Lib\site-packages\hgext\acl.py to acl.pyc
...
byte-compiling C:\Python25\Lib\site-packages\mercurial\ancestor.py to ancestor.pyc
...
running install_scripts
copying build\scripts-2.5\hg -> C:\Python25\Scripts
running install_data
creating C:\Python25\Lib\site-packages\mercurial\templates
copying templates\changelog.tmpl -> C:\Python25\Lib\site-packages\mercurial\templates
copying templates\changelogentry.tmpl -> C:\Python25\Lib\site-packages\mercurial\templates
...
running install_egg_info
Writing C:\Python25\Lib\site-packages\mercurial-fb259a3572e9-py2.5.egg-info


CategoryContributing CategoryWindows

BuildingOnWindows (last edited 2017-11-29 02:14:28 by AntonShestakov)