~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/win32_build_setup.txt

(jameinel) Allow 'bzr serve' to interpret SIGHUP as a graceful shutdown.
 (bug #795025) (John A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
===============================
 
2
Setting Up A Windows Build Host
 
3
===============================
 
4
 
 
5
This document describes the steps taken to set up a Windows build host. It is
 
6
intended to be step-by-step instructions of what packages need to be installed,
 
7
where they can be gotten from, and how they are configured.
 
8
 
 
9
 
 
10
Baseline
 
11
========
 
12
 
 
13
This was written as a step-by-step as I set up the Amazon EC2 'desolation'
 
14
instance. This was based on an Amazon Windows 2003 instance. Also note that for
 
15
Amazon EC2, all programs were installed into the "C:" drive, as the "D:" drive
 
16
is essentially ``/tmp`` and is not preserved between launched instances.
 
17
 
 
18
 
 
19
Install Packages
 
20
================
 
21
 
 
22
1) Download cygwin's setup.exe from http://www.cygwin.com
 
23
   At present the current version is 1.5.25-15. This is used primarily to
 
24
   install the build scripts and gcc-mingw. Note that we explicitly *don't*
 
25
   install cygwin's python or bzr package. As we are only interested in
 
26
   running the native version of bzr. For information on running the cygwin
 
27
   port of bzr, look elsewhere.
 
28
 
 
29
   Probably not all of these packages are necessary, but they make life easier.
 
30
 
 
31
   a) gcc-mingw32
 
32
   b) make
 
33
   c) openssh
 
34
   d) rsync
 
35
   e) vim
 
36
   f) wget
 
37
   g) zip
 
38
   h) unzip
 
39
   i) patch
 
40
   j) gettext-devel # brings 'msgfmt'
 
41
 
 
42
 
 
43
2) Download the supported versions of python from http://www.python.org
 
44
 
 
45
   a) python 2.6.4
 
46
   b) python 2.5.4 http://www.python.org/ftp/python/2.5.4/python-2.5.4.msi
 
47
   c) python 2.4.4 (there is no Windows installer for 2.4.5 or 2.4.6)
 
48
      http://www.python.org/ftp/python/2.4.4/python-2.4.4.msi
 
49
 
 
50
   Note that for Amazon EC2, all of these were installed int
 
51
 
 
52
3) Configure 'distutils' for the compiler that you will be using. For python
 
53
   2.4 and 2.5 we use gcc-mingw32, for 2.6 we use Visual Studio 2008.
 
54
 
 
55
   Edit ``D:\Python25\Lib\disutils\distutils.cfg`` (you have to create the
 
56
   file). You want to add a section like::
 
57
 
 
58
     [build]
 
59
     compiler = mingw32
 
60
 
 
61
   This also requires 'fixing' the cygwin gcc installation so that distutils
 
62
   can find it. Specifically, it knows to look for ``gcc.exe`` however, the
 
63
   latest versions of cygwin start using "alternatives" and making ``gcc`` just
 
64
   a symlink.
 
65
 
 
66
   You also need to add ``C:\cygwin\bin`` and ``C:\cygwin\lib`` into your
 
67
   environment path. This is generally done with::
 
68
 
 
69
        Right Click My Computer / Properties / Advanced / Environment Variables
 
70
        System Variables / Select 'PATH' / Edit
 
71
 
 
72
4) Download important python libraries. At the moment, the official Windows
 
73
   all-in-one installer is built using python 2.5. We will likely soon switch
 
74
   to python 2.6.
 
75
 
 
76
   a) http://pypi.python.org/pypi/setuptools
 
77
 
 
78
      Installing this first should make it easier to install some of the other
 
79
      tools. To install something using easy install, it is generally best to
 
80
      open up a ``cmd.exe`` shell (*not* a cygwin shell) and do::
 
81
 
 
82
        cd C:\Python25
 
83
        python.exe Scripts\easy_install-script.py -Z -O1 PACKAGE
 
84
 
 
85
      The '-Z' tells it to install as a regular directory. This generally works
 
86
      better with py2exe.
 
87
 
 
88
   b) pywin32 http://sourceforge.net/projects/pywin32/files/
 
89
   c) easy_install paramiko
 
90
      This will also bring in PyCrypto and compile it, so it is important to
 
91
      have configured step (3) correctly.
 
92
   d) easy_install Pyrex    (or Cython)
 
93
      Note, you should probably install pyrex for all versions of python. All
 
94
      of them need to run 'setup.py bdist_wininst' and so it is good to have it
 
95
      build automatically, rather than setting up an explicit build order based
 
96
      on which one has pyrex.
 
97
   e) easy_install cogapp
 
98
   f) install py2exe (easy_install failed)
 
99
      http://sourceforge.net/projects/py2exe/files/
 
100
   g) easy_install docutils
 
101
   h) Install PyQt
 
102
      http://www.riverbankcomputing.co.uk/software/pyqt/download
 
103
 
 
104
      Currently they only seem to offer PyQt 4.4.3 for python 2.5 and PyQt
 
105
      4.6.1 for python 2.6. They generally don't make it easy to install old
 
106
      versions of PyQt.
 
107
   i) Install pyreadline
 
108
      https://launchpad.net/pyreadline/+download
 
109
   j) easy_install pygments
 
110
   k) Patch pycrypto, so that it supports older Windows installs. (see bugs
 
111
      #248522, #272791, #497733). The direct link to the patch is:
 
112
      http://launchpadlibrarian.net/16133025/win32_clock.patch
 
113
      This may not end up necessary w/ pycrypto 2.1, especially if paramiko can
 
114
      be taught to use the new functionality (avoiding the warning).
 
115
   l) easy_install testtools
 
116
 
 
117
5) Get Pageant, not strictly necessary, but it is a pretty good ssh-agent for
 
118
   Windows, and paramiko knows how to use keys from Pageant.
 
119
 
 
120
   http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
 
121
 
 
122
   Note that you probably want to set the environment variable
 
123
   ``BZR_SSH=paramiko`` at this time. Otherwise it will try to use the
 
124
   ``ssh.exe`` that it finds on your PATH (as configured in step 3), and
 
125
   cygwin's openssh does *not* know how to access Pageant.
 
126
 
 
127
   I usually get the 'all-in-one' installer, but only because it is easier. You
 
128
   only really need ``pageant.exe`` and possibly ``puttygen.exe``.
 
129
 
 
130
   If you do this, you'll probably also want to install a shortcut to
 
131
   ``pageant.exe`` in Start / Programs / Startup so that it always starts when
 
132
   you log in (though you still have to manually add your SSH keys.)
 
133
 
 
134
   Note that on the Amazon EC2 machine, I'm having problems with temp files
 
135
   being created without the permission for the current user to actually read
 
136
   them. They seem to be owned by ``Administrator`` rather than by
 
137
   ``Administrators``.
 
138
 
 
139
6) Install bzr. Usually it is easiest to just get the latest all-in-one
 
140
   installer from https://launchpad.net/bzr/+download
 
141
 
 
142
7) Install INNOSetup from:
 
143
   http://www.jrsoftware.org/isdl.php
 
144
 
 
145
   After installing, you'll want to add ``C:\Program Files\Inno Setup 5`` to
 
146
   your PATH.
 
147
 
 
148
8) Fix distutils for the specific version of gcc. Distutils in python2.4.4 has
 
149
   a bug where it assumes version strings have only 3 digits. The fix is to
 
150
   just change one '?' in the regex into a '*'::
 
151
 
 
152
        --- version.py  2009-11-05 14:41:47.497212900 -0800
 
153
        +++ version.py  2009-11-05 14:39:57.684712900 -0800
 
154
        @@ -97,7 +97,7 @@
 
155
             in the distutils documentation.
 
156
             """
 
157
 
 
158
        -    version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
 
159
        +    version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))* ([ab](\d+))?$',
 
160
                                     re.VERBOSE)
 
161
 
 
162
 
 
163
9) If you want to build in the source tree, you need the zlib dll and
 
164
   associated libraries, put somewhere on your path. The buildout routines grab
 
165
   this directly and add it to the build path, but that doesn't work for
 
166
   ``setup.py``.
 
167
   http://www.zlib.net/zlib123-dll.zip
 
168
 
 
169
   I usually download and extract this to something like ``C:\local\`` so that
 
170
   I end up with a ``C:\local\lib`` and ``C:\local\include`` directory. I then
 
171
   modify the ``distutils.cfg`` file to tell the compiler where to find these
 
172
   headers and libraries::
 
173
 
 
174
      [build_ext]
 
175
      include-dirs = C:/local/include
 
176
      library-dirs = C:/local/lib
 
177
 
 
178
   Note that you'll probably want to put the ``zlib1.dll`` into your path. You
 
179
   can:
 
180
 
 
181
     1) Add ``C:\local`` to your PATH variable in
 
182
        "My Computer/Properties/Advanced/Environment Variables"
 
183
     2) More logically, move ``zlib1.dll`` to either 'lib' or 'bin'
 
184
        subdirectories and add that.
 
185
     3) Copy it to ``C:\Windows\``.
 
186
 
 
187
   I recommend 3, mostly because lots of apps will want to use zlib1.dll in the
 
188
   long run. (You may already have it.)
 
189
 
 
190
10) Install Visual Studio 2008 Professional
 
191
    http://www.microsoft.com/downloads/details.aspx?FamilyId=83C3A1EC-ED72-4A79-8961-25635DB0192B&displaylang=en
 
192
 
 
193
    This is a 3GB DVD iso image. You can mount it directly with Microsofts
 
194
    iso mounting utility:
 
195
    http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe
 
196
 
 
197
    You need at least Windows XP (which introduced direct iso support, I
 
198
    believe.)
 
199
 
 
200
    Note that there is a Service Pack 1 for Visual Studio. The ISO can be
 
201
    downloaded here:
 
202
    http://www.microsoft.com/downloads/thankyou.aspx?familyId=27673c47-b3b5-4c67-bd99-84e525b5ce61&displayLang=en
 
203
 
 
204
    However, on EC2, there isn't enough room on C: to actually run the
 
205
    installer. You need approx 6GB of free disk space. And EC2 only gives your
 
206
    10GB and Windows itself takes up about 5GB. So we are currently running
 
207
    stock VS 2008 with no service packs. (Even installing VS 2008 to a
 
208
    different drive doesn't leave enough room on C: to run the upgrader.)
 
209
 
 
210
    When installing on EC2, it seems their 2003 Server comes with a Visual
 
211
    Studio key already supplied. There is also the possibility of using Visual
 
212
    Studio Express Edition, but it is currently unable to compile TortoiseBzr.
 
213
 
 
214
..
 
215
   vim: ft=rst tw=79 et