~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/win32_build_setup.txt

  • Committer: John Arbash Meinel
  • Date: 2010-02-17 17:11:16 UTC
  • mfrom: (4797.2.17 2.1)
  • mto: (4797.2.18 2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: john@arbash-meinel.com-20100217171116-h7t9223ystbnx5h8
merge bzr.2.1 in preparation for NEWS entry.

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