blob: b7e8783bd32a3e7fa9921e521d8d56c84092279a [file] [log] [blame]
Tim Petersff8505d2004-01-03 05:45:59 +00001Building Python using VC++ 6.0 or 5.0
2-------------------------------------
3This directory is used to build Python for Win32 platforms, e.g. Windows
Hirokazu Yamamoto0255f0e2008-08-14 01:40:45 +000042000 and XP. It requires Microsoft Visual C++ 6.x or 5.x and Platform
5SDK February 2003 Edition (Core SDK). You can download this SDK from
6http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm.
Tim Petersff8505d2004-01-03 05:45:59 +00007(For other Windows platforms and compilers, see ../readme.txt.)
8
9All you need to do is open the workspace "pcbuild.dsw" in MSVC++, select
10the Debug or Release setting (using Build -> Set Active Configuration...),
11and build the projects.
12
13The proper order to build subprojects:
14
151) pythoncore (this builds the main Python DLL and library files,
Christian Heimesfd440622008-12-03 18:35:13 +000016 python31.{dll, lib} in Release mode)
Tim Petersff8505d2004-01-03 05:45:59 +000017
182) python (this builds the main Python executable,
19 python.exe in Release mode)
20
213) 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
26When using the Debug setting, the output files have a _d added to
Christian Heimesfd440622008-12-03 18:35:13 +000027their name: python31_d.dll, python_d.exe, pyexpat_d.pyd, and so on.
Tim Petersff8505d2004-01-03 05:45:59 +000028
29SUBPROJECTS
30-----------
31These subprojects should build out of the box. Subprojects other than the
32main 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
34supporting that module unless they import the module.
35
36pythoncore
37 .dll and .lib
38python
39 .exe
40pythonw
41 pythonw.exe, a variant of python.exe that doesn't pop up a DOS box
Hirokazu Yamamoto0255f0e2008-08-14 01:40:45 +000042_msi
43 _msi.c. You need to install Windows Installer SDK to build this module.
Tim Petersff8505d2004-01-03 05:45:59 +000044_socket
45 socketmodule.c
Tim Petersff8505d2004-01-03 05:45:59 +000046_testcapi
47 tests of the Python C API, run via Lib/test/test_capi.py, and
48 implemented by module Modules/_testcapimodule.c
Tim Petersff8505d2004-01-03 05:45:59 +000049pyexpat
50 Python wrapper for accelerated XML parsing, which incorporates stable
51 code from the Expat project: http://sourceforge.net/projects/expat/
52select
53 selectmodule.c
54unicodedata
55 large tables of Unicode data
Tim Petersff8505d2004-01-03 05:45:59 +000056winsound
57 play sounds (typically .wav files) under Windows
58
59The following subprojects will generally NOT build out of the box. They
60wrap code Python doesn't control, and you'll need to download the base
61packages first and unpack them into siblings of PCbuilds's parent
62directory; for example, if your PCbuild is .......\dist\src\PCbuild\,
63unpack into new subdirectories of dist\.
64
65_tkinter
66 Python wrapper for the Tk windowing system. Requires building
Thomas Wouters89f507f2006-12-13 04:49:30 +000067 Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.12.
Tim Petersff8505d2004-01-03 05:45:59 +000068
69 Get source
70 ----------
Thomas Wouters89f507f2006-12-13 04:49:30 +000071 In the dist directory, run
72 svn export http://svn.python.org/projects/external/tcl8.4.12
73 svn export http://svn.python.org/projects/external/tk8.4.12
74 svn export http://svn.python.org/projects/external/tix-8.4.0
Tim Petersff8505d2004-01-03 05:45:59 +000075
Thomas Wouters89f507f2006-12-13 04:49:30 +000076 Build Tcl first (done here w/ MSVC 6 on Win2K)
Tim Petersff8505d2004-01-03 05:45:59 +000077 ---------------
Thomas Wouters89f507f2006-12-13 04:49:30 +000078 cd dist\tcl8.4.12\win
79 run vcvars32.bat
Tim Petersff8505d2004-01-03 05:45:59 +000080 nmake -f makefile.vc
Thomas Wouters89f507f2006-12-13 04:49:30 +000081 nmake -f makefile.vc INSTALLDIR=..\..\tcltk install
Tim Petersff8505d2004-01-03 05:45:59 +000082
83 XXX Should we compile with OPTS=threads?
84
Thomas Wouters89f507f2006-12-13 04:49:30 +000085 Optional: run tests, via
86 nmake -f makefile.vc test
87
88 all.tcl: Total 10835 Passed 10096 Skipped 732 Failed 7
89 Sourced 129 Test Files.
90 Files with failing tests: exec.test expr.test io.test main.test string.test stri
91 ngObj.test
Tim Petersff8505d2004-01-03 05:45:59 +000092
93 Build Tk
94 --------
Thomas Wouters89f507f2006-12-13 04:49:30 +000095 cd dist\tk8.4.12\win
96 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12
97 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.12 INSTALLDIR=..\..\tcltk install
Tim Petersff8505d2004-01-03 05:45:59 +000098
99 XXX Should we compile with OPTS=threads?
100
101 XXX I have no idea whether "nmake -f makefile.vc test" passed or
102 XXX failed. It popped up tons of little windows, and did lots of
103 XXX stuff, and nothing blew up.
104
Thomas Wouters89f507f2006-12-13 04:49:30 +0000105 Built Tix
106 ---------
107 cd dist\tix-8.4.0\win
108 nmake -f python.mak
109 nmake -f python.mak install
Tim Petersff8505d2004-01-03 05:45:59 +0000110
111bz2
112 Python wrapper for the libbz2 compression library. Homepage
Hirokazu Yamamoto0f0932c2009-01-09 04:41:03 +0000113 http://www.bzip.org/
Thomas Wouters89f507f2006-12-13 04:49:30 +0000114 Download the source from the python.org copy into the dist
115 directory:
Tim Petersff8505d2004-01-03 05:45:59 +0000116
Hirokazu Yamamoto0f0932c2009-01-09 04:41:03 +0000117 svn export http://svn.python.org/projects/external/bzip2-1.0.5
Tim Petersff8505d2004-01-03 05:45:59 +0000118
Thomas Wouters89f507f2006-12-13 04:49:30 +0000119 And requires building bz2 first.
Tim Petersff8505d2004-01-03 05:45:59 +0000120
Hirokazu Yamamoto0f0932c2009-01-09 04:41:03 +0000121 cd dist\bzip2-1.0.5
Thomas Wouters89f507f2006-12-13 04:49:30 +0000122 nmake -f makefile.msc
123
Hirokazu Yamamoto0f0932c2009-01-09 04:41:03 +0000124 All of this managed to build bzip2-1.0.5\libbz2.lib, which the Python
Tim Petersff8505d2004-01-03 05:45:59 +0000125 project links in.
126
127
Hirokazu Yamamoto0255f0e2008-08-14 01:40:45 +0000128_sqlite3
129 Python wrapper for SQLite library.
130
131 Get the source code through
132
133 svn export http://svn.python.org/projects/external/sqlite-source-3.3.4
134
135 To use the extension module in a Python build tree, copy sqlite3.dll into
136 the PC/VC6 folder.
137
138
Tim Petersff8505d2004-01-03 05:45:59 +0000139_ssl
140 Python wrapper for the secure sockets library.
141
142 Get the latest source code for OpenSSL from
143 http://www.openssl.org
144
145 You (probably) don't want the "engine" code. For example, get
146 openssl-0.9.6g.tar.gz
147 not
148 openssl-engine-0.9.6g.tar.gz
149
150 Unpack into the "dist" directory, retaining the folder name from
151 the archive - for example, the latest stable OpenSSL will install as
152 dist/openssl-0.9.6g
153
154 You can (theoretically) use any version of OpenSSL you like - the
155 build process will automatically select the latest version.
156
157 You must also install ActivePerl from
158 http://www.activestate.com/Products/ActivePerl/
159 as this is used by the OpenSSL build process. Complain to them <wink>.
160
Christian Heimes4c3eda32008-01-04 15:35:04 +0000161 The MSVC project simply invokes PC/VC6/build_ssl.py to perform
Tim Petersff8505d2004-01-03 05:45:59 +0000162 the build. This Python script locates and builds your OpenSSL
163 installation, then invokes a simple makefile to build the final .pyd.
164
Tim Petersff8505d2004-01-03 05:45:59 +0000165 build_ssl.py attempts to catch the most common errors (such as not
166 being able to find OpenSSL sources, or not being able to find a Perl
167 that works with OpenSSL) and give a reasonable error message.
168 If you have a problem that doesn't seem to be handled correctly
169 (eg, you know you have ActivePerl but we can't find it), please take
170 a peek at build_ssl.py and suggest patches. Note that build_ssl.py
171 should be able to be run directly from the command-line.
172
173 build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do
174 this by hand.
175
Tim Petersff8505d2004-01-03 05:45:59 +0000176
177YOUR OWN EXTENSION DLLs
178-----------------------
179If you want to create your own extension module DLL, there's an example
180with easy-to-follow instructions in ../PC/example/; read the file
181readme.txt there first.