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