summaryrefslogtreecommitdiffstats
path: root/PCbuild
diff options
context:
space:
mode:
Diffstat (limited to 'PCbuild')
-rw-r--r--PCbuild/_ssl.mak34
-rw-r--r--PCbuild/_ssl.vcproj3
-rw-r--r--PCbuild/build_ssl.py75
-rw-r--r--PCbuild/pythoncore.vcproj24
-rw-r--r--PCbuild/readme.txt4
5 files changed, 75 insertions, 65 deletions
diff --git a/PCbuild/_ssl.mak b/PCbuild/_ssl.mak
index 2c47c6b..2623d27 100644
--- a/PCbuild/_ssl.mak
+++ b/PCbuild/_ssl.mak
@@ -1,21 +1,37 @@
!IFDEF DEBUG
-MODULE=_ssl_d.pyd
-TEMP_DIR=x86-temp-debug/_ssl
+SUFFIX=_d.pyd
+TEMP=x86-temp-debug/
CFLAGS=/Od /Zi /MDd /LDd /DDEBUG /D_DEBUG /DWIN32
SSL_LIB_DIR=$(SSL_DIR)/out32.dbg
!ELSE
-MODULE=_ssl.pyd
-TEMP_DIR=x86-temp-release/_ssl
+SUFFIX=.pyd
+TEMP=x86-temp-release/
CFLAGS=/Ox /MD /LD /DWIN32
SSL_LIB_DIR=$(SSL_DIR)/out32
!ENDIF
INCLUDES=-I ../Include -I ../PC -I $(SSL_DIR)/inc32
-LIBS=gdi32.lib wsock32.lib user32.lib advapi32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib
-SOURCE=../Modules/_ssl.c $(SSL_LIB_DIR)/libeay32.lib $(SSL_LIB_DIR)/ssleay32.lib
+SSL_LIBS=gdi32.lib wsock32.lib user32.lib advapi32.lib /LIBPATH:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib
+SSL_SOURCE=../Modules/_ssl.c
-$(MODULE): $(SOURCE) ../PC/*.h ../Include/*.h
- @if not exist "$(TEMP_DIR)/." mkdir "$(TEMP_DIR)"
- cl /nologo $(SOURCE) $(CFLAGS) /Fo$(TEMP_DIR)\$*.obj $(INCLUDES) /link /out:$(MODULE) $(LIBS)
+HASH_LIBS=gdi32.lib user32.lib advapi32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib
+HASH_SOURCE=../Modules/_hashopenssl.c
+
+all: _ssl$(SUFFIX) _hashlib$(SUFFIX)
+
+# Split compile/link into two steps to better support VSExtComp
+_ssl$(SUFFIX): $(SSL_SOURCE) $(SSL_LIB_DIR)/libeay32.lib $(SSL_LIB_DIR)/ssleay32.lib ../PC/*.h ../Include/*.h
+ @if not exist "$(TEMP)/_ssl/." mkdir "$(TEMP)/_ssl"
+ cl /nologo /c $(SSL_SOURCE) $(CFLAGS) /Fo$(TEMP)\_ssl\$*.obj $(INCLUDES)
+ link /nologo @<<
+ /dll /out:_ssl$(SUFFIX) $(TEMP)\_ssl\$*.obj $(SSL_LIBS)
+<<
+
+_hashlib$(SUFFIX): $(HASH_SOURCE) $(SSL_LIB_DIR)/libeay32.lib ../PC/*.h ../Include/*.h
+ @if not exist "$(TEMP)/_hashlib/." mkdir "$(TEMP)/_hashlib"
+ cl /nologo /c $(HASH_SOURCE) $(CFLAGS) /Fo$(TEMP)\_hashlib\$*.obj $(INCLUDES)
+ link /nologo @<<
+ /dll /out:_hashlib$(SUFFIX) $(HASH_LIBS) $(TEMP)\_hashlib\$*.obj
+<<
diff --git a/PCbuild/_ssl.vcproj b/PCbuild/_ssl.vcproj
index bc69ee8..c1abd24 100644
--- a/PCbuild/_ssl.vcproj
+++ b/PCbuild/_ssl.vcproj
@@ -75,6 +75,9 @@
<File
RelativePath="..\Modules\_ssl.c">
</File>
+ <File
+ RelativePath="..\Modules\_hashopenssl.c">
+ </File>
</Files>
<Globals>
</Globals>
diff --git a/PCbuild/build_ssl.py b/PCbuild/build_ssl.py
index d4beee5..5ab3449 100644
--- a/PCbuild/build_ssl.py
+++ b/PCbuild/build_ssl.py
@@ -1,7 +1,7 @@
-# Script for building the _ssl module for Windows.
+# Script for building the _ssl and _hashlib modules for Windows.
# Uses Perl to setup the OpenSSL environment correctly
# and build OpenSSL, then invokes a simple nmake session
-# for _ssl.pyd itself.
+# for the actual _ssl.pyd and _hashlib.pyd DLLs.
# THEORETICALLY, you can:
# * Unpack the latest SSL release one level above your main Python source
@@ -10,8 +10,8 @@
# * Install ActivePerl and ensure it is somewhere on your path.
# * Run this script from the PCBuild directory.
#
-# it should configure and build SSL, then build the ssl Python extension
-# without intervention.
+# it should configure and build SSL, then build the _ssl and _hashlib
+# Python extensions without intervention.
import os, sys, re
@@ -59,7 +59,8 @@ def find_best_ssl_dir(sources):
candidates = []
for s in sources:
try:
- s = os.path.abspath(s)
+ # note: do not abspath s; the build will fail if any
+ # higher up directory name has spaces in it.
fnames = os.listdir(s)
except os.error:
fnames = []
@@ -82,31 +83,9 @@ def find_best_ssl_dir(sources):
print "Found an SSL directory at '%s'" % (best_name,)
else:
print "Could not find an SSL directory in '%s'" % (sources,)
+ sys.stdout.flush()
return best_name
-def run_32all_py():
- # ms\32all.bat will reconfigure OpenSSL and then try to build
- # all outputs (debug/nondebug/dll/lib). So we filter the file
- # to exclude any "nmake" commands and then execute.
- tempname = "ms\\32all_py.bat"
-
- in_bat = open("ms\\32all.bat")
- temp_bat = open(tempname,"w")
- while 1:
- cmd = in_bat.readline()
- print 'cmd', repr(cmd)
- if not cmd: break
- if cmd.strip()[:5].lower() == "nmake":
- continue
- temp_bat.write(cmd)
- in_bat.close()
- temp_bat.close()
- os.system(tempname)
- try:
- os.remove(tempname)
- except:
- pass
-
def run_configure(configure, do_script):
os.system("perl Configure "+configure)
os.system(do_script)
@@ -117,12 +96,14 @@ def main():
arch = "x86"
debug = False
configure = "VC-WIN32"
- makefile = "32.mak"
+ do_script = "ms\\do_masm"
+ makefile = "ms\\nt.mak"
elif sys.argv[1] == "Debug":
arch = "x86"
debug = True
configure = "VC-WIN32"
- makefile="d32.mak"
+ do_script = "ms\\do_masm"
+ makefile="ms\\d32.mak"
elif sys.argv[1] == "ReleaseItanium":
arch = "ia64"
debug = False
@@ -148,8 +129,9 @@ def main():
sys.exit(1)
print "Found a working perl at '%s'" % (perl,)
+ sys.stdout.flush()
# Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live.
- ssl_dir = find_best_ssl_dir(("../..",))
+ ssl_dir = find_best_ssl_dir(("..\\..",))
if ssl_dir is None:
sys.exit(1)
@@ -157,31 +139,40 @@ def main():
try:
os.chdir(ssl_dir)
# If the ssl makefiles do not exist, we invoke Perl to generate them.
- if not os.path.isfile(makefile):
+ # Due to a bug in this script, the makefile sometimes ended up empty
+ # Force a regeneration if it is.
+ if not os.path.isfile(makefile) or os.path.getsize(makefile)==0:
print "Creating the makefiles..."
+ sys.stdout.flush()
# Put our working Perl at the front of our path
- os.environ["PATH"] = os.path.split(perl)[0] + \
+ os.environ["PATH"] = os.path.dirname(perl) + \
os.pathsep + \
os.environ["PATH"]
- if arch=="x86":
- run_32all_py()
- else:
- run_configure(configure, do_script)
+ run_configure(configure, do_script)
+ if arch=="x86" and debug:
+ # the do_masm script in openssl doesn't generate a debug
+ # build makefile so we generate it here:
+ os.system("perl util\mk1mf.pl debug "+configure+" >"+makefile)
# Now run make.
- print "Executing nmake over the ssl makefiles..."
- rc = os.system("nmake /nologo -f "+makefile)
+ makeCommand = "nmake /nologo PERL=\"%s\" -f \"%s\"" %(perl, makefile)
+ print "Executing ssl makefiles:", makeCommand
+ sys.stdout.flush()
+ rc = os.system(makeCommand)
if rc:
- print "Executing d32.mak failed"
+ print "Executing "+makefile+" failed"
print rc
sys.exit(rc)
finally:
os.chdir(old_cd)
# And finally, we can build the _ssl module itself for Python.
- defs = "SSL_DIR=%s" % (ssl_dir,)
+ defs = "SSL_DIR=\"%s\"" % (ssl_dir,)
if debug:
defs = defs + " " + "DEBUG=1"
- rc = os.system('nmake /nologo -f _ssl.mak ' + defs + " " + make_flags)
+ makeCommand = 'nmake /nologo -f _ssl.mak ' + defs + " " + make_flags
+ print "Executing:", makeCommand
+ sys.stdout.flush()
+ rc = os.system(makeCommand)
sys.exit(rc)
if __name__=='__main__':
diff --git a/PCbuild/pythoncore.vcproj b/PCbuild/pythoncore.vcproj
index ef200c4..f0f71b8 100644
--- a/PCbuild/pythoncore.vcproj
+++ b/PCbuild/pythoncore.vcproj
@@ -39,15 +39,15 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="getbuildinfo.o"
- OutputFile="./python25.dll"
+ OutputFile="./python26.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames="libc"
GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\./python25.pdb"
+ ProgramDatabaseFile=".\./python26.pdb"
SubSystem="2"
BaseAddress="0x1e000000"
- ImportLibrary=".\./python25.lib"
+ ImportLibrary=".\./python26.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
@@ -99,15 +99,15 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="getbuildinfo.o"
- OutputFile="./python25_d.dll"
+ OutputFile="./python26_d.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames="libc"
GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\./python25_d.pdb"
+ ProgramDatabaseFile=".\./python26_d.pdb"
SubSystem="2"
BaseAddress="0x1e000000"
- ImportLibrary=".\./python25_d.lib"
+ ImportLibrary=".\./python26_d.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
@@ -166,15 +166,15 @@
Name="VCLinkerTool"
AdditionalOptions=" /MACHINE:IA64 /USELINK:MS_SDK"
AdditionalDependencies="getbuildinfo.o"
- OutputFile="./python25.dll"
+ OutputFile="./python26.dll"
LinkIncremental="1"
SuppressStartupBanner="FALSE"
IgnoreDefaultLibraryNames="libc"
GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\./python25.pdb"
+ ProgramDatabaseFile=".\./python26.pdb"
SubSystem="2"
BaseAddress="0x1e000000"
- ImportLibrary=".\./python25.lib"
+ ImportLibrary=".\./python26.lib"
TargetMachine="0"/>
<Tool
Name="VCMIDLTool"/>
@@ -233,15 +233,15 @@
Name="VCLinkerTool"
AdditionalOptions=" /MACHINE:AMD64 /USELINK:MS_SDK"
AdditionalDependencies="getbuildinfo.o"
- OutputFile="./python25.dll"
+ OutputFile="./python26.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames="libc"
GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\./python25.pdb"
+ ProgramDatabaseFile=".\./python26.pdb"
SubSystem="2"
BaseAddress="0x1e000000"
- ImportLibrary=".\./python25.lib"
+ ImportLibrary=".\./python26.lib"
TargetMachine="0"/>
<Tool
Name="VCMIDLTool"/>
diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt
index 4536368..79a391a 100644
--- a/PCbuild/readme.txt
+++ b/PCbuild/readme.txt
@@ -12,7 +12,7 @@ the "Standard" toolbar"), and build the projects.
The proper order to build subprojects:
1) pythoncore (this builds the main Python DLL and library files,
- python25.{dll, lib} in Release mode)
+ python26.{dll, lib} in Release mode)
NOTE: in previous releases, this subproject was
named after the release number, e.g. python20.
@@ -26,7 +26,7 @@ The proper order to build subprojects:
test slave; see SUBPROJECTS below)
When using the Debug setting, the output files have a _d added to
-their name: python25_d.dll, python_d.exe, parser_d.pyd, and so on.
+their name: python26_d.dll, python_d.exe, parser_d.pyd, and so on.
SUBPROJECTS
-----------