author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Sun, 17 Dec 2017 01:29:32 +0100 | |
changeset 36 | ad68e85dc416 |
parent 34 | 0a8caba627ac |
permissions | -rw-r--r-- |
34
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
1 |
diff -pruN M2Crypto-0.22.6rc2.orig/setup.py M2Crypto-0.22.6rc2/setup.py |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
2 |
--- M2Crypto-0.22.6rc2.orig/setup.py 2015-10-19 14:34:45.000000000 +0200 |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
3 |
+++ M2Crypto-0.22.6rc2/setup.py 2015-10-20 18:48:14.231865096 +0200 |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
4 |
@@ -28,6 +28,23 @@ except ImportError: |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
5 |
from distutils.core import Extension |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
6 |
from distutils.file_util import copy_file |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
7 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
8 |
+# DISTUTILS HOT PATCH |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
9 |
+from distutils.cygwinccompiler import Mingw32CCompiler |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
10 |
+_old_mw32_init=Mingw32CCompiler.__init__ |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
11 |
+def Mingw32CCompInit(self, *args, **kwargs): |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
12 |
+ _old_mw32_init(self, *args, **kwargs) |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
13 |
+ for n in ["compiler", "compiler_so", "compiler_cxx", "linker_so"] : |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
14 |
+ l = getattr(self,n) |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
15 |
+ pfx = os.getenv("MINGCCPREFIX") |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
16 |
+ l[0] = pfx+l[0] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
17 |
+ self.linker_so.insert(1, "-static-libgcc") |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
18 |
+Mingw32CCompiler.__init__ = Mingw32CCompInit |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
19 |
+ |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
20 |
+import distutils |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
21 |
+distutils.sysconfig.get_python_inc = lambda *x,**y : os.getenv("PYTHONINC") |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
22 |
+distutils.cygwinccompiler.get_msvcr = lambda *x,**y : [] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
23 |
+distutils.util.get_platform = lambda *x,**y : "win32" |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
24 |
+distutils.sysconfig._init_nt() |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
25 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
26 |
class _M2CryptoBuildExt(build_ext.build_ext): |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
27 |
'''Specialization of build_ext to enable swig_opts to inherit any |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
28 |
@@ -40,14 +57,9 @@ class _M2CryptoBuildExt(build_ext.build_ |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
29 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
30 |
build_ext.build_ext.initialize_options(self) |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
31 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
32 |
- # openssl is the attribute corresponding to openssl directory prefix |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
33 |
- # command line option |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
34 |
- if os.name == 'nt': |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
35 |
- self.libraries = ['ssleay32', 'libeay32'] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
36 |
- self.openssl = 'c:\\pkg' |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
37 |
- else: |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
38 |
- self.libraries = ['ssl', 'crypto'] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
39 |
- self.openssl = '/usr' |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
40 |
+ self.openssl = "mhooooo" |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
41 |
+ self.libraries = ['ssleay32', 'libeay32'] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
42 |
+ self.libraries += ['ws2_32', 'crypt32', 'gdi32', "python27", "winstrm"] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
43 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
44 |
def finalize_options(self): |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
45 |
'''Overloaded build_ext implementation to append custom openssl |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
46 |
@@ -56,7 +68,8 @@ class _M2CryptoBuildExt(build_ext.build_ |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
47 |
build_ext.build_ext.finalize_options(self) |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
48 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
49 |
openssl_include_dir = os.path.join(self.openssl, 'include') |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
50 |
- openssl_library_dir = os.path.join(self.openssl, 'lib') |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
51 |
+ #openssl_library_dir = os.path.join(self.openssl, 'lib') |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
52 |
+ openssl_library_dir = self.openssl |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
53 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
54 |
self.swig_opts = ['-I%s' % i for i in self.include_dirs + |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
55 |
[openssl_include_dir]] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
56 |
@@ -90,7 +103,7 @@ class _M2CryptoBuildExt(build_ext.build_ |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
57 |
# Someday distutils will be fixed and this won't be needed. |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
58 |
self.library_dirs += [os.path.join(self.openssl, 'bin')] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
59 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
60 |
- self.library_dirs += [os.path.join(self.openssl, openssl_library_dir)] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
61 |
+ self.library_dirs += [os.getenv("PYTHONLIB"), os.path.join(self.openssl, openssl_library_dir)] |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
62 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
63 |
def run(self): |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
64 |
'''Overloaded build_ext implementation to allow inplace=1 to work, |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
65 |
diff -pruN M2Crypto-0.22.6rc2.orig/SWIG/_ssl.i M2Crypto-0.22.6rc2/SWIG/_ssl.i |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
66 |
--- M2Crypto-0.22.6rc2.orig/SWIG/_ssl.i 2015-10-17 21:06:56.000000000 +0200 |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
67 |
+++ M2Crypto-0.22.6rc2/SWIG/_ssl.i 2015-10-20 18:48:24.835905739 +0200 |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
68 |
@@ -10,6 +10,9 @@ |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
69 |
/* $Id$ */ |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
70 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
71 |
%{ |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
72 |
+#define _WIN32_WINNT 0x0600 |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
73 |
+#include <winsock2.h> |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
74 |
+#undef _WIN32_WINNT |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
75 |
#include <pythread.h> |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
76 |
#include <limits.h> |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
77 |
#include <openssl/bio.h> |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
78 |
@@ -17,7 +19,6 @@ |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
79 |
#include <openssl/ssl.h> |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
80 |
#include <openssl/tls1.h> |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
81 |
#include <openssl/x509.h> |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
82 |
-#include <poll.h> |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
83 |
#include <sys/time.h> |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
84 |
%} |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
85 |
|
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
86 |
@@ -514,7 +515,7 @@ static int ssl_sleep_with_timeout(SSL *s |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
87 |
return -1; |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
88 |
} |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
89 |
Py_BEGIN_ALLOW_THREADS |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
90 |
- tmp = poll(&fd, 1, ms); |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
91 |
+ tmp = WSAPoll(&fd, 1, ms); |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
92 |
Py_END_ALLOW_THREADS |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
93 |
switch (tmp) { |
0a8caba627ac
fixed M2Crypto build
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
94 |
case 1: |