Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba466cd

Browse files
author
Hirokazu Yamamoto
committed
Merged revisions 85071-85072,85894,87132 via svnmerge from
svn+ssh://[email protected]/python/branches/py3k ........ r85071 | hirokazu.yamamoto | 2010-09-29 03:29:57 +0900 (水, 29 9 2010) | 1 line Now perl path with spaces can be used. ........ r85072 | hirokazu.yamamoto | 2010-09-29 03:36:04 +0900 (水, 29 9 2010) | 1 line Updated PC/VC6 openssl build script. (for openssl-1.0.0a) ........ r85894 | hirokazu.yamamoto | 2010-10-29 02:57:25 +0900 (金, 29 10 2010) | 1 line Updated readme.txt about OpenSSL. ........ r87132 | hirokazu.yamamoto | 2010-12-08 23:47:07 +0900 (水, 08 12 2010) | 3 lines Mention NASM which is needed to build openssl-1.0.0a original source. (PC/VC6/readme.txt) ........
1 parent a85b671 commit ba466cd

5 files changed

Lines changed: 65 additions & 28 deletions

File tree

PC/VC6/build_ssl.py

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
# it should configure and build SSL, then build the ssl Python extension
1414
# without intervention.
1515

16+
# Modified by Christian Heimes
17+
# Now this script supports pre-generated makefiles and assembly files.
18+
# Developers don't need an installation of Perl anymore to build Python. A svn
19+
# checkout from our svn repository is enough.
20+
1621
import os, sys, re, shutil
1722

1823
# Find all "foo.exe" files on the PATH.
@@ -36,7 +41,7 @@ def find_all_on_path(filename, extras = None):
3641
# is available.
3742
def find_working_perl(perls):
3843
for perl in perls:
39-
fh = os.popen(perl + ' -e "use Win32;"')
44+
fh = os.popen('"%s" -e "use Win32;"' % perl)
4045
fh.read()
4146
rc = fh.close()
4247
if rc:
@@ -120,6 +125,22 @@ def run_configure(configure, do_script):
120125
print(do_script)
121126
os.system(do_script)
122127

128+
def cmp(f1, f2):
129+
bufsize = 1024 * 8
130+
with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
131+
while True:
132+
b1 = fp1.read(bufsize)
133+
b2 = fp2.read(bufsize)
134+
if b1 != b2:
135+
return False
136+
if not b1:
137+
return True
138+
139+
def copy(src, dst):
140+
if os.path.isfile(dst) and cmp(src, dst):
141+
return
142+
shutil.copy(src, dst)
143+
123144
def main():
124145
debug = "-d" in sys.argv
125146
build_all = "-a" in sys.argv
@@ -129,6 +150,7 @@ def main():
129150
do_script = "ms\\do_nasm"
130151
makefile="ms\\nt.mak"
131152
m32 = makefile
153+
dirsuffix = "32"
132154
configure += " no-idea no-rc5 no-mdc2"
133155
make_flags = ""
134156
if build_all:
@@ -137,12 +159,12 @@ def main():
137159
# as "well known" locations
138160
perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"])
139161
perl = find_working_perl(perls)
140-
if perl is None:
141-
print("No Perl installation was found. Existing Makefiles are used.")
142-
else:
162+
if perl:
143163
print("Found a working perl at '%s'" % (perl,))
164+
else:
165+
print("No Perl installation was found. Existing Makefiles are used.")
144166
sys.stdout.flush()
145-
# Look for SSL 3 levels up from pcbuild - ie, same place zlib etc all live.
167+
# Look for SSL 3 levels up from PC/VC6 - ie, same place zlib etc all live.
146168
ssl_dir = find_best_ssl_dir(("..\\..\\..",))
147169
if ssl_dir is None:
148170
sys.exit(1)
@@ -173,12 +195,21 @@ def main():
173195
# os.system("perl util\mk1mf.pl debug "+configure+" >"+makefile)
174196

175197
fix_makefile(makefile)
176-
shutil.copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
177-
shutil.copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch)
198+
copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
199+
copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch)
200+
201+
# If the assembler files don't exist in tmpXX, copy them there
202+
if perl is None:
203+
if not os.path.exists("tmp"+dirsuffix):
204+
os.mkdir("tmp"+dirsuffix)
205+
for f in os.listdir("asm"+dirsuffix):
206+
if not f.endswith(".asm"): continue
207+
if os.path.isfile(r"tmp%s\%s" % (dirsuffix, f)): continue
208+
shutil.copy(r"asm%s\%s" % (dirsuffix, f), "tmp"+dirsuffix)
178209

179210
# Now run make.
180-
shutil.copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h")
181-
shutil.copy(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h")
211+
copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h")
212+
copy(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h")
182213

183214
#makeCommand = "nmake /nologo PERL=\"%s\" -f \"%s\"" %(perl, makefile)
184215
makeCommand = "nmake /nologo -f \"%s\"" % makefile

PC/VC6/readme.txt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,21 +149,27 @@ _ssl
149149
Get the latest source code for OpenSSL from
150150
http://www.openssl.org
151151

152-
You (probably) don't want the "engine" code. For example, get
153-
openssl-0.9.8g.tar.gz
154-
not
155-
openssl-engine-0.9.8g.tar.gz
152+
You (probably) don't want the "engine" code. For example, don't get
153+
openssl-engine-0.9.6g.tar.gz
156154

157155
Unpack into the "dist" directory, retaining the folder name from
158156
the archive - for example, the latest stable OpenSSL will install as
159-
dist/openssl-0.9.8g
157+
dist/openssl-1.0.0a
160158

161159
You can (theoretically) use any version of OpenSSL you like - the
162160
build process will automatically select the latest version.
163161

164-
You must also install ActivePerl from
165-
http://www.activestate.com/Products/ActivePerl/
166-
as this is used by the OpenSSL build process. Complain to them <wink>.
162+
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.
167173

168174
The MSVC project simply invokes PC/VC6/build_ssl.py to perform
169175
the build. This Python script locates and builds your OpenSSL

PC/VS8.0/build_ssl.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# directory. It is likely you will already find the zlib library and
99
# any other external packages there.
1010
# * Install ActivePerl and ensure it is somewhere on your path.
11-
# * Run this script from the PCBuild directory.
11+
# * Run this script from the PC/VS8.0 directory.
1212
#
1313
# it should configure and build SSL, then build the _ssl and _hashlib
1414
# Python extensions without intervention.
@@ -46,7 +46,7 @@ def find_all_on_path(filename, extras = None):
4646
# is available.
4747
def find_working_perl(perls):
4848
for perl in perls:
49-
fh = os.popen(perl + ' -e "use Win32;"')
49+
fh = os.popen('"%s" -e "use Win32;"' % perl)
5050
fh.read()
5151
rc = fh.close()
5252
if rc:
@@ -178,12 +178,12 @@ def main():
178178
# as "well known" locations
179179
perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"])
180180
perl = find_working_perl(perls)
181-
if perl is None:
181+
if perl:
182+
print("Found a working perl at '%s'" % (perl,))
183+
else:
182184
print("No Perl installation was found. Existing Makefiles are used.")
183-
184-
print("Found a working perl at '%s'" % (perl,))
185185
sys.stdout.flush()
186-
# Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live.
186+
# Look for SSL 3 levels up from PC/VS8.0 - ie, same place zlib etc all live.
187187
ssl_dir = find_best_ssl_dir(("..\\..\\..",))
188188
if ssl_dir is None:
189189
sys.exit(1)

PCbuild/build_ssl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def find_all_on_path(filename, extras = None):
4646
# is available.
4747
def find_working_perl(perls):
4848
for perl in perls:
49-
fh = os.popen(perl + ' -e "use Win32;"')
49+
fh = os.popen('"%s" -e "use Win32;"' % perl)
5050
fh.read()
5151
rc = fh.close()
5252
if rc:
@@ -186,10 +186,10 @@ def main():
186186
# as "well known" locations
187187
perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"])
188188
perl = find_working_perl(perls)
189-
if perl is None:
189+
if perl:
190+
print("Found a working perl at '%s'" % (perl,))
191+
else:
190192
print("No Perl installation was found. Existing Makefiles are used.")
191-
192-
print("Found a working perl at '%s'" % (perl,))
193193
sys.stdout.flush()
194194
# Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live.
195195
ssl_dir = find_best_ssl_dir(("..\\..",))

PCbuild/readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ _ssl
156156
nasmw.exe.
157157

158158
You can also install ActivePerl from
159-
http://www.activestate.com/Products/ActivePerl/
159+
http://www.activestate.com/activeperl/
160160
if you like to use the official sources instead of the files from
161161
python's subversion repository. The svn version contains pre-build
162162
makefiles and assembly files.

0 commit comments

Comments
 (0)