blob: 59e65d06a76f15ed44bbfaec6279737e1c609376 [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
Hirokazu Yamamoto6c7e5622009-01-10 11:48:27 +000067 Tcl/Tk first. Following are instructions for Tcl/Tk 8.5.2.
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
Hirokazu Yamamoto6c7e5622009-01-10 11:48:27 +000072 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 Petersff8505d2004-01-03 05:45:59 +000079
Thomas Wouters89f507f2006-12-13 04:49:30 +000080 Build Tcl first (done here w/ MSVC 6 on Win2K)
Tim Petersff8505d2004-01-03 05:45:59 +000081 ---------------
Hirokazu Yamamoto6c7e5622009-01-10 11:48:27 +000082 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 Wouters89f507f2006-12-13 04:49:30 +000086 run vcvars32.bat
Tim Petersff8505d2004-01-03 05:45:59 +000087 nmake -f makefile.vc
Thomas Wouters89f507f2006-12-13 04:49:30 +000088 nmake -f makefile.vc INSTALLDIR=..\..\tcltk install
Tim Petersff8505d2004-01-03 05:45:59 +000089
90 XXX Should we compile with OPTS=threads?
91
Thomas Wouters89f507f2006-12-13 04:49:30 +000092 Optional: run tests, via
93 nmake -f makefile.vc test
94
Hirokazu Yamamoto6c7e5622009-01-10 11:48:27 +000095 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 Wouters89f507f2006-12-13 04:49:30 +000098 ngObj.test
Tim Petersff8505d2004-01-03 05:45:59 +000099
100 Build Tk
101 --------
Hirokazu Yamamoto6c7e5622009-01-10 11:48:27 +0000102 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 Petersff8505d2004-01-03 05:45:59 +0000105
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 Yamamoto6c7e5622009-01-10 11:48:27 +0000112 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 Petersff8505d2004-01-03 05:45:59 +0000117
118bz2
119 Python wrapper for the libbz2 compression library. Homepage
Hirokazu Yamamoto0f0932c2009-01-09 04:41:03 +0000120 http://www.bzip.org/
Thomas Wouters89f507f2006-12-13 04:49:30 +0000121 Download the source from the python.org copy into the dist
122 directory:
Tim Petersff8505d2004-01-03 05:45:59 +0000123
Hirokazu Yamamoto0f0932c2009-01-09 04:41:03 +0000124 svn export http://svn.python.org/projects/external/bzip2-1.0.5
Tim Petersff8505d2004-01-03 05:45:59 +0000125
Thomas Wouters89f507f2006-12-13 04:49:30 +0000126 And requires building bz2 first.
Tim Petersff8505d2004-01-03 05:45:59 +0000127
Hirokazu Yamamoto0f0932c2009-01-09 04:41:03 +0000128 cd dist\bzip2-1.0.5
Thomas Wouters89f507f2006-12-13 04:49:30 +0000129 nmake -f makefile.msc
130
Hirokazu Yamamoto0f0932c2009-01-09 04:41:03 +0000131 All of this managed to build bzip2-1.0.5\libbz2.lib, which the Python
Tim Petersff8505d2004-01-03 05:45:59 +0000132 project links in.
133
134
Hirokazu Yamamoto0255f0e2008-08-14 01:40:45 +0000135_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 Petersff8505d2004-01-03 05:45:59 +0000146_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
Hirokazu Yamamotoba466cd2010-12-09 09:25:38 +0000152 You (probably) don't want the "engine" code. For example, don't get
153 openssl-engine-0.9.6g.tar.gz
Tim Petersff8505d2004-01-03 05:45:59 +0000154
155 Unpack into the "dist" directory, retaining the folder name from
156 the archive - for example, the latest stable OpenSSL will install as
Hirokazu Yamamotoba466cd2010-12-09 09:25:38 +0000157 dist/openssl-1.0.0a
Tim Petersff8505d2004-01-03 05:45:59 +0000158
159 You can (theoretically) use any version of OpenSSL you like - the
160 build process will automatically select the latest version.
161
Hirokazu Yamamotoba466cd2010-12-09 09:25:38 +0000162 You can install the NASM assembler from
163 http://www.nasm.us/
164 for x86 builds. Put nasmw.exe anywhere in your PATH.
165 Note: recent releases of nasm only have nasm.exe. Just rename it to
166 nasmw.exe.
167
168 You can also install ActivePerl from
169 http://www.activestate.com/activeperl/
170 if you like to use the official sources instead of the files from
171 python's subversion repository. The svn version contains pre-build
172 makefiles and assembly files.
Tim Petersff8505d2004-01-03 05:45:59 +0000173
Christian Heimes4c3eda32008-01-04 15:35:04 +0000174 The MSVC project simply invokes PC/VC6/build_ssl.py to perform
Tim Petersff8505d2004-01-03 05:45:59 +0000175 the build. This Python script locates and builds your OpenSSL
176 installation, then invokes a simple makefile to build the final .pyd.
177
Tim Petersff8505d2004-01-03 05:45:59 +0000178 build_ssl.py attempts to catch the most common errors (such as not
179 being able to find OpenSSL sources, or not being able to find a Perl
180 that works with OpenSSL) and give a reasonable error message.
181 If you have a problem that doesn't seem to be handled correctly
182 (eg, you know you have ActivePerl but we can't find it), please take
183 a peek at build_ssl.py and suggest patches. Note that build_ssl.py
184 should be able to be run directly from the command-line.
185
186 build_ssl.py/MSVC isn't clever enough to clean OpenSSL - you must do
187 this by hand.
188
Tim Petersff8505d2004-01-03 05:45:59 +0000189
190YOUR OWN EXTENSION DLLs
191-----------------------
192If you want to create your own extension module DLL, there's an example
193with easy-to-follow instructions in ../PC/example/; read the file
194readme.txt there first.