Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 1 | Building Python using VC++ 9.0 |
| 2 | ------------------------------ |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 3 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 4 | This directory is used to build Python for Win32 platforms, e.g. Windows |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 5 | 2000, XP and Vista. It requires Microsoft Visual C++ 9.0 |
| 6 | (a.k.a. Visual Studio .NET 2008). |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 7 | (For other Windows platforms and compilers, see ../PC/readme.txt.) |
| 8 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 9 | All you need to do is open the workspace "pcbuild.sln" in Visual Studio, |
| 10 | select the desired combination of configuration and platform and eventually |
| 11 | build the solution. Unless you are going to debug a problem in the core or |
| 12 | you are going to create an optimized build you want to select "Release" as |
| 13 | configuration. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 14 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 15 | The PCbuild directory is compatible with all versions of Visual Studio from |
| 16 | VS C++ Express Edition over the standard edition up to the professional |
| 17 | edition. However the express edition does support features like solution |
| 18 | folders or profile guided optimization (PGO). The missing bits and pieces |
| 19 | won't stop you from building Python. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 20 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 21 | The solution is configured to build the projects in the correct order. "Build |
Christian Heimes | a822314 | 2008-02-09 20:58:00 +0000 | [diff] [blame] | 22 | Solution" or F7 takes care of dependencies except for x64 builds. To make |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 23 | cross compiling x64 builds on a 32bit OS possible the x64 builds require a |
| 24 | 32bit version of Python. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 25 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 26 | NOTE: |
| 27 | You probably don't want to build most of the other subprojects, unless |
| 28 | you're building an entire Python distribution from scratch, or |
| 29 | specifically making changes to the subsystems they implement, or are |
| 30 | running a Python core buildbot test slave; see SUBPROJECTS below) |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 31 | |
| 32 | When using the Debug setting, the output files have a _d added to |
Christian Heimes | a822314 | 2008-02-09 20:58:00 +0000 | [diff] [blame] | 33 | their name: python30_d.dll, python_d.exe, parser_d.pyd, and so on. Both |
| 34 | the build and rt batch files accept a -d option for debug builds. |
Guido van Rossum | e79cf32 | 1998-07-07 22:35:03 +0000 | [diff] [blame] | 35 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 36 | The 32bit builds end up in the solution folder PCbuild while the x64 builds |
| 37 | land in the amd64 subfolder. The PGI and PGO builds for profile guided |
| 38 | optimization end up in their own folders, too. |
| 39 | |
Christian Heimes | 57dddfb | 2008-01-02 18:30:52 +0000 | [diff] [blame] | 40 | Legacy support |
| 41 | -------------- |
| 42 | |
| 43 | You can find build directories for older versions of Visual Studio and |
| 44 | Visual C++ in the PC directory. The legacy build directories are no longer |
| 45 | actively maintained and may not work out of the box. |
| 46 | |
| 47 | PC/VC6/ |
| 48 | Visual C++ 6.0 |
| 49 | PC/VS7.1/ |
| 50 | Visual Studio 2003 (7.1) |
| 51 | PCbuild8/ |
| 52 | Visual Studio 2005 (8.0) |
| 53 | |
| 54 | |
| 55 | C RUNTIME |
| 56 | --------- |
| 57 | |
| 58 | Visual Studio 2008 uses version 9 of the C runtime (MSVCRT9). The executables |
| 59 | are linked to a CRT "side by side" assembly which must be present on the target |
| 60 | machine. This is avalible under the VC/Redist folder of your visual studio |
| 61 | distribution. On XP and later operating systems that support |
| 62 | side-by-side assemblies it is not enough to have the msvcrt80.dll present, |
| 63 | it has to be there as a whole assembly, that is, a folder with the .dll |
| 64 | and a .manifest. Also, a check is made for the correct version. |
| 65 | Therefore, one should distribute this assembly with the dlls, and keep |
| 66 | it in the same directory. For compatibility with older systems, one should |
| 67 | also set the PATH to this directory so that the dll can be found. |
| 68 | For more info, see the Readme in the VC/Redist folder. |
| 69 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 70 | SUBPROJECTS |
| 71 | ----------- |
Tim Peters | 610a827 | 2000-07-01 02:51:23 +0000 | [diff] [blame] | 72 | These subprojects should build out of the box. Subprojects other than the |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 73 | main ones (pythoncore, python, pythonw) generally build a DLL (renamed to |
Tim Peters | 610a827 | 2000-07-01 02:51:23 +0000 | [diff] [blame] | 74 | .pyd) from a specific module so that users don't have to load the code |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 75 | supporting that module unless they import the module. |
Guido van Rossum | e79cf32 | 1998-07-07 22:35:03 +0000 | [diff] [blame] | 76 | |
Tim Peters | 97c9640 | 2001-01-17 23:23:13 +0000 | [diff] [blame] | 77 | pythoncore |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 78 | .dll and .lib |
| 79 | python |
| 80 | .exe |
| 81 | pythonw |
| 82 | pythonw.exe, a variant of python.exe that doesn't pop up a DOS box |
| 83 | _socket |
| 84 | socketmodule.c |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 85 | _testcapi |
Tim Peters | b16c56f | 2001-02-02 21:24:51 +0000 | [diff] [blame] | 86 | tests of the Python C API, run via Lib/test/test_capi.py, and |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 87 | implemented by module Modules/_testcapimodule.c |
Tim Peters | b012a15 | 2002-02-13 23:56:46 +0000 | [diff] [blame] | 88 | pyexpat |
| 89 | Python wrapper for accelerated XML parsing, which incorporates stable |
| 90 | code from the Expat project: http://sourceforge.net/projects/expat/ |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 91 | select |
| 92 | selectmodule.c |
Tim Peters | 19f52c2 | 2001-01-24 10:07:22 +0000 | [diff] [blame] | 93 | unicodedata |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 94 | large tables of Unicode data |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 95 | winsound |
| 96 | play sounds (typically .wav files) under Windows |
| 97 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 98 | The following subprojects will generally NOT build out of the box. They |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 99 | wrap code Python doesn't control, and you'll need to download the base |
Tim Peters | aff1284 | 2000-08-25 06:52:44 +0000 | [diff] [blame] | 100 | packages first and unpack them into siblings of PCbuilds's parent |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 101 | directory; for example, if your PCbuild is ..\dist\py3k\PCbuild\, |
| 102 | unpack into new subdirectories of ..\dist\. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 103 | |
| 104 | _tkinter |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 105 | Python wrapper for the Tk windowing system. Requires building |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 106 | Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.16. |
| 107 | |
| 108 | NOTE: The 64 build builds must land in tcltk64 instead of tcltk. |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 109 | |
| 110 | Get source |
| 111 | ---------- |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 112 | In the dist directory, run |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 113 | svn export http://svn.python.org/projects/external/tcl8.4.16 |
| 114 | svn export http://svn.python.org/projects/external/tk8.4.16 |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 115 | svn export http://svn.python.org/projects/external/tix-8.4.0 |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 116 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 117 | Build with build_tkinter.py |
| 118 | --------------------------- |
| 119 | The PCbuild directory contains a Python script which automates all |
Christian Heimes | 25bb783 | 2008-01-11 16:17:00 +0000 | [diff] [blame] | 120 | steps. Run the script in a Visual Studio 2008 command prompt with |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 121 | |
| 122 | python build_tkinter.py Win32 |
| 123 | |
| 124 | Use x64 instead of Win32 for the x64 platform. |
| 125 | |
Christian Heimes | a822314 | 2008-02-09 20:58:00 +0000 | [diff] [blame] | 126 | NOTE: Tcl/Tk 8.4 doesn't compile for x64. |
| 127 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 128 | Build Tcl first |
Tim Peters | 6c62995 | 2002-11-15 18:36:11 +0000 | [diff] [blame] | 129 | --------------- |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 130 | Use "Start -> All Programs -> Microsoft Visual Studio 2008 |
| 131 | -> Visual Studio Tools -> Visual Studio 2008 Command Prompt" |
Guido van Rossum | d54357d | 2004-03-20 21:00:26 +0000 | [diff] [blame] | 132 | to get a shell window with the correct environment settings |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 133 | cd dist\tcl8.4.16\win |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 134 | nmake -f makefile.vc |
Martin v. Löwis | 6de2d4d | 2004-08-30 09:22:04 +0000 | [diff] [blame] | 135 | nmake -f makefile.vc INSTALLDIR=..\..\tcltk install |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 136 | |
| 137 | XXX Should we compile with OPTS=threads? |
| 138 | |
Tim Peters | 011de6cc | 2004-04-11 17:29:12 +0000 | [diff] [blame] | 139 | Optional: run tests, via |
| 140 | nmake -f makefile.vc test |
| 141 | |
Martin v. Löwis | 6de2d4d | 2004-08-30 09:22:04 +0000 | [diff] [blame] | 142 | On WinXP Pro, wholly up to date as of 30-Aug-2004: |
Tim Peters | e82b00f | 2004-08-30 21:14:51 +0000 | [diff] [blame] | 143 | all.tcl: Total 10678 Passed 9969 Skipped 709 Failed 0 |
Tim Peters | 011de6cc | 2004-04-11 17:29:12 +0000 | [diff] [blame] | 144 | Sourced 129 Test Files. |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 145 | |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 146 | Build Tk |
Tim Peters | 6c62995 | 2002-11-15 18:36:11 +0000 | [diff] [blame] | 147 | -------- |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 148 | cd dist\tk8.4.16\win |
| 149 | nmake -f makefile.vc TCLDIR=..\..\tcl8.4.16 |
| 150 | nmake -f makefile.vc TCLDIR=..\..\tcl8.4.16 INSTALLDIR=..\..\tcltk install |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 151 | |
| 152 | XXX Should we compile with OPTS=threads? |
| 153 | |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 154 | XXX Our installer copies a lot of stuff out of the Tcl/Tk install |
| 155 | XXX directory. Is all of that really needed for Python use of Tcl/Tk? |
| 156 | |
Tim Peters | 011de6cc | 2004-04-11 17:29:12 +0000 | [diff] [blame] | 157 | Optional: run tests, via |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 158 | nmake -f makefile.vc TCLDIR=..\..\tcl8.4.16 test |
Tim Peters | 011de6cc | 2004-04-11 17:29:12 +0000 | [diff] [blame] | 159 | |
Martin v. Löwis | 6de2d4d | 2004-08-30 09:22:04 +0000 | [diff] [blame] | 160 | On WinXP Pro, wholly up to date as of 30-Aug-2004: |
Tim Peters | e82b00f | 2004-08-30 21:14:51 +0000 | [diff] [blame] | 161 | all.tcl: Total 8420 Passed 6826 Skipped 1581 Failed 13 |
Martin v. Löwis | 6de2d4d | 2004-08-30 09:22:04 +0000 | [diff] [blame] | 162 | Sourced 91 Test Files. |
Tim Peters | e82b00f | 2004-08-30 21:14:51 +0000 | [diff] [blame] | 163 | Files with failing tests: canvImg.test scrollbar.test textWind.test winWm.test |
Tim Peters | 63db628 | 2005-08-07 02:47:12 +0000 | [diff] [blame] | 164 | |
Martin v. Löwis | 3cf2163 | 2004-08-31 16:22:09 +0000 | [diff] [blame] | 165 | Built Tix |
| 166 | --------- |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 167 | cd dist\tix-8.4.0\win |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 168 | nmake -f python9.mak |
| 169 | nmake -f python9.mak install |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 170 | |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 171 | bz2 |
| 172 | Python wrapper for the libbz2 compression library. Homepage |
| 173 | http://sources.redhat.com/bzip2/ |
Martin v. Löwis | f6f7925 | 2006-03-13 13:48:05 +0000 | [diff] [blame] | 174 | Download the source from the python.org copy into the dist |
| 175 | directory: |
| 176 | |
Martin v. Löwis | 14c1cf8 | 2006-03-13 10:52:04 +0000 | [diff] [blame] | 177 | svn export http://svn.python.org/projects/external/bzip2-1.0.3 |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 178 | |
Thomas Heller | 46a007e | 2003-08-20 18:27:36 +0000 | [diff] [blame] | 179 | A custom pre-link step in the bz2 project settings should manage to |
Tim Peters | 7ccbb07 | 2006-03-13 19:43:34 +0000 | [diff] [blame] | 180 | build bzip2-1.0.3\libbz2.lib by magic before bz2.pyd (or bz2_d.pyd) is |
Thomas Heller | 46a007e | 2003-08-20 18:27:36 +0000 | [diff] [blame] | 181 | linked in PCbuild\. |
| 182 | However, the bz2 project is not smart enough to remove anything under |
Martin v. Löwis | 14c1cf8 | 2006-03-13 10:52:04 +0000 | [diff] [blame] | 183 | bzip2-1.0.3\ when you do a clean, so if you want to rebuild bzip2.lib |
| 184 | you need to clean up bzip2-1.0.3\ by hand. |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 185 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 186 | All of this managed to build libbz2.lib in |
| 187 | bzip2-1.0.3\$platform-$configuration\, which the Python project links in. |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 188 | |
| 189 | |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 190 | _bsddb |
Tim Peters | 7ccbb07 | 2006-03-13 19:43:34 +0000 | [diff] [blame] | 191 | To use the version of bsddb that Python is built with by default, invoke |
Martin v. Löwis | f6f7925 | 2006-03-13 13:48:05 +0000 | [diff] [blame] | 192 | (in the dist directory) |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 193 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 194 | svn export http://svn.python.org/projects/external/db-4.4.20 |
Martin v. Löwis | f6f7925 | 2006-03-13 13:48:05 +0000 | [diff] [blame] | 195 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 196 | Next open the solution file db-4.4.20\build_win32\Berkeley_DB.sln with |
Christian Heimes | 292d351 | 2008-02-03 16:51:08 +0000 | [diff] [blame] | 197 | Visual Studio and convert the projects to the new format. VS 2008 |
| 198 | builds the necessary libraries in a pre-link step of _bsddb. You |
| 199 | have to add "$(VCInstallDir)vcpackages" to the search path first |
| 200 | (Tools -> Options -> Projects and Solutions -> VC++ Directories, |
| 201 | Platform: Win32, Show directories for: Executable files). |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 202 | |
| 203 | The _bsddb subprojects depends only on the db_static project of |
| 204 | Berkeley DB. You have to choose either "Release", "Release AMD64", "Debug" |
| 205 | or "Debug AMD64" as configuration. |
Martin v. Löwis | f6f7925 | 2006-03-13 13:48:05 +0000 | [diff] [blame] | 206 | |
Tim Peters | 32d996f | 2006-03-13 19:35:53 +0000 | [diff] [blame] | 207 | Alternatively, if you want to start with the original sources, |
Martin v. Löwis | f6f7925 | 2006-03-13 13:48:05 +0000 | [diff] [blame] | 208 | go to Sleepycat's download page: |
| 209 | http://www.sleepycat.com/downloads/releasehistorybdb.html |
| 210 | |
| 211 | and download version 4.4.20. |
Tim Peters | 011de6cc | 2004-04-11 17:29:12 +0000 | [diff] [blame] | 212 | |
| 213 | With or without strong cryptography? You can choose either with or |
| 214 | without strong cryptography, as per the instructions below. By |
Thomas Heller | 8139140 | 2004-07-02 08:58:46 +0000 | [diff] [blame] | 215 | default, Python is built and distributed WITHOUT strong crypto. |
Tim Peters | 011de6cc | 2004-04-11 17:29:12 +0000 | [diff] [blame] | 216 | |
Martin v. Löwis | f6f7925 | 2006-03-13 13:48:05 +0000 | [diff] [blame] | 217 | Unpack the sources; if you downloaded the non-crypto version, rename |
| 218 | the directory from db-4.4.20.NC to db-4.4.20. |
Tim Peters | 011de6cc | 2004-04-11 17:29:12 +0000 | [diff] [blame] | 219 | |
Martin v. Löwis | f6f7925 | 2006-03-13 13:48:05 +0000 | [diff] [blame] | 220 | Now apply any patches that apply to your version. |
Tim Peters | a0d781a | 2004-04-11 18:23:06 +0000 | [diff] [blame] | 221 | |
Tim Peters | 0064026 | 2003-01-24 15:31:31 +0000 | [diff] [blame] | 222 | Open |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 223 | db-4.4.20\docs\ref\build_win\intro.html |
Tim Peters | 0064026 | 2003-01-24 15:31:31 +0000 | [diff] [blame] | 224 | |
Mark Hammond | 2362da8 | 2004-01-06 04:04:01 +0000 | [diff] [blame] | 225 | and follow the "Windows->Building Berkeley DB with Visual C++ .NET" |
| 226 | instructions for building the Sleepycat |
Tim Peters | 0064026 | 2003-01-24 15:31:31 +0000 | [diff] [blame] | 227 | software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory. |
Martin v. Löwis | f6f7925 | 2006-03-13 13:48:05 +0000 | [diff] [blame] | 228 | Build the "db_static" project, for "Release" mode. |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 229 | |
Tim Peters | 0064026 | 2003-01-24 15:31:31 +0000 | [diff] [blame] | 230 | To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py |
| 231 | is then enabled. Running in verbose mode may be helpful. |
| 232 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 233 | _sqlite3 |
| 234 | Python wrapper for SQLite library. |
| 235 | |
| 236 | Get the source code through |
| 237 | |
| 238 | svn export http://svn.python.org/projects/external/sqlite-source-3.3.4 |
| 239 | |
| 240 | To use the extension module in a Python build tree, copy sqlite3.dll into |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 241 | the PCbuild folder. The source directory in svn also contains a .def file |
| 242 | from the binary release of sqlite3. |
Martin v. Löwis | b091241 | 2006-03-13 15:37:40 +0000 | [diff] [blame] | 243 | |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 244 | _ssl |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 245 | Python wrapper for the secure sockets library. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 246 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 247 | Get the source code through |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 248 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 249 | svn export http://svn.python.org/projects/external/openssl-0.9.8g |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 250 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 251 | Alternatively, get the latest version from http://www.openssl.org. |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 252 | You can (theoretically) use any version of OpenSSL you like - the |
| 253 | build process will automatically select the latest version. |
| 254 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 255 | You must install the NASM assembler from |
| 256 | http://www.kernel.org/pub/software/devel/nasm/binaries/win32/ |
| 257 | for x86 builds. Put nasmw.exe anywhere in your PATH. |
| 258 | |
| 259 | You can also install ActivePerl from |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 260 | http://www.activestate.com/Products/ActivePerl/ |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 261 | if you like to use the official sources instead of the files from |
| 262 | python's subversion repository. The svn version contains pre-build |
| 263 | makefiles and assembly files. |
| 264 | |
| 265 | The build process makes sure that no patented algorithms are included. |
| 266 | For now RC5, MDC2 and IDEA are excluded from the build. You may have |
| 267 | to manually remove $(OBJ_D)\i_*.obj from ms\nt.mak if the build process |
| 268 | complains about missing files or forbidden IDEA. Again the files provided |
| 269 | in the subversion repository are already fixed. |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 270 | |
| 271 | The MSVC project simply invokes PCBuild/build_ssl.py to perform |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 272 | the build. This Python script locates and builds your OpenSSL |
Mark Hammond | f229f9f | 2002-12-03 05:47:26 +0000 | [diff] [blame] | 273 | installation, then invokes a simple makefile to build the final .pyd. |
| 274 | |
| 275 | build_ssl.py attempts to catch the most common errors (such as not |
| 276 | being able to find OpenSSL sources, or not being able to find a Perl |
| 277 | that works with OpenSSL) and give a reasonable error message. |
| 278 | If you have a problem that doesn't seem to be handled correctly |
| 279 | (eg, you know you have ActivePerl but we can't find it), please take |
| 280 | a peek at build_ssl.py and suggest patches. Note that build_ssl.py |
| 281 | should be able to be run directly from the command-line. |
| 282 | |
Tim Peters | e8bcb25 | 2002-12-04 02:39:52 +0000 | [diff] [blame] | 283 | build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do |
| 284 | this by hand. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 285 | |
Martin v. Löwis | 13e50fe | 2004-07-20 14:37:48 +0000 | [diff] [blame] | 286 | Building for Itanium |
| 287 | -------------------- |
| 288 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 289 | NOTE: |
| 290 | Official support for Itanium builds have been dropped from the build. Please |
Christian Heimes | a822314 | 2008-02-09 20:58:00 +0000 | [diff] [blame] | 291 | contact us and provide patches if you are interested in Itanium builds. |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 292 | |
Tim Peters | e82b00f | 2004-08-30 21:14:51 +0000 | [diff] [blame] | 293 | The project files support a ReleaseItanium configuration which creates |
Martin v. Löwis | 13e50fe | 2004-07-20 14:37:48 +0000 | [diff] [blame] | 294 | Win64/Itanium binaries. For this to work, you need to install the Platform |
| 295 | SDK, in particular the 64-bit support. This includes an Itanium compiler |
| 296 | (future releases of the SDK likely include an AMD64 compiler as well). |
| 297 | In addition, you need the Visual Studio plugin for external C compilers, |
| 298 | from http://sf.net/projects/vsextcomp. The plugin will wrap cl.exe, to |
Tim Peters | e82b00f | 2004-08-30 21:14:51 +0000 | [diff] [blame] | 299 | locate the proper target compiler, and convert compiler options |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 300 | accordingly. The project files require atleast version 0.9. |
Martin v. Löwis | 13e50fe | 2004-07-20 14:37:48 +0000 | [diff] [blame] | 301 | |
Martin v. Löwis | 856bf9a | 2006-02-14 20:42:55 +0000 | [diff] [blame] | 302 | Building for AMD64 |
| 303 | ------------------ |
| 304 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 305 | The build process for AMD64 / x64 is very similar to standard builds. You just |
Martin v. Löwis | 1561bab | 2008-02-29 19:39:25 +0000 | [diff] [blame^] | 306 | have to set x64 as platform. In addition, the HOST_PYTHON environment variable |
| 307 | must point to a Python interpreter (at least 2.4), to support cross-compilation. |
Martin v. Löwis | 856bf9a | 2006-02-14 20:42:55 +0000 | [diff] [blame] | 308 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 309 | Building Python Using the free MS Toolkit Compiler |
| 310 | -------------------------------------------------- |
| 311 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 312 | Microsoft has withdrawn the free MS Toolkit Compiler, so this can no longer |
| 313 | be considered a supported option. Instead you can use the free VS C++ Express |
| 314 | Edition. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 315 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 316 | Profile Guided Optimization |
| 317 | --------------------------- |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 318 | |
Christian Heimes | 25bb783 | 2008-01-11 16:17:00 +0000 | [diff] [blame] | 319 | The solution has two configurations for PGO. The PGInstrument |
| 320 | configuration must be build first. The PGInstrument binaries are |
| 321 | lniked against a profiling library and contain extra debug |
| 322 | information. The PGUpdate configuration takes the profiling data and |
| 323 | generates optimized binaries. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 324 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 325 | The build_pgo.bat script automates the creation of optimized binaries. It |
| 326 | creates the PGI files, runs the unit test suite or PyBench with the PGI |
| 327 | python and finally creates the optimized files. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 328 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 329 | http://msdn2.microsoft.com/en-us/library/e7k32f4k(VS.90).aspx |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 330 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 331 | Static library |
| 332 | -------------- |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 333 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 334 | The solution has no configuration for static libraries. However it is easy |
| 335 | it build a static library instead of a DLL. You simply have to set the |
| 336 | "Configuration Type" to "Static Library (.lib)" and alter the preprocessor |
| 337 | macro "Py_ENABLE_SHARED" to "Py_NO_ENABLE_SHARED". You may also have to |
| 338 | change the "Runtime Library" from "Multi-threaded DLL (/MD)" to |
| 339 | "Multi-threaded (/MT)". |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 340 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 341 | Visual Studio properties |
| 342 | ------------------------ |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 343 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 344 | The PCbuild solution makes heavy use of Visual Studio property files |
| 345 | (*.vsprops). The properties can be viewed and altered in the Property |
| 346 | Manager (View -> Other Windows -> Property Manager). |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 347 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 348 | * debug (debug macro: _DEBUG) |
| 349 | * pginstrument (PGO) |
| 350 | * pgupdate (PGO) |
| 351 | +-- pginstrument |
| 352 | * pyd (python extension, release build) |
| 353 | +-- release |
| 354 | +-- pyproject |
| 355 | * pyd_d (python extension, debug build) |
| 356 | +-- debug |
| 357 | +-- pyproject |
| 358 | * pyproject (base settings for all projects, user macros like PyDllName) |
| 359 | * release (release macro: NDEBUG) |
| 360 | * x64 (AMD64 / x64 platform specific settings) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 361 | |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 362 | The pyproject propertyfile defines _WIN32 and x64 defines _WIN64 and _M_X64 |
| 363 | although the macros are set by the compiler, too. The GUI doesn't always know |
| 364 | about the macros and confuse the user with false information. |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 365 | |
Tim Peters | f9a4a6e | 2000-07-01 20:38:27 +0000 | [diff] [blame] | 366 | YOUR OWN EXTENSION DLLs |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 367 | ----------------------- |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 368 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 369 | If you want to create your own extension module DLL, there's an example |
| 370 | with easy-to-follow instructions in ../PC/example/; read the file |
| 371 | readme.txt there first. |