--- numpy-1.10.0/numpy/distutils/mingw32ccompiler.py.orig 2015-10-08 14:37:03.956864600 +0300 +++ numpy-1.10.0/numpy/distutils/mingw32ccompiler.py 2015-10-08 14:44:27.194536400 +0300 @@ -13,6 +13,7 @@ import sys import subprocess import re +import platform # Overwrite certain distutils.ccompiler functions: import numpy.distutils.ccompiler @@ -41,6 +42,11 @@ _START = re.compile(r'\[Ordinal/Name Pointer\] Table') _TABLE = re.compile(r'^\s+\[([\s*[0-9]*)\] ([a-zA-Z0-9_]*)') +def is_win64(): + return sys.platform == "win32" and platform.architecture()[0] == "64bit" +def is_win32(): + return sys.platform == "win32" and platform.architecture()[0] == "32bit" + # the same as cygwin plus some additional parameters class Mingw32CCompiler(distutils.cygwinccompiler.CygwinCCompiler): """ A modified MingW32 compiler compatible with an MSVC built Python. @@ -130,19 +136,35 @@ linker_exe='g++ -mno-cygwin', linker_so='g++ -mno-cygwin -shared') else: - # gcc-4 series releases do not support -mno-cygwin option i686 - # build needs '-mincoming-stack-boundary=2' due to ABI - # incompatibility to Win32 ABI - self.set_executables( - compiler='gcc -O2 -march=core2 -mtune=generic' - ' -mfpmath=sse -msse2' - ' -mincoming-stack-boundary=2 -Wall', - compiler_so='gcc -O2 -march=core2 -mtune=generic' - ' -mfpmath=sse -msse2' - ' -mincoming-stack-boundary=2 -Wall' - ' -Wstrict-prototypes', - linker_exe='g++ ', - linker_so='g++ -shared -Wl,-gc-sections -Wl,-s') + if is_win32(): + # gcc-4 series releases do not support -mno-cygwin option i686 + # build needs '-mincoming-stack-boundary=2' due to ABI + # incompatibility to Win32 ABI + self.set_executables( + compiler='gcc -O2 -march=core2 -mtune=generic' + ' -mfpmath=sse -msse2' + ' -mincoming-stack-boundary=2 -Wall', + compiler_so='gcc -O2 -march=core2 -mtune=generic' + ' -mfpmath=sse -msse2' + ' -mincoming-stack-boundary=2 -Wall' + ' -Wstrict-prototypes', + linker_exe='g++ ', + linker_so='g++ -shared -Wl,-gc-sections -Wl,-s') + else: + # gcc-4 series releases do not support -mno-cygwin option i686 + # build needs '-mincoming-stack-boundary=2' due to ABI + # incompatibility to Win32 ABI + self.set_executables( + compiler='gcc -O2 -march=x86-64 -DMS_WIN64 -mtune=generic' + ' -mfpmath=sse -msse2' + ' -Wall', + compiler_so='gcc -O2 -march=x86-64 -DMS_WIN64 -mtune=generic' + ' -mfpmath=sse -msse2' + ' -Wall' + ' -Wstrict-prototypes', + linker_exe='g++ ', + linker_so='g++ -shared -Wl,-gc-sections -Wl,-s') + # added for python2.3 support we can't pass it through set_executables # because pre 2.2 would fail self.compiler_cxx = ['g++']