edouard@34: diff -pruN M2Crypto-0.22.6rc2.orig/setup.py M2Crypto-0.22.6rc2/setup.py edouard@34: --- M2Crypto-0.22.6rc2.orig/setup.py 2015-10-19 14:34:45.000000000 +0200 edouard@34: +++ M2Crypto-0.22.6rc2/setup.py 2015-10-20 18:48:14.231865096 +0200 edouard@34: @@ -28,6 +28,23 @@ except ImportError: edouard@34: from distutils.core import Extension edouard@34: from distutils.file_util import copy_file edouard@34: edouard@34: +# DISTUTILS HOT PATCH edouard@34: +from distutils.cygwinccompiler import Mingw32CCompiler edouard@34: +_old_mw32_init=Mingw32CCompiler.__init__ edouard@34: +def Mingw32CCompInit(self, *args, **kwargs): edouard@34: + _old_mw32_init(self, *args, **kwargs) edouard@34: + for n in ["compiler", "compiler_so", "compiler_cxx", "linker_so"] : edouard@34: + l = getattr(self,n) edouard@34: + pfx = os.getenv("MINGCCPREFIX") edouard@34: + l[0] = pfx+l[0] edouard@34: + self.linker_so.insert(1, "-static-libgcc") edouard@34: +Mingw32CCompiler.__init__ = Mingw32CCompInit edouard@34: + edouard@34: +import distutils edouard@34: +distutils.sysconfig.get_python_inc = lambda *x,**y : os.getenv("PYTHONINC") edouard@34: +distutils.cygwinccompiler.get_msvcr = lambda *x,**y : [] edouard@34: +distutils.util.get_platform = lambda *x,**y : "win32" edouard@34: +distutils.sysconfig._init_nt() edouard@34: edouard@34: class _M2CryptoBuildExt(build_ext.build_ext): edouard@34: '''Specialization of build_ext to enable swig_opts to inherit any edouard@34: @@ -40,14 +57,9 @@ class _M2CryptoBuildExt(build_ext.build_ edouard@34: edouard@34: build_ext.build_ext.initialize_options(self) edouard@34: edouard@34: - # openssl is the attribute corresponding to openssl directory prefix edouard@34: - # command line option edouard@34: - if os.name == 'nt': edouard@34: - self.libraries = ['ssleay32', 'libeay32'] edouard@34: - self.openssl = 'c:\\pkg' edouard@34: - else: edouard@34: - self.libraries = ['ssl', 'crypto'] edouard@34: - self.openssl = '/usr' edouard@34: + self.openssl = "mhooooo" edouard@34: + self.libraries = ['ssleay32', 'libeay32'] edouard@34: + self.libraries += ['ws2_32', 'crypt32', 'gdi32', "python27", "winstrm"] edouard@34: edouard@34: def finalize_options(self): edouard@34: '''Overloaded build_ext implementation to append custom openssl edouard@34: @@ -56,7 +68,8 @@ class _M2CryptoBuildExt(build_ext.build_ edouard@34: build_ext.build_ext.finalize_options(self) edouard@34: edouard@34: openssl_include_dir = os.path.join(self.openssl, 'include') edouard@34: - openssl_library_dir = os.path.join(self.openssl, 'lib') edouard@34: + #openssl_library_dir = os.path.join(self.openssl, 'lib') edouard@34: + openssl_library_dir = self.openssl edouard@34: edouard@34: self.swig_opts = ['-I%s' % i for i in self.include_dirs + edouard@34: [openssl_include_dir]] edouard@34: @@ -90,7 +103,7 @@ class _M2CryptoBuildExt(build_ext.build_ edouard@34: # Someday distutils will be fixed and this won't be needed. edouard@34: self.library_dirs += [os.path.join(self.openssl, 'bin')] edouard@34: edouard@34: - self.library_dirs += [os.path.join(self.openssl, openssl_library_dir)] edouard@34: + self.library_dirs += [os.getenv("PYTHONLIB"), os.path.join(self.openssl, openssl_library_dir)] edouard@34: edouard@34: def run(self): edouard@34: '''Overloaded build_ext implementation to allow inplace=1 to work, edouard@34: diff -pruN M2Crypto-0.22.6rc2.orig/SWIG/_ssl.i M2Crypto-0.22.6rc2/SWIG/_ssl.i edouard@34: --- M2Crypto-0.22.6rc2.orig/SWIG/_ssl.i 2015-10-17 21:06:56.000000000 +0200 edouard@34: +++ M2Crypto-0.22.6rc2/SWIG/_ssl.i 2015-10-20 18:48:24.835905739 +0200 edouard@34: @@ -10,6 +10,9 @@ edouard@34: /* $Id$ */ edouard@34: edouard@34: %{ edouard@34: +#define _WIN32_WINNT 0x0600 edouard@34: +#include edouard@34: +#undef _WIN32_WINNT edouard@34: #include edouard@34: #include edouard@34: #include edouard@34: @@ -17,7 +19,6 @@ edouard@34: #include edouard@34: #include edouard@34: #include edouard@34: -#include edouard@34: #include edouard@34: %} edouard@34: edouard@34: @@ -514,7 +515,7 @@ static int ssl_sleep_with_timeout(SSL *s edouard@34: return -1; edouard@34: } edouard@34: Py_BEGIN_ALLOW_THREADS edouard@34: - tmp = poll(&fd, 1, ms); edouard@34: + tmp = WSAPoll(&fd, 1, ms); edouard@34: Py_END_ALLOW_THREADS edouard@34: switch (tmp) { edouard@34: case 1: