mirror of
https://github.com/python/cpython.git
synced 2025-12-05 00:52:25 +00:00
Patch #1470875: Building Python with MS Free Compiler.
This commit is contained in:
parent
73536e039b
commit
48bbaf2375
4 changed files with 171 additions and 0 deletions
|
|
@ -87,7 +87,10 @@ Library
|
||||||
Build
|
Build
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Patch #1470875: Building Python with MS Free Compiler
|
||||||
|
|
||||||
- Patch #1161914: Add a python-config script.
|
- Patch #1161914: Add a python-config script.
|
||||||
|
|
||||||
- Patch #1324762:Remove ccpython.cc; replace --with-cxx with
|
- Patch #1324762:Remove ccpython.cc; replace --with-cxx with
|
||||||
--with-cxx-main. Link with C++ compiler only if --with-cxx-main was
|
--with-cxx-main. Link with C++ compiler only if --with-cxx-main was
|
||||||
specified. (Can be overridden by explicitly setting LINKCC.) Decouple
|
specified. (Can be overridden by explicitly setting LINKCC.) Decouple
|
||||||
|
|
|
||||||
10
PCbuild/db.build
Normal file
10
PCbuild/db.build
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<project>
|
||||||
|
<target name="all" description="Build all targets.">
|
||||||
|
<solution configuration="release">
|
||||||
|
<projects>
|
||||||
|
<include name="db_static.vcproj" />
|
||||||
|
</projects>
|
||||||
|
</solution>
|
||||||
|
</target>
|
||||||
|
</project>
|
||||||
21
PCbuild/python.build
Normal file
21
PCbuild/python.build
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<project>
|
||||||
|
<target name="all" description="Build all targets.">
|
||||||
|
<solution configuration="release">
|
||||||
|
<projects>
|
||||||
|
<include name="make_versioninfo.vcproj" />
|
||||||
|
</projects>
|
||||||
|
</solution>
|
||||||
|
<exec program="make_versioninfo" output="pythonnt_rc.h" />
|
||||||
|
|
||||||
|
<solution configuration="release" solutionfile="pcbuild.sln">
|
||||||
|
<excludeprojects>
|
||||||
|
<include name="_tkinter.vcproj" />
|
||||||
|
<include name="bz2.vcproj" />
|
||||||
|
<include name="_bsddb.vcproj" />
|
||||||
|
<include name="_sqlite3.vcproj" />
|
||||||
|
<include name="_ssl.vcproj" />
|
||||||
|
</excludeprojects>
|
||||||
|
</solution>
|
||||||
|
</target>
|
||||||
|
</project>
|
||||||
|
|
@ -273,6 +273,143 @@ The build process for the ReleaseAMD64 configuration is very similar
|
||||||
to the Itanium configuration; make sure you use the latest version of
|
to the Itanium configuration; make sure you use the latest version of
|
||||||
vsextcomp.
|
vsextcomp.
|
||||||
|
|
||||||
|
Building Python Using the free MS Toolkit Compiler
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
The build process for Visual C++ can be used almost unchanged with the free MS
|
||||||
|
Toolkit Compiler. This provides a way of building Python using freely
|
||||||
|
available software.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
|
||||||
|
To build Python, the following tools are required:
|
||||||
|
|
||||||
|
* The Visual C++ Toolkit Compiler
|
||||||
|
from http://msdn.microsoft.com/visualc/vctoolkit2003/
|
||||||
|
* A recent Platform SDK
|
||||||
|
from http://www.microsoft.com/downloads/details.aspx?FamilyID=484269e2-3b89-47e3-8eb7-1f2be6d7123a
|
||||||
|
* The .NET 1.1 SDK
|
||||||
|
from http://www.microsoft.com/downloads/details.aspx?FamilyID=9b3a2ca6-3647-4070-9f41-a333c6b9181d
|
||||||
|
|
||||||
|
[Does anyone have better URLs for the last 2 of these?]
|
||||||
|
|
||||||
|
The toolkit compiler is needed as it is an optimising compiler (the
|
||||||
|
compiler supplied with the .NET SDK is a non-optimising version). The
|
||||||
|
platform SDK is needed to provide the Windows header files and libraries
|
||||||
|
(the Windows 2003 Server SP1 edition, typical install, is known to work -
|
||||||
|
other configurations or versions are probably fine as well). The .NET 1.1
|
||||||
|
SDK is needed because it contains a version of msvcrt.dll which links to
|
||||||
|
the msvcr71.dll CRT. Note that the .NET 2.0 SDK is NOT acceptable, as it
|
||||||
|
references msvcr80.dll.
|
||||||
|
|
||||||
|
All of the above items should be installed as normal.
|
||||||
|
|
||||||
|
If you intend to build the openssl (needed for the _ssl extension) you
|
||||||
|
will need the C runtime sources installed as part of the platform SDK.
|
||||||
|
|
||||||
|
In addition, you will need Nant, available from
|
||||||
|
http://nant.sourceforge.net. The 0.85 release candidate 3 version is known
|
||||||
|
to work. This is the latest released version at the time of writing. Later
|
||||||
|
"nightly build" versions are known NOT to work - it is not clear at
|
||||||
|
present whether future released versions will work.
|
||||||
|
|
||||||
|
Setting up the environment
|
||||||
|
|
||||||
|
Start a platform SDK "build environment window" from the start menu. The
|
||||||
|
"Windows XP 32-bit retail" version is known to work.
|
||||||
|
|
||||||
|
Add the following directories to your PATH:
|
||||||
|
* The toolkit compiler directory
|
||||||
|
* The SDK "Win64" binaries directory
|
||||||
|
* The Nant directory
|
||||||
|
Add to your INCLUDE environment variable:
|
||||||
|
* The toolkit compiler INCLUDE directory
|
||||||
|
Add to your LIB environment variable:
|
||||||
|
* The toolkit compiler LIB directory
|
||||||
|
* The .NET SDK Visual Studio 2003 VC7\lib directory
|
||||||
|
|
||||||
|
The following commands should set things up as you need them:
|
||||||
|
|
||||||
|
rem Set these values according to where you installed the software
|
||||||
|
set TOOLKIT=C:\Program Files\Microsoft Visual C++ Toolkit 2003
|
||||||
|
set SDK=C:\Program Files\Microsoft Platform SDK
|
||||||
|
set NET=C:\Program Files\Microsoft Visual Studio .NET 2003
|
||||||
|
set NANT=C:\Utils\Nant
|
||||||
|
|
||||||
|
set PATH=%TOOLKIT%\bin;%PATH%;%SDK%\Bin\win64;%NANT%\bin
|
||||||
|
set INCLUDE=%TOOLKIT%\include;%INCLUDE%
|
||||||
|
set LIB=%TOOLKIT%\lib;%NET%\VC7\lib;%LIB%
|
||||||
|
|
||||||
|
The "win64" directory from the SDK is added to supply executables such as
|
||||||
|
"cvtres" and "lib", which are not available elsewhere. The versions in the
|
||||||
|
"win64" directory are 32-bit programs, so they are fine to use here.
|
||||||
|
|
||||||
|
That's it. To build Python (the core only, no binary extensions which
|
||||||
|
depend on external libraries) you just need to issue the command
|
||||||
|
|
||||||
|
nant -buildfile:python.build all
|
||||||
|
|
||||||
|
from within the PCBuild directory.
|
||||||
|
|
||||||
|
Extension modules
|
||||||
|
|
||||||
|
To build those extension modules which require external libraries
|
||||||
|
(_tkinter, bz2, _bsddb, _sqlite3, _ssl) you can follow the instructions
|
||||||
|
for the Visual Studio build above, with a few minor modifications. These
|
||||||
|
instructions have only been tested using the sources in the Python
|
||||||
|
subversion repository - building from original sources should work, but
|
||||||
|
has not been tested.
|
||||||
|
|
||||||
|
For each extension module you wish to build, you should remove the
|
||||||
|
associated include line from the excludeprojects section of pc.build.
|
||||||
|
|
||||||
|
The changes required are:
|
||||||
|
|
||||||
|
_tkinter
|
||||||
|
The tix makefile (tix-8.4.0\win\makefile.vc) must be modified to
|
||||||
|
remove references to TOOLS32. The relevant lines should be changed to
|
||||||
|
read:
|
||||||
|
cc32 = cl.exe
|
||||||
|
link32 = link.exe
|
||||||
|
include32 =
|
||||||
|
The remainder of the build instructions will work as given.
|
||||||
|
|
||||||
|
bz2
|
||||||
|
No changes are needed
|
||||||
|
|
||||||
|
_bsddb
|
||||||
|
The file db.build should be copied from the Python PCBuild directory
|
||||||
|
to the directory db-4.4.20\build_win32.
|
||||||
|
|
||||||
|
The file db_static.vcproj in db-4.4.20\build_win32 sould be edited to
|
||||||
|
remove the string "$(SolutionDir)" - this occurs in 2 places, only
|
||||||
|
relevant for 64-bit builds. (The edit is required as otherwise, nant
|
||||||
|
wants to read the solution file, which is not in a suitable form).
|
||||||
|
|
||||||
|
The bsddb library can then be build with the command
|
||||||
|
nant -buildfile:db.build all
|
||||||
|
run from the db-4.4.20\build_win32 directory.
|
||||||
|
|
||||||
|
_sqlite3
|
||||||
|
No changes are needed. However, in order for the tests to succeed, a
|
||||||
|
copy of sqlite3.dll must be downloaded, and placed alongside
|
||||||
|
python.exe.
|
||||||
|
|
||||||
|
_ssl
|
||||||
|
The documented build process works as written. However, it needs a
|
||||||
|
copy of the file setargv.obj, which is not supplied in the platform
|
||||||
|
SDK. However, the sources are available (in the crt source code). To
|
||||||
|
build setargv.obj, proceed as follows:
|
||||||
|
|
||||||
|
Copy setargv.c, cruntime.h and internal.h from %SDK%\src\crt to a
|
||||||
|
temporary directory.
|
||||||
|
Compile using "cl /c /I. /MD /D_CRTBLD setargv.c"
|
||||||
|
Copy the resulting setargv.obj to somewhere on your LIB environment
|
||||||
|
(%SDK%\lib is a reasonable place).
|
||||||
|
|
||||||
|
With setargv.obj in place, the standard build process should work
|
||||||
|
fine.
|
||||||
|
|
||||||
YOUR OWN EXTENSION DLLs
|
YOUR OWN EXTENSION DLLs
|
||||||
-----------------------
|
-----------------------
|
||||||
If you want to create your own extension module DLL, there's an example
|
If you want to create your own extension module DLL, there's an example
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue