]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - docs/build/build-pyOpenSSL.rst
Add doc for building pyOpenSSL.
[tahoe-lafs/tahoe-lafs.git] / docs / build / build-pyOpenSSL.rst
1 Building pyOpenSSL on Windows-7 (64-bit)
2 ========================================
3
4 This document details the steps to build an pyOpenSSL egg with embedded
5 OpenSSL library, for use by Tahoe-LAFS on Windows.
6
7 The instructions were tried on Windows-7 64-bit. Building on a 32-bit machine
8 shouldn't be too different.
9
10
11 Download and install Microsoft Visual C++ compiler for Python 2.7
12 -----------------------------------------------------------------
13
14 For reasons detailed in `the Python documentation`_, Python extension modules
15 need to be built using a compiler compatible with the same version of Visual C++
16 that was used to build Python itself. Until recently, this meant downloading
17 Microsoft Visual Studio 2008 Express Edition and Windows SDK 3.5. The recent
18 release of the Microsoft Visual C++ compiler for Python 2.7 made things a lot
19 simpler.
20
21 So, the first step is to download and install the C++ compiler from Microsoft
22 from `this link`_.
23
24 .. _the Python documentation: https://docs.python.org/2/extending/windows.html
25 .. _this link: https://www.microsoft.com/en-us/download/details.aspx?id=44266
26
27
28 Download and install Perl
29 -------------------------
30
31 Download and install ActiveState Perl:
32
33 * go to `the ActiveState Perl download page`_.
34 * identify the correct link and manually change it from http to https.
35
36 .. _the ActiveState Perl download page: https://www.activestate.com/activeperl/downloads
37
38
39 Download and install the latest OpenSSL version
40 -----------------------------------------------
41
42 * Download the latest OpenSSL from `the OpenSSL source download page`_ and untar it.
43   At the time of writing, the latest version was OpenSSL 1.0.1m.
44
45 * Set up the build environment::
46
47     "%USERPROFILE%\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat" amd64
48
49 * Go to the untar'ed OpenSSL source base directory and run the following commands::
50
51     mkdir c:\dist
52     perl Configure VC-WIN64A --prefix=c:\dist\openssl64 no-asm enable-tlsext
53     ms\do_win64a.bat
54     nmake -f ms\ntdll.mak
55     nmake -f ms\ntdll.mak install
56
57
58 To check that it is working, run ``c:\dist\openssl64\bin\openssl version``.
59
60 .. _the OpenSSL source download page: https://www.openssl.org/source/
61
62
63 Building PyOpenSSL
64 ------------------
65
66 * Download and untar pyOpenSSL 0.13.1 (see `ticket #2221`_ for why we
67   currently use this version). The MD5 hash of pyOpenSSL-0.13.1.tar.gz is
68   e27a3b76734c39ea03952ca94cc56715.
69
70 * Set up the build environment::
71
72     "%USERPROFILE%\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat" amd64
73
74 * Set OpenSSL ``LIB``, ``INCLUDE`` and ``PATH``::
75
76     set LIB=c:\dist\openssl64\lib;%LIB%
77     set INCLUDE=c:\dist\openssl64\include;%INCLUDE%
78     set PATH=c:\dist\openssl64\bin;%PATH%
79
80 * A workaround is needed to ensure that the setuptools ``bdist_egg`` command
81   is available. Edit pyOpenSSL's ``setup.py`` around line 13 as follows::
82
83     < from distutils.core import Extension, setup
84     ---
85     > from setuptools import setup
86     > from distutils.core import Extension
87
88 * Run ``python setup.py bdist_egg``
89
90 The generated egg will be in the ``dist`` directory. It is a good idea
91 to check that Tahoe-LAFS is able to use it before uploading the egg to
92 tahoe-lafs.org. This can be done by putting it in the ``tahoe-deps`` directory
93 of a Tahoe-LAFS checkout or release, then running ``python setup.py test``.
94
95 .. _ticket #2221: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2221