blob: feaeebf1c195f9f90776875e8e8d1fdfaf21f6fb [file] [log] [blame]
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05001
2INSTALLATION INSTRUCTIONS FOR pyOpenSSL
3------------------------------------------------------------------------------
4
5I have tested this on Debian Linux systems (woody and sid), Solaris 2.6 and
62.7. Others have successfully compiled it on Windows and NT.
7
8
9-- Building the Module on a Unix System --
10
11pyOpenSSL uses distutils, so there really shouldn't be any problems. To build
12the library:
13
Jean-Paul Calderonebaba5692009-07-21 12:08:47 -040014 $ python setup.py build
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050015
16If your OpenSSL header files aren't in /usr/include, you may need to supply
17the -I flag to let the setup script know where to look. The same goes for the
18libraries of course, use the -L flag. Note that build won't accept these
19flags, so you have to run first build_ext and then build! Example:
20
Jean-Paul Calderonebaba5692009-07-21 12:08:47 -040021 $ python setup.py build_ext -I/usr/local/ssl/include -L/usr/local/ssl/lib
22 $ python setup.py build
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050023
24Now you should have a directory called OpenSSL that contains e.g. SSL.so and
25__init__.py somewhere in the build dicrectory, so just:
26
Jean-Paul Calderonebaba5692009-07-21 12:08:47 -040027 $ python setup.py install
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050028
29If you, for some arcane reason, don't want the module to appear in the
30site-packages directory, use the --prefix option.
31
32You can, of course, do
33
Jean-Paul Calderonebaba5692009-07-21 12:08:47 -040034 $ python setup.py --help
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050035
36to find out more about how to use the script.
37
38
39-- Building the Module on a Windows System --
40
Jean-Paul Calderonebcd45452009-11-11 10:10:57 -050041First you should get OpenSSL linked with the same runtime library that Python
42uses. If you are using Python 2.6 you can use the installer at:
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050043
Jean-Paul Calderonebcd45452009-11-11 10:10:57 -050044 http://www.slproweb.com/products/Win32OpenSSL.html
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050045
Jean-Paul Calderonebcd45452009-11-11 10:10:57 -050046The binaries in the installer are built with Visual Studio 2008 at the
47time of this writing, which is the same compiler used for building the
48official Python 2.6 installers.
49
50If you want to build PyOpenSSL for an older Python version, it is preferred
51to build OpenSSL yourself, either with the Visual Studio 2003 compiler or
52with the MinGW compiler. This way you avoid all potential incompatibilities
53between different versions of runtime library (msvcrt.dll). To build OpenSSL
54folow the instructions in its source distribution and make sure that you build
55a shared library, not a static one. PyOpenSSL fails some of its tests when
56linked with the static OpenSSL libraries. Use the same compiler for OpenSSL
57that you will use for PyOpenSSL later. Make sure that OpenSSL is properly
58installed before continuing. To install OpenSSL when building with MinGW, use
59the folowing script:
60
61set OPENSSL_INSTALL_DIR=%1
62mkdir %OPENSSL_INSTALL_DIR%
63mkdir %OPENSSL_INSTALL_DIR%\bin
64mkdir %OPENSSL_INSTALL_DIR%\include
65mkdir %OPENSSL_INSTALL_DIR%\include\openssl
66mkdir %OPENSSL_INSTALL_DIR%\lib
67copy /b .\*.dll %OPENSSL_INSTALL_DIR%\bin
68copy /b .\out\openssl.exe %OPENSSL_INSTALL_DIR%\bin
69copy /b .\outinc\openssl\* %OPENSSL_INSTALL_DIR%\include\openssl
70copy /b .\out\*.a %OPENSSL_INSTALL_DIR%\lib
71
72Ensure that OpenSSL's openssl.exe executable can be found on PATH before
73running PyOpenSSL's setup script. The setup script finds OpenSSL's include dir
74and lib dir based on the location of openssl.exe, and the test suite requires
75openssl.exe for output comparison. Alternatively, you can specify the
76--with-openssl option to setup.py's build_ext command with the path to the
77OpenSSL installation dir:
78
79 > python setup.py build_ext --with-openssl=C:\path\to\openssl build
80
81PyOpenSSL is known to build with mingw32 for Python 2.3 through Python 2.5.
82Before using the mingw32 compiler for Python 2.3, you will have to create
83a Python library that MinGW understands. Find and download the pexports
84program, put it and MinGW's bin directory on path, then run from Python's
85install 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
91For Python 2.4 and 2.5, no special preparation is needed, just make sure that
92MinGW's gcc is on PATH. You can specify that mingw32 be used by passing
93the --compiler argument to build_ext:
94
95 C:\pyOpenSSL-X.Y> setup.py build_ext -c mingw32 bdist_msi
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050096
Jean-Paul Calderonebaba5692009-07-21 12:08:47 -040097The bdist_msi command will build an MSI installer. It can be substituted
Jean-Paul Calderonebcd45452009-11-11 10:10:57 -050098with another bdist command if another kind of installer is desired or with
99the install command if you want to install directly.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500100
Jean-Paul Calderonebcd45452009-11-11 10:10:57 -0500101For Python 2.4 and 2.5 you can use Visual Studio 2003 in addition to MinGW.
102For Python 2.6, the official Windows installer of which is built with
103Microsoft Visual Studio 2008 (version 9.0), Microsoft Visual Studio 2008
104(version 9.0) is required.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500105
Jean-Paul Calderonebcd45452009-11-11 10:10:57 -0500106To build with MSVC, just omit the compiler specific option:
107
108 C:\pyOpenSSL-X.Y> setup.py bdist_msi
Jean-Paul Calderonebaba5692009-07-21 12:08:47 -0400109
110The resulting binary distribution will be placed in the dist directory. To
Jean-Paul Calderonebcd45452009-11-11 10:10:57 -0500111install it, depending on what kind of distribution you create, run it,
Jean-Paul Calderonebaba5692009-07-21 12:08:47 -0400112unzip it, or copy it to Python installation's site-packages.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500113
114And similarily, you can do
115
116 setup.py --help
117
118to get more information.
119
Jean-Paul Calderonebaba5692009-07-21 12:08:47 -0400120Big thanks to Itamar Shtull-Trauring, Oleg Orlov, Zooko O'Whielacronx, Chris
121Galvan, and #python and #distutils on FreeNode for their help with Windows
122build instructions.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -0500123
124-- Documentation --
125
126The documentation is written in LaTeX, using the standard Python templates,
127and tools to compile it into a number of forms are included. You need to
128supply things like dvips, latex2html yourself of course!
129
130To build the text, html, postscript or dvi forms of the documentation, this is
131what you do:
132
133 cd doc
134 # To make the text-only documentation:
135 make text
136 # To make the dvi form:
137 make dvi
138
139It's as simple as that. Note that since Python's mkhowto script is used, if
140you do first ``make dvi'' and then ``make ps'', the dvi file will disappear.
141I included a special build target ``make all'' that will build all the
142documentation in an order that won't let anything disappear.
143
144
145@(#) $Id: INSTALL,v 1.7 2002/06/14 12:14:19 martin Exp $