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