Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 1 | Building Python using VC++ 6.0 or 5.0 |
| 2 | ------------------------------------- |
| 3 | This directory is used to build Python for Win32 platforms, e.g. Windows |
Hirokazu Yamamoto | 0255f0e | 2008-08-14 01:40:45 +0000 | [diff] [blame] | 4 | 2000 and XP. It requires Microsoft Visual C++ 6.x or 5.x and Platform |
| 5 | SDK February 2003 Edition (Core SDK). You can download this SDK from |
| 6 | http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 7 | (For other Windows platforms and compilers, see ../readme.txt.) |
| 8 | |
| 9 | All you need to do is open the workspace "pcbuild.dsw" in MSVC++, select |
| 10 | the Debug or Release setting (using Build -> Set Active Configuration...), |
| 11 | and build the projects. |
| 12 | |
| 13 | The proper order to build subprojects: |
| 14 | |
| 15 | 1) pythoncore (this builds the main Python DLL and library files, |
Christian Heimes | fd44062 | 2008-12-03 18:35:13 +0000 | [diff] [blame] | 16 | python31.{dll, lib} in Release mode) |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 17 | |
| 18 | 2) python (this builds the main Python executable, |
| 19 | python.exe in Release mode) |
| 20 | |
| 21 | 3) the other subprojects, as desired or needed (note: you probably don't |
| 22 | want to build most of the other subprojects, unless you're building an |
| 23 | entire Python distribution from scratch, or specifically making changes |
| 24 | to the subsystems they implement; see SUBPROJECTS below) |
| 25 | |
| 26 | When using the Debug setting, the output files have a _d added to |
Christian Heimes | fd44062 | 2008-12-03 18:35:13 +0000 | [diff] [blame] | 27 | their name: python31_d.dll, python_d.exe, pyexpat_d.pyd, and so on. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 28 | |
| 29 | SUBPROJECTS |
| 30 | ----------- |
| 31 | These subprojects should build out of the box. Subprojects other than the |
| 32 | main ones (pythoncore, python, pythonw) generally build a DLL (renamed to |
| 33 | .pyd) from a specific module so that users don't have to load the code |
| 34 | supporting that module unless they import the module. |
| 35 | |
| 36 | pythoncore |
| 37 | .dll and .lib |
| 38 | python |
| 39 | .exe |
| 40 | pythonw |
| 41 | pythonw.exe, a variant of python.exe that doesn't pop up a DOS box |
Hirokazu Yamamoto | 0255f0e | 2008-08-14 01:40:45 +0000 | [diff] [blame] | 42 | _msi |
| 43 | _msi.c. You need to install Windows Installer SDK to build this module. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 44 | _socket |
| 45 | socketmodule.c |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 46 | _testcapi |
| 47 | tests of the Python C API, run via Lib/test/test_capi.py, and |
| 48 | implemented by module Modules/_testcapimodule.c |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 49 | pyexpat |
| 50 | Python wrapper for accelerated XML parsing, which incorporates stable |
| 51 | code from the Expat project: http://sourceforge.net/projects/expat/ |
| 52 | select |
| 53 | selectmodule.c |
| 54 | unicodedata |
| 55 | large tables of Unicode data |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 56 | winsound |
| 57 | play sounds (typically .wav files) under Windows |
| 58 | |
| 59 | The following subprojects will generally NOT build out of the box. They |
| 60 | wrap code Python doesn't control, and you'll need to download the base |
| 61 | packages first and unpack them into siblings of PCbuilds's parent |
| 62 | directory; for example, if your PCbuild is .......\dist\src\PCbuild\, |
| 63 | unpack into new subdirectories of dist\. |
| 64 | |
| 65 | _tkinter |
| 66 | Python wrapper for the Tk windowing system. Requires building |
Hirokazu Yamamoto | 6c7e562 | 2009-01-10 11:48:27 +0000 | [diff] [blame] | 67 | Tcl/Tk first. Following are instructions for Tcl/Tk 8.5.2. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 68 | |
| 69 | Get source |
| 70 | ---------- |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 71 | In the dist directory, run |
Hirokazu Yamamoto | 6c7e562 | 2009-01-10 11:48:27 +0000 | [diff] [blame] | 72 | svn export http://svn.python.org/projects/external/tcl-8.5.2.1 tcl8.5.2 |
| 73 | svn export http://svn.python.org/projects/external/tk-8.5.2.0 tk8.5.2 |
| 74 | svn export http://svn.python.org/projects/external/tix-8.4.3.1 tix8.4.3 |
| 75 | |
| 76 | Debug Build |
| 77 | ----------- |
| 78 | To build debug version, add DEBUG=1 to all nmake call bellow. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 79 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 80 | Build Tcl first (done here w/ MSVC 6 on Win2K) |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 81 | --------------- |
Hirokazu Yamamoto | 6c7e562 | 2009-01-10 11:48:27 +0000 | [diff] [blame] | 82 | If your environment doesn't have struct _stat64, you need to apply |
| 83 | tcl852.patch in this directory to dist\tcl8.5.2\generic\tcl.h. |
| 84 | |
| 85 | cd dist\tcl8.5.2\win |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 86 | run vcvars32.bat |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 87 | nmake -f makefile.vc |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 88 | nmake -f makefile.vc INSTALLDIR=..\..\tcltk install |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 89 | |
| 90 | XXX Should we compile with OPTS=threads? |
| 91 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 92 | Optional: run tests, via |
| 93 | nmake -f makefile.vc test |
| 94 | |
Hirokazu Yamamoto | 6c7e562 | 2009-01-10 11:48:27 +0000 | [diff] [blame] | 95 | all.tcl: Total 24242 Passed 23358 Skipped 877 Failed 7 |
| 96 | Sourced 137 Test Files. |
| 97 | Files with failing tests: exec.test http.test io.test main.test string.test stri |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 98 | ngObj.test |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 99 | |
| 100 | Build Tk |
| 101 | -------- |
Hirokazu Yamamoto | 6c7e562 | 2009-01-10 11:48:27 +0000 | [diff] [blame] | 102 | cd dist\tk8.5.2\win |
| 103 | nmake -f makefile.vc TCLDIR=..\..\tcl8.5.2 |
| 104 | nmake -f makefile.vc TCLDIR=..\..\tcl8.5.2 INSTALLDIR=..\..\tcltk install |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 105 | |
| 106 | XXX Should we compile with OPTS=threads? |
| 107 | |
| 108 | XXX I have no idea whether "nmake -f makefile.vc test" passed or |
| 109 | XXX failed. It popped up tons of little windows, and did lots of |
| 110 | XXX stuff, and nothing blew up. |
| 111 | |
Hirokazu Yamamoto | 6c7e562 | 2009-01-10 11:48:27 +0000 | [diff] [blame] | 112 | Build Tix |
| 113 | --------- |
| 114 | cd dist\tix8.4.3\win |
| 115 | nmake -f python.mak TCL_MAJOR=8 TCL_MINOR=5 TCL_PATCH=2 MACHINE=IX86 DEBUG=0 |
| 116 | nmake -f python.mak TCL_MAJOR=8 TCL_MINOR=5 TCL_PATCH=2 MACHINE=IX86 DEBUG=0 INSTALL_DIR=..\..\tcltk install |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 117 | |
| 118 | bz2 |
| 119 | Python wrapper for the libbz2 compression library. Homepage |
Hirokazu Yamamoto | 0f0932c | 2009-01-09 04:41:03 +0000 | [diff] [blame] | 120 | http://www.bzip.org/ |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 121 | Download the source from the python.org copy into the dist |
| 122 | directory: |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 123 | |
Hirokazu Yamamoto | 0f0932c | 2009-01-09 04:41:03 +0000 | [diff] [blame] | 124 | svn export http://svn.python.org/projects/external/bzip2-1.0.5 |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 125 | |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 126 | And requires building bz2 first. |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 127 | |
Hirokazu Yamamoto | 0f0932c | 2009-01-09 04:41:03 +0000 | [diff] [blame] | 128 | cd dist\bzip2-1.0.5 |
Thomas Wouters | 89f507f | 2006-12-13 04:49:30 +0000 | [diff] [blame] | 129 | nmake -f makefile.msc |
| 130 | |
Hirokazu Yamamoto | 0f0932c | 2009-01-09 04:41:03 +0000 | [diff] [blame] | 131 | All of this managed to build bzip2-1.0.5\libbz2.lib, which the Python |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 132 | project links in. |
| 133 | |
| 134 | |
Hirokazu Yamamoto | 0255f0e | 2008-08-14 01:40:45 +0000 | [diff] [blame] | 135 | _sqlite3 |
| 136 | Python wrapper for SQLite library. |
| 137 | |
| 138 | Get the source code through |
| 139 | |
| 140 | svn export http://svn.python.org/projects/external/sqlite-source-3.3.4 |
| 141 | |
| 142 | To use the extension module in a Python build tree, copy sqlite3.dll into |
| 143 | the PC/VC6 folder. |
| 144 | |
| 145 | |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 146 | _ssl |
| 147 | Python wrapper for the secure sockets library. |
| 148 | |
| 149 | Get the latest source code for OpenSSL from |
| 150 | http://www.openssl.org |
| 151 | |
| 152 | You (probably) don't want the "engine" code. For example, get |
Hirokazu Yamamoto | ecdfd51 | 2009-03-18 11:39:46 +0000 | [diff] [blame^] | 153 | openssl-0.9.8g.tar.gz |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 154 | not |
Hirokazu Yamamoto | ecdfd51 | 2009-03-18 11:39:46 +0000 | [diff] [blame^] | 155 | openssl-engine-0.9.8g.tar.gz |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 156 | |
| 157 | Unpack into the "dist" directory, retaining the folder name from |
| 158 | the archive - for example, the latest stable OpenSSL will install as |
Hirokazu Yamamoto | ecdfd51 | 2009-03-18 11:39:46 +0000 | [diff] [blame^] | 159 | dist/openssl-0.9.8g |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 160 | |
| 161 | You can (theoretically) use any version of OpenSSL you like - the |
| 162 | build process will automatically select the latest version. |
| 163 | |
| 164 | You must also install ActivePerl from |
| 165 | http://www.activestate.com/Products/ActivePerl/ |
| 166 | as this is used by the OpenSSL build process. Complain to them <wink>. |
| 167 | |
Christian Heimes | 4c3eda3 | 2008-01-04 15:35:04 +0000 | [diff] [blame] | 168 | The MSVC project simply invokes PC/VC6/build_ssl.py to perform |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 169 | the build. This Python script locates and builds your OpenSSL |
| 170 | installation, then invokes a simple makefile to build the final .pyd. |
| 171 | |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 172 | build_ssl.py attempts to catch the most common errors (such as not |
| 173 | being able to find OpenSSL sources, or not being able to find a Perl |
| 174 | that works with OpenSSL) and give a reasonable error message. |
| 175 | If you have a problem that doesn't seem to be handled correctly |
| 176 | (eg, you know you have ActivePerl but we can't find it), please take |
| 177 | a peek at build_ssl.py and suggest patches. Note that build_ssl.py |
| 178 | should be able to be run directly from the command-line. |
| 179 | |
| 180 | build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do |
| 181 | this by hand. |
| 182 | |
Tim Peters | ff8505d | 2004-01-03 05:45:59 +0000 | [diff] [blame] | 183 | |
| 184 | YOUR OWN EXTENSION DLLs |
| 185 | ----------------------- |
| 186 | If you want to create your own extension module DLL, there's an example |
| 187 | with easy-to-follow instructions in ../PC/example/; read the file |
| 188 | readme.txt there first. |