Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 1 | |
| 2 | INSTALLATION INSTRUCTIONS FOR pyOpenSSL |
| 3 | ------------------------------------------------------------------------------ |
| 4 | |
| 5 | I have tested this on Debian Linux systems (woody and sid), Solaris 2.6 and |
| 6 | 2.7. Others have successfully compiled it on Windows and NT. |
| 7 | |
| 8 | |
| 9 | -- Building the Module on a Unix System -- |
| 10 | |
| 11 | pyOpenSSL uses distutils, so there really shouldn't be any problems. To build |
| 12 | the library: |
| 13 | |
Jean-Paul Calderone | baba569 | 2009-07-21 12:08:47 -0400 | [diff] [blame] | 14 | $ python setup.py build |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 15 | |
| 16 | If your OpenSSL header files aren't in /usr/include, you may need to supply |
| 17 | the -I flag to let the setup script know where to look. The same goes for the |
| 18 | libraries of course, use the -L flag. Note that build won't accept these |
| 19 | flags, so you have to run first build_ext and then build! Example: |
| 20 | |
Jean-Paul Calderone | baba569 | 2009-07-21 12:08:47 -0400 | [diff] [blame] | 21 | $ python setup.py build_ext -I/usr/local/ssl/include -L/usr/local/ssl/lib |
| 22 | $ python setup.py build |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 23 | |
| 24 | Now 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 Calderone | baba569 | 2009-07-21 12:08:47 -0400 | [diff] [blame] | 27 | $ python setup.py install |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 28 | |
| 29 | If you, for some arcane reason, don't want the module to appear in the |
| 30 | site-packages directory, use the --prefix option. |
| 31 | |
| 32 | You can, of course, do |
| 33 | |
Jean-Paul Calderone | baba569 | 2009-07-21 12:08:47 -0400 | [diff] [blame] | 34 | $ python setup.py --help |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 35 | |
| 36 | to find out more about how to use the script. |
| 37 | |
| 38 | |
| 39 | -- Building the Module on a Windows System -- |
| 40 | |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 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: |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 43 | |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 44 | http://www.slproweb.com/products/Win32OpenSSL.html |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 45 | |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 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 | |
Jean-Paul Calderone | 2023169 | 2009-11-11 21:59:29 -0500 | [diff] [blame] | 50 | If you want to build pyOpenSSL for an older Python version, it is preferred |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 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 |
Jean-Paul Calderone | 2023169 | 2009-11-11 21:59:29 -0500 | [diff] [blame] | 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: |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 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 |
Jean-Paul Calderone | 2023169 | 2009-11-11 21:59:29 -0500 | [diff] [blame] | 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: |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 78 | |
| 79 | > python setup.py build_ext --with-openssl=C:\path\to\openssl build |
| 80 | |
Jean-Paul Calderone | 2023169 | 2009-11-11 21:59:29 -0500 | [diff] [blame] | 81 | pyOpenSSL is known to build with mingw32 for Python 2.3 through Python 2.5. |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 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 |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 96 | |
Jean-Paul Calderone | baba569 | 2009-07-21 12:08:47 -0400 | [diff] [blame] | 97 | The bdist_msi command will build an MSI installer. It can be substituted |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 98 | with another bdist command if another kind of installer is desired or with |
| 99 | the install command if you want to install directly. |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 100 | |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 101 | For Python 2.4 and 2.5 you can use Visual Studio 2003 in addition to MinGW. |
| 102 | For Python 2.6, the official Windows installer of which is built with |
| 103 | Microsoft Visual Studio 2008 (version 9.0), Microsoft Visual Studio 2008 |
| 104 | (version 9.0) is required. |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 105 | |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 106 | To build with MSVC, just omit the compiler specific option: |
| 107 | |
| 108 | C:\pyOpenSSL-X.Y> setup.py bdist_msi |
Jean-Paul Calderone | baba569 | 2009-07-21 12:08:47 -0400 | [diff] [blame] | 109 | |
| 110 | The resulting binary distribution will be placed in the dist directory. To |
Jean-Paul Calderone | bcd4545 | 2009-11-11 10:10:57 -0500 | [diff] [blame] | 111 | install it, depending on what kind of distribution you create, run it, |
Jean-Paul Calderone | baba569 | 2009-07-21 12:08:47 -0400 | [diff] [blame] | 112 | unzip it, or copy it to Python installation's site-packages. |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 113 | |
| 114 | And similarily, you can do |
| 115 | |
| 116 | setup.py --help |
| 117 | |
| 118 | to get more information. |
| 119 | |
Jean-Paul Calderone | baba569 | 2009-07-21 12:08:47 -0400 | [diff] [blame] | 120 | Big thanks to Itamar Shtull-Trauring, Oleg Orlov, Zooko O'Whielacronx, Chris |
Jean-Paul Calderone | 2023169 | 2009-11-11 21:59:29 -0500 | [diff] [blame] | 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. |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 124 | |
| 125 | -- Documentation -- |
| 126 | |
| 127 | The documentation is written in LaTeX, using the standard Python templates, |
| 128 | and tools to compile it into a number of forms are included. You need to |
| 129 | supply things like dvips, latex2html yourself of course! |
| 130 | |
| 131 | To build the text, html, postscript or dvi forms of the documentation, this is |
| 132 | what you do: |
| 133 | |
| 134 | cd doc |
| 135 | # To make the text-only documentation: |
| 136 | make text |
| 137 | # To make the dvi form: |
| 138 | make dvi |
| 139 | |
| 140 | It's as simple as that. Note that since Python's mkhowto script is used, if |
| 141 | you do first ``make dvi'' and then ``make ps'', the dvi file will disappear. |
| 142 | I included a special build target ``make all'' that will build all the |
| 143 | documentation in an order that won't let anything disappear. |
| 144 | |
| 145 | |
| 146 | @(#) $Id: INSTALL,v 1.7 2002/06/14 12:14:19 martin Exp $ |