~myers-1/pyopenssl/npn

« back to all changes in this revision

Viewing changes to INSTALL

  • Committer: Jean-Paul Calderone
  • Date: 2010-01-25 22:55:30 UTC
  • mfrom: (126 trunk)
  • mto: This revision was merged to the branch mainline in revision 129.
  • Revision ID: exarkun@divmod.com-20100125225530-5e9nsb6bzoesoz42
merge trunk and resolve simple conflict

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
-- Building the Module on a Windows System --
40
40
 
41
 
pyOpenSSL is known to build with mingw32 for Python 2.3 through Python 2.5. 
 
41
First you should get OpenSSL linked with the same runtime library that Python
 
42
uses.  If you are using Python 2.6 you can use the installer at:
 
43
 
 
44
  http://www.slproweb.com/products/Win32OpenSSL.html
 
45
 
 
46
The binaries in the installer are built with Visual Studio 2008 at the
 
47
time of this writing, which is the same compiler used for building the
 
48
official Python 2.6 installers.
 
49
 
 
50
If you want to build pyOpenSSL for an older Python version, it is preferred
 
51
to build OpenSSL yourself, either with the Visual Studio 2003 compiler or
 
52
with the MinGW compiler.  This way you avoid all potential incompatibilities
 
53
between different versions of runtime library (msvcrt.dll).  To build
 
54
OpenSSL follow the instructions in its source distribution and make sure
 
55
that you build a shared library, not a static one.  pyOpenSSL fails some of
 
56
its tests when linked with the static OpenSSL libraries.  Use the same
 
57
compiler for OpenSSL that you will use for pyOpenSSL later.  Make sure that
 
58
OpenSSL is properly installed before continuing.  To install OpenSSL when
 
59
building with MinGW, use the folowing script:
 
60
 
 
61
set OPENSSL_INSTALL_DIR=%1
 
62
mkdir %OPENSSL_INSTALL_DIR%
 
63
mkdir %OPENSSL_INSTALL_DIR%\bin
 
64
mkdir %OPENSSL_INSTALL_DIR%\include
 
65
mkdir %OPENSSL_INSTALL_DIR%\include\openssl
 
66
mkdir %OPENSSL_INSTALL_DIR%\lib
 
67
copy /b .\*.dll            %OPENSSL_INSTALL_DIR%\bin
 
68
copy /b .\out\openssl.exe  %OPENSSL_INSTALL_DIR%\bin
 
69
copy /b .\outinc\openssl\* %OPENSSL_INSTALL_DIR%\include\openssl
 
70
copy /b .\out\*.a          %OPENSSL_INSTALL_DIR%\lib
 
71
 
 
72
Ensure that OpenSSL's openssl.exe executable can be found on PATH before
 
73
running pyOpenSSL's setup script.  The setup script finds OpenSSL's include
 
74
dir and lib dir based on the location of openssl.exe, and the test suite
 
75
requires openssl.exe for output comparison.  Alternatively, you can specify
 
76
the --with-openssl option to setup.py's build_ext command with the path to
 
77
the OpenSSL installation dir:
 
78
 
 
79
  > python setup.py build_ext --with-openssl=C:\path\to\openssl build
 
80
 
 
81
pyOpenSSL is known to build with mingw32 for Python 2.3 through Python 2.5.
 
82
Before using the mingw32 compiler for Python 2.3, you will have to create
 
83
a Python library that MinGW understands. Find and download the pexports
 
84
program, put it and MinGW's bin directory on path, then run from Python's
 
85
install dir:
 
86
 
 
87
> pexports python23.dll > libs\python23.def
 
88
> dlltool --dllname python23.dll --def libs\python23.def \
 
89
          --output-lib libs\libpython23.a
 
90
 
 
91
For Python 2.4 and 2.5, no special preparation is needed, just make sure that
 
92
MinGW's gcc is on PATH.  You can specify that mingw32 be used by passing
 
93
the --compiler argument to build_ext:
 
94
 
 
95
  C:\pyOpenSSL-X.Y> setup.py build_ext -c mingw32 bdist_msi
 
96
 
 
97
The bdist_msi command will build an MSI installer.  It can be substituted
 
98
with another bdist command if another kind of installer is desired or with
 
99
the install command if you want to install directly.
 
100
 
 
101
For Python 2.4 and 2.5 you can use Visual Studio 2003 in addition to MinGW.
42
102
For Python 2.6, the official Windows installer of which is built with
43
103
Microsoft Visual Studio 2008 (version 9.0), Microsoft Visual Studio 2008
44
 
(version 9.0) is required.  You can specify that mingw32 be used by passing
45
 
the --compiler argument to build_ext.  You will also need to specify the
46
 
location of the OpenSSL headers and libraries:
47
 
 
48
 
  C:\pyOpenSSL-X.Y> setup.py build_ext -c mingw32 -I C:\OpenSSL\include ^
49
 
                      -L C:\OpenSSL bdist_msi
50
 
 
51
 
The correct header and library paths depend on how you have OpenSSL
52
 
installed.  The above paths are correct for the default installation of
53
 
(<http://www.slproweb.com/products/Win32OpenSSL.html>).
54
 
 
55
 
The bdist_msi command will build an MSI installer.  It can be substituted
56
 
with another bdist command if another kind of installer is desired.
57
 
 
58
 
To build with MSVC instead, omit the -c option and pass a slightly different
59
 
library directory:
60
 
 
61
 
  C:\pyOpenSSL-X.Y> setup.py build_ext -I C:\OpenSSL\include ^
62
 
                      -L C:\OpenSSL\lib bdist_msi
 
104
(version 9.0) is required.
 
105
 
 
106
To build with MSVC, just omit the compiler specific option:
 
107
 
 
108
  C:\pyOpenSSL-X.Y> setup.py bdist_msi
63
109
 
64
110
The resulting binary distribution will be placed in the dist directory. To
65
 
install it, dDepending on what kind of distribution you create, run it,
 
111
install it, depending on what kind of distribution you create, run it,
66
112
unzip it, or copy it to Python installation's site-packages.
67
113
 
68
114
And similarily, you can do
72
118
to get more information.
73
119
 
74
120
Big thanks to Itamar Shtull-Trauring, Oleg Orlov, Zooko O'Whielacronx, Chris
75
 
Galvan, and #python and #distutils on FreeNode for their help with Windows
76
 
build instructions.
 
121
Galvan, Žiga Seilnacht, and #python and #distutils on FreeNode for their
 
122
help with Windows build instructions and to Michael Schneider for providing
 
123
Windows build hosts.
77
124
 
78
125
-- Documentation --
79
126