diff --git a/mingw-w64-python-numpy/0001-detect-mingw-environment.patch b/mingw-w64-python2-numpy/0001-detect-mingw-environment.patch similarity index 100% rename from mingw-w64-python-numpy/0001-detect-mingw-environment.patch rename to mingw-w64-python2-numpy/0001-detect-mingw-environment.patch diff --git a/mingw-w64-python-numpy/0002-fix-finding-python2.patch b/mingw-w64-python2-numpy/0002-fix-finding-python2.patch similarity index 100% rename from mingw-w64-python-numpy/0002-fix-finding-python2.patch rename to mingw-w64-python2-numpy/0002-fix-finding-python2.patch diff --git a/mingw-w64-python-numpy/0003-gfortran-better-version-check.patch b/mingw-w64-python2-numpy/0003-gfortran-better-version-check.patch similarity index 100% rename from mingw-w64-python-numpy/0003-gfortran-better-version-check.patch rename to mingw-w64-python2-numpy/0003-gfortran-better-version-check.patch diff --git a/mingw-w64-python-numpy/0004-fix-testsuite.patch b/mingw-w64-python2-numpy/0004-fix-testsuite.patch similarity index 100% rename from mingw-w64-python-numpy/0004-fix-testsuite.patch rename to mingw-w64-python2-numpy/0004-fix-testsuite.patch diff --git a/mingw-w64-python-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch b/mingw-w64-python2-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch similarity index 100% rename from mingw-w64-python-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch rename to mingw-w64-python2-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch diff --git a/mingw-w64-python-numpy/0006-disable-visualcompaq-for-mingw.patch b/mingw-w64-python2-numpy/0006-disable-visualcompaq-for-mingw.patch similarity index 100% rename from mingw-w64-python-numpy/0006-disable-visualcompaq-for-mingw.patch rename to mingw-w64-python2-numpy/0006-disable-visualcompaq-for-mingw.patch diff --git a/mingw-w64-python-numpy/0007-disable-64bit-experimental-warning.patch b/mingw-w64-python2-numpy/0007-disable-64bit-experimental-warning.patch similarity index 100% rename from mingw-w64-python-numpy/0007-disable-64bit-experimental-warning.patch rename to mingw-w64-python2-numpy/0007-disable-64bit-experimental-warning.patch diff --git a/mingw-w64-python2-numpy/0008-mingw-gcc-doesnt-support-visibility.patch b/mingw-w64-python2-numpy/0008-mingw-gcc-doesnt-support-visibility.patch new file mode 100644 index 0000000000..abda77bd10 --- /dev/null +++ b/mingw-w64-python2-numpy/0008-mingw-gcc-doesnt-support-visibility.patch @@ -0,0 +1,11 @@ +--- numpy-1.17.0/numpy/core/setup.py.orig 2019-08-03 12:29:51.332524800 +0300 ++++ numpy-1.17.0/numpy/core/setup.py 2019-08-03 12:31:17.294441500 +0300 +@@ -387,7 +387,7 @@ + """Return the define value to use for NPY_VISIBILITY_HIDDEN (may be empty + string).""" + hide = '__attribute__((visibility("hidden")))' +- if config.check_gcc_function_attribute(hide, 'hideme'): ++ if config.check_gcc_function_attribute(hide, 'hideme') and sys.platform != "win32": + return hide + else: + return '' diff --git a/mingw-w64-python2-numpy/0009-disable-old-mingw-stuff.patch b/mingw-w64-python2-numpy/0009-disable-old-mingw-stuff.patch new file mode 100644 index 0000000000..3166312d44 --- /dev/null +++ b/mingw-w64-python2-numpy/0009-disable-old-mingw-stuff.patch @@ -0,0 +1,11 @@ +--- numpy-1.17.0/numpy/core/include/numpy/npy_common.h.orig 2019-08-03 12:42:33.905141400 +0300 ++++ numpy-1.17.0/numpy/core/include/numpy/npy_common.h 2019-08-03 12:43:02.271763900 +0300 +@@ -160,7 +160,7 @@ + #include + + /* mingw based on 3.4.5 has lseek but not ftell/fseek */ +-#if defined(__MINGW32__) || defined(__MINGW64__) ++#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) + extern int __cdecl _fseeki64(FILE *, long long, int); + extern long long __cdecl _ftelli64(FILE *); + #endif diff --git a/mingw-w64-python-numpy/PKGBUILD b/mingw-w64-python2-numpy/PKGBUILD similarity index 64% rename from mingw-w64-python-numpy/PKGBUILD rename to mingw-w64-python2-numpy/PKGBUILD index 0f2223c482..c90ac935b1 100644 --- a/mingw-w64-python-numpy/PKGBUILD +++ b/mingw-w64-python2-numpy/PKGBUILD @@ -4,19 +4,20 @@ _realname=numpy pkgbase=mingw-w64-python-${_realname} -pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}") +pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}") pkgver=1.16.4 -pkgrel=1 +pkgrel=2 pkgdesc="Scientific tools for Python (mingw-w64)" arch=('any') license=('BSD') url="http://www.numpy.org/" makedepends=("${MINGW_PACKAGE_PREFIX}-openblas" - "${MINGW_PACKAGE_PREFIX}-python3-setuptools" - "${MINGW_PACKAGE_PREFIX}-python3-pytest" "${MINGW_PACKAGE_PREFIX}-python2-setuptools" "${MINGW_PACKAGE_PREFIX}-python2-pytest" "${MINGW_PACKAGE_PREFIX}-gcc-fortran") +depends=("${MINGW_PACKAGE_PREFIX}-openblas" + "${MINGW_PACKAGE_PREFIX}-python2") +optdepends=("${MINGW_PACKAGE_PREFIX}-python2-pytest: testsuite") #options=('!strip' 'debug') source=(https://github.com/numpy/numpy/releases/download/v${pkgver}/${_realname}-${pkgver}.tar.gz 0001-detect-mingw-environment.patch @@ -25,7 +26,9 @@ source=(https://github.com/numpy/numpy/releases/download/v${pkgver}/${_realname} 0004-fix-testsuite.patch 0005-mincoming-stack-boundary-32bit-optimized-64bit.patch 0006-disable-visualcompaq-for-mingw.patch - 0007-disable-64bit-experimental-warning.patch) + 0007-disable-64bit-experimental-warning.patch + 0008-mingw-gcc-doesnt-support-visibility.patch + 0009-disable-old-mingw-stuff.patch) sha256sums=('a3bccb70ad94091a5b9e2469fabd41ac877c140a6828c2022e35560a2ec0346c' '173e9020eb88a9b281180024ad0f137f86f893e2099693693e42a5bf5944381a' '140c23c214cae880833380e8479e4ce45c8439b22b1432d73ff0cc2cd58da886' @@ -33,7 +36,9 @@ sha256sums=('a3bccb70ad94091a5b9e2469fabd41ac877c140a6828c2022e35560a2ec0346c' '720fbba58ac6a73e9476266d033ada9bdc809ec5a6c3cd518fc2f1efec34c3f9' '3cc0176440f4f474612cb3c28b94d0846b74b508631b399aec0a5c0943c4cf1a' 'e8f2c52131e79a4e36c98f499efa85bc56254e577fae11ebce0093422114a306' - 'c1114a027fc797bb6c5c6f7b3044fa853b9e9263555088b4b2b12bdb77baefd5') + 'c1114a027fc797bb6c5c6f7b3044fa853b9e9263555088b4b2b12bdb77baefd5' + '9204922151a7459ed0ecb5d7379fc16bdee6b8c74c925c575667b0ac6ff6441a' + 'a089bb11db5110903dba987c2ffb0ab9468414c5828bdc18809b1baeebe61b92') prepare() { cd ${_realname}-${pkgver} @@ -46,10 +51,11 @@ prepare() { patch -Np1 -i ${srcdir}/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch patch -Np1 -i ${srcdir}/0006-disable-visualcompaq-for-mingw.patch patch -Np1 -i ${srcdir}/0007-disable-64bit-experimental-warning.patch + patch -Np1 -i ${srcdir}/0008-mingw-gcc-doesnt-support-visibility.patch + patch -Np1 -i ${srcdir}/0009-disable-old-mingw-stuff.patch cd .. cp -a ${_realname}-${pkgver} ${_realname}-py2-${CARCH} - cp -a ${_realname}-${pkgver} ${_realname}-py3-${CARCH} cd ${_realname}-py2-${CARCH} sed -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/python2|" \ @@ -62,21 +68,12 @@ build() { export ATLAS=None export LDFLAGS="$LDFLAGS -shared" - echo "Building Python2" cd ${_realname}-py2-${CARCH} MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ ${MINGW_PREFIX}/bin/python2 setup.py config_fc --fcompiler=gnu95 build - - echo "Building Python3" - cd ../${_realname}-py3-${CARCH} - MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ - ${MINGW_PREFIX}/bin/python3 setup.py config_fc --fcompiler=gnu95 build } -package_python2-numpy() { - depends=("${MINGW_PACKAGE_PREFIX}-openblas" "${MINGW_PACKAGE_PREFIX}-python2") - optdepends=("${MINGW_PACKAGE_PREFIX}-python2-pytest: testsuite") - +package() { _pyver=$(${MINGW_PREFIX}/bin/python2 -c "import sys;sys.stdout.write('.'.join(map(str, sys.version_info[:2])))") export ATLAS=None @@ -107,46 +104,3 @@ package_python2-numpy() { sed -e "s|${_mingw_prefix}/bin/|/usr/bin/env |g" -i ${_f} done } - -package_python3-numpy() { - depends=("${MINGW_PACKAGE_PREFIX}-openblas" "${MINGW_PACKAGE_PREFIX}-python3") - optdepends=("${MINGW_PACKAGE_PREFIX}-python3-pytest: testsuite") - - _pyver=$(${MINGW_PREFIX}/bin/python3 -c "import sys;sys.stdout.write('.'.join(map(str, sys.version_info[:2])))") - _pyinc=${_pyver}m - - export ATLAS=None - export LDFLAGS="$LDFLAGS -shared" - - cd ${_realname}-py3-${CARCH} - MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ - ${MINGW_PREFIX}/bin/python3 setup.py config_fc --fcompiler=gnu95 install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1 - - install -m755 -d "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}" - install -m644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/" - - install -m755 -d "${pkgdir}${MINGW_PREFIX}/include/python${_pyinc}" - cp -rf ${pkgdir}${MINGW_PREFIX}/lib/python${_pyver}/site-packages/${_realname}/core/include/${_realname} "${pkgdir}${MINGW_PREFIX}/include/python${_pyinc}/" - - # fix python command in files - local _mingw_prefix=$(cygpath -am ${MINGW_PREFIX}) - for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do - sed -e "s|${_mingw_prefix}/bin/|/usr/bin/env |g" -i ${_f} - done -} - -package_mingw-w64-i686-python2-numpy() { - package_python2-numpy -} - -package_mingw-w64-i686-python3-numpy() { - package_python3-numpy -} - -package_mingw-w64-x86_64-python2-numpy() { - package_python2-numpy -} - -package_mingw-w64-x86_64-python3-numpy() { - package_python3-numpy -} diff --git a/mingw-w64-python3-numpy/0001-detect-mingw-environment.patch b/mingw-w64-python3-numpy/0001-detect-mingw-environment.patch new file mode 100644 index 0000000000..047ccd7825 --- /dev/null +++ b/mingw-w64-python3-numpy/0001-detect-mingw-environment.patch @@ -0,0 +1,14 @@ +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 +@@ -396,6 +396,10 @@ + return True + if os.environ.get('MSYSTEM', '')=='MINGW32': + return True ++ if os.environ.get('MSYSTEM', '')=='MINGW64': ++ return True ++ if 'GCC' in sys.version: ++ return True + return False + + def msvc_runtime_library(): diff --git a/mingw-w64-python3-numpy/0002-fix-finding-python2.patch b/mingw-w64-python3-numpy/0002-fix-finding-python2.patch new file mode 100644 index 0000000000..ca8dd88f3a --- /dev/null +++ b/mingw-w64-python3-numpy/0002-fix-finding-python2.patch @@ -0,0 +1,54 @@ +diff -urN numpy-1.13.0.orig/numpy/distutils/mingw32ccompiler.py numpy-1.13.0/numpy/distutils/mingw32ccompiler.py +--- numpy-1.13.0.orig/numpy/distutils/mingw32ccompiler.py 2015-11-12 20:04:51.000000000 +0000 ++++ numpy-1.13.0/numpy/distutils/mingw32ccompiler.py 2016-01-02 03:35:27.818684200 +0000 +@@ -97,22 +97,24 @@ + 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 = msvc_runtime_version() +- if msvcr_version: +- self.define_macro('__MSVCRT_VERSION__', '0x%04i' % 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 = msvc_runtime_version() ++ if msvcr_version: ++ self.define_macro('__MSVCRT_VERSION__', '0x%04i' % 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 +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 +@@ -108,7 +108,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 '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-python3-numpy/0003-gfortran-better-version-check.patch b/mingw-w64-python3-numpy/0003-gfortran-better-version-check.patch new file mode 100644 index 0000000000..45777e6b15 --- /dev/null +++ b/mingw-w64-python3-numpy/0003-gfortran-better-version-check.patch @@ -0,0 +1,11 @@ +--- 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 +@@ -63,7 +63,7 @@ + return ('gfortran', m.group(1)) + else: + # Output probably from --version, try harder: +- m = re.search(r'GNU Fortran\s+95.*?([0-9-.]+)', version_string) ++ m = re.search(r'GNU Fortran.*?\-?(\d*(?:\.\d+)+)', version_string) + if m: + return ('gfortran', m.group(1)) + m = re.search( diff --git a/mingw-w64-python3-numpy/0004-fix-testsuite.patch b/mingw-w64-python3-numpy/0004-fix-testsuite.patch new file mode 100644 index 0000000000..7bcdad5af0 --- /dev/null +++ b/mingw-w64-python3-numpy/0004-fix-testsuite.patch @@ -0,0 +1,11 @@ +--- 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 +@@ -4708,7 +4708,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""" +- if sys.platform != 'win32': ++ if sys.platform != 'win32' or "MSYSTEM" in os.environ: + return + try: + # before workarounds, only up to 2**32-1 worked diff --git a/mingw-w64-python3-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch b/mingw-w64-python3-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch new file mode 100644 index 0000000000..5def1f1cb1 --- /dev/null +++ b/mingw-w64-python3-numpy/0005-mincoming-stack-boundary-32bit-optimized-64bit.patch @@ -0,0 +1,41 @@ +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 +@@ -131,10 +131,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( +@@ -155,10 +155,16 @@ + linker_so='g++ -mno-cygwin -shared') + else: + # 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-python3-numpy/0006-disable-visualcompaq-for-mingw.patch b/mingw-w64-python3-numpy/0006-disable-visualcompaq-for-mingw.patch new file mode 100644 index 0000000000..ea04bc9a46 --- /dev/null +++ b/mingw-w64-python3-numpy/0006-disable-visualcompaq-for-mingw.patch @@ -0,0 +1,12 @@ +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 '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 diff --git a/mingw-w64-python3-numpy/0007-disable-64bit-experimental-warning.patch b/mingw-w64-python3-numpy/0007-disable-64bit-experimental-warning.patch new file mode 100644 index 0000000000..44e891b040 --- /dev/null +++ b/mingw-w64-python3-numpy/0007-disable-64bit-experimental-warning.patch @@ -0,0 +1,18 @@ +diff -urN numpy-1.10.2.orig/numpy/core/src/multiarray/multiarraymodule.c numpy-1.10.2/numpy/core/src/multiarray/multiarraymodule.c +--- numpy-1.10.2.orig/numpy/core/src/multiarray/multiarraymodule.c 2015-11-12 13:04:51.000000000 -0700 ++++ numpy-1.10.2/numpy/core/src/multiarray/multiarraymodule.c 2016-03-30 06:20:16.617824700 -0700 +@@ -4556,15 +4556,6 @@ + goto err; + } + +-#if defined(MS_WIN64) && defined(__GNUC__) +- PyErr_WarnEx(PyExc_Warning, +- "Numpy built with MINGW-W64 on Windows 64 bits is experimental, " \ +- "and only available for \n" \ +- "testing. You are advised not to use it for production. \n\n" \ +- "CRASHES ARE TO BE EXPECTED - PLEASE REPORT THEM TO NUMPY DEVELOPERS", +- 1); +-#endif +- + /* Initialize access to the PyDateTime API */ + numpy_pydatetime_import(); diff --git a/mingw-w64-python3-numpy/0008-mingw-gcc-doesnt-support-visibility.patch b/mingw-w64-python3-numpy/0008-mingw-gcc-doesnt-support-visibility.patch new file mode 100644 index 0000000000..abda77bd10 --- /dev/null +++ b/mingw-w64-python3-numpy/0008-mingw-gcc-doesnt-support-visibility.patch @@ -0,0 +1,11 @@ +--- numpy-1.17.0/numpy/core/setup.py.orig 2019-08-03 12:29:51.332524800 +0300 ++++ numpy-1.17.0/numpy/core/setup.py 2019-08-03 12:31:17.294441500 +0300 +@@ -387,7 +387,7 @@ + """Return the define value to use for NPY_VISIBILITY_HIDDEN (may be empty + string).""" + hide = '__attribute__((visibility("hidden")))' +- if config.check_gcc_function_attribute(hide, 'hideme'): ++ if config.check_gcc_function_attribute(hide, 'hideme') and sys.platform != "win32": + return hide + else: + return '' diff --git a/mingw-w64-python3-numpy/0009-disable-old-mingw-stuff.patch b/mingw-w64-python3-numpy/0009-disable-old-mingw-stuff.patch new file mode 100644 index 0000000000..3166312d44 --- /dev/null +++ b/mingw-w64-python3-numpy/0009-disable-old-mingw-stuff.patch @@ -0,0 +1,11 @@ +--- numpy-1.17.0/numpy/core/include/numpy/npy_common.h.orig 2019-08-03 12:42:33.905141400 +0300 ++++ numpy-1.17.0/numpy/core/include/numpy/npy_common.h 2019-08-03 12:43:02.271763900 +0300 +@@ -160,7 +160,7 @@ + #include + + /* mingw based on 3.4.5 has lseek but not ftell/fseek */ +-#if defined(__MINGW32__) || defined(__MINGW64__) ++#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) + extern int __cdecl _fseeki64(FILE *, long long, int); + extern long long __cdecl _ftelli64(FILE *); + #endif diff --git a/mingw-w64-python3-numpy/PKGBUILD b/mingw-w64-python3-numpy/PKGBUILD new file mode 100644 index 0000000000..52ba64b7cc --- /dev/null +++ b/mingw-w64-python3-numpy/PKGBUILD @@ -0,0 +1,92 @@ +# Maintainer: Alexey Pavlov +# Contributor: Ray Donnelly +# Contributor: Duong Pham + +_realname=numpy +pkgbase=mingw-w64-python-${_realname} +pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}") +pkgver=1.16.4 +pkgrel=2 +pkgdesc="Scientific tools for Python (mingw-w64)" +arch=('any') +license=('BSD') +url="http://www.numpy.org/" +makedepends=("${MINGW_PACKAGE_PREFIX}-openblas" + "${MINGW_PACKAGE_PREFIX}-python3-setuptools" + "${MINGW_PACKAGE_PREFIX}-python3-pytest" + "${MINGW_PACKAGE_PREFIX}-gcc-fortran") +depends=("${MINGW_PACKAGE_PREFIX}-openblas" + "${MINGW_PACKAGE_PREFIX}-python3") +optdepends=("${MINGW_PACKAGE_PREFIX}-python3-pytest: testsuite") +#options=('!strip' 'debug') +source=(https://github.com/numpy/numpy/releases/download/v${pkgver}/${_realname}-${pkgver}.tar.gz + 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 + 0007-disable-64bit-experimental-warning.patch + 0008-mingw-gcc-doesnt-support-visibility.patch + 0009-disable-old-mingw-stuff.patch) +sha256sums=('a3bccb70ad94091a5b9e2469fabd41ac877c140a6828c2022e35560a2ec0346c' + '173e9020eb88a9b281180024ad0f137f86f893e2099693693e42a5bf5944381a' + '140c23c214cae880833380e8479e4ce45c8439b22b1432d73ff0cc2cd58da886' + '3b640625b56b158465d6628f75fadce90af8825259d04af1b1af09fef53a720c' + '720fbba58ac6a73e9476266d033ada9bdc809ec5a6c3cd518fc2f1efec34c3f9' + '3cc0176440f4f474612cb3c28b94d0846b74b508631b399aec0a5c0943c4cf1a' + 'e8f2c52131e79a4e36c98f499efa85bc56254e577fae11ebce0093422114a306' + 'c1114a027fc797bb6c5c6f7b3044fa853b9e9263555088b4b2b12bdb77baefd5' + '9204922151a7459ed0ecb5d7379fc16bdee6b8c74c925c575667b0ac6ff6441a' + 'a089bb11db5110903dba987c2ffb0ab9468414c5828bdc18809b1baeebe61b92') + +prepare() { + cd ${_realname}-${pkgver} + 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 + patch -Np1 -i ${srcdir}/0007-disable-64bit-experimental-warning.patch + patch -Np1 -i ${srcdir}/0008-mingw-gcc-doesnt-support-visibility.patch + patch -Np1 -i ${srcdir}/0009-disable-old-mingw-stuff.patch + cd .. + + cp -a ${_realname}-${pkgver} ${_realname}-py3-${CARCH} +} + +build() { + export ATLAS=None + export LDFLAGS="$LDFLAGS -shared" + + cd ${_realname}-py3-${CARCH} + MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ + ${MINGW_PREFIX}/bin/python3 setup.py config_fc --fcompiler=gnu95 build +} + +package() { + _pyver=$(${MINGW_PREFIX}/bin/python3 -c "import sys;sys.stdout.write('.'.join(map(str, sys.version_info[:2])))") + _pyinc=${_pyver}m + + export ATLAS=None + export LDFLAGS="$LDFLAGS -shared" + + cd ${_realname}-py3-${CARCH} + MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ + ${MINGW_PREFIX}/bin/python3 setup.py config_fc --fcompiler=gnu95 install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1 + + install -m755 -d "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}" + install -m644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/" + + install -m755 -d "${pkgdir}${MINGW_PREFIX}/include/python${_pyinc}" + cp -rf ${pkgdir}${MINGW_PREFIX}/lib/python${_pyver}/site-packages/${_realname}/core/include/${_realname} "${pkgdir}${MINGW_PREFIX}/include/python${_pyinc}/" + + # fix python command in files + local _mingw_prefix=$(cygpath -am ${MINGW_PREFIX}) + for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do + sed -e "s|${_mingw_prefix}/bin/|/usr/bin/env |g" -i ${_f} + done +}