From 352a6eee69f6f1da69a3c9b7e9bbd6f33ac49f4c Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Mon, 4 Jan 2016 01:11:22 +0000 Subject: [PATCH] numpy: Missed bits, remove _POSIX_BUILD It is a dependency back to our Python changes that makes our NumPy changes less palatable from an upstreaming perspective. Really, we want to know if Python has been built with GCC, and that is exactly what 'GCC' in sys.version determines. --- .../0001-detect-mingw-environment.patch | 17 +-- .../0002-fix-finding-python2.patch | 76 ++++++------- .../0003-gfortran-better-version-check.patch | 6 +- .../0004-fix-testsuite.patch | 2 +- ...stack-boundary-32bit-optimized-64bit.patch | 106 +++++++----------- .../0006-disable-visualcompaq-for-mingw.patch | 23 ++-- mingw-w64-python-numpy/PKGBUILD | 46 ++++---- 7 files changed, 118 insertions(+), 158 deletions(-) diff --git a/mingw-w64-python-numpy/0001-detect-mingw-environment.patch b/mingw-w64-python-numpy/0001-detect-mingw-environment.patch index 62bfc375a1..326ab058d0 100644 --- a/mingw-w64-python-numpy/0001-detect-mingw-environment.patch +++ b/mingw-w64-python-numpy/0001-detect-mingw-environment.patch @@ -1,20 +1,13 @@ ---- numpy-1.10.0/numpy/distutils/misc_util.py.orig 2015-10-08 15:20:14.760758300 +0300 -+++ numpy-1.10.0/numpy/distutils/misc_util.py 2015-10-08 15:21:22.951938500 +0300 -@@ -13,6 +13,7 @@ - - import distutils - from distutils.errors import DistutilsError -+from sysconfig import _POSIX_BUILD - try: - from threading import local as tlocal - except ImportError: -@@ -385,6 +386,10 @@ +diff -urN numpy-1.10.2.orig/numpy/distutils/misc_util.py numpy-1.10.2/numpy/distutils/misc_util.py +--- numpy-1.10.2.orig/numpy/distutils/misc_util.py 2016-01-04 00:38:06.433855300 +0000 ++++ numpy-1.10.2/numpy/distutils/misc_util.py 2016-01-04 00:40:27.356823400 +0000 +@@ -386,6 +386,10 @@ return True if os.environ.get('MSYSTEM', '')=='MINGW32': return True + if os.environ.get('MSYSTEM', '')=='MINGW64': + return True -+ if _POSIX_BUILD: ++ if 'GCC' in sys.version: + return True return False diff --git a/mingw-w64-python-numpy/0002-fix-finding-python2.patch b/mingw-w64-python-numpy/0002-fix-finding-python2.patch index d84aeb892d..f30e2af4ce 100644 --- a/mingw-w64-python-numpy/0002-fix-finding-python2.patch +++ b/mingw-w64-python-numpy/0002-fix-finding-python2.patch @@ -1,52 +1,52 @@ ---- numpy-py2-1.10.0/numpy/distutils/mingw32ccompiler.py 2014-02-19 01:07:43.787600000 +0400 -+++ numpy-1.10.0/numpy/distutils/mingw32ccompiler.py 2014-02-19 01:26:21.634200000 +0400 -@@ -91,30 +91,6 @@ - stdout=subprocess.PIPE) - out_string = p.stdout.read() - p.stdout.close() -- -- # Before build with MinGW-W64 generate the python import library -- # with gendef and dlltool according to the MingW-W64 FAQ. -- # Use the MinGW-W64 provided msvc runtime import libraries. -- # Don't call build_import_library() and build_msvcr_library. -- -- if 'MinGW-W64' not in str(out_string): -- -- # **changes: eric jones 4/11/01 -- # 1. Check for import library on Windows. Build if it doesn't -- # exist. -- build_import_library() -- -- # Check for custom msvc runtime library on Windows. Build if it -- # doesn't exist. -- msvcr_success = build_msvcr_library() -- msvcr_dbg_success = build_msvcr_library(debug=True) -- if msvcr_success or msvcr_dbg_success: -- # add preprocessor statement for using customized msvcr lib -- self.define_macro('NPY_MINGW_USE_CUSTOM_MSVCR') +diff -urN numpy-1.10.2.orig/numpy/distutils/mingw32ccompiler.py numpy-1.10.2/numpy/distutils/mingw32ccompiler.py +--- numpy-1.10.2.orig/numpy/distutils/mingw32ccompiler.py 2015-11-12 20:04:51.000000000 +0000 ++++ numpy-1.10.2/numpy/distutils/mingw32ccompiler.py 2016-01-02 03:35:27.818684200 +0000 +@@ -87,21 +87,23 @@ + elif self.linker_dll == 'gcc': + self.linker = 'g++' + +- # **changes: eric jones 4/11/01 +- # 1. Check for import library on Windows. Build if it doesn't exist. ++ if not 'GCC' in sys.version: + +- build_import_library() ++ # **changes: eric jones 4/11/01 ++ # 1. Check for import library on Windows. Build if it doesn't exist. + +- # Check for custom msvc runtime library on Windows. Build if it doesn't exist. +- msvcr_success = build_msvcr_library() +- msvcr_dbg_success = build_msvcr_library(debug=True) +- if msvcr_success or msvcr_dbg_success: +- # add preprocessor statement for using customized msvcr lib +- self.define_macro('NPY_MINGW_USE_CUSTOM_MSVCR') - - # Define the MSVC version as hint for MinGW - msvcr_version = '0x%03i0' % int(msvc_runtime_library().lstrip('msvcr')) - self.define_macro('__MSVCRT_VERSION__', msvcr_version) ++ build_import_library() ++ ++ # Check for custom msvc runtime library on Windows. Build if it doesn't exist. ++ msvcr_success = build_msvcr_library() ++ msvcr_dbg_success = build_msvcr_library(debug=True) ++ if msvcr_success or msvcr_dbg_success: ++ # add preprocessor statement for using customized msvcr lib ++ self.define_macro('NPY_MINGW_USE_CUSTOM_MSVCR') ++ ++ # Define the MSVC version as hint for MinGW ++ msvcr_version = '0x%03i0' % int(msvc_runtime_library().lstrip('msvcr')) ++ self.define_macro('__MSVCRT_VERSION__', msvcr_version) # MS_WIN64 should be defined when building for amd64 on windows, # but python headers define it only for MS compilers, which has all ---- numpy-py2-1.10.0/numpy/distutils/fcompiler/gnu.py 2014-02-19 01:27:32.252800000 +0400 -+++ numpy-1.10.0/numpy/distutils/fcompiler/gnu.py 2014-02-19 01:31:29.804200000 +0400 -@@ -6,6 +6,7 @@ - import warnings - import platform - import tempfile -+from sysconfig import _POSIX_BUILD - from subprocess import Popen, PIPE, STDOUT - - from numpy.distutils.cpuinfo import cpu -@@ -103,7 +103,7 @@ +diff -urN numpy-1.10.2.orig/numpy/distutils/fcompiler/gnu.py numpy-1.10.2/numpy/distutils/fcompiler/gnu.py +--- numpy-1.10.2.orig/numpy/distutils/fcompiler/gnu.py 2015-11-12 20:04:51.000000000 +0000 ++++ numpy-1.10.2/numpy/distutils/fcompiler/gnu.py 2016-01-02 03:36:30.528498700 +0000 +@@ -101,7 +101,7 @@ pic_flags = ['-fPIC'] # use -mno-cygwin for g77 when Python is not Cygwin-Python - if sys.platform == 'win32': -+ if sys.platform == 'win32' and not _POSIX_BUILD: ++ if sys.platform == 'win32' and not 'GCC' in sys.version: for key in ['version_cmd', 'compiler_f77', 'linker_so', 'linker_exe']: executables[key].append('-mno-cygwin') diff --git a/mingw-w64-python-numpy/0003-gfortran-better-version-check.patch b/mingw-w64-python-numpy/0003-gfortran-better-version-check.patch index ceb1c6d685..2f7efa78a9 100644 --- a/mingw-w64-python-numpy/0003-gfortran-better-version-check.patch +++ b/mingw-w64-python-numpy/0003-gfortran-better-version-check.patch @@ -1,6 +1,6 @@ ---- numpy-1.10.0/numpy/distutils/fcompiler/gnu.py.orig 2014-08-28 15:49:10.742000000 +0400 -+++ numpy-1.10.0/numpy/distutils/fcompiler/gnu.py 2014-08-28 15:50:44.903600000 +0400 -@@ -63,7 +63,7 @@ +--- numpy-1.10.2/numpy/distutils/fcompiler/gnu.py.orig 2014-08-28 15:49:10.742000000 +0400 ++++ numpy-1.10.2/numpy/distutils/fcompiler/gnu.py 2014-08-28 15:50:44.903600000 +0400 +@@ -60,7 +60,7 @@ m = re.search(r'GNU Fortran\s+95.*?([0-9-.]+)', version_string) if m: return ('gfortran', m.group(1)) diff --git a/mingw-w64-python-numpy/0004-fix-testsuite.patch b/mingw-w64-python-numpy/0004-fix-testsuite.patch index 2b19f8703b..f1f95e94e3 100644 --- a/mingw-w64-python-numpy/0004-fix-testsuite.patch +++ b/mingw-w64-python-numpy/0004-fix-testsuite.patch @@ -1,6 +1,6 @@ --- numpy-1.9.0/numpy/core/tests/test_multiarray.py.orig 2014-09-07 10:57:48.000000000 +0200 +++ numpy-1.9.0/numpy/core/tests/test_multiarray.py 2014-09-22 20:42:55.177362800 +0200 -@@ -2691,7 +2691,7 @@ +@@ -3367,7 +3367,7 @@ """Test workarounds for 32-bit limited fwrite, fseek, and ftell calls in windows. These normally would hang doing something like this. See http://projects.scipy.org/numpy/ticket/1660""" diff --git a/mingw-w64-python-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch b/mingw-w64-python-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch index 444ddf82d4..f17aabb73f 100644 --- a/mingw-w64-python-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch +++ b/mingw-w64-python-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch @@ -1,71 +1,41 @@ ---- 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', +diff -urN numpy-1.10.2.orig/numpy/distutils/mingw32ccompiler.py numpy-1.10.2/numpy/distutils/mingw32ccompiler.py +--- numpy-1.10.2.orig/numpy/distutils/mingw32ccompiler.py 2016-01-02 03:57:55.666397000 +0000 ++++ numpy-1.10.2/numpy/distutils/mingw32ccompiler.py 2016-01-02 03:54:51.695638100 +0000 +@@ -120,10 +120,12 @@ + else: + # gcc-4 series releases do not support -mno-cygwin option + self.set_executables( +- compiler='gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall', +- compiler_so='gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes', +- linker_exe='gcc -g', +- linker_so='gcc -g -shared') ++ compiler='gcc -march=x86-64 -mtune=generic -DMS_WIN64' ++ ' -O2 -msse2 -Wall', ++ compiler_so='gcc -march=x86-64 -mtune=generic -DMS_WIN64' ++ ' -O2 -msse2 -Wall -Wstrict-prototypes', ++ linker_exe='gcc', ++ linker_so='gcc -shared -Wl,-gc-sections -Wl,-s') + else: + if self.gcc_version <= "3.0.0": + self.set_executables( +@@ -142,10 +144,16 @@ 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 + # gcc-4 series releases do not support -mno-cygwin option +- self.set_executables(compiler='gcc -O2 -Wall', +- compiler_so='gcc -O2 -Wall -Wstrict-prototypes', +- linker_exe='g++ ', +- linker_so='g++ -shared') ++ 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') + # added for python2.3 support + # we can't pass it through set_executables because pre 2.2 would fail self.compiler_cxx = ['g++'] diff --git a/mingw-w64-python-numpy/0006-disable-visualcompaq-for-mingw.patch b/mingw-w64-python-numpy/0006-disable-visualcompaq-for-mingw.patch index 0f61b4c558..183e0a3c75 100644 --- a/mingw-w64-python-numpy/0006-disable-visualcompaq-for-mingw.patch +++ b/mingw-w64-python-numpy/0006-disable-visualcompaq-for-mingw.patch @@ -1,24 +1,19 @@ ---- numpy-1.10.0/numpy/distutils/fcompiler/compaq.py.orig 2015-10-08 14:58:05.495698100 +0300 -+++ numpy-1.10.0/numpy/distutils/fcompiler/compaq.py 2015-10-08 14:59:02.712975800 +0300 -@@ -4,13 +4,14 @@ - - import os - import sys -+from sysconfig import _POSIX_BUILD - - from numpy.distutils.fcompiler import FCompiler - from numpy.distutils.compat import get_exception +diff -urN numpy-1.10.2.orig/numpy/distutils/fcompiler/compaq.py numpy-1.10.2/numpy/distutils/fcompiler/compaq.py +--- numpy-1.10.2.orig/numpy/distutils/fcompiler/compaq.py 2016-01-04 00:44:11.333672900 +0000 ++++ numpy-1.10.2/numpy/distutils/fcompiler/compaq.py 2016-01-04 00:46:47.573905500 +0000 +@@ -10,7 +10,7 @@ from distutils.errors import DistutilsPlatformError compilers = ['CompaqFCompiler'] -if os.name != 'posix' or sys.platform[:6] == 'cygwin' : -+if (os.name != 'posix' or sys.platform[:6] == 'cygwin') and not _POSIX_BUILD : ++if (os.name != 'posix' or sys.platform[:6] == 'cygwin') and not 'GCC' in sys.version: # Otherwise we'd get a false positive on posix systems with # case-insensitive filesystems (like darwin), because we'll pick # up /bin/df ---- numpy-1.10.0/numpy/distutils/msvccompiler.py.orig 2015-10-08 15:14:33.374900300 +0300 -+++ numpy-1.10.0/numpy/distutils/msvccompiler.py 2015-10-08 15:14:40.886149100 +0300 -@@ -10,7 +10,7 @@ +diff -urN numpy-1.10.2.orig/numpy/distutils/msvccompiler.py numpy-1.10.2/numpy/distutils/msvccompiler.py +--- numpy-1.10.2.orig/numpy/distutils/msvccompiler.py 2016-01-04 00:44:11.283672800 +0000 ++++ numpy-1.10.2/numpy/distutils/msvccompiler.py 2016-01-04 00:44:31.151202200 +0000 +@@ -14,7 +14,7 @@ def initialize(self, plat_name=None): environ_lib = os.getenv('lib') environ_include = os.getenv('include') diff --git a/mingw-w64-python-numpy/PKGBUILD b/mingw-w64-python-numpy/PKGBUILD index 6fd42536f1..d8c6c1ac29 100644 --- a/mingw-w64-python-numpy/PKGBUILD +++ b/mingw-w64-python-numpy/PKGBUILD @@ -4,8 +4,8 @@ _realname=numpy pkgbase=mingw-w64-python-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}") -pkgver=1.10.1 -pkgrel=1 +pkgver=1.10.2 +pkgrel=2 pkgdesc="Scientific tools for Python (mingw-w64)" arch=('any') license=('BSD') @@ -16,30 +16,32 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-openblas" "${MINGW_PACKAGE_PREFIX}-python2-setuptools" "${MINGW_PACKAGE_PREFIX}-python2-nose" "${MINGW_PACKAGE_PREFIX}-gcc-fortran") -options=('staticlibs' 'strip' '!debug') +#options=('!strip' 'debug') source=(http://downloads.sourceforge.net/numpy/${_realname}-${pkgver}.tar.gz - detect-mingw-environment.patch - fix-finding-python2.patch - gfortran-better-version-check.patch - fix-testsuite.patch - mincoming-stack-boundary-only-32bit.patch - disable-visualcompaq-for-mingw.patch) -md5sums=('3fed2b50906bc19018cec5fa26168aa5' - 'e2c63f8472ea162d442beb9f05441f9d' - 'c9e172056f09052d17cf8162b9cf5b3a' - 'f4a729b29154f1fde5ffe911beef5984' - '59c4e9b71cc7b297099b4430bcb7ea28' - 'abc51ef8452d30fd83c69eb183425b16' - 'c4fd82349f2c2c9352ae666b91b7ceea') + 0001-detect-mingw-environment.patch + 0002-fix-finding-python2.patch + 0003-gfortran-better-version-check.patch + 0004-fix-testsuite.patch + 0005-mincoming-stack-boundary-32bit-optimized-64bit.patch + 0006-disable-visualcompaq-for-mingw.patch) +md5sums=('816518282f1617636aaf26e7cd9b127b' + 'ee1e86a6e0d56801172501cf5804c6a7' + 'f36c1e2c52810daf4a572e922873f876' + 'e09574eed1940cd2e39a5fe1bb78bc73' + 'decfa557f219a4581d1b53164c0868f9' + '4eb5373f73b4287379c3b992cfcc239b' + '19c3a59a0a7f50ba288d9502fa079e71') prepare() { cd ${_realname}-${pkgver} - patch -Np1 -i ${srcdir}/detect-mingw-environment.patch - patch -Np1 -i ${srcdir}/fix-finding-python2.patch - patch -Np1 -i ${srcdir}/gfortran-better-version-check.patch - patch -Np1 -i ${srcdir}/fix-testsuite.patch - patch -Np1 -i ${srcdir}/mincoming-stack-boundary-only-32bit.patch - patch -Np1 -i ${srcdir}/disable-visualcompaq-for-mingw.patch + patch -Np1 -i ${srcdir}/0001-detect-mingw-environment.patch + patch -Np1 -i ${srcdir}/0002-fix-finding-python2.patch + patch -Np1 -i ${srcdir}/0003-gfortran-better-version-check.patch + patch -Np1 -i ${srcdir}/0004-fix-testsuite.patch + # Note, -mincoming-stack-boundary (and the other flags set) doesn't get used except + # in a test compilation, AFAICT. + patch -Np1 -i ${srcdir}/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch + patch -Np1 -i ${srcdir}/0006-disable-visualcompaq-for-mingw.patch cd .. cp -a numpy-${pkgver} ${_realname}-py2-${CARCH}