~mbp/bzr/remove-logging

« back to all changes in this revision

Viewing changes to doc/developers/win32_build_setup.txt

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-11-20 13:58:49 UTC
  • mfrom: (4786.2.6 windows-setup)
  • Revision ID: pqm@pqm.ubuntu.com-20091120135849-rxmryotfq30r6q79
(jam) Add a developer doc describing dependencies for win32 builds

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
 
 
110
5) Get Pageant, not strictly necessary, but it is a pretty good ssh-agent for
 
111
   Windows, and paramiko knows how to use keys from Pageant.
 
112
 
 
113
   http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
 
114
 
 
115
   Note that you probably want to set the environment variable
 
116
   ``BZR_SSH=paramiko`` at this time. Otherwise it will try to use the
 
117
   ``ssh.exe`` that it finds on your PATH (as configured in step 3), and
 
118
   cygwin's openssh does *not* know how to access Pageant.
 
119
 
 
120
   I usually get the 'all-in-one' installer, but only because it is easier. You
 
121
   only really need ``pageant.exe`` and possibly ``puttygen.exe``.
 
122
   
 
123
   If you do this, you'll probably also want to install a shortcut to
 
124
   ``pageant.exe`` in Start / Programs / Startup so that it always starts when
 
125
   you log in (though you still have to manually add your ssh keys.)
 
126
 
 
127
   Note that on the Amazon EC2 machine, I'm having problems with temp files
 
128
   being created without the permission for the current user to actually read
 
129
   them. They seem to be owned by ``Administrator`` rather than by
 
130
   ``Administrators``.
 
131
   
 
132
6) Install bzr. Usually it is easiest to just get the latest all-in-one
 
133
   installer from https://launchpad.net/bzr/+download
 
134
 
 
135
7) Install INNOSetup from:
 
136
   http://www.jrsoftware.org/isdl.php
 
137
 
 
138
   After installing, you'll want to add ``C:\Program Files\Inno Setup 5`` to
 
139
   your PATH.
 
140
 
 
141
8) Fix distutils for the specific version of gcc. Distutils in python2.4.4 has
 
142
   a bug where it assumes version strings have only 3 digits. The fix is to
 
143
   just change one '?' in the regex into a '*'::
 
144
 
 
145
        --- version.py  2009-11-05 14:41:47.497212900 -0800
 
146
        +++ version.py  2009-11-05 14:39:57.684712900 -0800
 
147
        @@ -97,7 +97,7 @@
 
148
             in the distutils documentation.
 
149
             """
 
150
 
 
151
        -    version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
 
152
        +    version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))* ([ab](\d+))?$',
 
153
                                     re.VERBOSE)
 
154
 
 
155
 
 
156
9) If you want to build in the source tree, you need the zlib dll and
 
157
   associated libraries, put somewhere on your path. The buildout routines grab
 
158
   this directly and add it to the build path, but that doesn't work for
 
159
   ``setup.py``.
 
160
   http://www.zlib.net/zlib123-dll.zip
 
161
 
 
162
   I usually download and extract this to something like ``C:\local\`` so that
 
163
   I end up with a ``C:\local\lib`` and ``C:\local\include`` directory. I then
 
164
   modify the ``distutils.cfg`` file to tell the compiler where to find these
 
165
   headers and libraries::
 
166
 
 
167
      [build_ext]
 
168
      include-dirs = C:/local/include
 
169
      library-dirs = C:/local/lib
 
170
 
 
171
   Note that you'll probably want to put the ``zlib1.dll`` into your path. You
 
172
   can:
 
173
 
 
174
     1) Add ``C:\local`` to your PATH variable in
 
175
        "My Computer/Properties/Advanced/Environment Variables"
 
176
     2) More logically, move ``zlib1.dll`` to either 'lib' or 'bin'
 
177
        subdirectories and add that.
 
178
     3) Copy it to ``C:\Windows\``.
 
179
 
 
180
   I recommend 3, mostly because lots of apps will want to use zlib1.dll in the
 
181
   long run. (You may already have it.)
 
182
 
 
183
10) Install Visual Studio 2008 Professional
 
184
    http://www.microsoft.com/downloads/details.aspx?FamilyId=83C3A1EC-ED72-4A79-8961-25635DB0192B&displaylang=en
 
185
 
 
186
    This is a 3GB DVD iso image. You can mount it directly with Microsofts
 
187
    iso mounting utility:
 
188
    http://download.microsoft.com/download/7/b/6/7b6abd84-7841-4978-96f5-bd58df02efa2/winxpvirtualcdcontrolpanel_21.exe
 
189
 
 
190
    You need at least Windows XP (which introduced direct iso support, I
 
191
    believe.)
 
192
 
 
193
    Note that there is a Service Pack 1 for Visual Studio. The ISO can be
 
194
    downloaded here:
 
195
    http://www.microsoft.com/downloads/thankyou.aspx?familyId=27673c47-b3b5-4c67-bd99-84e525b5ce61&displayLang=en
 
196
 
 
197
    However, on EC2, there isn't enough room on C: to actually run the
 
198
    installer. You need approx 6GB of free disk space. And EC2 only gives your
 
199
    10GB and Windows itself takes up about 5GB. So we are currently running
 
200
    stock VS 2008 with no service packs. (Even installing VS 2008 to a
 
201
    different drive doesn't leave enough room on C: to run the upgrader.)
 
202
 
 
203
    When installing on EC2, it seems their 2003 Server comes with a Visual
 
204
    Studio key already supplied. There is also the possibility of using Visual
 
205
    Studio Express Edition, but it is currently unable to compile TortoiseBzr.
 
206
 
 
207
.. 
 
208
   vim: ft=rst tw=79 et