Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 1 | Building Python using VC++ 6.0 or 5.0 |
Guido van Rossum | a29b360 | 2000-03-29 01:51:37 +0000 | [diff] [blame] | 2 | ------------------------------------- |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 3 | This directory is used to build Python for Win32 platforms, e.g. Windows |
| 4 | 95, 98 and NT. It requires Microsoft Visual C++ 6.x or 5.x. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 5 | (For other Windows platforms and compilers, see ../PC/readme.txt.) |
| 6 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 7 | All you need to do is open the workspace "pcbuild.dsw" in MSVC++, select |
| 8 | the Debug or Release setting (using Build -> Set Active Configuration...), |
| 9 | and build the projects. |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 10 | |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 11 | The proper order to build subprojects: |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 12 | |
Tim Peters | 97c9640 | 2001-01-17 23:23:13 +0000 | [diff] [blame] | 13 | 1) pythoncore (this builds the main Python DLL and library files, |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 14 | 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 Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 17 | |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 18 | 2) python (this builds the main Python executable, |
| 19 | python.exe in Release mode) |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 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) |
Guido van Rossum | 15b239f | 1998-05-26 14:16:23 +0000 | [diff] [blame] | 25 | |
| 26 | When using the Debug setting, the output files have a _d added to |
Tim Peters | 97c9640 | 2001-01-17 23:23:13 +0000 | [diff] [blame] | 27 | their name: python21_d.dll, python_d.exe, parser_d.pyd, and so on. |
Guido van Rossum | e79cf32 | 1998-07-07 22:35:03 +0000 | [diff] [blame] | 28 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 29 | SUBPROJECTS |
| 30 | ----------- |
Tim Peters | 610a827 | 2000-07-01 02:51:23 +0000 | [diff] [blame] | 31 | These subprojects should build out of the box. Subprojects other than the |
Tim Peters | befc97c | 2001-01-18 19:01:39 +0000 | [diff] [blame] | 32 | main ones (pythoncore, python, pythonw) generally build a DLL (renamed to |
Tim Peters | 610a827 | 2000-07-01 02:51:23 +0000 | [diff] [blame] | 33 | .pyd) from a specific module so that users don't have to load the code |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 34 | supporting that module unless they import the module. |
Guido van Rossum | e79cf32 | 1998-07-07 22:35:03 +0000 | [diff] [blame] | 35 | |
Tim Peters | 97c9640 | 2001-01-17 23:23:13 +0000 | [diff] [blame] | 36 | pythoncore |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 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 |
| 42 | _socket |
| 43 | socketmodule.c |
| 44 | _sre |
| 45 | Unicode-aware regular expression engine |
Tim Peters | b16c56f | 2001-02-02 21:24:51 +0000 | [diff] [blame] | 46 | _symtable |
| 47 | the _symtable module, symtablemodule.c |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 48 | _testcapi |
Tim Peters | b16c56f | 2001-02-02 21:24:51 +0000 | [diff] [blame] | 49 | tests of the Python C API, run via Lib/test/test_capi.py, and |
Tim Peters | d66595f | 2001-02-04 03:09:53 +0000 | [diff] [blame] | 50 | implemented by module Modules/_testcapimodule.c |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 51 | mmap |
| 52 | mmapmodule.c |
| 53 | parser |
| 54 | the parser module |
Tim Peters | b012a15 | 2002-02-13 23:56:46 +0000 | [diff] [blame] | 55 | pyexpat |
| 56 | Python wrapper for accelerated XML parsing, which incorporates stable |
| 57 | code from the Expat project: http://sourceforge.net/projects/expat/ |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 58 | select |
| 59 | selectmodule.c |
Tim Peters | 19f52c2 | 2001-01-24 10:07:22 +0000 | [diff] [blame] | 60 | unicodedata |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 61 | large tables of Unicode data |
| 62 | winreg |
| 63 | Windows registry API |
| 64 | winsound |
| 65 | play sounds (typically .wav files) under Windows |
| 66 | |
| 67 | The following subprojects will generally NOT build out of the box. They |
| 68 | wrap code Python doesn't control, and you'll need to download the base |
Tim Peters | aff1284 | 2000-08-25 06:52:44 +0000 | [diff] [blame] | 69 | packages first and unpack them into siblings of PCbuilds's parent |
| 70 | directory; for example, if your PCbuild is .......\dist\src\PCbuild\, |
| 71 | unpack into new subdirectories of dist\. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 72 | |
| 73 | _tkinter |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 74 | 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\ |
Tim Peters | 6c62995 | 2002-11-15 18:36:11 +0000 | [diff] [blame] | 86 | dist\tk8.4.1\ |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 87 | respectively. |
| 88 | |
Tim Peters | 6c62995 | 2002-11-15 18:36:11 +0000 | [diff] [blame] | 89 | Build Tcl first (done here w/ MSVC 6 on Win2K; also Win98SE) |
| 90 | --------------- |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 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 | |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 100 | Build Tk |
Tim Peters | 6c62995 | 2002-11-15 18:36:11 +0000 | [diff] [blame] | 101 | -------- |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 102 | cd dist\tk8.4.1\win |
| 103 | nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 |
| 104 | nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 INSTALLDIR=..\..\tcl84 install |
| 105 | |
| 106 | XXX Should we compile with OPTS=threads? |
| 107 | |
| 108 | XXX Some tests failed in "nmake -f makefile.vc test". |
| 109 | |
| 110 | XXX Our installer copies a lot of stuff out of the Tcl/Tk install |
| 111 | XXX directory. Is all of that really needed for Python use of Tcl/Tk? |
| 112 | |
Tim Peters | a406b58 | 2002-11-19 17:38:27 +0000 | [diff] [blame] | 113 | Make sure the installer matches |
| 114 | ------------------------------- |
| 115 | Ensure that the Wise compiler vrbl _TCLDIR_ is set to the name of |
| 116 | the common Tcl/Tk installation directory (tcl84 for the instructions |
| 117 | above). This is needed so the installer can copy various Tcl/Tk |
| 118 | files into the Python distribution. |
| 119 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 120 | |
| 121 | zlib |
Tim Peters | ee826f8 | 2001-01-31 19:39:44 +0000 | [diff] [blame] | 122 | Python wrapper for the zlib compression library. Get the source code |
Tim Peters | 6077f64 | 2002-03-13 21:51:55 +0000 | [diff] [blame] | 123 | for version 1.1.4 from a convenient mirror at: |
| 124 | http://www.gzip.org/zlib/ |
| 125 | Unpack into dist\zlib-1.1.4. |
Tim Peters | ee826f8 | 2001-01-31 19:39:44 +0000 | [diff] [blame] | 126 | A custom pre-link step in the zlib project settings should manage to |
Tim Peters | 6077f64 | 2002-03-13 21:51:55 +0000 | [diff] [blame] | 127 | build zlib-1.1.4\zlib.lib by magic before zlib.pyd (or zlib_d.pyd) is |
Tim Peters | ee826f8 | 2001-01-31 19:39:44 +0000 | [diff] [blame] | 128 | linked in PCbuild\. |
| 129 | However, the zlib project is not smart enough to remove anything under |
Tim Peters | 6077f64 | 2002-03-13 21:51:55 +0000 | [diff] [blame] | 130 | zlib-1.1.4\ when you do a clean, so if you want to rebuild zlib.lib |
| 131 | you need to clean up zlib-1.1.4\ by hand. |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 132 | |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 133 | bz2 |
| 134 | Python wrapper for the libbz2 compression library. Homepage |
| 135 | http://sources.redhat.com/bzip2/ |
| 136 | Download the source tarball, bzip2-1.0.2.tar.gz. |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 137 | Unpack into dist\bzip2-1.0.2. WARNING: If you're using WinZip, you |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 138 | must disable its "TAR file smart CR/LF conversion" feature (under |
| 139 | Options -> Configuration -> Miscellaneous -> Other) for the duration. |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 140 | |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 141 | Don't bother trying to use libbz2.dsp with MSVC. After 10 minutes |
| 142 | of fiddling, I couldn't get it to work. Perhaps it works with |
| 143 | MSVC 5 (I used MSVC 6). It's better to run the by-hand makefile |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 144 | anyway, because it runs a helpful test step at the end. |
| 145 | |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 146 | cd into dist\bzip2-1.0.2, and run |
| 147 | nmake -f makefile.msc |
| 148 | [Note that if you're running Win9X, you'll need to run vcvars32.bat |
| 149 | before running nmake (this batch file is in your MSVC installation). |
| 150 | TODO: make this work like zlib (in particular, MSVC runs the prelink |
| 151 | step in an enviroment that already has the correct envars set up). |
| 152 | ] |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 153 | The make step shouldn't yield any warnings or errors, and should end |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 154 | by displaying 6 blocks each terminated with |
| 155 | FC: no differences encountered |
| 156 | If FC finds differences, see the warning abou WinZip above (when I |
| 157 | first tried it, sample3.ref failed due to CRLF conversion). |
Tim Peters | 077736b | 2002-11-14 23:24:40 +0000 | [diff] [blame] | 158 | |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 159 | All of this managed to build bzip2-1.0.2\libbz2.lib, which the Python |
| 160 | project links in. |
| 161 | |
| 162 | |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 163 | _bsddb |
Tim Peters | 84c7a3f | 2002-11-23 18:48:06 +0000 | [diff] [blame] | 164 | XXX The Sleepycat release we use will probably change before |
| 165 | XXX 2.3a1. |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 166 | Go to Sleepycat's patches page: |
| 167 | http://www.sleepycat.com/update/index.html |
| 168 | and download |
| 169 | 4.0.14.zip |
| 170 | from the download page. The file name is db-4.0.14.zip. Unpack into |
| 171 | dist\db-4.0.14 |
Tim Peters | b0ead4e | 2002-11-09 04:48:58 +0000 | [diff] [blame] | 172 | |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 173 | Apply the patch file bsddb_patch.txt in this (PCbuild) directory |
| 174 | against the file |
| 175 | dist\db-4.0.14\db\db_reclaim.c |
| 176 | |
| 177 | Go to |
| 178 | http://www.sleepycat.com/docs/ref/build_win/intro.html |
| 179 | and follow the instructions for building the Sleepycat software. |
| 180 | Build the Release version. |
Tim Peters | 19cf4ee | 2002-11-23 03:49:08 +0000 | [diff] [blame] | 181 | NOTE: The instructions are for a later release of the software, |
| 182 | so use your imagination. Berkeley_DB.dsw in this release was |
| 183 | also pre-MSVC6, so you'll be prompted to upgrade the format (say |
| 184 | yes, of course). Choose configuration "db_buildall - Win32 Release", |
| 185 | and build db_buildall.exe. |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 186 | |
Tim Peters | 84c7a3f | 2002-11-23 18:48:06 +0000 | [diff] [blame] | 187 | XXX We're actually linking against Release_static\libdb40s.lib. |
| 188 | XXX This yields the following warnings: |
| 189 | """ |
| 190 | Compiling... |
| 191 | _bsddb.c |
| 192 | Linking... |
| 193 | Creating library ./_bsddb.lib and object ./_bsddb.exp |
| 194 | LINK : warning LNK4049: locally defined symbol "_malloc" imported |
| 195 | LINK : warning LNK4049: locally defined symbol "_free" imported |
| 196 | LINK : warning LNK4049: locally defined symbol "_fclose" imported |
| 197 | LINK : warning LNK4049: locally defined symbol "_fopen" imported |
| 198 | _bsddb.pyd - 0 error(s), 4 warning(s) |
| 199 | """ |
| 200 | XXX This isn't encouraging, but I don't know what to do about it. |
Tim Peters | 78e35f9 | 2002-11-22 20:00:34 +0000 | [diff] [blame] | 201 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 202 | |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 203 | |
Tim Peters | f9a4a6e | 2000-07-01 20:38:27 +0000 | [diff] [blame] | 204 | YOUR OWN EXTENSION DLLs |
Tim Peters | 4b5fb07 | 2000-07-01 00:03:43 +0000 | [diff] [blame] | 205 | ----------------------- |
| 206 | If you want to create your own extension module DLL, there's an example |
| 207 | with easy-to-follow instructions in ../PC/example/; read the file |
| 208 | readme.txt there first. |