blob: 5c8fdf6a702740ce889eeeccdcb9626997cc6b17 [file] [log] [blame]
Tim Peters4b5fb072000-07-01 00:03:43 +00001Building Python using VC++ 6.0 or 5.0
Guido van Rossuma29b3602000-03-29 01:51:37 +00002-------------------------------------
Tim Peters4b5fb072000-07-01 00:03:43 +00003This directory is used to build Python for Win32 platforms, e.g. Windows
495, 98 and NT. It requires Microsoft Visual C++ 6.x or 5.x.
Guido van Rossum15b239f1998-05-26 14:16:23 +00005(For other Windows platforms and compilers, see ../PC/readme.txt.)
6
Tim Peters4b5fb072000-07-01 00:03:43 +00007All you need to do is open the workspace "pcbuild.dsw" in MSVC++, select
8the Debug or Release setting (using Build -> Set Active Configuration...),
9and build the projects.
Guido van Rossum15b239f1998-05-26 14:16:23 +000010
Tim Petersbefc97c2001-01-18 19:01:39 +000011The proper order to build subprojects:
Guido van Rossum15b239f1998-05-26 14:16:23 +000012
Tim Peters97c96402001-01-17 23:23:13 +0000131) pythoncore (this builds the main Python DLL and library files,
Tim Petersbefc97c2001-01-18 19:01:39 +000014 python21.{dll, lib} in Release mode)
15 NOTE: in previous releases, this subproject was
16 named after the release number, e.g. python20.
Guido van Rossum15b239f1998-05-26 14:16:23 +000017
Tim Petersbefc97c2001-01-18 19:01:39 +0000182) python (this builds the main Python executable,
19 python.exe in Release mode)
Tim Peters4b5fb072000-07-01 00:03:43 +000020
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)
Guido van Rossum15b239f1998-05-26 14:16:23 +000025
26When using the Debug setting, the output files have a _d added to
Tim Peters97c96402001-01-17 23:23:13 +000027their name: python21_d.dll, python_d.exe, parser_d.pyd, and so on.
Guido van Rossume79cf321998-07-07 22:35:03 +000028
Tim Peters4b5fb072000-07-01 00:03:43 +000029SUBPROJECTS
30-----------
Tim Peters610a8272000-07-01 02:51:23 +000031These subprojects should build out of the box. Subprojects other than the
Tim Petersbefc97c2001-01-18 19:01:39 +000032main ones (pythoncore, python, pythonw) generally build a DLL (renamed to
Tim Peters610a8272000-07-01 02:51:23 +000033.pyd) from a specific module so that users don't have to load the code
Tim Peters4b5fb072000-07-01 00:03:43 +000034supporting that module unless they import the module.
Guido van Rossume79cf321998-07-07 22:35:03 +000035
Tim Peters97c96402001-01-17 23:23:13 +000036pythoncore
Tim Peters4b5fb072000-07-01 00:03:43 +000037 .dll and .lib
38python
39 .exe
40pythonw
41 pythonw.exe, a variant of python.exe that doesn't pop up a DOS box
42_socket
43 socketmodule.c
44_sre
45 Unicode-aware regular expression engine
Tim Petersb16c56f2001-02-02 21:24:51 +000046_symtable
47 the _symtable module, symtablemodule.c
Tim Petersd66595f2001-02-04 03:09:53 +000048_testcapi
Tim Petersb16c56f2001-02-02 21:24:51 +000049 tests of the Python C API, run via Lib/test/test_capi.py, and
Tim Petersd66595f2001-02-04 03:09:53 +000050 implemented by module Modules/_testcapimodule.c
Tim Peters4b5fb072000-07-01 00:03:43 +000051mmap
52 mmapmodule.c
53parser
54 the parser module
Tim Petersb012a152002-02-13 23:56:46 +000055pyexpat
56 Python wrapper for accelerated XML parsing, which incorporates stable
57 code from the Expat project: http://sourceforge.net/projects/expat/
Tim Peters4b5fb072000-07-01 00:03:43 +000058select
59 selectmodule.c
Tim Peters19f52c22001-01-24 10:07:22 +000060unicodedata
Tim Peters4b5fb072000-07-01 00:03:43 +000061 large tables of Unicode data
62winreg
63 Windows registry API
64winsound
65 play sounds (typically .wav files) under Windows
66
67The following subprojects will generally NOT build out of the box. They
68wrap code Python doesn't control, and you'll need to download the base
Tim Petersaff12842000-08-25 06:52:44 +000069packages first and unpack them into siblings of PCbuilds's parent
70directory; for example, if your PCbuild is .......\dist\src\PCbuild\,
71unpack into new subdirectories of dist\.
Tim Peters4b5fb072000-07-01 00:03:43 +000072
73_tkinter
Tim Peters077736b2002-11-14 23:24:40 +000074 Python wrapper for the Tk windowing system. Requires building
75 Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.1:
76
77 Get source
78 ----------
79 Go to
80 http://prdownloads.sourceforge.net/tcl/
81 and download
82 tcl841-src.zip
83 tk841-src.zip
84 Unzip into
85 dist\tcl8.4.1\
86 dist\tk\8.4.1\
87 respectively.
88
89 Build Tcl first (done here w/ MSVC 6 on Win2K)
90 ----------------------------------------------
91 cd dist\tcl8.4.1\win
92 run vcvars32.bat [necessary even on Win2K]
93 nmake -f makefile.vc
94 nmake -f makefile.vc INSTALLDIR=..\..\tcl84 install
95
96 XXX Should we compile with OPTS=threads?
97
98 XXX Some tests failed in "nmake -f makefile.vc test".
99
100 XXX Should rename destination directory to something more generic
101 XXX then tcl84. But unless I can backport 8.3.4 to the 2.2 line
102 XXX too, I've got to be able to build using more than oneX Tcl/Tk
103 XXX release, and that effectively reserves the "tcl" directory name
104 XXX for the duration. Nothing that requires thought is going to
105 XXX work when it comes to release crunch times.
106
107
108 Build Tk
109 -------
110 cd dist\tk8.4.1\win
111 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1
112 nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 INSTALLDIR=..\..\tcl84 install
113
114 XXX Should we compile with OPTS=threads?
115
116 XXX Some tests failed in "nmake -f makefile.vc test".
117
118 XXX Our installer copies a lot of stuff out of the Tcl/Tk install
119 XXX directory. Is all of that really needed for Python use of Tcl/Tk?
120
Tim Peters4b5fb072000-07-01 00:03:43 +0000121
122zlib
Tim Petersee826f82001-01-31 19:39:44 +0000123 Python wrapper for the zlib compression library. Get the source code
Tim Peters6077f642002-03-13 21:51:55 +0000124 for version 1.1.4 from a convenient mirror at:
125 http://www.gzip.org/zlib/
126 Unpack into dist\zlib-1.1.4.
Tim Petersee826f82001-01-31 19:39:44 +0000127 A custom pre-link step in the zlib project settings should manage to
Tim Peters6077f642002-03-13 21:51:55 +0000128 build zlib-1.1.4\zlib.lib by magic before zlib.pyd (or zlib_d.pyd) is
Tim Petersee826f82001-01-31 19:39:44 +0000129 linked in PCbuild\.
130 However, the zlib project is not smart enough to remove anything under
Tim Peters6077f642002-03-13 21:51:55 +0000131 zlib-1.1.4\ when you do a clean, so if you want to rebuild zlib.lib
132 you need to clean up zlib-1.1.4\ by hand.
Tim Peters4b5fb072000-07-01 00:03:43 +0000133
Tim Petersb0ead4e2002-11-09 04:48:58 +0000134bz2
135 Python wrapper for the libbz2 compression library. Homepage
136 http://sources.redhat.com/bzip2/
137 Download the source tarball, bzip2-1.0.2.tar.gz.
Tim Peters077736b2002-11-14 23:24:40 +0000138 Unpack into dist\bzip2-1.0.2. WARNING: If you're using WinZip, you
Tim Petersb0ead4e2002-11-09 04:48:58 +0000139 must disable its "TAR file smart CR/LF conversion" feature (under
140 Options -> Configuration -> Miscellaneous -> Other) for the duration.
Tim Peters077736b2002-11-14 23:24:40 +0000141
Tim Petersb0ead4e2002-11-09 04:48:58 +0000142 Don't bother trying to use libbz2.dsp with MSVC. After 10 minutes
143 of fiddling, I couldn't get it to work. Perhaps it works with
144 MSVC 5 (I used MSVC 6). It's better to run the by-hand makefile
Tim Peters077736b2002-11-14 23:24:40 +0000145 anyway, because it runs a helpful test step at the end.
146
Tim Petersb0ead4e2002-11-09 04:48:58 +0000147 cd into dist\bzip2-1.0.2, and run
148 nmake -f makefile.msc
149 [Note that if you're running Win9X, you'll need to run vcvars32.bat
150 before running nmake (this batch file is in your MSVC installation).
151 TODO: make this work like zlib (in particular, MSVC runs the prelink
152 step in an enviroment that already has the correct envars set up).
153 ]
Tim Peters077736b2002-11-14 23:24:40 +0000154 The make step shouldn't yield any warnings or errors, and should end
Tim Petersb0ead4e2002-11-09 04:48:58 +0000155 by displaying 6 blocks each terminated with
156 FC: no differences encountered
157 If FC finds differences, see the warning abou WinZip above (when I
158 first tried it, sample3.ref failed due to CRLF conversion).
Tim Peters077736b2002-11-14 23:24:40 +0000159
Tim Petersb0ead4e2002-11-09 04:48:58 +0000160 All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python
161 project links in.
162
163
164
Tim Peters4b5fb072000-07-01 00:03:43 +0000165bsddb
Tim Peters610a8272000-07-01 02:51:23 +0000166 Python wrapper for the BSD database 1.85. Requires db.1.85.win32.zip,
167 from the "bsd db" link at
Tim Peters4b5fb072000-07-01 00:03:43 +0000168 http://www.nightmare.com/software.html
Tim Petersaff12842000-08-25 06:52:44 +0000169 Unpack into dist\bsddb.
170 You then need to compile it: cd to dist\bsddb\Port\win32, and run
171 nmake -f makefile_nt.msc
172 This builds bsddb\Port\win32\db.lib, which the MSVC project links in.
173 Note that if you're running Win9X, you'll need to run vcvars32.bat
174 before running nmake (this batch file is in your MSVC installation).
Tim Petersca873ed2001-02-01 05:10:02 +0000175 TODO: make this work like zlib (in particular, MSVC runs the prelink
176 step in an enviroment that already has the correct envars set up).
Tim Peters4b5fb072000-07-01 00:03:43 +0000177
Tim Peters4b5fb072000-07-01 00:03:43 +0000178
Tim Petersf9a4a6e2000-07-01 20:38:27 +0000179YOUR OWN EXTENSION DLLs
Tim Peters4b5fb072000-07-01 00:03:43 +0000180-----------------------
181If you want to create your own extension module DLL, there's an example
182with easy-to-follow instructions in ../PC/example/; read the file
183readme.txt there first.